/*
Theme Name: Leiritech
Theme URI: https://leiritech.com
Author: Leiritech
Description: Editorial-technical theme sharing the exact shell (ink + cobalt + Space Grotesk) of the Leiritech Next.js marketing site. Header/footer are pixel-matched so /blog is seamless with the app.
Version: 2.0.1
Requires at least: 6.0
Tested up to: 7.1
Requires PHP: 8.0
License: Proprietary
Text Domain: leiritech
*/

/* ===================== Design tokens (mirror of the app's index.css) ===================== */
:root {
  --background: 0 0% 100%;
  --foreground: 222.2 84% 4.9%;
  --card: 0 0% 100%;
  --card-foreground: 222.2 84% 4.9%;
  --muted: 210 40% 96.1%;
  --muted-foreground: 215.4 16.3% 46.9%;
  --primary: 224 72% 54%;          /* refined cobalt */
  --primary-foreground: 0 0% 100%;
  --ink: 222 47% 11%;              /* CTA / wordmark near-black */
  --ink-foreground: 0 0% 100%;
  --secondary: 210 40% 96.1%;
  --secondary-foreground: 222.2 47.4% 11.2%;
  --accent: 142 76% 36%;           /* semantic success only */
  --border: 214.3 31.8% 91.4%;
  --input: 214.3 31.8% 91.4%;
  --ring: 224 72% 54%;
  --radius: 0.75rem;
  --font-heading: 'Space Grotesk', ui-sans-serif, system-ui, sans-serif;
  --font-body: 'Inter', ui-sans-serif, system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font-body);
  color: hsl(var(--foreground));
  background: hsl(var(--background));
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  line-height: 1.6;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; height: auto; display: block; }
::selection { background: hsl(var(--primary) / 0.15); }

h1, h2, h3, h4 { font-family: var(--font-heading); font-weight: 700; letter-spacing: -0.02em; line-height: 1.1; color: hsl(var(--foreground)); }

.container { width: 100%; max-width: 80rem; margin-inline: auto; padding-inline: 1rem; }
@media (min-width: 640px) { .container { padding-inline: 1.5rem; } }
@media (min-width: 1024px) { .container { padding-inline: 2rem; } }

/* ===================== HEADER — pixel-match to the app's Navigation.tsx ===================== */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: hsl(var(--background) / 0.6);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  border-bottom: 1px solid hsl(var(--border));
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .site-header { background: hsl(var(--background) / 0.95); }
}
.site-header .bar { display: flex; justify-content: space-between; align-items: stretch; height: 4rem; }
.site-header .brand-wrap { display: flex; align-items: center; }
.site-header .brand {
  font-family: var(--font-heading); font-size: 1.25rem; line-height: 1.75rem;
  font-weight: 700; letter-spacing: -0.025em; color: hsl(var(--foreground));
}

.nav { display: none; align-items: center; gap: 2rem; }
@media (min-width: 768px) { .nav { display: flex; } }
.navlink {
  padding: 0.5rem 0.75rem; font-size: 0.875rem; line-height: 1.25rem; font-weight: 500;
  color: hsl(var(--muted-foreground)); transition: color .15s ease;
}
.navlink:hover { color: hsl(var(--foreground)); }
.navlink.active { color: hsl(var(--primary)); box-shadow: inset 0 -2px 0 0 hsl(var(--primary)); }

.lang {
  display: inline-flex; align-items: center; gap: 0.5rem; height: 2.25rem; padding: 0 0.75rem;
  border-radius: calc(var(--radius) - 0.25rem); font-size: 0.875rem; font-weight: 500;
  color: hsl(var(--foreground)); background: transparent; transition: background .15s ease; cursor: pointer;
}
.lang:hover { background: hsl(var(--secondary)); }
.lang .code { text-transform: uppercase; }
.lang .icon { width: 1rem; height: 1rem; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  font-family: var(--font-body); font-size: 0.875rem; font-weight: 500; line-height: 1.25rem;
  border-radius: calc(var(--radius) - 0.25rem); border: 1px solid transparent; cursor: pointer;
  transition: background .15s ease, transform .15s ease, opacity .15s ease; white-space: nowrap;
}
.btn-primary { height: 2.5rem; padding: 0 1rem; background: hsl(var(--ink)); color: #fff; }
.btn-primary:hover { background: hsl(222 47% 16%); }
.btn-ghost { background: transparent; border-color: hsl(var(--border)); color: hsl(var(--foreground)); padding: 0.6rem 1.1rem; }
.btn-ghost:hover { background: hsl(var(--secondary)); }
.btn-oncolor { height: 2.5rem; padding: 0 1rem; background: #fff; color: hsl(var(--ink)); }
.btn-oncolor:hover { opacity: .92; }

/* icons: lucide 1.5-1.8 stroke, no fill */
.site-header svg, .site-footer svg, .back-link svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* mobile menu */
.menu-toggle {
  display: inline-flex; align-items: center; justify-content: center; width: 2.25rem; height: 2.25rem;
  border: none; background: transparent; color: hsl(var(--foreground)); border-radius: calc(var(--radius) - 0.25rem); cursor: pointer;
}
.menu-toggle:hover { background: hsl(var(--secondary)); }
.menu-toggle svg { width: 1.5rem; height: 1.5rem; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.mobile-controls { display: flex; align-items: center; gap: 0.25rem; }
@media (min-width: 768px) { .mobile-controls { display: none; } }
.mobile-panel { display: none; padding: 0.5rem 0.5rem 0.75rem; border-top: 1px solid hsl(var(--border)); }
.mobile-panel.open { display: block; }
@media (min-width: 768px) { .mobile-panel { display: none !important; } }
.mobile-panel a.navlink { display: block; padding: 0.5rem 0.75rem; font-size: 1rem; box-shadow: none; border-radius: calc(var(--radius) - 0.25rem); }
.mobile-panel a.navlink.active { color: hsl(var(--primary)); background: hsl(var(--primary) / 0.1); }
.mobile-panel a.navlink:hover { background: hsl(var(--muted)); }
.mobile-panel .btn-primary { width: 100%; margin-top: 0.5rem; }

/* ===================== Page shell ===================== */
.site-main { display: block; }
.content-wrap { padding-block: clamp(2.5rem, 5vw, 4.5rem); }

/* Hero (blog index / archive) */
.hero { position: relative; overflow: hidden; border-bottom: 1px solid hsl(var(--border)); }
.hero::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(60% 50% at 50% 0%, hsl(var(--primary) / .13), transparent 70%),
    radial-gradient(45% 45% at 88% 8%, hsl(226 84% 60% / .10), transparent 70%);
}
.hero .container { position: relative; padding-block: clamp(3rem, 6vw, 5.5rem); }
.hero .inner { max-width: 42rem; }
.eyebrow {
  display: inline-flex; align-items: center; gap: .5rem; font-size: .75rem; font-weight: 600;
  letter-spacing: .08em; text-transform: uppercase; color: hsl(var(--primary));
  background: hsl(var(--primary) / .08); padding: .35rem .7rem; border-radius: 999px;
}
.hero h1 { margin: 1.25rem 0 0; font-size: clamp(2.25rem, 5vw, 3.75rem); }
.hero .lead { margin: 1.25rem 0 0; font-size: 1.125rem; color: hsl(var(--muted-foreground)); max-width: 42rem; }

/* ===================== Post grid / cards (match the app's Work cards) ===================== */
.post-grid { display: grid; gap: 1.25rem; grid-template-columns: 1fr; }
@media (min-width: 640px) { .post-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .post-grid { grid-template-columns: repeat(3, 1fr); } }

.card {
  display: flex; flex-direction: column; overflow: hidden; background: hsl(var(--card));
  border: 1px solid hsl(var(--border)); border-radius: var(--radius);
  transition: box-shadow .25s ease, transform .25s ease, border-color .25s ease;
}
.card:hover { box-shadow: 0 18px 40px -24px hsl(222 47% 25% / .35); transform: translateY(-3px); border-color: hsl(var(--primary) / .35); }
.card .thumb { display: block; aspect-ratio: 16 / 9; border-bottom: 1px solid hsl(var(--border)); background: hsl(var(--secondary) / .4); overflow: hidden; }
.card .thumb img { width: 100%; height: 100%; object-fit: cover; }
.card .body { display: flex; flex-direction: column; flex: 1; padding: 1.5rem; }
.card .meta { font-size: 0.8rem; color: hsl(var(--muted-foreground)); font-variant-numeric: tabular-nums; }
.card h2 { margin: 0.5rem 0 0; font-size: 1.25rem; }
.card h2 a:hover { color: hsl(var(--primary)); }
.card .excerpt { margin: 0.5rem 0 0; font-size: 0.9rem; line-height: 1.6; color: hsl(var(--muted-foreground)); }
.card .readmore { margin-top: 1.25rem; display: inline-flex; align-items: center; gap: 0.25rem; font-size: 0.875rem; font-weight: 600; color: hsl(var(--primary)); }

/* Pagination */
.pagination { margin-top: 3rem; display: flex; justify-content: center; gap: 0.4rem; flex-wrap: wrap; }
.pagination .page-numbers {
  display: inline-flex; align-items: center; justify-content: center; min-width: 2.25rem; height: 2.25rem; padding: 0 0.6rem;
  border: 1px solid hsl(var(--border)); border-radius: calc(var(--radius) - 0.25rem);
  font-size: 0.875rem; font-weight: 500; color: hsl(var(--foreground)); background: hsl(var(--card));
}
.pagination .page-numbers:hover { border-color: hsl(var(--primary) / .4); color: hsl(var(--primary)); }
.pagination .page-numbers.current { background: hsl(var(--ink)); color: #fff; border-color: hsl(var(--ink)); }
.pagination .page-numbers.dots { border: none; background: transparent; }

/* ===================== Single post ===================== */
.layout.has-sidebar { display: grid; gap: 3rem; grid-template-columns: 1fr; }
@media (min-width: 1024px) { .layout.has-sidebar { grid-template-columns: minmax(0, 1fr) 20rem; } }

.back-link { display: inline-flex; align-items: center; gap: 0.4rem; font-size: 0.875rem; font-weight: 500; color: hsl(var(--muted-foreground)); }
.back-link:hover { color: hsl(var(--primary)); }
.back-link .icon { width: 1rem; height: 1rem; }

.article-header { margin-top: 1.5rem; }
.cat-chip {
  display: inline-flex; align-items: center; font-size: .8rem; font-weight: 500; color: hsl(var(--muted-foreground));
  background: hsl(var(--secondary)); border: 1px solid hsl(var(--border)); border-radius: 999px; padding: .3rem .7rem;
}
.cat-chip:hover { color: hsl(var(--primary)); border-color: hsl(var(--primary) / .4); }
.post-title { margin: 1.25rem 0 0; font-size: clamp(2rem, 4.5vw, 3.25rem); }
.byline { display: flex; align-items: center; gap: 0.75rem; margin-top: 1.5rem; }
.byline .avatar { border-radius: 999px; }
.byline-text { display: flex; flex-direction: column; }
.byline-author { font-weight: 600; font-size: 0.9rem; }
.byline-meta { font-size: 0.85rem; color: hsl(var(--muted-foreground)); font-variant-numeric: tabular-nums; }
.byline-meta .dot { margin: 0 0.35rem; }

.featured { margin: 2rem 0 0; border-radius: var(--radius); overflow: hidden; border: 1px solid hsl(var(--border)); box-shadow: 0 1px 0 hsl(222 47% 11% / .03), 0 8px 24px -18px hsl(222 47% 20% / .25); }
.featured img { width: 100%; }

/* Long-form body — capped measure, real typographic hierarchy */
.entry-content { margin-top: 2.25rem; font-size: 1.075rem; line-height: 1.75; color: hsl(222 30% 20%); max-width: 44rem; }
.entry-content > * + * { margin-top: 1.25rem; }
.entry-content h2 { margin-top: 2.5rem; font-size: 1.6rem; }
.entry-content h3 { margin-top: 2rem; font-size: 1.3rem; }
.entry-content a { color: hsl(var(--primary)); text-decoration: underline; text-underline-offset: 2px; }
.entry-content ul, .entry-content ol { padding-left: 1.4rem; }
.entry-content li + li { margin-top: 0.4rem; }
.entry-content blockquote { margin: 1.75rem 0; padding: 0.5rem 0 0.5rem 1.25rem; border-left: 3px solid hsl(var(--primary)); color: hsl(var(--muted-foreground)); font-style: italic; }
.entry-content img { border-radius: var(--radius); border: 1px solid hsl(var(--border)); }
.entry-content pre { background: hsl(var(--ink)); color: #e6ebf5; padding: 1.1rem 1.25rem; border-radius: var(--radius); overflow-x: auto; font-size: 0.9rem; }
.entry-content code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.9em; background: hsl(var(--secondary)); padding: 0.1rem 0.35rem; border-radius: 4px; }
.entry-content pre code { background: transparent; padding: 0; }

.post-tags { margin-top: 2rem; display: flex; flex-wrap: wrap; gap: 0.5rem; }
.tag { font-size: 0.8rem; color: hsl(var(--muted-foreground)); background: hsl(var(--secondary)); border: 1px solid hsl(var(--border)); border-radius: 999px; padding: 0.3rem 0.7rem; }
.tag:hover { color: hsl(var(--primary)); }

.author-card { margin-top: 2.5rem; display: flex; gap: 1rem; padding: 1.5rem; background: hsl(var(--card)); border: 1px solid hsl(var(--border)); border-radius: var(--radius); }
.author-card .avatar { border-radius: 999px; flex: none; }
.author-eyebrow { font-size: 0.7rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: hsl(var(--muted-foreground)); }
.author-name { margin: 0.25rem 0 0; font-size: 1.1rem; }
.author-bio { margin: 0.5rem 0 0; font-size: 0.9rem; color: hsl(var(--muted-foreground)); }

.post-nav { margin-top: 2.5rem; display: grid; gap: 1rem; grid-template-columns: 1fr 1fr; }
.post-nav-item { display: flex; flex-direction: column; gap: 0.35rem; padding: 1.25rem; border: 1px solid hsl(var(--border)); border-radius: var(--radius); background: hsl(var(--card)); }
.post-nav-item:hover { border-color: hsl(var(--primary) / .4); }
.post-nav-item.next { text-align: right; }
.pn-label { font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: hsl(var(--muted-foreground)); }
.pn-title { font-weight: 600; }

/* Generic article surface (page.php, 404, empty states) */
.article { background: hsl(var(--card)); }

/* ===================== Sidebar ===================== */
.sidebar-inner { display: flex; flex-direction: column; gap: 1.25rem; position: sticky; top: 5.5rem; }
.s-card { background: hsl(var(--card)); border: 1px solid hsl(var(--border)); border-radius: var(--radius); padding: 1.25rem; }
.widget-title { margin: 0 0 0.9rem; font-size: 0.8rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: hsl(var(--muted-foreground)); }
.cta-card { background: var(--gradient-hero, linear-gradient(160deg, hsl(222 47% 11%), hsl(224 55% 22%))); border: none; color: #fff; }
.cta-title { margin: 0; font-size: 1.1rem; color: #fff; }
.cta-text { margin: 0.5rem 0 1.1rem; font-size: 0.9rem; color: hsl(0 0% 100% / .85); }
.recent-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.9rem; }
.recent-post { display: flex; gap: 0.75rem; align-items: center; }
.recent-thumb { flex: none; width: 3rem; height: 3rem; border-radius: 0.5rem; overflow: hidden; background: hsl(var(--secondary)); }
.recent-thumb img { width: 100%; height: 100%; object-fit: cover; }
.recent-thumb-ph { display: block; width: 100%; height: 100%; background: hsl(var(--secondary)); }
.recent-body { display: flex; flex-direction: column; }
.recent-title { font-size: 0.9rem; font-weight: 600; line-height: 1.3; }
.recent-post:hover .recent-title { color: hsl(var(--primary)); }
.recent-date { font-size: 0.78rem; color: hsl(var(--muted-foreground)); }
.cat-pills { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.cat-pill { display: inline-flex; align-items: center; gap: 0.4rem; font-size: 0.8rem; color: hsl(var(--muted-foreground)); background: hsl(var(--secondary)); border: 1px solid hsl(var(--border)); border-radius: 999px; padding: 0.3rem 0.7rem; }
.cat-pill:hover { color: hsl(var(--primary)); }
.cat-count { color: hsl(var(--muted-foreground)); opacity: .7; font-variant-numeric: tabular-nums; }

/* Search form */
.searchform { display: flex; gap: 0.5rem; }
.searchform input[type="search"] { flex: 1; min-width: 0; height: 2.5rem; padding: 0 0.85rem; border: 1px solid hsl(var(--border)); border-radius: calc(var(--radius) - 0.25rem); font: inherit; font-size: 0.9rem; background: hsl(var(--card)); }
.searchform input[type="search"]:focus { outline: 2px solid hsl(var(--ring) / .4); outline-offset: 1px; border-color: hsl(var(--primary)); }
.searchform .btn { flex: none; }
.btn-outline { height: 2.5rem; padding: 0 1rem; background: transparent; border-color: hsl(var(--border)); color: hsl(var(--foreground)); }
.btn-outline:hover { background: hsl(var(--secondary)); }
.screen-reader-text { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

/* ===================== Comments ===================== */
.comments-section { margin-top: 3rem; padding-top: 2.5rem; border-top: 1px solid hsl(var(--border)); max-width: 44rem; }
.comment-list { list-style: none; margin: 1.5rem 0 0; padding: 0; }
.comment-list ul { list-style: none; padding-left: 1.5rem; }
.comment-body { padding: 1rem 0; border-bottom: 1px solid hsl(var(--border)); }
.comment-notes { font-size: 0.85rem; color: hsl(var(--muted-foreground)); }
.comment-form label { display: block; font-size: 0.85rem; font-weight: 600; margin-bottom: 0.35rem; }
.comment-form input[type="text"], .comment-form input[type="email"], .comment-form input[type="url"], .comment-form textarea {
  width: 100%; padding: 0.6rem 0.75rem; border: 1px solid hsl(var(--border)); border-radius: calc(var(--radius) - 0.25rem); font: inherit; font-size: 0.9rem;
}
.comment-form p { margin: 0 0 1rem; }
.comment-form textarea:focus, .comment-form input:focus { outline: 2px solid hsl(var(--ring) / .4); outline-offset: 1px; border-color: hsl(var(--primary)); }

/* ===================== FOOTER — match the app's Footer.tsx ===================== */
.site-footer { background: hsl(var(--muted) / 0.5); border-top: 1px solid hsl(var(--border)); margin-top: 4rem; }
.site-footer .container { padding-block: 3rem; }
.site-footer .cols { display: grid; gap: 2rem; grid-template-columns: 1fr; }
@media (min-width: 768px) { .site-footer .cols { grid-template-columns: 2fr 1fr 1fr; } }
.site-footer .brand { font-family: var(--font-heading); font-size: 1.25rem; font-weight: 700; letter-spacing: -0.025em; color: hsl(var(--foreground)); display: inline-block; margin-bottom: 1rem; }
.site-footer .desc { color: hsl(var(--muted-foreground)); max-width: 28rem; margin: 0 0 1rem; }
.site-footer .tagline { font-size: 0.875rem; color: hsl(var(--muted-foreground)); font-style: italic; margin: 0; }
.site-footer h3 { font-family: var(--font-body); font-size: 1rem; font-weight: 600; color: hsl(var(--foreground)); margin: 0 0 1rem; }
.site-footer ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.5rem; }
.site-footer ul a { color: hsl(var(--muted-foreground)); transition: color .15s ease; }
.site-footer ul a:hover { color: hsl(var(--foreground)); }
.site-footer .contact-item { display: flex; align-items: center; gap: 0.5rem; color: hsl(var(--muted-foreground)); margin-bottom: 0.5rem; }
.site-footer .contact-item .icon { width: 1rem; height: 1rem; flex: none; }
.site-footer .contact-item span { font-size: 0.875rem; }
.site-footer .legal { margin-top: 2rem; padding-top: 2rem; border-top: 1px solid hsl(var(--border)); text-align: center; }
.site-footer .legal p { margin: 0; font-size: 0.875rem; color: hsl(var(--muted-foreground)); }

@media (max-width: 640px) { .post-nav { grid-template-columns: 1fr; } }
