/* theme.js resolves "follow the OS" into a concrete data-theme before first
   paint, so the palette needs one light block and one dark block — no
   duplicated prefers-color-scheme copy drifting out of sync with this one. */

:root,
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #fbfbfa;
  --surface: #ffffff;
  --line: #e3e2df;
  --ink: #1c1b19;
  --ink-soft: #56534d;
  --ink-faint: #85817a;
  --accent: #1f5f4b;
  --accent-ink: #ffffff;
  --accent-soft: #eaf2ee;
  --warn: #8a5a00;
  --warn-soft: #fdf5e4;
  --good: #1f6b3f;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(20, 18, 15, .05), 0 6px 20px rgba(20, 18, 15, .04);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #16161a;
  --surface: #1e1e23;
  --line: #33333b;
  --ink: #ecebe8;
  --ink-soft: #adaba5;
  --ink-faint: #85817a;
  --accent: #4fbf95;
  --accent-ink: #10261e;
  --accent-soft: #1c2f28;
  --warn: #e0b25e;
  --warn-soft: #2b2519;
  --good: #63c98b;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 20px rgba(0, 0, 0, .25);
}

* { box-sizing: border-box; }

/* An explicit display rule beats the UA's [hidden]{display:none}, which would
   otherwise leave .row elements visible when we toggle the attribute. */
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.6 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.wrap { width: min(880px, 100% - 2.5rem); margin-inline: auto; }

/* ---------- chrome ---------- */

header.site { border-bottom: 1px solid var(--line); background: var(--surface); }

.bar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; padding: .9rem 0; flex-wrap: wrap;
}

.brand { font-weight: 650; letter-spacing: -.02em; font-size: 1.512rem; }
.brand-accent { color: var(--accent); }

.badge {
  display: inline-flex; align-items: center; gap: .4rem;
  font-size: .8rem; font-weight: 500; color: var(--accent);
  background: var(--accent-soft); border-radius: 100px; padding: .3rem .7rem;
}
.badge svg { width: 14px; height: 14px; fill: currentColor; }

.bar-right { display: inline-flex; align-items: center; gap: .6rem; }

.theme-toggle {
  display: grid; place-items: center; cursor: pointer;
  width: 34px; height: 34px; padding: 0; flex: none;
  background: transparent; color: var(--ink-soft);
  border: 1px solid var(--line); border-radius: 8px;
  transition: color .15s, border-color .15s, background .15s;
}
.theme-toggle:hover { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
.theme-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.theme-toggle svg {
  width: 17px; height: 17px; grid-area: 1 / 1;
  fill: none; stroke: currentColor; stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round;
}
/* Show the icon for the theme you would switch TO, which is the convention
   people expect from a single-button toggle. */
:root[data-theme="light"] .icon-sun,
:root[data-theme="dark"] .icon-moon { display: none; }

footer.site {
  margin-top: 4rem; border-top: 1px solid var(--line);
  padding: 1.5rem 0; color: var(--ink-faint); font-size: .85rem;
}
footer.site p { margin: 0; }

/* ---------- hero ---------- */

.hero { padding: 3rem 0 2rem; }
.hero strong { font-weight: 620; color: var(--ink); }

h1 {
  margin: 0 0 .9rem;
  font-size: clamp(1.7rem, 4.5vw, 2.5rem);
  line-height: 1.2; letter-spacing: -.025em; font-weight: 680;
}

.lede { margin: 0; max-width: 60ch; color: var(--ink-soft); font-size: 1.02rem; }

/* ---------- drop zone ---------- */

.drop {
  border: 1.5px dashed var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 2.5rem 1.5rem; text-align: center; cursor: pointer;
  transition: border-color .15s, background .15s;
}
.drop:hover, .drop:focus-visible { border-color: var(--accent); background: var(--accent-soft); outline: none; }
.drop.hot { border-color: var(--accent); background: var(--accent-soft); border-style: solid; }

.drop-icon {
  width: 30px; height: 30px; margin-bottom: .6rem;
  fill: none; stroke: var(--accent); stroke-width: 1.6;
  stroke-linecap: round; stroke-linejoin: round;
}
.drop-title { margin: 0 0 .25rem; font-weight: 570; }
.drop-sub { margin: 0; color: var(--ink-faint); font-size: .87rem; }

/* ---------- controls ---------- */

.controls { margin-top: 1.25rem; }

.ctl {
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); padding: 1.1rem 1.25rem 1.25rem; margin: 0;
}
.ctl legend { padding: 0 .4rem; font-size: .8rem; font-weight: 600; color: var(--ink-faint); text-transform: uppercase; letter-spacing: .06em; }

.chips { display: flex; gap: .5rem; margin-bottom: 1rem; flex-wrap: wrap; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip span {
  display: inline-block; padding: .4rem .85rem; border-radius: 100px;
  border: 1px solid var(--line); font-size: .88rem; cursor: pointer;
  transition: all .15s;
}
.chip input:checked + span { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 550; }
.chip input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

.row { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.row-label { font-size: .92rem; color: var(--ink-soft); }

input[type="text"], select {
  font: inherit; font-size: .95rem; color: var(--ink);
  background: var(--bg); border: 1px solid var(--line);
  border-radius: 7px; padding: .45rem .6rem;
}
input[type="text"] { width: 7.5rem; }
input[type="text"]:focus, select:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: var(--accent); }
input[type="text"].bad { border-color: #c2453a; }

.presets { display: flex; gap: .35rem; flex-wrap: wrap; }
.presets button {
  font: inherit; font-size: .82rem; cursor: pointer;
  background: var(--bg); color: var(--ink-soft);
  border: 1px solid var(--line); border-radius: 6px; padding: .3rem .55rem;
}
.presets button:hover { border-color: var(--accent); color: var(--accent); }

.hint { flex-basis: 100%; margin: .5rem 0 0; font-size: .84rem; color: var(--ink-faint); max-width: 62ch; }

.check { display: flex; gap: .55rem; align-items: baseline; margin-top: 1rem; font-size: .92rem; cursor: pointer; }
.check em { color: var(--ink-faint); font-style: normal; }
.check input { margin: 0; accent-color: var(--accent); }

/* ---------- actions ---------- */

.actions { display: flex; gap: .6rem; margin-top: 1.25rem; align-items: center; }

button.primary, button.ghost {
  font: inherit; font-weight: 560; cursor: pointer;
  border-radius: 8px; padding: .6rem 1.4rem; border: 1px solid transparent;
  transition: opacity .15s, background .15s;
}
button.primary { background: var(--accent); color: var(--accent-ink); }
button.primary:hover:not(:disabled) { opacity: .9; }
button.primary:disabled { opacity: .45; cursor: not-allowed; }
button.ghost { background: transparent; color: var(--ink-soft); border-color: var(--line); }
button.ghost:hover { border-color: var(--ink-faint); }

/* ---------- results ---------- */

.results { list-style: none; margin: 1.5rem 0 0; padding: 0; display: grid; gap: .6rem; }

.results li {
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); padding: .85rem 1rem;
  display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
  box-shadow: var(--shadow);
}

.r-main { flex: 1 1 16rem; min-width: 0; }
.r-name { font-weight: 550; overflow-wrap: anywhere; }
.r-meta { font-size: .86rem; color: var(--ink-faint); margin-top: .15rem; }
.r-meta .drop-pct { color: var(--good); font-weight: 600; }
.r-meta .miss { color: var(--warn); font-weight: 600; }
.r-meta .fail { color: #c2453a; font-weight: 600; }
.r-meta .r-note { opacity: .7; }

.bar-track { height: 4px; border-radius: 3px; background: var(--line); overflow: hidden; margin-top: .5rem; }
.bar-fill { height: 100%; background: var(--accent); width: 0; transition: width .2s; }

.r-dl {
  font: inherit; font-size: .88rem; font-weight: 560; text-decoration: none;
  background: var(--accent-soft); color: var(--accent);
  border: 1px solid transparent; border-radius: 7px; padding: .45rem .9rem;
  white-space: nowrap; cursor: pointer;
}
.r-dl:hover { border-color: var(--accent); }

/* ---------- notes & columns ---------- */

.warn {
  margin-top: 1.25rem; padding: .8rem 1rem; font-size: .88rem;
  background: var(--warn-soft); color: var(--warn);
  border: 1px solid color-mix(in srgb, var(--warn) 25%, transparent);
  border-radius: 8px;
}
.warn strong { font-weight: 620; }

.cols { display: grid; gap: 2rem; grid-template-columns: 1fr; }
@media (min-width: 700px) { .cols { grid-template-columns: 1fr 1fr; } }
.cols p { margin: 0 0 .8rem; color: var(--ink-soft); font-size: .93rem; }
.cols p:last-child { margin-bottom: 0; }

/* ---------- content sections ---------- */

main section + section, main section + .ad-slot { margin-top: 3.5rem; }

section h2 {
  font-size: clamp(1.25rem, 2.6vw, 1.5rem);
  letter-spacing: -.02em; margin: 0 0 1.25rem;
}
section h3 { font-size: 1rem; margin: 0 0 .4rem; letter-spacing: -.01em; }

.steps { list-style: none; counter-reset: s; margin: 0; padding: 0; display: grid; gap: 1.25rem; }
.steps li { counter-increment: s; padding-left: 2.6rem; position: relative; }
.steps li::before {
  content: counter(s);
  position: absolute; left: 0; top: -.1rem;
  width: 1.8rem; height: 1.8rem; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent);
  font-size: .88rem; font-weight: 650;
}
.steps p { margin: 0; color: var(--ink-soft); font-size: .93rem; }

.cards { display: grid; gap: 1.25rem; grid-template-columns: 1fr; }
@media (min-width: 700px) { .cards { grid-template-columns: 1fr 1fr; } }
.cards article {
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); padding: 1.1rem 1.25rem;
}
.cards p { margin: 0; color: var(--ink-soft); font-size: .93rem; }

/* ---------- faq ---------- */

.faq { display: grid; gap: .5rem; }
.faq details {
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); padding: .85rem 1.1rem;
}
.faq summary {
  cursor: pointer; font-weight: 550; font-size: .96rem;
  list-style: none; display: flex; justify-content: space-between; gap: 1rem;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: '+'; color: var(--accent); font-weight: 500;
  font-size: 1.2rem; line-height: 1; flex: none;
}
.faq details[open] summary::after { content: '−'; }
.faq summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
.faq p { margin: .7rem 0 .1rem; color: var(--ink-soft); font-size: .93rem; }

/* ---------- ad slots ---------- */

/* Height is reserved up front so switching ads on never shifts the page —
   layout shift after monetising is the classic way a tool site loses its
   rankings. Slots stay display:none until ads.js unhides them. */
.ad-slot {
  min-height: 90px;
  display: grid; place-items: center;
  border-radius: var(--radius);
}
@media (min-width: 700px) { .ad-slot { min-height: 100px; } }

/* ---------- feedback dialog ---------- */

.foot-links { margin: .6rem 0 0; }

.linkish {
  font: inherit; font-size: inherit; cursor: pointer;
  background: none; border: 0;
  /* Vertical padding keeps the tap target at least 24px tall on mobile, which
     is what Lighthouse and Search Console's mobile usability check want. */
  padding: .3rem 0;
  color: var(--accent); text-decoration: underline;
  text-underline-offset: 2px;
}
.linkish:hover { text-decoration-thickness: 2px; }
.r-meta .linkish { font-size: .86rem; margin-left: .2rem; }

dialog#feedback {
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); color: var(--ink);
  padding: 1.5rem; width: min(34rem, calc(100vw - 2rem));
  box-shadow: 0 10px 40px rgba(20, 18, 15, .18);
}
dialog#feedback::backdrop { background: rgba(20, 18, 15, .45); }

.dlg-close-row { display: flex; justify-content: flex-end; margin: -.5rem -.5rem 0 0; }
.dlg-x {
  font: inherit; font-size: 1.4rem; line-height: 1; cursor: pointer;
  background: none; border: 0; color: var(--ink-faint); padding: .2rem .4rem;
  border-radius: 6px;
}
.dlg-x:hover { color: var(--ink); background: var(--bg); }

dialog#feedback h2 { font-size: 1.15rem; margin: 0 0 .5rem; letter-spacing: -.02em; }
.dlg-lede { margin: 0 0 1.1rem; color: var(--ink-soft); font-size: .92rem; }
.dlg-label { display: block; font-size: .9rem; font-weight: 550; margin-bottom: .35rem; }

dialog#feedback textarea {
  width: 100%; font: inherit; font-size: .93rem; color: var(--ink);
  background: var(--bg); border: 1px solid var(--line); border-radius: 7px;
  padding: .6rem .7rem; resize: vertical;
}
dialog#feedback textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }

.dlg-pre {
  margin: .6rem 0 0; padding: .6rem .7rem; max-height: 8rem; overflow: auto;
  background: var(--bg); border: 1px solid var(--line); border-radius: 7px;
  font-size: .76rem; color: var(--ink-faint); white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.dlg-actions { display: flex; gap: .6rem; margin-top: 1.1rem; flex-wrap: wrap; }
.dlg-note { margin: .9rem 0 0; font-size: .86rem; color: var(--ink-faint); }
.dlg-note a { color: var(--accent); }
.dlg-sent {
  margin: .8rem 0 0; padding: .6rem .75rem; font-size: .86rem;
  background: var(--accent-soft); color: var(--accent); border-radius: 7px;
}

/* ---------- a11y helpers ---------- */

.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip {
  position: absolute; left: -9999px; top: 0; z-index: 10;
  background: var(--accent); color: var(--accent-ink);
  padding: .6rem 1rem; border-radius: 0 0 8px 0; text-decoration: none;
}
.skip:focus { left: 0; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
