/* =========================================================================
   Word Puzzle Solver — styles
   Mobile-first. Light theme. Card-based layout.
   Signature element: wooden letter tiles (the brand + hero motif).
   ========================================================================= */

/* ----------------------------- Tokens ----------------------------- */
:root {
  --bg: #eef2f7;
  --card: #ffffff;
  --ink: #16202e;
  --muted: #586b7d;
  --line: #e3e9f0;

  --primary: #127a6b;        /* teal — the single functional accent */
  --primary-dark: #0c5d52;
  --primary-tint: #e1f2ee;

  /* Tile motif: warm wood, used ONLY for tiles */
  --tile-face: #fbf3de;
  --tile-edge: #e6d2a4;
  --tile-shadow: #d8c08c;
  --tile-ink: #2e2614;
  --tile-pts: #a9852f;

  --radius: 14px;
  --radius-sm: 9px;
  --shadow-sm: 0 1px 2px rgba(16, 32, 46, .06);
  --shadow: 0 1px 2px rgba(16, 32, 46, .05), 0 10px 28px rgba(16, 32, 46, .07);

  --font: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --maxw: 1120px;
}

/* ----------------------------- Reset ----------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.6;
  font-size: 16px;
}
h1, h2, h3, p, ul, ol { margin: 0; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }

/* ----------------------------- Helpers ----------------------------- */
.container {
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: 18px;
}
.sr-only {
  position: absolute; 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: -48px;
  background: var(--ink); color: #fff;
  padding: 10px 14px; border-radius: 8px; z-index: 100;
  transition: top .15s ease;
}
.skip-link:focus { top: 12px; text-decoration: none; }

/* Visible keyboard focus everywhere */
:focus-visible {
  outline: 3px solid var(--primary);
  outline-offset: 2px;
  border-radius: 6px;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 22px;
}

/* ============================ Tiles (signature) ============================ */
.tile {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  width: 46px; height: 46px;
  background: var(--tile-face);
  color: var(--tile-ink);
  border: 1px solid var(--tile-edge);
  border-radius: 8px;
  box-shadow: 0 2px 0 var(--tile-shadow), var(--shadow-sm);
  font-weight: 800;
  font-size: 1.35rem;
  letter-spacing: 0;
  text-transform: uppercase;
}
.tile[data-pts]::after {
  content: attr(data-pts);
  position: absolute;
  right: 4px; bottom: 2px;
  font-size: .55rem;
  font-weight: 700;
  color: var(--tile-pts);
}
.tile--sm { width: 26px; height: 26px; font-size: .82rem; border-radius: 6px; box-shadow: 0 1px 0 var(--tile-shadow); }

/* ============================ Header ============================ */
.site-header {
  background: var(--card);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 50;
}
.site-header__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 18px;
  padding-block: 12px;
}
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); }
.brand:hover { text-decoration: none; }
.brand__tiles { display: inline-flex; gap: 3px; }
.brand__name { font-weight: 800; font-size: 1.08rem; letter-spacing: -.01em; }

.site-nav ul {
  list-style: none; padding: 0;
  display: flex; flex-wrap: wrap; gap: 4px 6px;
}
.site-nav a {
  display: inline-block;
  color: var(--muted);
  font-weight: 600;
  font-size: .92rem;
  padding: 7px 11px;
  border-radius: 999px;
}
.site-nav a:hover { color: var(--ink); background: var(--bg); text-decoration: none; }
.site-nav a[aria-current="page"] { color: var(--primary); background: var(--primary-tint); }

/* ============================ Hero ============================ */
.hero { padding-block: 30px 18px; }
.eyebrow {
  text-transform: uppercase;
  letter-spacing: .14em;
  font-size: .74rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 12px;
}
.hero__tiles {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin-bottom: 18px;
}
.hero__title {
  font-size: clamp(2.1rem, 7vw, 3.2rem);
  font-weight: 800;
  letter-spacing: -.025em;
  line-height: 1.05;
  margin-bottom: 12px;
}
.hero__lead {
  color: var(--muted);
  font-size: 1.06rem;
  max-width: 60ch;
  margin-bottom: 22px;
}

/* ============================ Tool ============================ */
.tool { padding: 20px; box-shadow: var(--shadow); }
.tool__form { display: grid; gap: 16px; }
.field { display: grid; gap: 6px; }
.field label { font-weight: 700; font-size: .95rem; }
.field__opt { font-weight: 500; color: var(--muted); font-size: .85rem; }
.field__help { color: var(--muted); font-size: .82rem; }

.tool input[type="text"],
.tool select {
  width: 100%;
  font: inherit;
  color: var(--ink);
  background: #fff;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px 13px;
}
.field--main input[type="text"] {
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.field--main input::placeholder { letter-spacing: .02em; }
.tool input:focus, .tool select:focus {
  border-color: var(--primary);
  outline: none;
  box-shadow: 0 0 0 3px var(--primary-tint);
}
.tool input[aria-invalid="true"] { border-color: #c0392b; }

.tool__row { display: grid; gap: 16px; }

.field__error {
  color: #a02b1d;
  background: #fdecea;
  border: 1px solid #f3c7c0;
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: .9rem;
  font-weight: 600;
  margin: 0;
}

.tool__actions { display: flex; flex-wrap: wrap; gap: 10px; }

.btn {
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  border-radius: var(--radius-sm);
  padding: 12px 20px;
  border: 1.5px solid transparent;
  transition: background .15s ease, color .15s ease, transform .05s ease;
}
.btn:active { transform: translateY(1px); }
.btn--primary { background: var(--primary); color: #fff; flex: 1 1 auto; }
.btn--primary:hover { background: var(--primary-dark); }
.btn--ghost { background: #fff; color: var(--ink); border-color: var(--line); }
.btn--ghost:hover { background: var(--bg); }

/* ----------------------------- Results ----------------------------- */
.tool__results { margin-top: 18px; }
.results__summary {
  display: flex; flex-wrap: wrap; gap: 8px 18px;
  color: var(--muted);
  font-size: .92rem;
  margin-bottom: 4px;
}
.results__summary:empty { display: none; }
.results__summary strong { color: var(--ink); }

.results { display: grid; gap: 18px; margin-top: 14px; }
.results:empty { margin-top: 0; }

.results__empty {
  color: var(--muted);
  background: var(--bg);
  border: 1px dashed var(--line);
  border-radius: var(--radius-sm);
  padding: 18px;
  text-align: center;
}

/* "Show more results" control — batches keep the DOM small. */
.results__more { display: flex; justify-content: center; margin-top: 4px; }
.results__more-btn { width: 100%; max-width: 320px; }

.wordgroup__title {
  display: flex; align-items: center; gap: 8px;
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--muted);
  font-weight: 700;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 12px;
}
.wordgroup__count {
  background: var(--primary-tint);
  color: var(--primary-dark);
  font-size: .72rem;
  padding: 1px 8px;
  border-radius: 999px;
}
.wordgroup__list {
  list-style: none; padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(118px, 1fr));
  gap: 8px;
}
.word {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px;
  background: var(--tile-face);
  border: 1px solid var(--tile-edge);
  border-radius: var(--radius-sm);
  padding: 8px 11px;
}
.word__text {
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .03em;
  font-size: .98rem;
  color: var(--tile-ink);
}
.word__score {
  font-size: .72rem;
  font-weight: 700;
  color: var(--tile-pts);
  background: rgba(169, 133, 47, .12);
  border-radius: 6px;
  padding: 1px 6px;
  min-width: 20px;
  text-align: center;
}

/* ============================ Ads ============================ */
.ad {
  margin-block: 22px;
  text-align: center;
}
.ad__label {
  display: block;
  text-transform: uppercase;
  letter-spacing: .12em;
  font-size: .66rem;
  font-weight: 700;
  color: #9aa7b4;
  margin-bottom: 6px;
}
.ad__slot {
  background: #f4f6f9;
  border: 1px dashed #d4dce5;
  border-radius: var(--radius-sm);
  min-height: 92px;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.ad__slot--tall { min-height: 540px; }
.ad--inline { margin-block: 4px 22px; }

/* Reserve space for each AdSense <ins> before it loads, to avoid layout
   shift (CLS). The .ad / .ad__label / .ad__slot wrappers above keep the
   units visually separate from results, navigation, and content cards. */
.ad-unit {
  width: 100%;
  min-height: 90px;
}
.ad-unit--horizontal { min-height: 90px; }
.ad-unit--inline { min-height: 180px; }
.ad-unit--sidebar { min-height: 540px; }

/* ============================ Content layout ============================ */
.layout { display: block; }
.layout__main { display: grid; gap: 18px; }
.layout__side { display: none; }   /* sidebar ad: desktop only */

.prose h2 {
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: -.015em;
  margin-bottom: 12px;
}
.prose h3 {
  font-size: 1.06rem;
  font-weight: 700;
  margin-top: 18px;
  margin-bottom: 6px;
}
.prose p { color: #344452; margin-bottom: 12px; }
.prose p:last-child { margin-bottom: 0; }

.steps { padding-left: 0; list-style: none; counter-reset: step; display: grid; gap: 12px; }
.steps li {
  position: relative;
  padding-left: 44px;
  color: #344452;
}
.steps li::before {
  counter-increment: step;
  content: counter(step);
  position: absolute; left: 0; top: -2px;
  width: 30px; height: 30px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--primary); color: #fff;
  font-weight: 800; font-size: .9rem;
  border-radius: 8px;
}

.examples { list-style: none; padding: 0; display: grid; gap: 8px; margin-bottom: 12px; }
.examples li {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  color: #344452;
}
.examples__in {
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--primary-dark);
  margin-right: 4px;
}
.examples__note { color: var(--muted); font-size: .9rem; }

/* ============================ Wordle position grid ============================ */
.wordle-pos { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 14px; margin: 0; }
.wordle-pos legend { font-weight: 700; font-size: .95rem; padding: 0 6px; }
.wordle-pos__grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin-top: 8px; }
.wordle-pos__cell { display: grid; gap: 4px; font-size: .72rem; color: var(--muted); text-align: center; }
.wordle-pos__cell input {
  width: 100%; font: inherit; text-align: center; text-transform: uppercase;
  color: var(--ink); background: #fff;
  border: 1.5px solid var(--line); border-radius: var(--radius-sm); padding: 8px 4px;
}
.wordle-pos__cell input:focus {
  border-color: var(--primary); outline: none; box-shadow: 0 0 0 3px var(--primary-tint);
}

/* ============================ Static content pages ============================ */
/* Shared layout for About / Contact / Privacy / Terms. Same light, card-based
   language as the tool pages — never plain unstyled legal text. */
.page-hero { padding-block: 30px 12px; }
.page-title {
  font-size: clamp(1.9rem, 6vw, 2.8rem);
  font-weight: 800;
  letter-spacing: -.025em;
  line-height: 1.08;
  margin-bottom: 12px;
}
.page-lead {
  color: var(--muted);
  font-size: 1.06rem;
  max-width: 65ch;
  margin-bottom: 4px;
}
.content-page {
  display: grid;
  gap: 18px;
  padding-bottom: 8px;
}

/* Bullet/number lists inside legal & info copy (the .prose rules cover only
   headings and paragraphs). */
.legal-content ul,
.legal-content ol {
  color: #344452;
  padding-left: 22px;
  margin-bottom: 12px;
  display: grid;
  gap: 6px;
}
.legal-content li { padding-left: 2px; }
.legal-content li:last-child { margin-bottom: 0; }
.legal-content .meta-date {
  color: var(--muted);
  font-size: .9rem;
  margin-bottom: 16px;
}

/* A tappable list of links to tools/pages. */
.link-list { list-style: none; padding: 0; display: grid; gap: 8px; margin-bottom: 12px; }
.link-list li {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}
.link-list a {
  display: block;
  padding: 10px 13px;
  font-weight: 700;
  color: var(--primary-dark);
}
.link-list a:hover { background: var(--primary-tint); text-decoration: none; border-radius: var(--radius-sm); }
/* Non-linked "coming soon" items in a link-list. */
.link-list--soon li {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 13px; font-weight: 700; color: var(--muted);
}
.badge-soon {
  font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em;
  color: var(--primary-dark); background: var(--primary-tint);
  border-radius: 999px; padding: 2px 9px;
}

/* ============================ Homepage ============================ */
.tools-grid { list-style: none; padding: 0; display: grid; gap: 14px; margin: 0; }
.tool-card {
  display: flex; flex-direction: column; gap: 6px;
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
  padding: 18px 18px 20px;
  color: var(--ink);
}
a.tool-card:hover { text-decoration: none; border-color: var(--primary); box-shadow: var(--shadow); }
.tool-card__name { font-weight: 800; font-size: 1.12rem; letter-spacing: -.01em; }
.tool-card__desc { color: var(--muted); font-size: .94rem; }
.tool-card--soon { opacity: .85; }
.tool-card--soon .tool-card__name { color: var(--muted); }
@media (min-width: 620px) { .tools-grid { grid-template-columns: 1fr 1fr; } }
@media (min-width: 1000px) { .tools-grid--3 { grid-template-columns: 1fr 1fr 1fr; } }

/* Soft callout used for "this is not legal advice" notices. */
.notice-card {
  background: var(--primary-tint);
  border: 1px solid #bfe0d8;
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  color: var(--primary-dark);
  font-size: .92rem;
  margin-bottom: 4px;
}
.notice-card strong { color: var(--primary-dark); }

/* ============================ Footer ============================ */
.site-footer {
  background: var(--ink);
  color: #c7d2dd;
  margin-top: 36px;
  padding-top: 30px;
}
.site-footer__inner {
  display: grid; gap: 24px;
  padding-bottom: 22px;
}
.site-footer .brand__name { color: #fff; }
.site-footer__tag { color: #9fb0bf; font-size: .92rem; margin-top: 4px; }
.site-footer__heading { font-size: .78rem; text-transform: uppercase; letter-spacing: .1em; color: #8fa1b1; margin-bottom: 10px; }
.site-footer nav ul { list-style: none; padding: 0; display: grid; gap: 7px; }
.site-footer nav a { color: #c7d2dd; font-size: .94rem; }
.site-footer nav a:hover { color: #fff; }
/* Non-linked "coming soon" tools in the footer. */
.site-footer__soon li { color: #8093a3; font-size: .94rem; }
.site-footer__legal {
  border-top: 1px solid rgba(255,255,255,.12);
  padding-block: 16px;
}
.site-footer__legal p { color: #8fa1b1; font-size: .82rem; margin: 0; }

/* ============================ Desktop ============================ */
@media (min-width: 760px) {
  .container { padding-inline: 28px; }
  .tool { padding: 28px; }
  .tool__row { grid-template-columns: 1fr 1fr; }
  .tool__actions .btn--primary { flex: 0 0 auto; }
  .site-footer__inner { grid-template-columns: 1.6fr 1fr 1fr 1fr; }
}

@media (min-width: 1000px) {
  .hero { padding-block: 44px 26px; }
  .tile { width: 54px; height: 54px; font-size: 1.6rem; }
  .layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 300px;
    gap: 28px;
    align-items: start;
  }
  .layout__side { display: block; }
  .ad--sidebar { position: sticky; top: 86px; margin: 0; }
  .prose { padding: 28px; }
}

/* ============================ Motion preference ============================ */
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
}
