/* Kanavoi public site. Design: docs/suunnitelma.md section 16 and
   docs/mockups/luo-linkki.html. Three text sizes only (17/22/30 px), one
   flat accent colour, light and dark themes. */

@font-face {
  font-family: "Familjen Grotesk";
  src: url("/static/fonts/FamiljenGrotesk-400-700-latin.woff2") format("woff2");
  font-weight: 400 700;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("/static/fonts/IBMPlexMono-400-latin.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("/static/fonts/IBMPlexMono-500-latin.woff2") format("woff2");
  font-weight: 500;
  font-display: swap;
}

/* ---------- Tokens ---------- */
:root {
  --bg: #F6F5F2;
  --surface: #FFFFFF;
  --surface-2: #F1EFEB;
  --border: #E2DFD9;
  --border-strong: #CBC7BF;
  --text: #1B1A18;
  --muted: #4F4B45;          /* brand book: 4.5:1 or more on --bg */
  --accent: #D03A1F;
  --accent-hover: #B5301A;
  --accent-text: #A62D16;
  --accent-soft: #FBE7E1;
  --on-accent: #FFFFFF;
  --ok: #1E7A46;
  --ok-soft: #E4F3EA;
  --warn: #8A5A00;
  --warn-soft: #FCF1D8;

  --font: "Familjen Grotesk", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  --fs: 17px;
  --fs-lg: 22px;
  --fs-xl: 30px;
  --radius: 12px;
  --radius-sm: 8px;
  --tracking-display: -0.025em; /* headlines, as in the wordmark */
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #141312; --surface: #1C1B19; --surface-2: #242320;
    --border: #302E2A; --border-strong: #45423D;
    --text: #EDEAE5; --muted: #A8A39B;
    --accent: #FF6B4A; --accent-hover: #FF8466; --accent-text: #FF8F75;
    --accent-soft: #3A1F18; --on-accent: #1A0D09;
    --ok: #62CF8F; --ok-soft: #15301F; --warn: #F2B84B; --warn-soft: #33280E;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #141312; --surface: #1C1B19; --surface-2: #242320;
  --border: #302E2A; --border-strong: #45423D;
  --text: #EDEAE5; --muted: #A8A39B;
  --accent: #FF6B4A; --accent-hover: #FF8466; --accent-text: #FF8F75;
  --accent-soft: #3A1F18; --on-accent: #1A0D09;
  --ok: #62CF8F; --ok-soft: #15301F; --warn: #F2B84B; --warn-soft: #33280E;
  color-scheme: dark;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 88px; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: var(--font); font-size: var(--fs); line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { margin: 0; line-height: 1.2; font-weight: 600; }
h1 { font-size: var(--fs-xl); letter-spacing: var(--tracking-display); }
h2 { font-size: var(--fs-lg); }
h3 { font-size: var(--fs); font-weight: 700; }
p { margin: 0; }
a { color: var(--accent-text); }
button, input, select { font: inherit; color: inherit; }
svg.i { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); font-size: 16px; }
.lead { color: var(--muted); max-width: 60ch; }
.center { text-align: center; margin-inline: auto; }
.sr-only, .hp { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.skip { position: absolute; left: 16px; top: -100px; padding: 10px 16px; background: var(--surface); border-radius: var(--radius-sm); z-index: 50; }
.skip:focus { top: 12px; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 32px; }
.wrap.narrow { max-width: 760px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 10px 18px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.small { min-height: 40px; padding: 6px 12px; margin-top: 8px; }
.btn.done { background: var(--ok); border-color: var(--ok); color: var(--surface); }
.icon-btn {
  display: inline-grid; place-items: center; width: 44px; height: 44px; flex: none;
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface);
  color: var(--text); cursor: pointer; list-style: none;
}
.icon-btn:hover { background: var(--surface-2); }
.icon-btn::-webkit-details-marker { display: none; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; }
.actions.center { justify-content: center; margin-top: 24px; }

/* ---------- Header and footer ---------- */
.site-header {
  position: sticky; top: 0; z-index: 20;
  background: var(--surface); border-bottom: 1px solid var(--border);
}
.header-row { display: flex; align-items: center; gap: 24px; min-height: 72px; }
/* Logo: the brand book's "Tiivis" lockup (templates/partials/logo.html).
   28 px tall in the header, 24 px (the minimum) in the footer. */
.brand { display: flex; align-items: center; color: var(--text); text-decoration: none; }
.logo { display: block; width: 111px; height: 28px; }
.logo-node { fill: var(--accent); }
.site-footer .logo { width: 95px; height: 24px; }
.nav-desktop { display: flex; gap: 4px; margin-left: 8px; }
.nav-desktop a { padding: 8px 12px; border-radius: var(--radius-sm); color: var(--text); text-decoration: none; }
.nav-desktop a:hover { background: var(--surface-2); }
.header-actions { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.nav-mobile { display: none; position: relative; }
.nav-mobile[open] summary { background: var(--surface-2); }
.nav-mobile nav {
  position: absolute; right: 0; top: calc(100% + 8px); width: min(300px, calc(100vw - 32px));
  display: flex; flex-direction: column; gap: 2px; padding: 8px;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0,0,0,.12);
}
.nav-mobile nav a:not(.btn) { padding: 12px; border-radius: var(--radius-sm); color: var(--text); text-decoration: none; }
.nav-mobile nav a:not(.btn):hover { background: var(--surface-2); }
.nav-mobile nav .btn { margin-top: 6px; }

.site-footer { border-top: 1px solid var(--border); background: var(--surface); padding: 32px 0; }
.footer-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }

/* ---------- Sections ---------- */
.hero h1 { max-width: 22ch; }
.hero .lead { margin-top: 16px; max-width: 64ch; }
.hero .hero-points { margin: 24px 0 28px; }
.band h2 + .lead, .band .section-head + .lead { margin-top: 10px; }
.band .lead + .gen, .band .lead + .compare { margin-top: 28px; }
.section { padding: 72px 0; }
.section.alt { background: var(--surface-2); }
/* Alternate bands fade in from the page colour and back out, so there is no
   hard edge between sections; --fade is the length of each transition. */
.band.alt {
  --fade: 160px;
  background: linear-gradient(to bottom,
    var(--bg) 0,
    var(--surface-2) var(--fade),
    var(--surface-2) calc(100% - var(--fade)),
    var(--bg) 100%);
}
.section h2 + .lead, .section-head + .lead { margin-top: 10px; }
.section-head { display: flex; align-items: center; gap: 14px; }
.badge { display: inline-flex; padding: 2px 12px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-text); font-weight: 600; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.compare { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-top: 28px; }
.list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.list li { display: flex; gap: 12px; align-items: flex-start; }
.list li svg.i { margin-top: 3px; }
.list.bad svg.i { color: var(--warn); }
.list.good svg.i { color: var(--ok); }

.features { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; margin-top: 28px; }
.feature { padding: 28px; display: flex; flex-direction: column; gap: 10px; }
.feature-icon { display: grid; place-items: center; width: 44px; height: 44px; border-radius: var(--radius-sm); background: var(--accent-soft); color: var(--accent-text); }
.feature-icon.big { width: 56px; height: 56px; }
.feature-icon.big svg.i { width: 28px; height: 28px; }

.plans { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; margin: 28px 0 20px; }
.plan { padding: 28px; display: flex; flex-direction: column; gap: 16px; }
.plan.highlight { border: 2px solid var(--accent); }
.plan .list { flex: 1; }
.price { font-size: var(--fs-xl); font-weight: 700; }
.price .muted { font-size: var(--fs); font-weight: 400; }

.trust { display: flex; gap: 20px; align-items: flex-start; padding: 28px; margin-top: 28px; }
.trust .list { margin-top: 12px; }

/* "Tuttu näky GA4:ssä?": two example reports side by side. */
.report { margin: 0; padding: 24px; display: flex; flex-direction: column; gap: 14px; }
.report figcaption { display: flex; align-items: center; gap: 10px; font-weight: 700; }
.report.bad figcaption svg.i { color: var(--warn); }
.report.good figcaption svg.i { color: var(--ok); }
.report table { width: 100%; border-collapse: collapse; }
.report th { text-align: left; font-weight: 600; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--border); }
.report td { padding: 10px; border-bottom: 1px solid var(--border); }
.report .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.report tr.flag td { background: var(--warn-soft); }
.report.good td:first-child { color: var(--ok); }

/* "Näin Kanavoi toimii": three steps. */
.how { list-style: none; margin: 28px 0 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; }
.how-step { padding: 28px; display: flex; flex-direction: column; gap: 10px; }

.faqs { padding: 4px 24px; margin-top: 20px; }
.faqs .faq:last-child { border-bottom: 0; }

.faq { border-bottom: 1px solid var(--border); }
.faq summary { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 18px 0; cursor: pointer; font-weight: 600; list-style: none; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary svg.i { transition: transform .15s; color: var(--muted); }
.faq[open] summary svg.i { transform: rotate(180deg); }
.faq p { padding-bottom: 18px; color: var(--muted); }
#ukk h2 { margin-bottom: 8px; }

.waitlist { padding: 32px; display: flex; flex-direction: column; gap: 14px; }
.waitlist-form { display: flex; flex-direction: column; gap: 16px; margin-top: 6px; }
.waitlist-row { display: flex; gap: 10px; }
.waitlist-row .input { flex: 1; }
.plan-pick { border: 0; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.plan-pick legend { padding: 0; margin-bottom: 10px; font-weight: 600; }
.plan-pick legend .muted { font-weight: 400; }
/* Radio buttons that look like the generator's chips. */
.chip-radio { position: relative; }
.chip-radio input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.chip-radio:has(input:checked) { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-text); font-weight: 600; }
.chip-radio:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.waitlist-done { display: flex; gap: 12px; align-items: flex-start; padding: 16px; border-radius: var(--radius-sm); background: var(--ok-soft); }
.waitlist-done svg.i { color: var(--ok); margin-top: 3px; }
.form-error { color: var(--warn); }

/* ---------- Generator ---------- */
.gen { display: grid; grid-template-columns: minmax(0, 1fr) 440px; gap: 24px; align-items: start; }
.gen-form { padding: 8px 28px; }
.step { padding: 24px 0; display: flex; flex-direction: column; gap: 16px; }
.step + .step { border-top: 1px solid var(--border); }
.step-title { display: flex; align-items: center; gap: 12px; font-size: var(--fs-lg); font-weight: 600; }
.step-num { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; flex: none; background: var(--accent-soft); color: var(--accent-text); font-size: var(--fs); font-weight: 700; }
.field { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.field label, .label { font-weight: 600; }
.row { display: grid; gap: 16px; }
.row.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.input {
  width: 100%; min-height: 50px; padding: 12px 14px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface); font-size: var(--fs);
}
.input::placeholder { color: var(--muted); opacity: .8; }
.input:hover { border-color: var(--muted); }
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.chips { display: flex; flex-wrap: wrap; gap: 10px; }
.chip {
  display: inline-flex; align-items: center; min-height: 44px; padding: 8px 16px;
  border: 1px solid var(--border-strong); border-radius: 999px; background: var(--surface); cursor: pointer;
}
.chip:hover { border-color: var(--muted); }
.chip[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-text); font-weight: 600; }
details.more summary { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-weight: 600; list-style: none; }
details.more summary::-webkit-details-marker { display: none; }
details.more summary svg.i { transition: transform .15s; }
details.more[open] summary svg.i { transform: rotate(180deg); }
details.more .row { margin-top: 16px; }

.gen-result { position: sticky; top: 96px; padding: 24px; display: flex; flex-direction: column; gap: 18px; }
.url-box {
  padding: 16px; border-radius: var(--radius-sm); background: var(--surface-2);
  font-family: var(--mono); font-size: 16px; line-height: 1.6; word-break: break-all;
}
.url-box .u-key { color: var(--muted); }
.url-box .u-value { font-weight: 500; color: var(--accent-text); }
.url-box.empty { font-family: var(--font); font-size: var(--fs); color: var(--muted); word-break: normal; }
.url-box.is-error { background: var(--warn-soft); color: var(--warn); }
.gen-result .actions .btn.primary { flex: 1; }
.channel { display: flex; gap: 14px; padding: 16px; border-radius: var(--radius-sm); }
.channel.ok { background: var(--ok-soft); }
.channel.warn { background: var(--warn-soft); }
.channel > svg.i { width: 26px; height: 26px; margin-top: 2px; }
.channel.ok > svg.i, .channel.ok .channel-label { color: var(--ok); }
.channel.warn > svg.i, .channel.warn .channel-label { color: var(--warn); }
.channel-label { font-weight: 600; }
.channel-name { font-size: var(--fs-lg); font-weight: 600; }
.notes { display: flex; flex-direction: column; gap: 10px; margin: 0; padding: 0; list-style: none; }
.note { display: flex; gap: 10px; align-items: flex-start; }
.note > svg.i { margin-top: 3px; color: var(--warn); }
.export { display: flex; flex-direction: column; gap: 8px; }
.export-line { display: flex; gap: 10px; align-items: flex-start; }
.export-line .url-box { flex: 1; padding: 12px 14px; }
.changes { display: flex; flex-direction: column; gap: 8px; }
.change { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.change s { color: var(--muted); }
.change svg.i { color: var(--muted); width: 18px; height: 18px; }
.team-note { padding-top: 16px; border-top: 1px solid var(--border); color: var(--muted); }
.htmx-request .url-box { opacity: .6; }

/* ---------- Responsive ---------- */
@media (max-width: 1080px) {
  .gen { grid-template-columns: minmax(0, 1fr); }
  .gen-result { position: static; }
  .nav-desktop { display: none; }
  .nav-mobile { display: block; }
}
@media (max-width: 860px) {
  .features, .plans, .compare, .how { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
  .wrap { padding: 0 16px; }
  .section { padding: 48px 0; }
  .gen-form { padding: 4px 20px; }
  .gen-result, .report, .how-step, .feature, .plan, .waitlist, .trust { padding: 20px; }
  .report td, .report th { padding: 8px 6px; }
  .row.cols-2 { grid-template-columns: minmax(0, 1fr); }
  .nav-cta { display: none; }
  .header-row { min-height: 64px; gap: 12px; }
  .waitlist-row { flex-direction: column; }
  .trust { flex-direction: column; }
  .hero h1 { font-size: 28px; }
  .band.alt { --fade: 96px; }
  html { scroll-padding-top: 76px; }
}

/* ---------- Tool pages (channel checker, QR) ---------- */
.band .lead + .tool { margin-top: 28px; }
.band h1 + .lead { margin-top: 14px; }
details.more > .field { margin-top: 16px; }
.qr-image { display: grid; place-items: center; padding: 16px; background: #fff; border-radius: var(--radius-sm); border: 1px solid var(--border); }
.qr-image img { width: 240px; height: 240px; image-rendering: pixelated; }
.qr-hint { margin-top: 12px; }
.table-card { padding: 8px 16px; overflow-x: auto; }
.more-tools { margin-top: 20px; color: var(--muted); }
.footer-tools { display: flex; gap: 16px; flex-wrap: wrap; }
.footer-tools a { color: var(--text); }
.prose ol { margin: 0; padding-left: 22px; display: flex; flex-direction: column; gap: 10px; }

/* ---------- Long text (privacy notice, articles) ---------- */
.prose { display: flex; flex-direction: column; gap: 14px; }
.prose h1 { margin-bottom: 4px; }
.prose h2 { margin-top: 24px; }
.prose h3 { margin-top: 8px; }
.prose ul { margin: 0; padding-left: 22px; display: flex; flex-direction: column; gap: 8px; }
