/* ============================================================
   Clikkin v2 — Design System
   "A printed charter that happens to be a website."
   ============================================================ */

/* --- Fonts (Google Fonts) --- */
@import url('https://fonts.googleapis.com/css2?family=Source+Serif+4:opsz,wght@8..60,400;8..60,500&family=Inter:wght@400;500;600&family=IBM+Plex+Mono:wght@400;500&display=swap');

/* --- Tokens: Light mode (default) --- */
:root {
  /* Color */
  --paper: #F5F2EA;
  --paper-2: #ECE7DB;
  --ink: #1A1A1A;
  --ink-muted: #5C5750;
  --rule: #D6D0C2;
  --seal: #8E2A1F;
  --seal-ink: #FFFFFF;

  /* Typography */
  --font-serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", "SF Mono", Menlo, Consolas, monospace;

  /* Spacing */
  --s-1: 0.25rem;   /* 4 */
  --s-2: 0.5rem;    /* 8 */
  --s-3: 0.75rem;   /* 12 */
  --s-4: 1rem;      /* 16 */
  --s-5: 1.5rem;    /* 24 */
  --s-6: 2.5rem;    /* 40 */
  --s-7: 4rem;      /* 64 */
  --s-8: 6.5rem;    /* 104 */
  --s-9: 10.5rem;   /* 168 */

  /* Layout */
  --max-text: 720px;
  --max-content: 920px;
  --max-outer: 1280px;
  --side-pad: clamp(1.25rem, 4vw, 3rem);
}

/* --- Tokens: Dark mode --- */
[data-theme="dark"] {
  --paper: #15140F;
  --paper-2: #1B1E1A;
  --ink: #F0EDE2;
  --ink-muted: #8A8F84;
  --rule: #2A2D27;
  --seal: #C4452F;
  --seal-ink: #15140F;
}

/* --- Reset --- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body, h1, h2, h3, h4, h5, p, figure, blockquote, dl, dd, ul, ol { margin: 0; padding: 0; }
ul, ol { list-style: none; }
img, svg, video { max-width: 100%; display: block; }
button { font: inherit; color: inherit; background: transparent; border: 0; cursor: pointer; }
input, select, textarea { font: inherit; color: inherit; }
a { color: var(--seal); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }

/* --- Body base --- */
html { font-size: 100%; }
body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 1.0625rem;   /* 17px */
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-variant-numeric: tabular-nums;
}

/* --- Headlines --- */
h1, h2, h3, h4 {
  font-family: var(--font-serif);
  font-weight: 400;
  line-height: 1.1;
  letter-spacing: -0.018em;
  color: var(--ink);
}
h1 { font-size: clamp(2.25rem, 6vw, 4rem); line-height: 1.05; letter-spacing: -0.02em; }
h2 { font-size: clamp(1.625rem, 4vw, 2.625rem); }
h3 { font-size: clamp(1.25rem, 2.5vw, 1.5rem); letter-spacing: -0.01em; }
h4 { font-size: 1.125rem; letter-spacing: 0; }

/* --- Layout containers --- */
.wrap {
  max-width: var(--max-outer);
  margin-inline: auto;
  padding-inline: var(--side-pad);
}
.col { max-width: var(--max-text); }
.col-wide { max-width: var(--max-content); }

/* --- Civic stamp (the signature pattern) --- */
.stamp {
  display: flex;
  align-items: center;
  gap: var(--s-4);
  font-family: var(--font-mono);
  font-size: 0.6875rem;   /* 11px */
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin-bottom: var(--s-5);
}
.stamp::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--rule);
}

/* --- Section --- */
.section {
  padding-block: clamp(var(--s-7), 10vw, var(--s-9));
  border-bottom: 1px solid var(--rule);
}
.section:last-of-type { border-bottom: 0; }
.section > .wrap > * + * { margin-top: var(--s-5); }
.section .lede {
  font-size: 1.1875rem;
  line-height: 1.55;
  color: var(--ink);
  max-width: 56ch;
}
.section .lede + p, .section p + p { margin-top: var(--s-4); }

/* --- Header / nav --- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--paper) 92%, transparent);
  backdrop-filter: saturate(140%) blur(8px);
  -webkit-backdrop-filter: saturate(140%) blur(8px);
  border-bottom: 1px solid var(--rule);
}
.nav {
  display: flex;
  align-items: center;
  gap: var(--s-5);
  padding-block: var(--s-4);
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  letter-spacing: 0.04em;
}
.nav .brand {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  color: var(--ink);
}
.nav .brand:hover { text-decoration: none; }
.nav .brand img {
  height: 22px;
  width: auto;
  display: block;
}
[data-theme="dark"] .nav .brand img { filter: brightness(1.4); }
.nav .links {
  display: flex;
  gap: var(--s-5);
  flex: 1;
  flex-wrap: wrap;
}
.nav .links a {
  color: var(--ink-muted);
  text-decoration: none;
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  letter-spacing: 0;
  text-transform: none;
}
.nav .links a:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 4px; }
.nav .tools {
  display: flex;
  gap: var(--s-3);
  align-items: center;
}

/* --- Inline text link with seal underline --- */
.link {
  color: var(--seal);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}
.link:hover { text-decoration-thickness: 2px; }

/* --- Buttons (used sparingly: only the calculator) --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  padding: var(--s-3) var(--s-5);
  border: 1px solid var(--ink);
  background: transparent;
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  font-weight: 500;
  border-radius: 2px;
  cursor: pointer;
  transition: background 120ms ease, color 120ms ease;
}
.btn:hover { background: var(--ink); color: var(--paper); }
.btn-seal { border-color: var(--seal); color: var(--seal); }
.btn-seal:hover { background: var(--seal); color: var(--seal-ink); }
.btn-ghost { border-color: var(--rule); color: var(--ink-muted); }
.btn-ghost:hover { background: var(--paper-2); color: var(--ink); }

/* --- Three-column strip (trust / operator economics) --- */
.cols-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--s-6);
}
.cols-3 > div { min-width: 0; }
.cols-3 h4 {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-muted);
  margin-bottom: var(--s-3);
}
.cols-3 p {
  font-size: 1rem;
  line-height: 1.55;
}
@media (max-width: 720px) {
  .cols-3 { grid-template-columns: 1fr; gap: var(--s-5); }
}

/* --- Path selector (audience routing) --- */
.path-selector {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: var(--s-4);
  margin-top: var(--s-6);
}
.path-selector a {
  display: block;
  padding: var(--s-5);
  border: 1px solid var(--rule);
  background: var(--paper-2);
  color: var(--ink);
  text-decoration: none;
  border-radius: 2px;
  transition: border-color 120ms ease, background 120ms ease;
}
.path-selector a:hover {
  border-color: var(--ink);
  background: var(--paper);
  text-decoration: none;
}
.path-selector strong {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin-bottom: var(--s-3);
}
.path-selector span {
  display: block;
  font-family: var(--font-serif);
  font-size: 1.0625rem;
  line-height: 1.35;
  color: var(--ink);
}
@media (max-width: 720px) {
  .path-selector { grid-template-columns: 1fr; }
}

/* --- Definition-style key/value blocks (used for §5, §7, etc.) --- */
.kv {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: var(--s-5) var(--s-6);
  align-items: start;
}
.kv dt {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-muted);
  padding-top: 0.1rem;
}
.kv dd { font-size: 1rem; line-height: 1.55; margin: 0; }
@media (max-width: 720px) {
  .kv { grid-template-columns: 1fr; gap: var(--s-2) 0; }
  .kv dt { margin-top: var(--s-4); }
  .kv dt:first-child { margin-top: 0; }
}

/* --- Card catalog (used for space templates / pricing) --- */
.catalog {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: var(--s-4);
}
.catalog .card {
  border: 1px solid var(--rule);
  padding: var(--s-5);
  background: var(--paper);
  border-radius: 2px;
}
.catalog .card .no {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin-bottom: var(--s-2);
}
.catalog .card h3 {
  font-family: var(--font-serif);
  font-size: 1.375rem;
  margin-bottom: var(--s-2);
}
.catalog .card p { font-size: 0.9375rem; line-height: 1.55; color: var(--ink); }
.catalog .card .meta {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--ink-muted);
  margin-top: var(--s-3);
  letter-spacing: 0.03em;
}

/* --- Pricing table --- */
.price-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9375rem;
}
.price-table th, .price-table td {
  padding: var(--s-3) var(--s-4);
  text-align: left;
  border-bottom: 1px solid var(--rule);
  vertical-align: top;
}
.price-table th {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-muted);
}
.price-table td.num { font-family: var(--font-mono); white-space: nowrap; }
.price-table tr:last-child th, .price-table tr:last-child td { border-bottom: 0; }

/* --- Footer --- */
.site-footer {
  border-top: 1px solid var(--rule);
  padding-block: var(--s-7);
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  letter-spacing: 0.02em;
  color: var(--ink-muted);
}
.site-footer .row { display: flex; flex-wrap: wrap; gap: var(--s-5); justify-content: space-between; }
.site-footer a { color: var(--ink-muted); text-decoration: none; }
.site-footer a:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
.site-footer .addr { font-family: var(--font-sans); font-size: 0.875rem; line-height: 1.55; }

/* --- Calculator (forms, button grids, output) --- */
.calc {
  border: 1px solid var(--rule);
  padding: var(--s-6);
  background: var(--paper-2);
  border-radius: 2px;
}
.calc-step { display: none; }
.calc-step.active { display: block; }
.calc-step .question {
  font-family: var(--font-serif);
  font-size: 1.375rem;
  line-height: 1.3;
  margin-bottom: var(--s-5);
}
.calc-step .hint {
  font-size: 0.875rem;
  color: var(--ink-muted);
  margin-top: -0.5rem;
  margin-bottom: var(--s-4);
}

.btn-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--s-3);
}
.btn-grid button {
  padding: var(--s-4) var(--s-4);
  border: 1px solid var(--rule);
  background: var(--paper);
  text-align: left;
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  color: var(--ink);
  cursor: pointer;
  border-radius: 2px;
  transition: border-color 120ms ease, background 120ms ease;
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  min-height: 64px;
  justify-content: center;
}
.btn-grid button:hover {
  border-color: var(--ink);
  background: var(--paper);
}
.btn-grid button.selected {
  border-color: var(--seal);
  background: color-mix(in srgb, var(--seal) 6%, var(--paper));
  outline: none;
}
.btn-grid button .icon {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-muted);
}
.btn-grid button .label {
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  color: var(--ink);
}

.calc-progress {
  display: flex;
  gap: var(--s-2);
  margin-bottom: var(--s-5);
}
.calc-progress span {
  flex: 1;
  height: 2px;
  background: var(--rule);
}
.calc-progress span.done { background: var(--seal); }
.calc-progress span.current { background: var(--ink); }

.calc-nav {
  display: flex;
  justify-content: space-between;
  margin-top: var(--s-5);
  gap: var(--s-3);
}

.slider-wrap {
  margin-block: var(--s-5);
}
.slider-wrap input[type="range"] {
  width: 100%;
  accent-color: var(--seal);
}
.slider-wrap .slider-value {
  font-family: var(--font-mono);
  font-size: 1.5rem;
  color: var(--ink);
  text-align: center;
  margin-top: var(--s-3);
  letter-spacing: 0.02em;
}

.calc-output {
  background: var(--paper);
  border: 1px solid var(--ink);
  padding: var(--s-6);
  border-radius: 2px;
}
.calc-output .stamp { margin-bottom: var(--s-4); }
.calc-output h3 {
  font-family: var(--font-serif);
  font-size: 1.375rem;
  margin-bottom: var(--s-5);
}
.calc-output .rows { display: grid; grid-template-columns: 1fr auto; gap: var(--s-2) var(--s-5); font-family: var(--font-mono); font-size: 0.9375rem; }
.calc-output .rows .label { color: var(--ink-muted); }
.calc-output .rows .value { text-align: right; color: var(--ink); white-space: nowrap; }
.calc-output .total {
  margin-top: var(--s-5);
  padding-top: var(--s-4);
  border-top: 1px solid var(--ink);
  font-family: var(--font-mono);
  font-size: 1.125rem;
  display: flex;
  justify-content: space-between;
  color: var(--ink);
  font-weight: 500;
}
.calc-output .compare {
  margin-top: var(--s-5);
  padding: var(--s-4);
  background: var(--paper-2);
  border-radius: 2px;
  font-size: 0.875rem;
  color: var(--ink-muted);
  line-height: 1.55;
}
.calc-output .seal-num { color: var(--seal); font-weight: 500; }
.calc-output details { margin-top: var(--s-5); font-size: 0.875rem; }
.calc-output summary { cursor: pointer; color: var(--seal); font-family: var(--font-mono); font-size: 0.75rem; letter-spacing: 0.06em; text-transform: uppercase; }
.calc-output summary:hover { text-decoration: underline; }
.calc-output details > div { margin-top: var(--s-3); color: var(--ink); line-height: 1.55; }

/* --- Banner (translation in progress, etc.) --- */
.banner {
  background: var(--paper-2);
  border-bottom: 1px solid var(--rule);
  padding: var(--s-3) var(--side-pad);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  color: var(--ink-muted);
  text-align: center;
}

/* --- Lang / region switcher (small selects in nav) --- */
.lang-switch, .region-switch {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  color: var(--ink-muted);
  background: transparent;
  border: 1px solid var(--rule);
  padding: var(--s-1) var(--s-3);
  border-radius: 2px;
  cursor: pointer;
}
.lang-switch:hover, .region-switch:hover { border-color: var(--ink); color: var(--ink); }

/* --- Hero tier-price block --- */
.tier-prices {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--s-5);
  margin-top: var(--s-6);
  padding-top: var(--s-5);
  border-top: 1px solid var(--rule);
}
.tier-prices > div .label {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin-bottom: var(--s-2);
}
.tier-prices > div .price {
  font-family: var(--font-serif);
  font-size: 2rem;
  line-height: 1;
  color: var(--ink);
  letter-spacing: -0.01em;
}
.tier-prices > div .unit {
  font-family: var(--font-sans);
  font-size: 0.875rem;
  color: var(--ink-muted);
  margin-top: var(--s-2);
}
.region-hint {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin-top: var(--s-3);
}
.region-hint a { color: var(--seal); }

/* --- Theme toggle (small button) --- */
.theme-toggle {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  color: var(--ink-muted);
  background: transparent;
  border: 1px solid var(--rule);
  padding: var(--s-1) var(--s-3);
  border-radius: 2px;
  cursor: pointer;
  text-transform: uppercase;
}
.theme-toggle:hover { border-color: var(--ink); color: var(--ink); }

/* --- Hero typography rhythm --- */
.hero { padding-block: clamp(var(--s-8), 12vw, var(--s-9)); }
.hero h1 { max-width: 22ch; }
.hero .lede { margin-top: var(--s-5); max-width: 50ch; font-family: var(--font-sans); font-size: 1.1875rem; line-height: 1.55; color: var(--ink); }
.hero .meta { margin-top: var(--s-6); font-family: var(--font-mono); font-size: 0.8125rem; letter-spacing: 0.04em; color: var(--ink-muted); }
.hero .meta a { color: var(--seal); }

/* --- Definition pair: term and inline value, used for trust commitments etc. --- */
.commit { display: grid; grid-template-columns: 220px 1fr; gap: var(--s-4) var(--s-6); }
.commit dt { font-family: var(--font-mono); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-muted); padding-top: 0.15rem; }
.commit dd { margin: 0; font-size: 0.9375rem; line-height: 1.55; }
@media (max-width: 720px) { .commit { grid-template-columns: 1fr; gap: var(--s-2); } .commit dt { margin-top: var(--s-3); } .commit dt:first-child { margin-top: 0; } }

/* --- Misc utilities --- */
.muted { color: var(--ink-muted); }
.serif { font-family: var(--font-serif); }
.mono { font-family: var(--font-mono); font-size: 0.8125rem; letter-spacing: 0.04em; }
.small { font-size: 0.875rem; }
.center { text-align: center; }
.hidden { display: none !important; }

/* --- Reduced motion --- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001s !important; transition-duration: 0.001s !important; }
}

/* --- Print --- */
@media print {
  .site-header, .site-footer, .nav .tools { display: none; }
  body { background: white; color: black; }
  a { color: black; text-decoration: none; }
}
