/* ================================================================
   WordMetrics — global.css — Global header, footer, colors, typography, layout
   ================================================================ */

/* ── Design Tokens ── */
:root {
  /* Backgrounds */
  --bg:        #080b12;
  --bg-alt:    #0c1018;
  --surface: #1a2332;   /* was #10151f – noticeably lighter */
  --srf-2:   #232e41;   /* was #161d2c */
  --srf-3:   #2b3a52;   /* was #1b2336 */

  /* Borders */
  --bd:    rgba(255,255,255,0.35);  /* was 0.07 */
  --bd-2:  rgba(255,255,255,0.5);  /* was 0.12 */
  --bd-hi: rgba(255,255,255,0.6);   /* was 0.18 – optional */

     /* WordCounter‑specific variables (added to unify all pages) */
  --clr-bg:          #0d1117;
  --clr-surface:     #161b22;
  --clr-surface2:    #1e2631;
  --clr-border:      #2a3344;
  --clr-primary:     #2dd4bf;
  --clr-primary-dim: #14b8a4;
  --clr-accent:      #f59e0b;
  --clr-text:        #e6edf3;
  --clr-text-dim:    #a0a9b3;
  --clr-text-muted:  #b0bbc4;
  --clr-white:       #ffffff;
  --clr-danger:      #f85149;
  --clr-success:     #3fb950;

  --radius-sm:   6px;
  --radius-md:   12px;
  --radius-lg:   18px;
  --radius-xl:   24px;

  --shadow-card:  0 6px 28px rgba(0,0,0,0.7);
  --shadow-glow:  0 0 36px rgba(45,212,191,0.3);

  --font-display:  'DM Serif Display', Georgia, serif;
  --font-body:     'DM Sans', system-ui, sans-serif;

  --transition:   all 0.22s cubic-bezier(.4,0,.2,1);
  --max-width:    1180px;
   

  /* Brand colours */
  --teal:      #2dd4bf;
  --teal-dk:   #0d9488;
  --amber:     #f59e0b;
  --amber-dk:  #b45309;
  --violet:    #818cf8;
  --emerald:   #34d399;
  --sky:       #38bdf8;
  --rose:      #fb7185;

  /* Text - Lightened for better readability while keeping dark theme */
--tx-1:  #ffffff;     /* Pure white for headings - crisp */
--tx-2:  #ffffff;     /* Very light gray for body text - readable */
--tx-3: #f0f4fa;

  /* Type */
  --serif: 'DM Serif Display', Georgia, serif;
  --sans:  'DM Sans', system-ui, -apple-system, sans-serif;

  /* Radius */
  --r1: 5px;  --r2: 9px;  --r3: 13px;
  --r4: 17px; --r5: 22px;

  /* Shadows / glows */
  --sh-md: 0 4px 20px rgba(0,0,0,.5);
  --sh-lg: 0 12px 48px rgba(0,0,0,.6);
  --glow-t: 0 0 0 1px rgba(45,212,191,0.35), 0 8px 28px rgba(45,212,191,0.15);
  --glow-a: 0 0 0 1px rgba(245,158,11,0.35),  0 8px 28px rgba(245,158,11,0.12);

  /* Motion */
  --ease: cubic-bezier(.4,0,.2,1);
  --d:    .2s;

  /* Layout */
  --mw: 1160px;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--tx-2);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

ul { list-style: none; }
img, svg { display: block; max-width: 100%; }
button { cursor: pointer; font: inherit; border: none; background: none; }
a { color: inherit; text-decoration: none; }
:focus-visible { outline: 2px solid var(--teal); outline-offset: 3px; border-radius: 3px; }
.container { max-width: var(--mw); margin: 0 auto; padding: 0 1.5rem; }
html.nav-locked { overflow: hidden; }

.hero-pill {
    animation: fadeUp .42s var(--ease) both;
}

.hero-pill {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .26rem .85rem;
    margin-bottom: 1.3rem;
    background: rgba(45, 212, 191, .07);
    border: 1px solid rgba(45, 212, 191, .15);
    border-radius: 100px;
    font-size: .72rem;
    font-weight: 600;
    color: var(--teal);
    letter-spacing: .05em;
    text-transform: uppercase;
}


/* ================================================================
   HEADER — sticky frosted bar
   ================================================================ */
.site-header {
  position: sticky; top: 0; z-index: 500;
  background: rgba(8,11,18,0.98);
  backdrop-filter: blur(12px);
  border-bottom: 2px solid var(--bd);
}

/* ── nav-bar: the flex row
   LEFT group (logo+search) | RIGHT group (nav+hamburger)
   justify-content:space-between guarantees RIGHT is always at the end.
   This is the bullet-proof hamburger fix — no margin-auto tricks. ── */
/* Single flat flex row. Desktop: logo | search | [nav fills rest] | hamburger(hidden)
   Mobile: logo | [hidden search] | [hidden nav] | hamburger(margin-left:auto = far right)  */
.nav-bar {
  display: flex;
  align-items: center;
  height: 60px;
  gap: .75rem;
}

/* These groups no longer exist — replaced by flat row */
.nav-left  { display: contents; }
.nav-right { display: contents; }

/* ── Logo ── */
.logo {
  display: flex; align-items: center; gap: 7px;
  flex-shrink: 0; color: var(--tx-1);
}
.logo:hover { opacity: .88; }
.logo-mark {
  width: 25px; height: 25px; border-radius: 6px; flex-shrink: 0;
  background: linear-gradient(135deg, var(--teal) 0%, var(--amber) 100%);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--serif); font-size: .8rem; font-weight: 700; color: #040810;
  line-height: 1;
}
.logo-text { font-size: .95rem; font-weight: 400; white-space: nowrap; color: var(--tx-1); }
.logo-text strong { font-weight: 700; }

/* ── Header search ── */
.hdr-search {
  position: relative; display: flex; align-items: center;
  width: 240px; flex-shrink: 1; min-width: 0;
}
.hdr-search svg { position: absolute; left: 10px; color: var(--tx-3); pointer-events: none; flex-shrink: 0; }
.hdr-search input {
  width: 100%; padding: .4rem .8rem .4rem 1.9rem;
  background: var(--surface); border: 1px solid var(--bd-2); border-radius: 100px;
  font-family: var(--sans); font-size: .82rem; color: var(--tx-1); outline: none;
  transition: border-color var(--d) var(--ease), box-shadow var(--d) var(--ease);
}
.hdr-search input::placeholder { color: var(--tx-3); }
.hdr-search input:focus { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(45,212,191,.09); }

/* Search dropdown */
.search-drop {
  display: none; position: absolute; top: calc(100% + 6px); left: 0; right: 0;
  background: var(--srf-2); border: 1px solid var(--bd-2);
  border-radius: var(--r3); box-shadow: var(--sh-lg); z-index: 999;
  max-height: 280px; overflow-y: auto;
}
.search-drop.open { display: block; }
.sd-item {
  display: flex; align-items: center; gap: .6rem;
  padding: .5rem .85rem; font-size: .65rem; color: var(--tx-2);
  border-bottom: 1px solid var(--bd); cursor: pointer;
  transition: background var(--d) var(--ease);
}
.sd-item:last-child { border-bottom: none; }
.sd-item:hover { background: var(--srf-3); color: var(--tx-1); }
.sd-icon { font-size: .9rem; line-height: 1; flex-shrink: 0; }
.sd-name { flex: 1; font-weight: 500; }
.sd-cat {
  font-size: .65rem; padding: .1rem .42rem; border-radius: 3px;
  background: var(--surface); border: 1px solid var(--bd); color: var(--tx-3); white-space: nowrap;
}
.sd-empty { padding: .9rem; text-align: center; color: var(--tx-3); font-size: .82rem; }

/* ── Desktop nav ── */
.nav-desktop { display: flex; align-items: center; margin-left: auto; }
.nav-list    { display: flex; align-items: center; }
.nav-link {
  display: flex; align-items: center; gap: .2rem;
  padding: .4rem .6rem; font-size: .82rem; font-weight: 500;
  color: var(--tx-2); border-radius: var(--r2); white-space: nowrap;
  transition: color var(--d) var(--ease), background var(--d) var(--ease);
}
.nav-link:hover { color: var(--tx-1); background: var(--surface); }
.nav-link.active { color: var(--teal); }
.nav-arrow { font-size: .5rem; transition: transform .18s var(--ease); }

.has-drop { position: relative; }
.nav-drop {
  display: none; position: absolute; top: calc(100% + 4px); left: 0;
  min-width: 190px; background: var(--srf-2);
  border: 1px solid var(--bd-2); border-radius: var(--r3);
  padding: .28rem; box-shadow: var(--sh-lg); z-index: 600;
}
.nav-drop li a {
  display: block; padding: .36rem .62rem; font-size: .81rem;
  color: var(--tx-2); border-radius: var(--r2);
  transition: background var(--d) var(--ease), color var(--d) var(--ease);
}
.nav-drop li a:hover { background: var(--srf-3); color: var(--tx-1); }
.has-drop:hover .nav-drop  { display: block; }
.has-drop:hover .nav-arrow { transform: rotate(180deg); }

/* ── Hamburger ──
   Lives inside .nav-right which is always at the far right of .nav-bar.
   No margin tricks needed. Desktop: hidden. Mobile: shown. Simple. ── */
.hamburger {
  display: none;              /* visible only via @media override */
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 36px; height: 36px;
  border-radius: var(--r2);
  flex-shrink: 0;
  transition: background var(--d) var(--ease);
}

.hamburger span {
  display: block; width: 20px; height: 2px;
  background: var(--tx-2); border-radius: 2px;
  transition: transform var(--d) var(--ease), opacity var(--d) var(--ease);
}
.hamburger:hover span { background: var(--tx-1); }
.hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.open span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }


/* ================================================================
   MOBILE NAV — direct child of <body>, outside <header>
   No stacking context from backdrop-filter. z-index wins cleanly.
   ================================================================ */
.nav-mobile { display: none; }   /* shown only in @media block */


/* ================================================================
   FOOTER
   ================================================================ */
.site-footer { background: var(--surface); border-top: 1px solid var(--bd); }
.ft-top {
  display: grid; grid-template-columns: 2fr 1fr 1fr 1fr 1fr;
  gap: 2rem; padding: 2.75rem 1.5rem 2rem;
}
.ft-brand p { font-size: .78rem; color: var(--tx-3); margin-top: .55rem; line-height: 1.72; max-width: 230px; }
.ft-flags   { display: flex; gap: .36rem; margin-top: .65rem; font-size: 1rem; }
.ft-col h4  { font-size: .67rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--tx-1); margin-bottom: .8rem; }
.ft-col ul  { display: flex; flex-direction: column; gap: .38rem; }
.ft-col a   { font-size: .78rem; color: var(--tx-3); transition: color var(--d) var(--ease); }
.ft-col a:hover { color: var(--teal); }
.ft-bottom  { border-top: 1px solid var(--bd); padding: 1rem 1.5rem; text-align: center; }
.ft-bottom p { font-size: .74rem; color: var(--tx-3); line-height: 1.9; }
.ft-note { color: var(--tx-3); }
.ft-social-under-flags {
  margin-top: 1rem;
  margin-bottom: 1.5rem;
  display: flex;
  gap: 1rem;
}

.ft-social-under-flags a {
  color: var(--tx-3);
}

.ft-social-under-flags svg {
  width: 17px;
  height: 17px;
}

.ft-social-under-flags a:hover {
  color: var(--teal);
}


/* ================================================================
   SCROLLBAR
   ================================================================ */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--bd-2); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--tx-3); }


/* ================================================================
   RESPONSIVE — global only (header, footer)
   ================================================================ */

/* 1060 — footer */
@media (max-width: 1060px) {
  .ft-top    { grid-template-columns: 1fr 1fr 1fr; }
  .ft-brand  { grid-column: 1 / -1; }
  .ft-brand p { max-width: 100%; }
}

/* 900 */
@media (max-width: 900px) {
  .hdr-search { width: 180px; }
}

/* ── 768 — MOBILE ── */
@media (max-width: 768px) {

  /* ── Kill desktop search & nav ── */
  .hdr-search  { display: none; }
  .nav-desktop { display: none; }

  /* hamburger: margin-left:auto pushes it to the far right of the flex row */
  .hamburger { display: flex; margin-left: auto; }

  /* ── Mobile nav overlay ──
     Direct child of <body>. Not inside header.
     No backdrop-filter ancestor → no stacking context trap.
     No overflow-x:hidden on html/body → no iOS fixed-position bug.
     z-index:9999 wins over everything. ── */
  .nav-mobile {
    display: block;
    position: fixed;
    top: 60px; left: 0; right: 0; bottom: 0;
    background: #080b12;
    border-top: 1px solid var(--bd);
    z-index: 9999;
    transform: translateX(105%);
    transition: transform .27s cubic-bezier(0,0,.2,1);
    overflow-y: auto; overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
  }
  .nav-mobile.open { transform: translateX(0); }

  .mob-inner { padding: 1rem 1rem 3rem; }

  .mob-search {
    display: flex; align-items: center; gap: .48rem;
    background: var(--surface); border: 1px solid var(--bd-2);
    border-radius: var(--r2); padding: .48rem .82rem; margin-bottom: .82rem;
  }
  .mob-search svg { color: var(--tx-3); flex-shrink: 0; }
  .mob-search input {
    flex: 1; background: none; border: none; outline: none;
    font-family: var(--sans); font-size: .89rem; color: var(--tx-1);
  }
  .mob-search input::placeholder { color: var(--tx-3); }

  .mob-list { display: flex; flex-direction: column; gap: .08rem; }

  .mob-link {
    display: flex; align-items: center; justify-content: space-between;
    width: 100%; padding: .68rem .85rem; border-radius: var(--r2);
    font-size: .9rem; font-weight: 600; color: var(--tx-2);
    background: none; text-align: left;
    transition: color var(--d) var(--ease), background var(--d) var(--ease);
  }
  a.mob-link { text-decoration: none; }
  .mob-link:hover { color: var(--tx-1); background: var(--surface); }

  .mob-arr { font-size: .52rem; color: var(--tx-3); transition: transform .18s var(--ease); flex-shrink: 0; }

  .mob-sub {
    display: none; flex-direction: column; gap: .04rem;
    margin: .1rem 0 .1rem .75rem;
    padding: .16rem 0 .16rem .7rem;
    border-left: 2px solid rgba(45,212,191,.2);
  }
  .mob-sub li a {
    display: block; padding: .42rem .56rem; font-size: .84rem;
    color: var(--tx-3); border-radius: var(--r1);
    transition: color var(--d) var(--ease), background var(--d) var(--ease);
  }
  .mob-sub li a:hover { color: var(--teal); background: var(--surface); }
  .mob-has-sub.expanded .mob-sub { display: flex; }
  .mob-has-sub.expanded .mob-arr { transform: rotate(180deg); }

  /* footer */
  .ft-top    { grid-template-columns: repeat(2, 1fr); gap: 1.2rem; padding: 2rem 1.25rem 1.5rem; }
  .ft-brand  { grid-column: 1 / -1; }
}

/* 560 — footer and global */
@media (max-width: 560px) {
  .ft-top { grid-template-columns: repeat(2, 1fr); gap: 1rem; }
}

@media print {
  .site-header,.site-footer { display: none; }
}
