/* Delve No More: an editor's desk. Red pencil marks the tells, blue pencil is the site's own hand, green shows the fixes. */
:root {
  --paper: #F5F7F6;
  --sheet: #FFFFFF;
  --ink: #1B2422;
  --muted: #5D6B68;
  --rule: #D9E0DE;
  --pencil: #2B55C9;
  --pencil-wash: #E3EAFB;
  --mark: #B4472E;
  --mark-wash: #F8E6E1;
  --good: #2E7A55;
  --good-wash: #E2F2E9;
  --f-display: "Young Serif", Georgia, serif;
  --f-body: "Public Sans", system-ui, -apple-system, sans-serif;
  --f-read: "Newsreader", Georgia, "Times New Roman", serif;
  --f-mono: "JetBrains Mono", ui-monospace, Menlo, monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #131917; --sheet: #1B2321; --ink: #E6ECEA; --muted: #98A6A2; --rule: #2E3936;
    --pencil: #8EA8F2; --pencil-wash: #222D47; --mark: #EE8C74; --mark-wash: #3A2520;
    --good: #6FC79A; --good-wash: #1C3328;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  background: var(--paper); color: var(--ink);
  font-family: var(--f-body); font-size: 15px; line-height: 1.55;
  padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px);
}
a { color: var(--pencil); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--pencil); outline-offset: 2px; }

.wrap {
  max-width: 1180px; margin: 0 auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}

/* ---- site header and footer ---- */
.site-head { border-bottom: 1px solid var(--rule); }
.site-head .wrap { display: flex; align-items: center; justify-content: space-between; gap: 12px 24px; flex-wrap: wrap; padding-block: 14px; }
.brand { font-family: var(--f-display); font-size: 1.25rem; color: var(--ink); text-decoration: none; white-space: nowrap; }
.brand s { text-decoration-color: var(--mark); text-decoration-thickness: 2px; }
.brand span { color: var(--pencil); }
.nav { display: flex; gap: 4px 18px; flex-wrap: wrap; font-size: 0.92rem; }
.nav a { color: var(--muted); text-decoration: none; padding-block: 4px; border-bottom: 2px solid transparent; }
.nav a:hover { color: var(--ink); }
.nav a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--pencil); }

.site-foot { border-top: 1px solid var(--rule); margin-top: 56px; }
.site-foot .wrap { padding-block: 24px 32px; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px 24px; color: var(--muted); font-size: 0.85rem; }
.site-foot p { margin: 0; max-width: 60ch; }
.site-foot nav { display: flex; gap: 16px; flex-wrap: wrap; }
.site-foot a { color: var(--muted); }

/* ---- shared type ---- */
.eyebrow { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); font-weight: 600; }
h1, h2, h3 { text-wrap: balance; }
.page-title { font-family: var(--f-display); font-weight: 400; font-size: clamp(1.8rem, 4vw, 2.4rem); line-height: 1.15; margin: 0; letter-spacing: -0.01em; }
.page-title s { text-decoration-color: var(--mark); text-decoration-thickness: 3px; }
.page-title span { color: var(--pencil); }
.lede { margin: 0; color: var(--muted); max-width: 58ch; text-wrap: pretty; font-size: 1.02rem; }
.section-title { font-family: var(--f-display); font-weight: 400; font-size: 1.5rem; margin: 0 0 4px; }
.prose { max-width: 66ch; font-size: 1.02rem; }
.prose p, .prose ul { margin: 0 0 14px; }
.prose ul { padding-left: 20px; }
.prose li { margin-bottom: 6px; }
.prose h2 { font-family: var(--f-display); font-weight: 400; font-size: 1.4rem; margin: 32px 0 8px; }

/* ---- buttons, chips ---- */
button, .button {
  font: inherit; font-weight: 600; font-size: 0.88rem; cursor: pointer; text-decoration: none; display: inline-block;
  border-radius: 999px; padding: 6px 14px; border: 1px solid var(--rule); background: var(--sheet); color: var(--ink);
}
button:hover, .button:hover { border-color: var(--ink); }
.primary { background: var(--pencil); border-color: var(--pencil); color: var(--sheet); }
.primary:hover { filter: brightness(1.08); border-color: var(--pencil); }
.quiet { border-color: transparent; background: transparent; color: var(--muted); font-weight: 500; }
.quiet:hover { color: var(--ink); border-color: var(--rule); }
.chip { font-size: 0.78rem; padding: 2px 9px; border-radius: 999px; background: var(--mark-wash); color: var(--mark); white-space: nowrap; }
.chip b { font-family: var(--f-mono); font-weight: 500; margin-left: 4px; }
.chip.ok { background: var(--good-wash); color: var(--good); }
.none { color: var(--muted); font-size: 0.82rem; }

/* ---- tool ---- */
.tool { display: grid; gap: 20px; padding-block: 28px 0; }
.tool-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px 24px; }
.controls { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; padding-block: 12px; border-block: 1px solid var(--rule); }
.check { display: inline-flex; align-items: center; gap: 6px; font-size: 0.88rem; cursor: pointer; }
.check input { accent-color: var(--pencil); width: 15px; height: 15px; margin: 0; }
.keep { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin-top: -8px; }
.keep input {
  flex: 1 1 260px; min-width: 0; font: inherit; font-size: 0.9rem; padding: 7px 12px;
  border-radius: 999px; border: 1px solid var(--rule); background: var(--sheet); color: var(--ink);
}
.keep input::placeholder { color: var(--muted); }

.desk { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 820px) { .desk { grid-template-columns: 1fr; } }
.pane { min-width: 0; display: grid; grid-template-rows: auto 1fr auto; background: var(--sheet); border: 1px solid var(--rule); border-radius: 6px; }
.pane-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 14px; border-bottom: 1px solid var(--rule); min-height: 46px; flex-wrap: wrap; }
.pane-head h2 { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em; margin: 0; font-weight: 600; color: var(--muted); }
.meta { font-family: var(--f-mono); font-size: 0.75rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.editor { position: relative; }
.editor textarea, .editor .mirror {
  font-family: var(--f-read); font-size: 1.08rem; line-height: 1.65;
  padding: 16px 18px; margin: 0; border: 0; width: 100%;
  white-space: pre-wrap; overflow-wrap: break-word; letter-spacing: normal;
}
.editor .mirror { position: absolute; inset: 0; color: transparent; overflow: hidden; pointer-events: none; }
.editor .mirror mark { background: var(--mark-wash); color: transparent; border-bottom: 2px solid var(--mark); border-radius: 2px; }
.editor textarea { position: relative; display: block; background: transparent; color: var(--ink); resize: vertical; min-height: 360px; height: 100%; outline: none; }
.editor textarea:focus-visible { box-shadow: inset 0 0 0 2px var(--pencil-wash); }
@media (max-width: 820px) { .editor textarea, .out { min-height: 260px; } }

.out { font-family: var(--f-read); font-size: 1.08rem; line-height: 1.65; padding: 16px 18px; min-height: 360px; white-space: pre-wrap; overflow-wrap: break-word; }
.out.empty { color: var(--muted); font-style: italic; }
.out ins, .ba ins { text-decoration: none; background: var(--good-wash); border-bottom: 2px solid var(--good); border-radius: 2px; }
.out ins { cursor: help; }
.out .cut { display: inline-block; width: 2px; height: 1.05em; vertical-align: -0.15em; margin: 0 1px; background: var(--mark); border-radius: 1px; cursor: help; }
.show-plain .out ins { background: none; border: 0; cursor: text; }
.show-plain .out .cut { display: none; }

.tells { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px 14px; border-top: 1px solid var(--rule); min-height: 46px; align-items: center; }

.review { background: var(--sheet); border: 1px solid var(--rule); border-radius: 6px; padding: 14px 18px; display: grid; gap: 8px; }
.review ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; }
.review li { display: grid; grid-template-columns: minmax(0, 11rem) minmax(0, 1fr); gap: 4px 14px; font-size: 0.9rem; }
.review li b { font-weight: 600; }
.review li span { color: var(--muted); overflow-wrap: anywhere; }
@media (max-width: 560px) { .review li { grid-template-columns: 1fr; } }

.tip { position: fixed; z-index: 20; max-width: 280px; padding: 6px 10px; border-radius: 6px; background: var(--ink); color: var(--paper); font-size: 0.82rem; line-height: 1.4; pointer-events: none; }
.tip s { opacity: 0.75; }

/* ---- home sections ---- */
.band { padding-top: 56px; display: grid; gap: 20px; }
.steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin: 0; padding: 0; list-style: none; counter-reset: step; }
@media (max-width: 760px) { .steps { grid-template-columns: 1fr; } }
.steps li { counter-increment: step; display: grid; gap: 6px; align-content: start; }
.steps li::before { content: counter(step); font-family: var(--f-display); font-size: 1.6rem; color: var(--pencil); line-height: 1; }
.steps h3 { margin: 0; font-size: 1rem; }
.steps p { margin: 0; color: var(--muted); }

.faq { display: grid; gap: 0; max-width: 72ch; border-top: 1px solid var(--rule); }
.faq details { border-bottom: 1px solid var(--rule); }
.faq summary { cursor: pointer; padding: 14px 4px; font-weight: 600; list-style: none; display: flex; justify-content: space-between; gap: 12px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; font-family: var(--f-mono); color: var(--muted); }
.faq details[open] summary::after { content: "−"; }
.faq details p { margin: 0 4px 16px; color: var(--muted); max-width: 64ch; }

.cta { display: flex; flex-wrap: wrap; gap: 10px 20px; align-items: center; justify-content: space-between; background: var(--sheet); border: 1px solid var(--rule); border-radius: 6px; padding: 18px 20px; }
.cta p { margin: 0; max-width: 56ch; }

/* ---- word list ---- */
.page { padding-block: 32px 0; display: grid; gap: 24px; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.filters input[type="search"] {
  font: inherit; padding: 7px 12px; border-radius: 999px; border: 1px solid var(--rule); background: var(--sheet); color: var(--ink); min-width: 0; width: min(100%, 260px);
}
.filters button[aria-pressed="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.words { display: grid; gap: 0; border-top: 1px solid var(--rule); }
.word { display: grid; grid-template-columns: minmax(0, 13rem) minmax(0, 1fr); gap: 6px 24px; padding: 18px 0; border-bottom: 1px solid var(--rule); }
@media (max-width: 680px) { .word { grid-template-columns: 1fr; } }
.word h2 { margin: 0; font-family: var(--f-display); font-weight: 400; font-size: 1.25rem; line-height: 1.25; }
.word .kind { display: block; margin-top: 4px; }
.word p { margin: 0 0 8px; max-width: 64ch; }
.ba { display: grid; gap: 4px; font-family: var(--f-read); font-size: 1.02rem; }
.ba div { display: grid; grid-template-columns: 3.4rem minmax(0, 1fr); gap: 8px; }
.ba .eyebrow { padding-top: 3px; }
.ba .before mark { background: var(--mark-wash); color: inherit; border-bottom: 2px solid var(--mark); border-radius: 2px; }
.ba del { color: var(--mark); text-decoration-color: var(--mark); text-decoration-thickness: 1.5px; opacity: 0.85; }
.ba .flag { color: var(--muted); font-family: var(--f-body); font-size: 0.9rem; }
.empty-note { color: var(--muted); padding: 18px 0; }

@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; } }
