/* =====================================================================
   MyWordIQ — shared stylesheet (all pages)
   Tokens · base · header · footer · buttons · ad slots · content pages
   ===================================================================== */

/* ---------- Design tokens ---------- */
:root {
  --bg: #f6f5f1;
  --surface: #ffffff;
  --surface-2: #efede8;
  --surface-3: #e6e3dc;
  --ink: #15171c;
  --ink-2: #3b3f47;
  --muted: #5f646e;
  --line: #e2dfd8;
  --line-strong: #c9c5bc;

  /* Game feedback colors (green = correct, yellow = present, gray = absent) */
  --c-correct: #3e8a4c;
  --c-present: #ae932b;
  --c-absent: #787c7e;
  --c-on-state: #ffffff;

  --brand: #3e8a4c;
  --brand-strong: #2f7340;
  --focus: #1d4ed8;

  --radius: 12px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 2px rgba(21, 23, 28, 0.06);
  --shadow-lg: 0 24px 60px -12px rgba(21, 23, 28, 0.28);

  --font-ui: "Libre Franklin", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-display: "Fraunces", Georgia, "Times New Roman", serif;

  --header-h: 60px;
  color-scheme: light;
}

.dark {
  --bg: #101113;
  --surface: #18191c;
  --surface-2: #212226;
  --surface-3: #2a2c31;
  --ink: #ededee;
  --ink-2: #c9cad0;
  --muted: #9a9da6;
  --line: #2a2c31;
  --line-strong: #3d4046;
  --c-absent: #3a3c41;
  --brand-strong: #58a866;
  --focus: #8ab4ff;
  --shadow-lg: 0 24px 60px -12px rgba(0, 0, 0, 0.7);
  color-scheme: dark;
}

/* Colour-blind friendly palette (Settings › High Contrast) */
.high-contrast {
  --c-correct: #d9661f;
  --c-present: #3d7fc4;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
img, svg { display: block; }
a { color: inherit; }
button { font: inherit; color: inherit; }
h1, h2, h3, h4 { margin: 0; line-height: 1.15; }
p { margin: 0; }

.hidden { display: none !important; }
.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: 12px; top: -60px; z-index: 100;
  background: var(--ink); color: var(--bg); padding: 10px 14px; border-radius: var(--radius-sm);
  font-weight: 700; text-decoration: none;
}
.skip-link:focus { top: 12px; }

:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }

.container { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 16px; }

/* ---------- Brand ---------- */
.brand {
  display: inline-flex; align-items: center; gap: 0.34em;
  font-family: var(--font-display); font-weight: 800;
  font-size: 26px; letter-spacing: -0.025em; line-height: 1;
  text-decoration: none; color: var(--ink); white-space: nowrap;
}
.brand .iq { color: var(--brand); margin-left: 1px; }
.dark .brand .iq { color: #58a866; }
/* Official MyWordIQ logo mark (assets/logo-mark.png, derived from assets/logo.svg).
   Height follows the wordmark size; width stays proportional. */
.brand-mark { height: 1.18em; width: auto; flex-shrink: 0; }
.brand-word { display: inline-flex; align-items: baseline; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 40;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.site-header .bar {
  height: var(--header-h);
  display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 12px;
}
.site-header .bar-left { display: none; }
.site-header .bar-right { display: flex; align-items: center; justify-content: flex-end; gap: 2px; }
@media (min-width: 768px) {
  .site-header .bar.is-centered { grid-template-columns: 1fr auto 1fr; }
  .site-header .bar.is-centered .bar-left { display: flex; align-items: center; gap: 2px; }
  .site-header .bar.is-centered .brand { font-size: 30px; }
  .only-mobile { display: none !important; }
}

.icon-btn {
  position: relative;
  width: 42px; height: 42px; border-radius: 10px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 0; background: transparent; color: var(--ink-2); cursor: pointer;
  transition: background-color .15s, color .15s;
}
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.icon-btn:active { background: var(--surface-3); }
.icon-btn svg { width: 22px; height: 22px; }
@media (max-width: 360px) {
  .site-header .bar { gap: 6px; }
  .brand { font-size: 21px; }
  .icon-btn { width: 36px; height: 36px; }
  .icon-btn svg { width: 20px; height: 20px; }
}

.text-btn {
  display: inline-flex; align-items: center; gap: 8px;
  height: 40px; padding: 0 12px; border-radius: 10px;
  border: 0; background: transparent; color: var(--ink-2);
  font-size: 14px; font-weight: 600; cursor: pointer; text-decoration: none;
}
.text-btn:hover { background: var(--surface-2); color: var(--ink); }
.text-btn svg { width: 20px; height: 20px; }

/* Tooltips (pointer devices only) */
@media (hover: hover) and (pointer: fine) {
  [data-tip]::after {
    content: attr(data-tip);
    position: absolute; top: calc(100% + 6px); left: 50%; transform: translate(-50%, -2px);
    padding: 5px 8px; border-radius: 6px; white-space: nowrap;
    background: var(--ink); color: var(--bg);
    font-size: 12px; font-weight: 600; line-height: 1.2;
    opacity: 0; pointer-events: none; transition: opacity .12s, transform .12s; z-index: 50;
  }
  [data-tip]:hover::after, [data-tip]:focus-visible::after { opacity: 1; transform: translate(-50%, 0); }
  .bar-right [data-tip]:last-child::after { left: auto; right: 0; transform: translateY(-2px); }
  .bar-right [data-tip]:last-child:hover::after,
  .bar-right [data-tip]:last-child:focus-visible::after { transform: translateY(0); }
}

/* Site nav on content pages */
.site-nav { display: flex; align-items: center; gap: 4px; }
.site-nav .nav-link {
  display: none; padding: 8px 12px; border-radius: 8px;
  font-size: 14px; font-weight: 600; color: var(--ink-2); text-decoration: none;
}
.site-nav .nav-link:hover { background: var(--surface-2); color: var(--ink); }
.site-nav .nav-link[aria-current="page"] { color: var(--ink); box-shadow: inset 0 -2px 0 var(--brand); border-radius: 0; }
@media (min-width: 820px) { .site-nav .nav-link { display: inline-flex; } }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 44px; padding: 0 20px; border-radius: 999px;
  font-size: 15px; font-weight: 700; letter-spacing: 0.005em;
  border: 1px solid transparent; cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background-color .15s, border-color .15s, color .15s, transform .05s;
}
.btn:active { transform: translateY(1px); }
.btn svg { width: 18px; height: 18px; }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-strong); }
.dark .btn-primary:hover { background: #347a42; }
.btn-dark { background: var(--ink); color: var(--bg); }
.btn-dark:hover { opacity: .88; }
.btn-outline { background: transparent; color: var(--ink); border-color: var(--line-strong); }
.btn-outline:hover { background: var(--surface-2); }
.btn-sm { height: 36px; padding: 0 14px; font-size: 14px; }
.btn-lg { height: 52px; padding: 0 24px; font-size: 16px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }

/* ---------- Advertisement slots ----------
   Empty, clearly labelled containers. Paste approved AdSense units inside .ad-box. */
.ad {
  display: flex; flex-direction: column; align-items: center;
  margin: 0 auto; max-width: 100%;
}
.ad-label {
  font-size: 10px; font-weight: 700; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--muted); margin-bottom: 6px;
}
.ad-box {
  width: var(--ad-w, 300px); height: var(--ad-h, 250px); max-width: 100%;
  background: var(--surface-2);
  border: 1px dashed var(--line-strong);
  border-radius: 6px;
}
.ad--rect { --ad-w: 300px; --ad-h: 250px; }
.ad--responsive { --ad-w: 300px; --ad-h: 250px; }
@media (min-width: 768px) {
  .ad--responsive { --ad-w: 728px; --ad-h: 90px; }
}

/* ---------- Footer ---------- */
.site-footer {
  margin-top: auto;
  border-top: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-2);
  font-size: 14px;
}
.footer-grid {
  display: grid; gap: 28px;
  padding: 40px 0 28px;
  grid-template-columns: 1fr 1fr;
}
.footer-brand { grid-column: 1 / -1; }
.footer-brand .brand { font-size: 24px; }
.footer-tagline { margin-top: 8px; color: var(--muted); max-width: 32ch; }
.footer-col h2 {
  font-family: var(--font-ui); font-size: 11px; font-weight: 700;
  letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); margin-bottom: 10px;
}
.footer-col ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.footer-col a, .footer-col button.linkish {
  color: var(--ink-2); text-decoration: none; background: none; border: 0; padding: 0; cursor: pointer; font-size: 14px;
}
.footer-col a:hover, .footer-col button.linkish:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
.footer-bottom {
  display: flex; flex-wrap: wrap; gap: 8px 20px; justify-content: space-between;
  padding: 18px 0 26px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px;
}
.footer-bottom a { color: var(--ink-2); }
@media (min-width: 768px) {
  .footer-grid { grid-template-columns: 1.6fr 1fr 1fr 1fr; }
  .footer-brand { grid-column: auto; }
}

/* ---------- Content pages ---------- */
.page-hero { padding: 48px 0 28px; border-bottom: 1px solid var(--line); }
.eyebrow {
  font-size: 12px; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase; color: var(--brand);
}
.dark .eyebrow { color: #6bbb79; }
.page-hero h1 {
  font-family: var(--font-display); font-weight: 800;
  font-size: clamp(34px, 6vw, 52px); letter-spacing: -0.025em; margin-top: 10px;
}
.page-hero .lede { margin-top: 14px; font-size: clamp(17px, 2.2vw, 20px); color: var(--ink-2); max-width: 60ch; }
.page-hero .meta { margin-top: 12px; font-size: 13px; color: var(--muted); }

.page-body { padding: 36px 0 64px; }
.prose { max-width: 720px; }
.prose h2 {
  font-family: var(--font-display); font-weight: 700; font-size: 26px; letter-spacing: -0.015em;
  margin: 40px 0 12px;
}
.prose h2:first-child { margin-top: 0; }
.prose h3 { font-size: 17px; font-weight: 700; margin: 24px 0 8px; }
.prose p, .prose li { color: var(--ink-2); font-size: 17px; line-height: 1.7; }
.prose p + p { margin-top: 14px; }
.prose ul, .prose ol { padding-left: 22px; margin: 12px 0; }
.prose li + li { margin-top: 6px; }
.prose a { color: var(--ink); text-decoration: underline; text-decoration-color: var(--brand); text-underline-offset: 3px; text-decoration-thickness: 2px; }
.prose a:hover { color: var(--brand-strong); }
.prose strong { color: var(--ink); }
.prose .note {
  margin: 20px 0; padding: 16px 18px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--line); font-size: 15px;
}

.cta-band {
  margin-top: 48px; padding: 28px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--line);
  display: flex; flex-wrap: wrap; gap: 16px; align-items: center; justify-content: space-between;
}
.cta-band h2 { font-family: var(--font-display); font-size: 24px; font-weight: 700; margin: 0; }
.cta-band p { color: var(--muted); margin-top: 4px; font-size: 15px; }

/* Example tiles used on content pages and in the quick guide */
.ex-row { display: flex; gap: 5px; margin: 10px 0 8px; }
.ex-tile {
  width: 42px; height: 42px; display: inline-flex; align-items: center; justify-content: center;
  border: 2px solid var(--line-strong); border-radius: 4px;
  font-weight: 800; font-size: 21px; color: var(--ink); background: var(--surface);
}
.ex-tile.is-correct { background: var(--c-correct); border-color: var(--c-correct); color: var(--c-on-state); }
.ex-tile.is-present { background: var(--c-present); border-color: var(--c-present); color: var(--c-on-state); }
.ex-tile.is-absent  { background: var(--c-absent);  border-color: var(--c-absent);  color: var(--c-on-state); }

.steps { list-style: none; padding: 0; margin: 16px 0; counter-reset: step; display: grid; gap: 12px; }
.steps > li {
  counter-increment: step; position: relative; padding: 16px 18px 16px 60px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
}
.steps > li::before {
  content: counter(step); position: absolute; left: 18px; top: 16px;
  width: 28px; height: 28px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--ink); color: var(--bg); font-size: 14px; font-weight: 700;
}
.steps > li > strong { display: block; color: var(--ink); font-size: 17px; margin-bottom: 2px; }
.steps > li p { font-size: 16px; }

.contact-card {
  margin-top: 8px; padding: 24px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--line);
}
.contact-card .email {
  display: inline-block; margin-top: 6px;
  font-family: var(--font-display); font-weight: 700; font-size: clamp(22px, 4vw, 30px);
  color: var(--ink); text-decoration: none; word-break: break-all;
}
.contact-card .email:hover { color: var(--brand-strong); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
}
