/* Wordle UK - global styles: tokens, layout, header, footer, buttons, dialogs, content blocks */

@font-face {
  font-family: "Bricolage Grotesque";
  src: url("/assets/fonts/bricolage-grotesque.woff2") format("woff2");
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
}
/* Metric-matched fallback so the swap does not move the layout */
@font-face {
  font-family: "Bricolage Fallback";
  src: local("Arial");
  size-adjust: 99%;
  ascent-override: 93%;
  descent-override: 24%;
  line-gap-override: 0%;
}

:root {
  --font: "Bricolage Grotesque", "Bricolage Fallback", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --ink: #0b2545;
  --ink-soft: #3d5270;
  --bg: #eef2f7;
  --surface: #ffffff;
  --surface-2: #e3e9f1;
  --line: #cbd5e3;
  --brand: #0b2545;
  --brand-ink: #ffffff;
  --correct: #0a7c4a;
  --present: #a86b00;
  --absent: #5b6b7e;
  --tile-empty: #ffffff;
  --tile-border: #b7c3d4;
  --focus: #1d6fe0;
  --danger: #b3261e;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgb(11 37 69 / 8%), 0 6px 20px rgb(11 37 69 / 8%);
  --header-h: 60px;
  --wrap: 1120px;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --ink: #e8eef7;
  --ink-soft: #a9b8cc;
  --bg: #07111f;
  --surface: #0e1d33;
  --surface-2: #162842;
  --line: #243a5a;
  --brand: #12294a;
  --brand-ink: #ffffff;
  --correct: #178f5a;
  --present: #b87800;
  --absent: #3a4a62;
  --tile-empty: #0e1d33;
  --tile-border: #34496b;
  --focus: #6aa7ff;
  --danger: #ff8a80;
  --shadow: 0 1px 2px rgb(0 0 0 / 40%), 0 6px 20px rgb(0 0 0 / 35%);
  color-scheme: dark;
}
:root[data-contrast="high"] {
  --correct: #f5793a;
  --present: #6cb4ee;
}

*, *::before, *::after { box-sizing: border-box; }
html {
  -webkit-text-size-adjust: 100%;
  scrollbar-gutter: stable;
  scroll-padding-top: calc(var(--header-h) + 12px);
}
body {
  margin: 0;
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.6;
  color: var(--ink);
  background: var(--bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
main { flex: 1 0 auto; }
img, svg { max-width: 100%; height: auto; }
a { color: inherit; text-underline-offset: 3px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
button { font: inherit; color: inherit; cursor: pointer; }
h1, h2, h3 { line-height: 1.15; margin: 0 0 .6em; letter-spacing: -.01em; text-wrap: balance; }
h1 { font-size: clamp(2rem, 1.4rem + 2.4vw, 3.1rem); font-weight: 800; }
h2 { font-size: clamp(1.45rem, 1.2rem + 1vw, 2rem); font-weight: 700; }
h3 { font-size: 1.2rem; font-weight: 700; }
p { margin: 0 0 1em; }
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: 12px; top: -60px; z-index: 100; padding: 10px 16px;
  background: var(--brand); color: var(--brand-ink); border-radius: var(--radius-sm);
}
.skip-link:focus { top: 12px; }

/* Tiny scrollbars, everywhere */
* { scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line); border-radius: 6px; }
::-webkit-scrollbar-thumb:hover { background: var(--ink-soft); }

.wrap { width: min(100% - 32px, var(--wrap)); margin-inline: auto; }
.prose { width: min(100% - 32px, 760px); margin-inline: auto; }

/* Header */
.site-header {
  position: sticky; top: 0; z-index: 50; height: var(--header-h);
  background: var(--brand); color: var(--brand-ink);
  border-bottom: 3px solid var(--correct);
}
.site-header__bar { display: flex; align-items: center; gap: 12px; height: 100%; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 800; font-size: 1.2rem; letter-spacing: -.01em; }
.brand__mark { width: 32px; height: 32px; flex: none; }
.site-nav { margin-left: auto; display: flex; align-items: center; gap: 2px; }
.site-nav__link {
  padding: 8px 12px; border-radius: var(--radius-sm); text-decoration: none; font-weight: 600; font-size: .95rem;
  color: rgb(255 255 255 / 86%);
}
.site-nav__link:hover, .site-nav__link[aria-current="page"] { background: rgb(255 255 255 / 12%); color: #fff; }
.icon-btn {
  display: inline-grid; place-items: center; width: 40px; height: 40px; border: 0; border-radius: var(--radius-sm);
  background: transparent; color: inherit;
}
.icon-btn:hover { background: rgb(255 255 255 / 14%); }
.icon-btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.site-header .icon-btn:focus-visible { outline-color: #fff; }
.nav-toggle { display: none; }
.install-btn {
  display: none; align-items: center; gap: 6px; padding: 7px 12px; border: 1.5px solid rgb(255 255 255 / 55%);
  border-radius: 999px; background: transparent; color: #fff; font-weight: 600; font-size: .9rem;
}
.install-btn:hover { background: rgb(255 255 255 / 14%); }
.install-btn.is-visible { display: inline-flex; }
.install-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.nav-toggle .icon-close, .nav-toggle[aria-expanded="true"] .icon-menu { display: none; }
.nav-toggle[aria-expanded="true"] .icon-close { display: block; }

@media (max-width: 860px) {
  .nav-toggle { display: inline-grid; margin-left: auto; }
  .site-nav {
    position: absolute; inset: var(--header-h) 0 auto 0; flex-direction: column; align-items: stretch; gap: 0;
    padding: 8px 16px 16px; background: var(--brand); border-bottom: 3px solid var(--correct);
    display: none; margin-left: 0;
  }
  .site-nav.is-open { display: flex; }
  .site-nav__link { padding: 12px; }
}
.site-header__actions { display: flex; align-items: center; gap: 6px; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 18px; min-height: 44px;
  border: 2px solid var(--brand); border-radius: var(--radius-sm); background: var(--brand); color: var(--brand-ink);
  font-weight: 700; text-decoration: none; line-height: 1.2;
}
:root[data-theme="dark"] .btn { border-color: var(--line); }
.btn:hover { filter: brightness(1.12); }
.btn--ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn--ghost:hover { background: var(--surface-2); filter: none; }
.btn--green { background: var(--correct); border-color: var(--correct); color: #fff; }
.btn--sm { padding: 6px 12px; min-height: 36px; font-size: .92rem; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* Page intro */
.page-intro { padding: 20px 0 6px; text-align: center; }
.page-intro h1 { margin-bottom: .25em; font-size: clamp(1.55rem, 1.1rem + 2vw, 2.5rem); }
.page-intro__lead { max-width: 62ch; margin: 0 auto 8px; color: var(--ink-soft); font-size: clamp(.95rem, .9rem + .3vw, 1.05rem); }

/* Sections */
.section { padding: 40px 0; }
.section > .page-intro { padding: 0; }
.section:has(> .page-intro) { padding: 28px 0 4px; }
html:has(dialog[open]) { overflow: hidden; }
.section > .page-intro h1 { margin-bottom: .35em; }
.section--tint { background: var(--surface); border-block: 1px solid var(--line); }
.section__head { max-width: 62ch; margin-bottom: 20px; }

/* Letter-count links */
.letter-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.letter-links__item {
  display: flex; flex-direction: column; align-items: center; justify-content: center; width: 76px;
  padding: 10px 6px; border: 2px solid var(--line); border-radius: var(--radius); background: var(--surface);
  text-decoration: none; font-weight: 700; line-height: 1.1;
}
.letter-links__item b { font-size: 1.6rem; }
.letter-links__item small { font-size: .78rem; font-weight: 500; color: var(--ink-soft); }
.letter-links__item:hover { border-color: var(--correct); }
.letter-links__item[aria-current="page"] { background: var(--correct); border-color: var(--correct); color: #fff; }
.letter-links__item[aria-current="page"] small { color: rgb(255 255 255 / 85%); }

/* Game cards (thumbnail grid) */
.game-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; list-style: none; margin: 0; padding: 0; }
.game-grid--fit { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.game-card {
  display: flex; flex-direction: column; align-items: center; gap: 8px; height: 100%; padding: 16px 10px 14px;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface);
  text-align: center; text-decoration: none; transition: transform .15s, border-color .15s;
}
.game-card:hover { border-color: var(--correct); transform: translateY(-2px); }
.game-card__img, .game-card__badge { width: 64px; height: 64px; border-radius: 14px; flex: none; }
.game-card__img { object-fit: cover; background: var(--surface-2); }
.game-card__badge {
  display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 1.8rem;
  background: linear-gradient(135deg, var(--a, #0a7c4a), var(--b, #0b2545));
}
.game-card__title { font-weight: 700; line-height: 1.2; }
.game-card__text { font-size: .85rem; color: var(--ink-soft); line-height: 1.3; }

/* SEO article copy */
.article { max-width: 760px; }
.article h2 { margin-top: 1.6em; }
.article h2:first-child { margin-top: 0; }
.article p, .article li { color: var(--ink); }
.article ul, .article ol { padding-left: 1.3em; margin: 0 0 1em; }
.article li { margin-bottom: .4em; }
.article figure { margin: 1.2em 0; }
.article figcaption { font-size: .9rem; color: var(--ink-soft); margin-top: 6px; }
.article img { border-radius: var(--radius); border: 1px solid var(--line); }
.faq { border-top: 1px solid var(--line); }
.faq details { border-bottom: 1px solid var(--line); padding: 14px 0; }
.faq summary { cursor: pointer; font-weight: 700; list-style: none; display: flex; justify-content: space-between; gap: 12px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; font-size: 1.4rem; line-height: 1; color: var(--correct); }
.faq details[open] summary::after { content: "\2212"; }
.faq details p { margin: .7em 0 0; color: var(--ink-soft); }

.steps { list-style: none; padding: 0 !important; counter-reset: step; }
.steps li { counter-increment: step; position: relative; padding-left: 48px; min-height: 36px; }
.steps li::before {
  content: counter(step); position: absolute; left: 0; top: 0; width: 34px; height: 34px; display: grid; place-items: center;
  border-radius: 8px; background: var(--brand); color: var(--brand-ink); font-weight: 800;
}

/* Dialog */
.dialog {
  width: min(100% - 24px, 460px); max-height: calc(100dvh - 24px); padding: 0; border: 1px solid var(--line);
  border-radius: var(--radius); background: var(--surface); color: var(--ink); box-shadow: var(--shadow); overflow: auto;
}
.dialog::backdrop { background: rgb(4 12 24 / 62%); }
.dialog__head { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px 0; }
.dialog__title { margin: 0; font-size: 1.35rem; }
.dialog__body { padding: 14px 18px 20px; }
.dialog__close { color: var(--ink); }
.dialog__close:hover { background: var(--surface-2); }

/* Footer */
.site-footer { margin-top: 40px; background: var(--brand); color: rgb(255 255 255 / 88%); border-top: 3px solid var(--correct); }
.site-footer a { color: #fff; }
.site-footer__grid { display: grid; grid-template-columns: minmax(0, 420px) minmax(0, 260px); justify-content: start; gap: 28px 72px; padding: 36px 0 24px; }
.site-footer h2 { font-size: 1rem; color: #fff; margin-bottom: .7em; }
.site-footer ul { list-style: none; margin: 0; padding: 0; }
.site-footer li { margin-bottom: 6px; }
.site-footer__about { font-size: .95rem; max-width: 38ch; }
.site-footer__chips { display: flex; flex-wrap: wrap; gap: 6px; }
.site-footer__chips a { min-width: 34px; text-align: center; padding: 3px 8px; border: 1px solid rgb(255 255 255 / 35%); border-radius: 6px; text-decoration: none; font-weight: 600; }
.site-footer__chips a:hover { background: rgb(255 255 255 / 14%); }
.site-footer__disclaimer {
  border-top: 1px solid rgb(255 255 255 / 20%); padding: 16px 0; font-size: .85rem; color: rgb(255 255 255 / 75%);
}
.site-footer__disclaimer p { margin: 0 0 .5em; max-width: 90ch; }
.site-footer__legal { display: flex; flex-wrap: wrap; gap: 6px 18px; justify-content: space-between; padding: 14px 0 24px; font-size: .9rem; border-top: 1px solid rgb(255 255 255 / 20%); }
.site-footer__legal nav { display: flex; gap: 16px; flex-wrap: wrap; }
@media (max-width: 600px) { .site-footer__grid { grid-template-columns: 1fr; } }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 200; transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  max-width: calc(100% - 32px); padding: 10px 16px; border-radius: var(--radius-sm); background: var(--ink); color: var(--bg);
  font-weight: 600; text-align: center; transition: opacity .2s, transform .2s;
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}
.legal h2 { margin-top: 1.4em; font-size: 1.35rem; }

@media (max-width: 420px) {
  .install-btn span { display: none; }
  .install-btn { padding: 7px 9px; }
  .brand { font-size: 1.1rem; }
  .section { padding: 28px 0; }
  .dialog__body { padding: 12px 14px 18px; }
}
@media (min-width: 1500px) { :root { --wrap: 1240px; } body { font-size: 1.125rem; } }

/* Breadcrumbs */
.breadcrumbs { padding-top: 16px; padding-bottom: 4px; font-size: .88rem; color: var(--ink-soft); }
.breadcrumbs ol { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 4px; list-style: none; margin: 0; padding: 0; }
.breadcrumbs li { display: inline-flex; align-items: center; min-width: 0; }
.breadcrumbs li + li::before { content: ""; width: 6px; height: 6px; margin: 0 8px 0 4px; border-top: 2px solid var(--ink-soft); border-right: 2px solid var(--ink-soft); transform: rotate(45deg); opacity: .55; flex: none; }
.breadcrumbs a { display: inline-flex; align-items: center; min-height: 32px; padding: 2px 10px; border-radius: 999px; background: var(--surface-2); color: var(--ink-soft); text-decoration: none; transition: background .15s, color .15s; }
.breadcrumbs a:hover { background: var(--brand); color: var(--brand-ink); }
.breadcrumbs a:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.breadcrumbs li:first-child a::before { content: ""; width: 14px; height: 14px; margin-right: 6px; background: currentColor; -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 3 2 12h3v8h5v-6h4v6h5v-8h3z'/%3E%3C/svg%3E") center/contain no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 3 2 12h3v8h5v-6h4v6h5v-8h3z'/%3E%3C/svg%3E") center/contain no-repeat; }
.breadcrumbs [aria-current] { padding: 2px 4px; color: var(--ink); font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 60vw; }
@media (max-width: 480px) { .breadcrumbs { font-size: .82rem; } .breadcrumbs a { padding: 2px 8px; } }

.toast.is-action { pointer-events: auto; cursor: pointer; text-decoration: underline; }

/* Worked example: step cards */
.section--tint { background: var(--surface-2); padding-block: 36px; }
.walk { list-style: none; margin: 0; padding: 0; display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 250px), 1fr)); counter-reset: none; }
.walk__item { display: flex; flex-direction: column; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); scroll-margin-top: 80px; transition: transform .2s, box-shadow .2s; }
.walk__item:hover { transform: translateY(-3px); }
.walk__fig { margin: 0; background: var(--surface-2); display: flex; justify-content: center; }
.walk__fig img { display: block; width: 100%; max-width: 343px; height: auto; aspect-ratio: 343 / 410; }
.walk__text { position: relative; padding: 26px 18px 18px; }
.walk__text h3 { margin: 0 0 6px; font-size: 1.12rem; }
.walk__text p { margin: 0 0 8px; color: var(--ink-soft); font-size: .95rem; }
.walk__text .walk__result { margin: 0; color: var(--ink); font-weight: 600; }
.walk__num { position: absolute; top: -18px; left: 18px; width: 36px; height: 36px; display: grid; place-items: center; border-radius: 50%; background: var(--brand); color: var(--brand-ink); font-weight: 800; box-shadow: 0 0 0 4px var(--surface); }
:root[data-theme="dark"] .walk__num { background: var(--correct); }
@media (prefers-reduced-motion: reduce) { .walk__item { transition: none; } .walk__item:hover { transform: none; } }
[data-motion="off"] .walk__item { transition: none; }
@media (min-width: 900px) { .walk { grid-template-columns: repeat(4, 1fr); } }
@media (max-width: 559px) { .walk { max-width: 380px; margin-inline: auto; } }
