/* Kleio public site.
 *
 * Design tokens transcribed from docs/design-system.md, which is itself a
 * transcription of the design artifact. If this file and the artifact
 * disagree, the artifact wins. Component CSS (.wordmark, .tagline,
 * .btn-primary, .field) was read from the artifact directly rather than
 * reinvented, so the site and the app share one visual language.
 */

/* --- tokens: light is the base -------------------------------------- */

:root {
  --ink: #1b241f;
  --ink-soft: #37423b;
  --parchment: #eee7d8;
  --parchment-raised: #f8f3e7;
  --parchment-sunken: #e2d9c4;
  --bronze: #a3611f;
  --bronze-strong: #8a4f18;
  --verdigris: #3f6d5c;
  --verdigris-soft: #dce8e1;
  --rule: #c7bb9d;
  --rule-soft: #d9d0b8;
  --danger: #9c3b2e;
  --danger-soft: #f3e0da;

  --shadow: 0 1px 2px rgba(27, 36, 31, 0.08), 0 8px 24px rgba(27, 36, 31, 0.10);
  --shadow-lift: 0 2px 6px rgba(27, 36, 31, 0.10), 0 16px 40px rgba(27, 36, 31, 0.16);

  --measure: 68ch;
  color-scheme: light dark;
}

/* Dark under the system preference, unless the page explicitly asks for
 * light. Same guarded structure the artifact uses. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ink: #ece5d3;
    --ink-soft: #c9c0a6;
    --parchment: #171d17;
    --parchment-raised: #1f261e;
    --parchment-sunken: #10140f;
    --bronze: #d6934f;
    --bronze-strong: #e8ab6c;
    --verdigris: #7fb39d;
    --verdigris-soft: #1c2b25;
    --rule: #3a4238;
    --rule-soft: #2a312a;
    --danger: #e08469;
    --danger-soft: #3a221d;

    --shadow: 0 1px 2px rgba(0, 0, 0, 0.35), 0 8px 24px rgba(0, 0, 0, 0.4);
    --shadow-lift: 0 2px 6px rgba(0, 0, 0, 0.4), 0 16px 40px rgba(0, 0, 0, 0.5);
  }
}

/* And again for an explicit toggle, so it wins in both directions. */
:root[data-theme="dark"] {
  --ink: #ece5d3;
  --ink-soft: #c9c0a6;
  --parchment: #171d17;
  --parchment-raised: #1f261e;
  --parchment-sunken: #10140f;
  --bronze: #d6934f;
  --bronze-strong: #e8ab6c;
  --verdigris: #7fb39d;
  --verdigris-soft: #1c2b25;
  --rule: #3a4238;
  --rule-soft: #2a312a;
  --danger: #e08469;
  --danger-soft: #3a221d;

  --shadow: 0 1px 2px rgba(0, 0, 0, 0.35), 0 8px 24px rgba(0, 0, 0, 0.4);
  --shadow-lift: 0 2px 6px rgba(0, 0, 0, 0.4), 0 16px 40px rgba(0, 0, 0, 0.5);
}

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

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--parchment);
  color: var(--ink);
  font-family: "Source Sans 3", "Source Sans Pro", system-ui, -apple-system,
               "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

img, svg { max-width: 100%; }

/* The artifact's single focus treatment, applied to everything. */
:focus-visible {
  outline: 2px solid var(--verdigris);
  outline-offset: 2px;
  border-radius: 2px;
}

/* --- type ------------------------------------------------------------ */

h1, h2, h3 {
  font-family: "Fraunces", Georgia, "Times New Roman", serif;
  font-variation-settings: "SOFT" 20, "opsz" 40;
  letter-spacing: -0.01em;
  line-height: 1.2;
  color: var(--ink);
}

h1 { font-size: clamp(28px, 4.5vw, 40px); margin: 0 0 0.4em; }
h2 { font-size: clamp(21px, 2.6vw, 27px); margin: 2em 0 0.5em; }
h3 { font-size: 18px; margin: 1.6em 0 0.4em; }

p, li { color: var(--ink-soft); }

a {
  color: var(--verdigris);
  text-underline-offset: 2px;
}
a:hover { color: var(--bronze); }

code, .mono {
  font-family: "Spline Sans Mono", ui-monospace, SFMono-Regular, Menlo,
               monospace;
  font-variant-numeric: tabular-nums;
}

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

.wrap {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 0 20px;
}

.site-header {
  border-bottom: 1px solid var(--rule-soft);
  background: var(--parchment-raised);
}

.site-header .wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 64px;
}

.site-header .seal-sm { width: 30px; height: 30px; flex: none; }

.site-header .name {
  font-family: "Cinzel", Georgia, serif;
  font-size: 19px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink);
  text-decoration: none;
}

.site-header nav {
  margin-left: auto;
  display: flex;
  gap: 18px;
  font-size: 14px;
}

.site-footer {
  margin-top: 72px;
  border-top: 1px solid var(--rule-soft);
  padding: 28px 0 48px;
  font-size: 14px;
  color: var(--ink-soft);
}

.site-footer .wrap { display: flex; flex-wrap: wrap; gap: 8px 20px; }
.site-footer .spacer { margin-left: auto; }

main { padding: 8px 0 0; }

/* --- hero (landing only) --------------------------------------------- */

.hero {
  text-align: center;
  padding: 64px 0 28px;
}

.hero .seal { width: 132px; height: 132px; }

.wordmark {
  margin-top: 22px;
  font-family: "Cinzel", Georgia, serif;
  font-size: clamp(38px, 6.4vw, 58px);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink);
}

.wordmark .k-flourish { color: var(--bronze); }

.tagline {
  font-family: "Cinzel", Georgia, serif;
  font-size: 12.5px;
  font-weight: 500;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--verdigris);
  margin-top: 14px;
}

.lede {
  max-width: 52ch;
  margin: 28px auto 0;
  font-size: 17px;
}

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

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin: 44px 0 0;
}

.card {
  background: var(--parchment-raised);
  border: 1px solid var(--rule);
  border-radius: 12px;
  padding: 20px;
  box-shadow: var(--shadow);
}

.card h3 { margin-top: 0; }
.card p:last-child { margin-bottom: 0; }

.label {
  font-family: "Spline Sans Mono", ui-monospace, monospace;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

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

.btn-primary {
  display: inline-block;
  width: 100%;
  height: 46px;
  line-height: 46px;
  padding: 0 20px;
  border-radius: 9px;
  border: none;
  background: var(--bronze);
  color: var(--parchment-raised);
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.01em;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: background .15s ease, transform .1s ease;
  box-shadow: var(--shadow);
}

.btn-primary:hover { background: var(--bronze-strong); color: var(--parchment-raised); }
.btn-primary:active { transform: translateY(1px); }
.btn-primary[disabled] { opacity: .6; cursor: not-allowed; transform: none; }

.field { margin-bottom: 16px; }

.field label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: var(--ink-soft);
  margin-bottom: 6px;
}

/* The "optional" chip sits inside its label, so it needs its own gap —
 * inline elements do not inherit one from the block. */
.field label .label { margin-left: 6px; opacity: 0.75; }

.field input,
.field textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  background: var(--parchment-raised);
  border: 1px solid var(--rule);
  border-radius: 8px;
  color: var(--ink);
  font-family: inherit;
  font-size: 15px;
}

.field textarea { resize: vertical; }

.field input:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--verdigris);
  box-shadow: 0 0 0 3px var(--verdigris-soft);
}

.field .hint {
  margin: 6px 0 0;
  font-size: 13px;
  color: var(--ink-soft);
}

/* --- notices --------------------------------------------------------- */

.notice {
  border: 1px solid var(--rule);
  border-left: 3px solid var(--bronze);
  background: var(--parchment-raised);
  border-radius: 8px;
  padding: 14px 16px;
  margin: 20px 0;
}

.notice.warn { border-left-color: var(--danger); background: var(--danger-soft); }
.notice.ok   { border-left-color: var(--verdigris); background: var(--verdigris-soft); }
.notice p:first-child { margin-top: 0; }
.notice p:last-child  { margin-bottom: 0; }

/* --- generated policy pages ------------------------------------------ */

.prose { padding-top: 20px; }
.prose table {
  width: 100%;
  border-collapse: collapse;
  margin: 18px 0;
  font-size: 15px;
}
.prose th, .prose td {
  border: 1px solid var(--rule);
  padding: 8px 10px;
  text-align: left;
  vertical-align: top;
}
.prose th { background: var(--parchment-sunken); color: var(--ink); }
.prose blockquote {
  margin: 18px 0;
  padding-left: 16px;
  border-left: 3px solid var(--rule);
  color: var(--ink-soft);
}
.prose hr { border: none; border-top: 1px solid var(--rule-soft); margin: 32px 0; }

/* Wide content scrolls inside its own box; the page body never does. */
.scroll-x { overflow-x: auto; }

.lang-switch {
  display: flex;
  gap: 8px;
  align-items: center;
  margin: 0 0 8px;
  font-size: 14px;
}

.generated-note {
  font-size: 13px;
  color: var(--ink-soft);
  border-top: 1px solid var(--rule-soft);
  margin-top: 40px;
  padding-top: 14px;
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
