/* ============================================================
   ApiFixer — base.css
   Loaded on every template: reset, tokens, nav, buttons, footer,
   shared post-card component, and accessibility baseline.
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

body {
  margin: 0;
  font-family: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background: #0B0F17;
  color: #E6EDF3;
  -webkit-font-smoothing: antialiased;
  background-image:
    radial-gradient(1200px 600px at 80% -10%, rgba(16,185,129,0.10), transparent 60%),
    radial-gradient(900px 500px at 0% 10%, rgba(6,182,212,0.08), transparent 60%);
  background-attachment: fixed;
}
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }

:root {
  --bg: #0B0F17;
  --fg: #E6EDF3;
  --muted: #94A3B8;
  --border: rgba(255,255,255,0.08);
  --card: rgba(255,255,255,0.03);
  --neon: #10B981;
  --neon-2: #34E5A1;
  --cyan: #06B6D4;
  --danger: #EF4444;
  --radius: 14px;
  --glow-neon: 0 0 0 1px rgba(16,185,129,0.4), 0 0 24px rgba(16,185,129,0.35), 0 0 60px rgba(16,185,129,0.2);
  --shadow-glass: 0 10px 40px -12px rgba(0,0,0,0.6);
}

@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url('../fonts/inter-latin-var.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212;
}
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('../fonts/jetbrains-mono-latin-var.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212;
}

.container { max-width: 1200px; margin: 0 auto; padding: 0 1.25rem; }
@media (min-width: 640px) { .container { padding: 0 1.5rem; } }

/* Utility */
.mono, .term-path, .eyebrow, .live, .cursor, .stat-k, .step-n { font-family: 'JetBrains Mono', ui-monospace, Menlo, monospace; }
.text-neon { color: var(--neon); }
.text-gradient { background: linear-gradient(90deg, var(--neon-2), var(--cyan)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.max-w-md { max-width: 32rem; }
.mt-4 { margin-top: 1rem; }
.dim { color: rgba(148,163,184,0.7); }

/* Accessibility */
.screen-reader-text {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip: rect(1px,1px,1px,1px); white-space: nowrap; border: 0; padding: 0; margin: -1px;
}
.skip-link.screen-reader-text:focus {
  position: fixed !important; top: 1rem; left: 1rem; z-index: 999;
  width: auto; height: auto; clip: auto; padding: 0.75rem 1.25rem;
  background: var(--neon); color: #04140C; border-radius: 8px; font-weight: 700;
}
a:focus-visible, button:focus-visible, input:focus-visible, textarea:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--neon); outline-offset: 2px; border-radius: 4px;
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; scroll-behavior: auto !important; }
}

/* Glass */
.glass {
  background: linear-gradient(180deg, rgba(255,255,255,0.04), rgba(255,255,255,0.02));
  border: 1px solid var(--border);
  backdrop-filter: blur(14px) saturate(140%);
  box-shadow: var(--shadow-glass);
  border-radius: var(--radius);
}
.glow-neon { box-shadow: var(--glow-neon); }
.grid-bg {
  background-image:
    linear-gradient(rgba(255,255,255,0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.04) 1px, transparent 1px);
  background-size: 40px 40px;
}

/* NAV */
.nav { position: fixed; inset: 0 0 auto 0; z-index: 50; }
.nav-inner {
  margin-top: 1rem;
  padding: 0.75rem 1.25rem;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  position: relative;
  /* .glass's own tint is nearly transparent (relies on a dark page behind
     it) — set an explicitly dark, more opaque background here so the nav
     reads as dark on every template, including the light single-post page. */
  background: rgba(11,15,23,0.75);
}
.brand { display: inline-flex; align-items: center; gap: 0.5rem; }
.brand img.custom-logo { max-height: 40px; width: auto; }
.brand-icon {
  display: grid; place-items: center;
  height: 36px; width: 36px; border-radius: 8px;
  background: rgba(16,185,129,0.15); color: var(--neon);
}
.brand-text { font-family: 'JetBrains Mono', monospace; font-weight: 700; letter-spacing: -0.01em; }
.brand-text em { font-style: normal; color: var(--neon); }
.cursor { color: var(--neon); animation: blink 1s step-end infinite; }

.nav-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: 8px; border: 1px solid var(--border);
  background: transparent; color: var(--fg); position: relative;
}
.nav-toggle-bar, .nav-toggle-bar::before, .nav-toggle-bar::after {
  content: ""; display: block; width: 18px; height: 2px; background: currentColor; border-radius: 2px;
  position: relative; transition: transform .2s, opacity .2s;
}
.nav-toggle-bar::before { position: absolute; top: -6px; }
.nav-toggle-bar::after { position: absolute; top: 6px; }
.nav-toggle[aria-expanded="true"] .nav-toggle-bar { background: transparent; }
.nav-toggle[aria-expanded="true"] .nav-toggle-bar::before { top: 0; transform: rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle-bar::after { top: 0; transform: rotate(-45deg); }

.nav-links { display: none; gap: 1.75rem; font-size: 0.875rem; color: var(--muted); }
.nav-links ul { list-style: none; margin: 0; padding: 0; display: flex; gap: 1.75rem; }
.nav-links a:hover, .nav-links a:focus-visible { color: var(--fg); }
@media (min-width: 900px) { .nav-toggle { display: none; } .nav-links { display: inline-flex; } }
@media (max-width: 899px) {
  .nav-links {
    position: absolute; top: calc(100% + 0.5rem); left: 0; right: 0;
    flex-direction: column; gap: 0; padding: 0.5rem 0;
    background: rgba(11,15,23,0.97); border: 1px solid var(--border); border-radius: var(--radius);
    box-shadow: var(--shadow-glass);
  }
  .nav-links.is-open { display: flex; }
  .nav-links ul { flex-direction: column; gap: 0; }
  .nav-links a { display: block; padding: 0.85rem 1.25rem; }
}

/* Adaptive nav (front page only, see .nav-adaptive in header.php): stays
   dark glass at the top, then switches to a light/white style once the JS
   in main.js adds .is-scrolled past the hero. Every other template
   (including single posts) keeps the plain dark nav throughout. */
.nav-adaptive .nav-inner { transition: background-color .25s ease, border-color .25s ease, box-shadow .25s ease; }
.nav-adaptive.is-scrolled .nav-inner {
  background: rgba(255,255,255,0.92);
  border-color: rgba(15,23,42,0.08);
  box-shadow: 0 10px 30px -15px rgba(15,23,42,0.25);
}
.nav-adaptive.is-scrolled .brand-text { color: #0F172A; }
.nav-adaptive.is-scrolled .nav-links { color: #475569; }
.nav-adaptive.is-scrolled .nav-links a:hover,
.nav-adaptive.is-scrolled .nav-links a:focus-visible { color: #0F172A; }
.nav-adaptive.is-scrolled .nav-toggle { border-color: rgba(15,23,42,0.15); color: #0F172A; }
@media (max-width: 899px) {
  .nav-adaptive.is-scrolled .nav-links.is-open {
    background: rgba(255,255,255,0.98); border-color: rgba(15,23,42,0.08); box-shadow: 0 10px 30px -15px rgba(15,23,42,0.25);
  }
}

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  padding: 0.75rem 1.25rem; border-radius: 10px; font-weight: 600; font-size: 0.875rem;
  transition: filter .2s, transform .2s, border-color .2s, background .2s; border: 1px solid transparent; }
.btn-sm { padding: 0.5rem 1rem; font-size: 0.85rem; }
.btn-primary { background: var(--neon); color: #04140C; box-shadow: var(--glow-neon); }
.btn-primary:hover { filter: brightness(1.1); }
.btn-ghost { color: var(--fg); }
.btn-ghost:hover { color: var(--neon); }
.btn-outline { border-color: var(--border); color: var(--fg); }
.btn-outline:hover { border-color: rgba(16,185,129,0.5); }
.btn-block { width: 100%; }

/* Generic section heading system (shared: front page + blog archive + pages) */
.section { padding: 5rem 0; }
@media (min-width: 900px) { .section { padding: 7rem 0; } }
.section.narrow { padding: 3.5rem 0; }
.eyebrow { text-transform: uppercase; letter-spacing: 0.15em; font-size: 0.7rem; color: var(--neon); }
.h2 { font-size: clamp(1.75rem, 3vw, 2.5rem); font-weight: 800; letter-spacing: -0.02em; margin: 0.75rem 0 0.75rem; }
.sub { color: var(--muted); max-width: 44rem; line-height: 1.6; margin: 0.5rem 0 0; }
.card { padding: 1.5rem; }
.card-wide { padding: 0; overflow: hidden; }
.mono-label { font-family: 'JetBrains Mono', monospace; font-size: 0.75rem; color: var(--muted); display: block; margin-bottom: 0.5rem; }

.section-light {
  background: #F4F6FB;
  color: #0F172A;
  background-image:
    radial-gradient(900px 400px at 90% 0%, rgba(16,185,129,0.10), transparent 60%),
    radial-gradient(700px 350px at 0% 100%, rgba(6,182,212,0.10), transparent 60%);
}
.section-light .sub { color: #475569; }
.section-light .glass {
  background: linear-gradient(180deg, rgba(255,255,255,0.9), rgba(255,255,255,0.75));
  border: 1px solid rgba(15,23,42,0.10);
  box-shadow: 0 10px 30px -18px rgba(15,23,42,0.25);
}
.section-light .mono-label { color: #64748B; }
.section-light .post-body p { color: #475569; }

/* Shared post-card component (front-page blog teaser + /blog archive grid) */
.blog-grid { display: grid; gap: 1.25rem; margin-top: 3rem; grid-template-columns: 1fr; }
@media (min-width: 720px) { .blog-grid { grid-template-columns: repeat(3, 1fr); } }
.post { overflow: hidden; display: flex; flex-direction: column; transition: transform .2s; }
.post:hover { transform: translateY(-2px); }
.post:hover h3 { color: var(--neon); }
.post-cover {
  height: 200px; position: relative; overflow: hidden;
  background: linear-gradient(135deg, rgba(16,185,129,0.28), rgba(6,182,212,0.28));
  display: grid; place-items: center;
}
.post-cover img { width: 100%; height: 100%; object-fit: cover; position: absolute; inset: 0; }
.post-cover::before {
  content: ""; position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(15,23,42,0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(15,23,42,0.06) 1px, transparent 1px);
  background-size: 40px 40px; opacity: 0.6;
}
.post-cover-title {
  position: relative; z-index: 1;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical;
  overflow: hidden;
  max-width: 88%;
  background: rgba(240,247,244,0.92);
  color: #0F172A;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 600;
  font-size: 1rem; /* overridden inline per gffi_get_card_title_settings()/theme default */
  line-height: 1.5;
  padding: 0.85rem 1.25rem;
  border-radius: 12px;
  box-shadow: 0 10px 24px -10px rgba(0,0,0,0.35);
}
@media (max-width: 480px) {
  .post-cover-title { max-width: 92%; padding: 0.65rem 1rem; }
}
.post-body { padding: 1.5rem; display: flex; flex-direction: column; flex: 1; }
.post-meta {
  display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: center;
  font-family: 'JetBrains Mono', monospace; font-size: 0.7rem;
  background: #fff;
  padding: 8px 5px;
  color: #086e4c;
  font-weight: bold;
}
.post-meta .tag-pill { background: #000; color: #fff; padding: 0.1rem 0.5rem; border-radius: 5px; }
.post-body h3 { margin: 1rem 0 0.5rem; font-size: 1.05rem; line-height: 1.35; transition: color .2s; }
.post-body h3 a { color: inherit; }
.post-body h3 a::after { content: ""; position: absolute; inset: 0; }
.post-body { position: relative; }
.post-body p { color: #dfecff; font-size: 0.875rem; flex: 1; margin: 0; line-height: 1.55; }
.post-read { margin-top: 1.25rem; color: var(--neon); font-weight: 600; font-size: 0.875rem; }

/* Footer */
.footer { border-top: 1px solid var(--border); margin-top: 3rem; }
.footer-widgets {
  display: grid; gap: 2rem; grid-template-columns: 1fr;
  background: #F4F6FB; color: #0F172A;
  padding: 2.5rem 1.5rem; margin: 0 calc(-1 * 1.25rem);
}
@media (min-width: 640px) { .footer-widgets { margin: 0 calc(-1 * 1.5rem); } }
@media (min-width: 720px) {
  /* auto-fit instead of a fixed repeat(3,...): when only 1 or 2 of the 3
     footer widget areas actually have widgets in them, the populated
     column(s) stretch to fill the row instead of sitting in a fixed-width
     left column with empty space to the right. */
  .footer-widgets { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
}
.footer-widget-col .widget-title { font-family: 'JetBrains Mono', monospace; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--neon); margin: 0 0 0.85rem; }
.footer-widget-col ul { list-style: none; padding: 0; margin: 0; }
.footer-widget-col li { padding: 0.3rem 0; }
.footer-widget-col a { color: #475569; font-size: 0.875rem; }
.footer-widget-col a:hover { color: var(--neon); }

/* Block-based widgets (Archives, Categories, etc. added via the Widgets
   block editor) render their own heading + wp-block-group wrapper instead
   of the classic before_title/after_title markup, and that heading would
   otherwise inherit the large sitewide h2/h3 style from theme.json — force
   it back down to the same small mono "widget title" look regardless of
   which heading level was used, and collapse the default 2em block gap. */
.footer-widget-col .wp-block-group > * + * { margin-block-start: 0.85rem; }
.footer-widget-col .wp-block-heading {
  font-family: 'JetBrains Mono', monospace; font-size: 0.75rem !important;
  font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--neon); margin: 0; line-height: 1.4;
}

/* Archives / Categories: full-width row(s) of dark buttons, evenly filling
   each line instead of clumping to the left with leftover empty space. */
.footer-widget-col .wp-block-archives-list,
.footer-widget-col .wp-block-categories-list {
  list-style: none; margin: 0; padding: 0;
  display: flex; flex-wrap: wrap; gap: 0.5rem;
}
.footer-widget-col .wp-block-archives-list li,
.footer-widget-col .wp-block-categories-list li {
  padding: 0; flex: 1 1 auto;
}
.footer-widget-col .wp-block-archives-list a,
.footer-widget-col .wp-block-categories-list a {
  display: flex; align-items: center; justify-content: center; text-align: center;
  width: 100%; padding: 0.45rem 0.9rem; border-radius: 5px;
  background: #0F172A; color: #FFFFFF !important;
  font-size: 0.8rem; font-weight: 600; line-height: 1.2; white-space: nowrap;
  transition: background-color .2s, transform .2s;
}
.footer-widget-col .wp-block-archives-list a:hover,
.footer-widget-col .wp-block-categories-list a:hover {
  background: var(--neon); color: #04140C !important; transform: translateY(-1px);
}

/* Recent Posts / Recent Comments: keep as a plain vertical link list */
.footer-widget-col .wp-block-latest-posts,
.footer-widget-col .wp-block-latest-comments {
  list-style: none; margin: 0; padding: 0;
}
.footer-widget-col .wp-block-latest-posts li,
.footer-widget-col .wp-block-latest-comments__comment {
  padding: 0.3rem 0;
}
.footer-widget-col .wp-block-latest-posts__post-title,
.footer-widget-col .wp-block-latest-comments__comment-link,
.footer-widget-col .wp-block-latest-comments__comment-author {
  color: #475569; font-size: 0.875rem;
}
.footer-widget-col .wp-block-latest-posts__post-title:hover {
  color: var(--neon);
}
.footer-widget-col select {
  width: 100%; padding: 0.6rem 0.75rem; border-radius: 8px;
  border: 1px solid rgba(15,23,42,0.15); background: #FFFFFF;
  color: #0F172A; font-size: 0.85rem; font-family: inherit;
}
.footer-inner { padding: 2.5rem 0; display: flex; flex-direction: column; align-items: center; gap: 1rem; justify-content: space-between; }
@media (min-width: 720px) { .footer-inner { flex-direction: row; } }
.foot-brand { display: inline-flex; align-items: center; gap: 0.75rem; font-size: 0.875rem; }
.foot-links ul { list-style: none; margin: 0; padding: 0; display: inline-flex; align-items: center; gap: 1.25rem; color: var(--muted); font-size: 0.8rem; }
.foot-links a:hover { color: var(--fg); }
.status-pill { display: inline-flex; align-items: center; gap: 0.5rem; padding: 0.4rem 0.85rem; border-radius: 999px; font-family: 'JetBrains Mono', monospace; font-size: 0.75rem; }

/* Shared animations */
@keyframes pulse-dot { 0%,100% { opacity: 1; transform: scale(1);} 50%{ opacity: 0.5; transform: scale(1.4);} }
.pulse-dot { display: inline-block; height: 6px; width: 6px; border-radius: 999px; background: var(--neon); animation: pulse-dot 1.6s ease-in-out infinite; }
.pulse-dot.green { background: var(--neon); }
@keyframes blink { 50% { opacity: 0; } }

/* Floating WhatsApp button (sitewide) */
.fab-whatsapp {
  position: fixed; right: 1.25rem; bottom: 1.25rem; z-index: 60;
  display: inline-flex; align-items: center; justify-content: center;
  height: 60px; width: 60px; border-radius: 999px;
  background: #25D366; color: #04140C;
  box-shadow: 0 12px 30px -8px rgba(37,211,102,0.55), 0 0 0 6px rgba(37,211,102,0.15);
  transition: transform .2s, box-shadow .2s;
  animation: fab-pulse 2.4s ease-in-out infinite;
}
.fab-whatsapp:hover { transform: translateY(-3px) scale(1.05); }
.fab-tooltip {
  position: absolute; right: 72px; top: 50%; transform: translateY(-50%);
  background: #0B0F17; color: #E6EDF3;
  font-family: 'JetBrains Mono', monospace; font-size: 0.75rem;
  padding: 0.4rem 0.75rem; border-radius: 8px; border: 1px solid var(--border);
  white-space: nowrap; opacity: 0; pointer-events: none; transition: opacity .2s;
}
.fab-whatsapp:hover .fab-tooltip, .fab-whatsapp:focus-visible .fab-tooltip { opacity: 1; }
@keyframes fab-pulse {
  0%, 100% { box-shadow: 0 12px 30px -8px rgba(37,211,102,0.55), 0 0 0 0 rgba(37,211,102,0.4); }
  50%      { box-shadow: 0 12px 30px -8px rgba(37,211,102,0.55), 0 0 0 14px rgba(37,211,102,0); }
}
