/* ==========================================================
   Night Reader site styles
   Colors live in the variables below. Change them here once
   and the whole site updates.
   ========================================================== */
:root {
  --bg: #14110D;
  --surface: #1E1A14;
  --surface-2: #2A2113;
  --border: #2F281D;
  --border-strong: #3A3226;
  --text: #F5EFE3;
  --muted: #B9AE9A;
  --accent: #FBB92B;
  --accent-ink: #1A1203;
  --link: #FBB92B;
  --ok: #6FCF8E;
  --bad: #FF8A80;
  --shadow: 0 12px 32px rgba(0, 0, 0, .38);
  --radius: 14px;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #FBF8F1; --surface: #FFFFFF; --surface-2: #FFF4DA; --border: #E8DFCB; --border-strong: #D6C9AB;
  --text: #1B1710; --muted: #5E5648; --link: #9A3F06; --ok: #1B7F3B; --bad: #B3261E;
  --shadow: 0 12px 32px rgba(60, 40, 0, .10); color-scheme: light;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #FBF8F1; --surface: #FFFFFF; --surface-2: #FFF4DA; --border: #E8DFCB; --border-strong: #D6C9AB;
    --text: #1B1710; --muted: #5E5648; --link: #9A3F06; --ok: #1B7F3B; --bad: #B3261E;
    --shadow: 0 12px 32px rgba(60, 40, 0, .10); color-scheme: light;
  }
}

[hidden] { display: none !important; }
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.65 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
}
img, svg, canvas { max-width: 100%; height: auto; }
a { color: var(--link); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
h1, h2, h3 { line-height: 1.2; letter-spacing: -0.015em; margin: 0 0 .6em; }
h1 { font-size: clamp(2rem, 4.2vw, 3.1rem); font-weight: 800; }
h2 { font-size: clamp(1.45rem, 2.6vw, 1.9rem); font-weight: 800; margin-top: 0; }
h3 { font-size: 1.1rem; font-weight: 700; }
p { margin: 0 0 1em; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.wrap { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 20px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--accent); color: var(--accent-ink); padding: 8px 14px; border-radius: 8px; z-index: 100; }
.skip:focus { left: 8px; }
ul.plain { list-style: none; margin: 0; padding: 0; }
ul.plain li { margin: 0 0 .5em; }
ul.checks { list-style: none; margin: 0 0 1em; padding: 0; }
ul.checks li { position: relative; padding-left: 28px; margin-bottom: .55em; }
ul.checks li::before { content: ""; position: absolute; left: 2px; top: .45em; width: 14px; height: 8px; border-left: 2.5px solid var(--accent); border-bottom: 2.5px solid var(--accent); transform: rotate(-45deg); }

/* Header */
.site-header { position: sticky; top: 0; z-index: 50; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border); }
.header-in { display: flex; align-items: center; gap: 14px; min-height: 64px; flex-wrap: wrap; padding-top: 8px; padding-bottom: 8px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-weight: 800; font-size: 1.05rem; margin-right: auto; }
.nav { display: flex; gap: 4px; flex-wrap: wrap; }
.nav a { color: var(--text); text-decoration: none; padding: 10px 12px; border-radius: 10px; font-weight: 600; font-size: .95rem; }
.nav a:hover { background: var(--surface); }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border: 1px solid var(--border-strong); background: transparent; color: var(--text); border-radius: 12px; cursor: pointer; }
.icon-btn:hover { background: var(--surface); }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 0 20px; border-radius: 12px; border: 1.5px solid var(--border-strong); background: transparent; color: var(--text); font: inherit; font-weight: 700; text-decoration: none; cursor: pointer; }
.btn:hover { background: var(--surface); }
.btn-primary { background: linear-gradient(135deg, #FFC107, #F5921B); border-color: transparent; color: var(--accent-ink); }
.btn-primary:hover { background: linear-gradient(135deg, #FFCA2C, #F7A03A); }
.btn-sm { min-height: 44px; padding: 0 16px; font-size: .92rem; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .45; cursor: not-allowed; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; }

/* Breadcrumbs */
.crumbs { padding-top: 22px; font-size: .88rem; }
.crumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; color: var(--muted); }
.crumbs li + li::before { content: "/"; margin-right: 6px; opacity: .6; }
.crumbs a { color: var(--muted); }

/* Sections */
.section { padding: 64px 0; }
.section-alt { background: var(--surface); border-block: 1px solid var(--border); }
.section-head { max-width: 720px; margin-bottom: 32px; }
.eyebrow { text-transform: uppercase; letter-spacing: .08em; font-weight: 800; font-size: .78rem; color: var(--link); margin-bottom: 10px; display: block; }
.lead { font-size: 1.15rem; color: var(--muted); max-width: 640px; }

/* Hero */
.hero { padding: 56px 0 64px; }
.hero-grid { display: grid; grid-template-columns: 1.15fr .85fr; gap: 48px; align-items: center; }
.hero .btn-row { margin: 28px 0 14px; }
.page-hero { padding: 28px 0 8px; }
.page-hero .lead { margin-bottom: 0; }

/* Cards */
.grid { display: grid; gap: 18px; }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; }
.section-alt .card { background: var(--bg); }
.card h3 { margin-bottom: .4em; }
.card p:last-child { margin-bottom: 0; }
a.card { display: block; color: inherit; text-decoration: none; transition: border-color .15s, transform .15s; }
a.card:hover { border-color: var(--accent); transform: translateY(-2px); }
a.card h3 { color: var(--text); }
.tag { display: inline-block; font-size: .75rem; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; padding: 3px 9px; border-radius: 999px; background: var(--surface-2); color: var(--link); border: 1px solid var(--border-strong); margin-bottom: 12px; }
.ico { width: 42px; height: 42px; border-radius: 12px; background: var(--surface-2); display: inline-flex; align-items: center; justify-content: center; margin-bottom: 14px; color: var(--accent); }
.steps { counter-reset: s; list-style: none; padding: 0; margin: 0; display: grid; gap: 14px; }
.steps li { counter-increment: s; position: relative; padding-left: 52px; }
.steps li::before { content: counter(s); position: absolute; left: 0; top: 0; width: 36px; height: 36px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font-weight: 800; }

/* Extension popup preview (decorative, always dark like the real popup) */
.popup { --p-bg: #14110D; --p-surface: #1E1A14; --p-border: #2F281D; --p-text: #F5EFE3; --p-muted: #B9AE9A; --p-acc: #FBB92B;
  width: 100%; max-width: 360px; margin-inline: auto; background: var(--p-bg); color: var(--p-text); border: 1px solid #3A3226; border-radius: 20px; padding: 14px; box-shadow: var(--shadow); font-size: 14px; line-height: 1.35; }
.popup small { color: var(--p-muted); font-size: 12px; display: block; }
.pp-row { display: flex; align-items: center; gap: 10px; }
.pp-head { padding: 2px 2px 12px; }
.pp-head .grow, .pp-site .grow { flex: 1; min-width: 0; }
.pp-switch { width: 48px; height: 28px; border-radius: 14px; background: var(--p-acc); padding: 3px; display: flex; justify-content: flex-end; }
.pp-switch i { width: 22px; height: 22px; border-radius: 50%; background: #14110D; }
.pp-site { background: var(--p-surface); border: 1px solid var(--p-border); border-radius: 14px; padding: 8px 8px 8px 12px; margin-bottom: 12px; }
.pp-fav { width: 32px; height: 32px; border-radius: 8px; background: #2A241B; color: var(--p-acc); font-weight: 800; display: grid; place-items: center; }
.pp-btn { border: 1px solid #3A3226; border-radius: 10px; padding: 10px 12px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.pp-label { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--p-muted); margin: 0 2px 6px; }
.pp-modes { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-bottom: 12px; }
.pp-mode { min-width: 0; background: var(--p-surface); border: 1.5px solid var(--p-border); border-radius: 12px; padding: 7px 6px; font-size: 12px; font-weight: 700; text-align: center; }
.pp-mode.sel { background: #2A2113; border-color: var(--p-acc); }
.pp-sw { display: flex; flex-direction: column; gap: 3px; height: 30px; border-radius: 6px; padding: 6px; margin-bottom: 6px; }
.pp-sw i { display: block; height: 3px; border-radius: 2px; }
.pp-sw i:nth-child(1) { width: 55%; } .pp-sw i:nth-child(2) { width: 85%; } .pp-sw i:nth-child(3) { width: 65%; }
.pp-sliders { background: var(--p-surface); border: 1px solid var(--p-border); border-radius: 14px; padding: 10px 14px 12px; display: grid; gap: 12px; }
.pp-sliders .lab { display: flex; justify-content: space-between; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.pp-sliders .lab b { color: var(--p-acc); }
.bar { height: 6px; background: #3A3226; border-radius: 3px; position: relative; }
.bar i { position: absolute; inset: 0 auto 0 0; background: var(--p-acc); border-radius: 3px; }
.bar i::after { content: ""; position: absolute; right: -7px; top: -5px; width: 16px; height: 16px; border-radius: 50%; background: var(--p-acc); }

/* Tool panel */
.tool { background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: 24px; box-shadow: var(--shadow); margin: 24px 0 8px; }
.dropzone { border: 2px dashed var(--border-strong); border-radius: 14px; padding: 36px 20px; text-align: center; background: var(--bg); transition: border-color .15s, background .15s; }
.dropzone.is-over { border-color: var(--accent); background: var(--surface-2); }
.dropzone p { margin: 0 0 14px; color: var(--muted); }
.dropzone strong { color: var(--text); }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.controls { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 16px; margin: 20px 0; }
.field label, .field .lbl { display: block; font-weight: 700; font-size: .9rem; margin-bottom: 6px; }
.field select, .field input[type="text"], .field input[type="number"], .field textarea {
  width: 100%; min-height: 44px; padding: 8px 12px; border-radius: 10px; border: 1px solid var(--border-strong); background: var(--bg); color: var(--text); font: inherit; }
.field input[type="range"] { width: 100%; accent-color: var(--accent); min-height: 44px; }
.field input[type="color"] { width: 56px; height: 44px; padding: 2px; border-radius: 10px; border: 1px solid var(--border-strong); background: var(--bg); cursor: pointer; }
.field .hint { font-size: .82rem; color: var(--muted); margin-top: 4px; }
.status { min-height: 1.5em; margin: 12px 0 0; color: var(--muted); font-size: .95rem; }
.status.error { color: var(--bad); }
.results { list-style: none; margin: 18px 0 0; padding: 0; display: grid; gap: 10px; }
.res { display: flex; align-items: center; gap: 14px; background: var(--bg); border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; }
.res img { width: 56px; height: 56px; object-fit: cover; border-radius: 8px; background: var(--surface-2); flex: none; }
.res .meta { flex: 1; min-width: 0; }
.res .name { font-weight: 700; overflow-wrap: anywhere; }
.res .sub { color: var(--muted); font-size: .88rem; }
.res .sub .good { color: var(--ok); font-weight: 700; }
.res .ctl { display: flex; gap: 6px; flex: none; }
.res .btn { min-height: 44px; padding: 0 14px; font-size: .9rem; }
.tool-actions { margin-top: 16px; }
.note { background: var(--surface-2); border: 1px solid var(--border-strong); border-radius: 12px; padding: 12px 16px; font-size: .92rem; margin: 16px 0 0; }
.privacy-note { display: flex; gap: 10px; align-items: flex-start; color: var(--muted); font-size: .9rem; margin-top: 14px; }

/* Contrast checker */
.cc-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.cc-pair { display: flex; gap: 10px; align-items: center; }
.cc-pair input[type="text"] { flex: 1; }
.cc-ratio { font-size: 3rem; font-weight: 800; line-height: 1; letter-spacing: -0.03em; }
.cc-preview { border-radius: 14px; padding: 24px; border: 1px solid var(--border-strong); }
.cc-preview .big { font-size: 1.6rem; font-weight: 700; margin: 0 0 6px; }
table.t { width: 100%; border-collapse: collapse; margin: 14px 0; font-size: .95rem; }
table.t th, table.t td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); }
table.t th { color: var(--muted); font-weight: 700; font-size: .82rem; text-transform: uppercase; letter-spacing: .04em; }
.pass { color: var(--ok); font-weight: 800; } .fail { color: var(--bad); font-weight: 800; }
.presets { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.chip { min-height: 44px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--border-strong); background: var(--bg); color: var(--text); font: inherit; font-weight: 600; cursor: pointer; }
.chip:hover { border-color: var(--accent); }

/* Color blindness grid */
.cvd-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; margin-top: 20px; }
.cvd-grid figure { margin: 0; background: var(--bg); border: 1px solid var(--border); border-radius: 12px; padding: 12px; }
.cvd-grid canvas { width: 100%; border-radius: 8px; display: block; }
.cvd-grid figcaption { margin-top: 8px; font-weight: 700; display: flex; justify-content: space-between; gap: 8px; align-items: center; flex-wrap: wrap; }
.cvd-grid figcaption small { font-weight: 400; color: var(--muted); display: block; }

/* Timer */
.timer { text-align: center; }
.timer-ring { position: relative; width: 220px; height: 220px; margin: 8px auto 18px; }
.timer-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.timer-ring .track { stroke: var(--border-strong); } .timer-ring .prog { stroke: var(--accent); transition: stroke-dashoffset .25s linear; }
.timer-time { position: absolute; inset: 0; display: grid; place-content: center; font-size: 2.6rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.timer-time small { display: block; font-size: .85rem; font-weight: 600; color: var(--muted); text-align: center; }
.checkline { display: flex; align-items: center; gap: 10px; min-height: 44px; }
.checkline input { width: 20px; height: 20px; accent-color: var(--accent); }

/* Word counter */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 12px; margin: 16px 0; }
.stat { background: var(--bg); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; }
.stat b { display: block; font-size: 1.6rem; line-height: 1.2; font-variant-numeric: tabular-nums; }
.stat span { color: var(--muted); font-size: .85rem; }
textarea.big { min-height: 220px; resize: vertical; }

/* Articles */
.prose > * { max-width: 760px; }
.prose h2 { margin-top: 2em; } .prose h3 { margin-top: 1.5em; }
.prose ul, .prose ol { padding-left: 1.3em; } .prose li { margin-bottom: .4em; }
.meta-line { color: var(--muted); font-size: .9rem; }

/* FAQ */
.faq { max-width: 820px; }
.faq details { border: 1px solid var(--border); border-radius: 12px; background: var(--surface); margin-bottom: 10px; }
.section-alt .faq details { background: var(--bg); }
.faq summary { cursor: pointer; padding: 16px 18px; font-weight: 700; list-style: none; display: flex; justify-content: space-between; gap: 12px; align-items: center; min-height: 44px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; font-size: 1.4rem; color: var(--link); flex: none; }
.faq details[open] summary::after { content: "\2212"; }
.faq details p { padding: 0 18px 16px; margin: 0; color: var(--muted); }

/* CTA band */
.cta-band { background: linear-gradient(135deg, #2A2113, #1E1A14); border: 1px solid var(--border-strong); border-radius: 22px; padding: 40px; text-align: center; color: #F5EFE3; }
.cta-band p { color: #B9AE9A; max-width: 560px; margin-inline: auto; }
.cta-band .btn-row { justify-content: center; }

/* Footer */
.site-footer { border-top: 1px solid var(--border); margin-top: 40px; padding: 48px 0 24px; background: var(--surface); }
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr; gap: 32px; }
.footer-brand { font-weight: 800; font-size: 1.1rem; margin: 0 0 .5em; }
.footer-h { font-weight: 800; font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 0 0 .8em; }
.site-footer a { color: var(--text); text-decoration: none; } .site-footer a:hover { color: var(--link); text-decoration: underline; }
.footer-bottom { margin-top: 28px; padding-top: 18px; border-top: 1px solid var(--border); }
.footer-bottom p { margin: 0; }

@media (max-width: 900px) {
  .hero-grid, .cc-grid { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .section { padding: 48px 0; }
}
@media (max-width: 600px) {
  .grid-3, .grid-2, .footer-grid { grid-template-columns: 1fr; }
  .header-in { gap: 8px; }
  .header-in .btn-sm { padding: 0 12px; font-size: .85rem; }
  .brand { font-size: .95rem; gap: 8px; }
  .nav { order: 5; width: 100%; }
  .tool { padding: 16px; }
  .res { flex-wrap: wrap; } .res .ctl { width: 100%; }
  .cta-band { padding: 28px 18px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }
