/* ==========================================================================
   Nemodits — design system
   Light-first, one indigo accent, generous whitespace.
   Tokens live in :root; the dark set is applied by media query and by an
   explicit [data-theme] set from the header toggle.
   ========================================================================== */

:root {
  --bg: #ffffff;
  --surface: #f7f8fb;
  --surface-2: #eef1f7;
  --text: #12141a;
  --text-muted: #585f6e;
  --border: #e2e6ee;
  --accent: #4338ca;
  --accent-hover: #3730a3;
  --accent-soft: #eef0fe;
  --accent-text: #ffffff;
  --success: #0f766e;
  --success-soft: #e7f5f2;
  --danger: #b42318;
  --danger-soft: #fdecea;

  --radius: 14px;
  --radius-sm: 9px;
  --radius-pill: 999px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 8px 24px -12px rgba(16, 24, 40, .18);
  --shadow-lg: 0 2px 4px rgba(16, 24, 40, .05), 0 18px 44px -16px rgba(16, 24, 40, .26);

  --maxw: 1120px;
  --maxw-prose: 46rem;
  --gutter: 1.25rem;

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

[data-theme="dark"] {
  --bg: #0c0e14;
  --surface: #12151d;
  --surface-2: #1a1f2b;
  --text: #f2f4f9;
  --text-muted: #a2abbd;
  --border: #242a38;
  --accent: #8b8cf9;
  --accent-hover: #a5a6ff;
  --accent-soft: #1b1d33;
  --accent-text: #0c0e14;
  --success: #5eead4;
  --success-soft: #10231f;
  --danger: #fca5a5;
  --danger-soft: #2a1516;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px -12px rgba(0, 0, 0, .6);
  --shadow-lg: 0 2px 6px rgba(0, 0, 0, .45), 0 18px 44px -16px rgba(0, 0, 0, .7);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --bg: #0c0e14;
    --surface: #12151d;
    --surface-2: #1a1f2b;
    --text: #f2f4f9;
    --text-muted: #a2abbd;
    --border: #242a38;
    --accent: #8b8cf9;
    --accent-hover: #a5a6ff;
    --accent-soft: #1b1d33;
    --accent-text: #0c0e14;
    --success: #5eead4;
    --success-soft: #10231f;
    --danger: #fca5a5;
    --danger-soft: #2a1516;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px -12px rgba(0, 0, 0, .6);
    --shadow-lg: 0 2px 6px rgba(0, 0, 0, .45), 0 18px 44px -16px rgba(0, 0, 0, .7);
  }
}

/* --------------------------------------------------------------- reset -- */

*, *::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-family: var(--font);
  font-size: 1rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

img, svg { max-width: 100%; height: auto; display: block; }

h1, h2, h3, h4 {
  margin: 0 0 .6em;
  line-height: 1.18;
  letter-spacing: -.02em;
  font-weight: 680;
  text-wrap: balance;
}

h1 { font-size: clamp(2.1rem, 1.4rem + 2.8vw, 3.4rem); }
h2 { font-size: clamp(1.6rem, 1.2rem + 1.6vw, 2.25rem); }
h3 { font-size: 1.2rem; }

p { margin: 0 0 1.1em; }

a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--accent-hover); }

ul, ol { margin: 0 0 1.1em; padding-left: 1.3em; }
li { margin-bottom: .45em; }

hr { border: 0; border-top: 1px solid var(--border); margin: 2.5rem 0; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
  }
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  background: var(--accent);
  color: var(--accent-text);
  padding: .7rem 1.1rem;
  border-radius: 0 0 var(--radius-sm) 0;
  font-weight: 600;
}
.skip-link:focus {
  left: 0;
  color: var(--accent-text);
}

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

/* -------------------------------------------------------------- layout -- */

.container {
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.section { padding-block: clamp(3rem, 1.5rem + 6vw, 5.5rem); }
.section--tight { padding-block: clamp(2rem, 1rem + 4vw, 3.5rem); }
.section--surface { background: var(--surface); }
.section--bordered { border-top: 1px solid var(--border); }

main { flex: 1 0 auto; }

.grid { display: grid; gap: 1.25rem; }
@media (min-width: 48rem) {
  .grid--2 { grid-template-columns: repeat(2, 1fr); }
  .grid--3 { grid-template-columns: repeat(3, 1fr); }
  .grid--4 { grid-template-columns: repeat(4, 1fr); }
}

.stack > * + * { margin-top: 1rem; }

.section-head { max-width: 44rem; margin-bottom: 2.25rem; }
.section-head--center { margin-inline: auto; text-align: center; }

.eyebrow {
  display: inline-block;
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: .7rem;
}

.lead {
  font-size: clamp(1.05rem, 1rem + .4vw, 1.22rem);
  color: var(--text-muted);
  max-width: 42rem;
}

.muted { color: var(--text-muted); }
.small { font-size: .89rem; }
.center { text-align: center; }

/* ------------------------------------------------------------- buttons -- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  padding: .72rem 1.35rem;
  border-radius: var(--radius-pill);
  border: 1px solid transparent;
  font: inherit;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  transition: background-color .15s ease, border-color .15s ease, color .15s ease, transform .15s ease;
}
.btn:active { transform: translateY(1px); }

.btn--primary {
  background: var(--accent);
  color: var(--accent-text);
}
.btn--primary:hover { background: var(--accent-hover); color: var(--accent-text); }

.btn--ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--border);
}
.btn--ghost:hover { background: var(--surface-2); color: var(--text); }

.btn--block { width: 100%; }
.btn--sm { padding: .45rem .9rem; font-size: .9rem; }

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
  margin-bottom: 1.25rem;
}

/* --------------------------------------------------------------- cards -- */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.6rem;
}
.card--plain { background: var(--bg); }
.card h3 { margin-bottom: .5rem; }
.card p:last-child, .card ul:last-child { margin-bottom: 0; }

a.card {
  color: inherit;
  text-decoration: none;
  display: block;
  transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}
a.card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow);
  transform: translateY(-2px);
  color: inherit;
}

.card__icon {
  width: 2.6rem;
  height: 2.6rem;
  display: grid;
  place-items: center;
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
  margin-bottom: 1rem;
}

.badge {
  display: inline-block;
  padding: .25rem .7rem;
  border-radius: var(--radius-pill);
  background: var(--accent-soft);
  color: var(--accent);
  font-size: .78rem;
  font-weight: 650;
}
.badge--ok { background: var(--success-soft); color: var(--success); }
.badge--no { background: var(--danger-soft); color: var(--danger); }

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

.hero {
  padding-block: clamp(3rem, 1.5rem + 7vw, 6rem);
  background:
    radial-gradient(60rem 30rem at 15% -10%, var(--accent-soft), transparent 60%),
    var(--bg);
}
.hero__inner { max-width: 44rem; }
.container.hero__inner { max-width: var(--maxw); }
.container.hero__inner > * { max-width: 44rem; }
.hero h1 { margin-bottom: .5em; }
.hero .lead { margin-bottom: 1.9rem; }

.trust-line {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem .9rem;
  color: var(--text-muted);
  font-size: .9rem;
  list-style: none;
  padding: 0;
  margin: 0;
}
.trust-line li { margin: 0; }
/* Trailing rather than leading, so a wrapped line never starts with a stray dot. */
.trust-line li:not(:last-child)::after {
  content: "·";
  margin-left: .9rem;
  color: var(--border);
}

/* --------------------------------------------------------------- steps -- */

.steps {
  counter-reset: step;
  list-style: none;
  padding: 0;
  display: grid;
  gap: 1.25rem;
}
@media (min-width: 48rem) {
  .steps--3 { grid-template-columns: repeat(3, 1fr); }
}
.steps > li {
  counter-increment: step;
  margin: 0;
  padding-top: 3.4rem;
  position: relative;
}
.steps > li::before {
  content: counter(step);
  position: absolute;
  top: 0;
  left: 0;
  width: 2.5rem;
  height: 2.5rem;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-text);
  font-weight: 700;
}
.steps h3 { margin-bottom: .35rem; }
.steps p { margin-bottom: 0; color: var(--text-muted); }

/* --------------------------------------------------------------- stats -- */

.stats {
  display: grid;
  gap: 1.5rem;
  grid-template-columns: repeat(2, 1fr);
  text-align: center;
}
@media (min-width: 48rem) {
  .stats { grid-template-columns: repeat(4, 1fr); }
}
.stats__value {
  display: block;
  font-size: clamp(1.7rem, 1.2rem + 1.6vw, 2.3rem);
  font-weight: 700;
  letter-spacing: -.02em;
  color: var(--accent);
}
.stats__label { color: var(--text-muted); font-size: .92rem; }

/* --------------------------------------------------------------- prose -- */

.prose { max-width: var(--maxw-prose); }

/* When the reading column shares an element with .container, keep the container
   width and narrow the children instead — otherwise the text block centres itself
   and stops lining up with the page head above it. */
.container.prose { max-width: var(--maxw); }
.container.prose > * { max-width: var(--maxw-prose); }

.measure { max-width: var(--maxw-prose); }
.measure--wide { max-width: 50rem; }
.measure--narrow { max-width: 36rem; }

.prose h2 { margin-top: 2.6rem; }
.prose h3 { margin-top: 1.8rem; }
.prose > :first-child { margin-top: 0; }
.prose table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1.4rem;
  font-size: .95rem;
}
.prose th, .prose td {
  text-align: left;
  padding: .7rem .8rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.prose th { font-weight: 650; background: var(--surface); }
.table-wrap { overflow-x: auto; }

.page-head {
  padding-block: clamp(2.5rem, 1.5rem + 4vw, 4rem) 1.5rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.page-head .lead { margin-bottom: 0; }

.updated {
  font-size: .88rem;
  color: var(--text-muted);
  margin-top: .8rem;
}

.toc {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.2rem 1.4rem;
  margin-bottom: 2.5rem;
}
.toc h2 { font-size: 1rem; margin: 0 0 .6rem; }
.toc ol { margin: 0; padding-left: 1.1rem; font-size: .95rem; }
.toc li { margin-bottom: .25rem; }

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

.faq-item {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  padding: 0 1.1rem;
  margin-bottom: .7rem;
}
.faq-item summary {
  cursor: pointer;
  padding: 1rem 0;
  font-weight: 600;
  list-style: none;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
  content: "+";
  color: var(--accent);
  font-size: 1.3rem;
  line-height: 1;
  flex: none;
}
.faq-item[open] summary::after { content: "–"; }
.faq-item > div { padding-bottom: 1rem; color: var(--text-muted); }
.faq-item > div > :last-child { margin-bottom: 0; }

/* --------------------------------------------------------------- forms -- */

.auth-wrap {
  display: flex;
  justify-content: center;
  padding-block: clamp(2.5rem, 1.5rem + 4vw, 4.5rem);
}
.auth-card {
  width: 100%;
  max-width: 27rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: clamp(1.5rem, 1rem + 2vw, 2.25rem);
  box-shadow: var(--shadow);
}
.auth-card h1 { font-size: 1.75rem; margin-bottom: .35em; }

.field { margin-bottom: 1.1rem; }
.field label {
  display: block;
  font-weight: 600;
  font-size: .93rem;
  margin-bottom: .4rem;
}
.field select,
.field textarea,
.field input[type="text"],
.field input[type="email"],
.field input[type="password"] {
  width: 100%;
  padding: .7rem .85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  font: inherit;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--accent);
  outline: none;
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.field input[aria-invalid="true"],
.field select[aria-invalid="true"],
.field textarea[aria-invalid="true"] { border-color: var(--danger); }
.field textarea { resize: vertical; min-height: 7rem; }

.choice-group { border: 0; padding: 0; margin: 0 0 1.1rem; }
.choice-group legend {
  font-weight: 600;
  font-size: .93rem;
  margin-bottom: .5rem;
  padding: 0;
}
.choice-group .field--check { margin-bottom: .45rem; }

.progress {
  height: .45rem;
  border-radius: var(--radius-pill);
  background: var(--surface-2);
  overflow: hidden;
  margin: .35rem 0 1.4rem;
}
.progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width .25s ease;
}
.field__hint { font-size: .85rem; color: var(--text-muted); margin-top: .35rem; }
.field__error { font-size: .87rem; color: var(--danger); margin-top: .35rem; font-weight: 500; }

.field--check {
  display: flex;
  gap: .65rem;
  align-items: flex-start;
  font-size: .92rem;
}
.field--check input { margin-top: .3rem; flex: none; }
.field--check label { font-weight: 400; margin: 0; }

.honeypot {
  position: absolute !important;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.alert {
  border-radius: var(--radius-sm);
  padding: .85rem 1rem;
  margin-bottom: 1.25rem;
  font-size: .94rem;
  border: 1px solid transparent;
}
.alert--error { background: var(--danger-soft); border-color: var(--danger); color: var(--text); }
.alert--info { background: var(--success-soft); border-color: var(--success); color: var(--text); }
.alert p:last-child { margin-bottom: 0; }

.form-foot {
  margin-top: 1.4rem;
  padding-top: 1.2rem;
  border-top: 1px solid var(--border);
  font-size: .92rem;
  color: var(--text-muted);
}
.form-foot p:last-child { margin-bottom: 0; }

/* -------------------------------------------------------------- header -- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid var(--border);
}
.site-header__inner {
  display: flex;
  align-items: center;
  gap: 1rem;
  min-height: 4.25rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  font-weight: 720;
  font-size: 1.12rem;
  letter-spacing: -.02em;
  color: var(--text);
  text-decoration: none;
  flex: none;
}
.brand:hover { color: var(--text); }
.brand__mark {
  width: 1.9rem;
  height: 1.9rem;
  border-radius: 8px;
  background: var(--accent);
  color: var(--accent-text);
  display: grid;
  place-items: center;
  font-size: .95rem;
  font-weight: 700;
}

.nav { margin-left: auto; }
.nav ul {
  display: flex;
  align-items: center;
  gap: .35rem;
  list-style: none;
  margin: 0;
  padding: 0;
}
.nav li { margin: 0; }
.nav a {
  display: block;
  padding: .5rem .75rem;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  text-decoration: none;
  font-size: .95rem;
  font-weight: 550;
}
.nav a:hover { background: var(--surface-2); color: var(--text); }
.nav a[aria-current="page"] { color: var(--accent); background: var(--accent-soft); }

.header-actions {
  display: flex;
  align-items: center;
  gap: .5rem;
  flex: none;
}

.icon-btn {
  width: 2.35rem;
  height: 2.35rem;
  display: grid;
  place-items: center;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  cursor: pointer;
  padding: 0;
}
.icon-btn:hover { background: var(--surface-2); }
.icon-btn svg { width: 1.1rem; height: 1.1rem; }
.theme-toggle .icon-moon { display: none; }
[data-theme="dark"] .theme-toggle .icon-sun { display: none; }
[data-theme="dark"] .theme-toggle .icon-moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) .theme-toggle .icon-sun { display: none; }
  :root:not([data-theme]) .theme-toggle .icon-moon { display: block; }
}

.nav-toggle { display: none; }

@media (max-width: 61.99rem) {
  .nav-toggle { display: grid; }
  .nav {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    padding: .6rem var(--gutter) 1rem;
    display: none;
    box-shadow: var(--shadow);
  }
  .nav[data-open="true"] { display: block; }
  .nav ul { flex-direction: column; align-items: stretch; gap: .1rem; }
  .nav a { padding: .7rem .75rem; }
  .header-actions .btn--ghost { display: none; }
}

/* -------------------------------------------------------------- footer -- */

.site-footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding-block: 3rem 1.75rem;
  margin-top: auto;
  font-size: .94rem;
}
.footer-grid {
  display: grid;
  gap: 2rem;
  grid-template-columns: 1fr;
  margin-bottom: 2.5rem;
}
@media (min-width: 40rem) {
  .footer-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 62rem) {
  .footer-grid { grid-template-columns: 1.4fr repeat(3, 1fr); }
}
.footer-col h2 {
  font-size: .8rem;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: .9rem;
}
.footer-col ul { list-style: none; margin: 0; padding: 0; }
.footer-col li { margin-bottom: .5rem; }
.footer-col a, .link-btn {
  color: var(--text-muted);
  text-decoration: none;
}
.footer-col a:hover, .link-btn:hover { color: var(--accent); text-decoration: underline; }
.link-btn {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  cursor: pointer;
  text-align: left;
}

.footer-about p { color: var(--text-muted); max-width: 26rem; }
.social {
  display: flex;
  gap: .6rem;
  list-style: none;
  padding: 0;
  margin: 1rem 0 0;
  flex-wrap: wrap;
}
.social li { margin: 0; }
.social a {
  display: inline-block;
  padding: .3rem .7rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  font-size: .85rem;
}

.footer-bottom {
  border-top: 1px solid var(--border);
  padding-top: 1.5rem;
  color: var(--text-muted);
  font-size: .87rem;
  display: grid;
  gap: .4rem;
}

/* ------------------------------------------------------- cookie banner -- */

.cookie-banner {
  position: fixed;
  inset-inline: 0;
  bottom: 0;
  z-index: 60;
  background: var(--bg);
  border-top: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  padding: 1.15rem 0;
}
.cookie-banner[hidden] { display: none; }
.cookie-banner__inner {
  display: grid;
  gap: 1rem;
  align-items: center;
}
@media (min-width: 56rem) {
  .cookie-banner__inner { grid-template-columns: 1fr auto; }
}
.cookie-banner p { margin: 0; font-size: .93rem; color: var(--text-muted); max-width: 52rem; }
.cookie-banner h2 { font-size: 1rem; margin-bottom: .3rem; }
.cookie-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .55rem;
}

.cookie-prefs {
  border: 0;
  padding: 0;
  margin: 0;
  max-width: 34rem;
  width: 100%;
}
.cookie-prefs[hidden] { display: none; }
.cookie-prefs .field--check {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: .8rem 1rem;
  margin-bottom: .6rem;
  background: var(--surface);
}

/* ---------------------------------------------------------------- blog -- */

.post-meta {
  color: var(--text-muted);
  font-size: .88rem;
  display: flex;
  flex-wrap: wrap;
  gap: .4rem .9rem;
  list-style: none;
  padding: 0;
  margin: 0 0 1.5rem;
}
.post-meta li { margin: 0; }

.post-card h3 { font-size: 1.12rem; }
.post-card p { color: var(--text-muted); font-size: .95rem; }
.post-card__more { color: var(--accent); font-weight: 600; font-size: .93rem; }
