/* =============================================================
   Kan Labs — design system
   Editorial + lab. Warm paper, deep ink, litmus-spectrum accent.
   ============================================================= */

/* Self-hosted fonts (SIL OFL 1.1). No third-party requests. */
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/assets/fonts/inter-var.woff2") format("woff2");
}
@font-face {
  font-family: "Fraunces";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  font-optical-sizing: auto;
  src: url("/assets/fonts/fraunces-var.woff2") format("woff2");
}

:root {
  /* Brand palette (from Litmus) */
  --ink: #16172b;
  --ink-2: #1f2138;
  --ink-3: #2a2c47;
  --paper: #f7f5ef;
  --surface: #fffdf8;
  --coral: #ff6b6b;
  --amber: #f5a623;
  --indigo: #6366f1;
  --teal: #13c7a6;

  /* Semantic */
  --text: #1b1d31;
  --muted: #5b6072;
  --muted-2: #8a8f9c;
  --line: rgba(22, 23, 43, 0.10);
  --line-strong: rgba(22, 23, 43, 0.16);
  --link: #5256e6;

  /* The signature: the litmus spectrum */
  --spectrum: linear-gradient(100deg, #ff6b6b 0%, #f5a623 30%, #6366f1 64%, #13c7a6 100%);
  --spectrum-soft: linear-gradient(100deg, #ff6b6b, #6366f1 55%, #13c7a6);

  /* Type */
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-serif: "Fraunces", Georgia, "Times New Roman", serif;

  /* Shape */
  --r-sm: 12px;
  --r: 18px;
  --r-lg: 28px;
  --pill: 999px;
  --container: 1140px;
  --shadow-sm: 0 1px 2px rgba(22, 23, 43, 0.05), 0 6px 20px -8px rgba(22, 23, 43, 0.10);
  --shadow: 0 24px 60px -22px rgba(22, 23, 43, 0.30);
  --shadow-ink: 0 30px 80px -28px rgba(10, 11, 26, 0.65);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 17px;
  line-height: 1.65;
  color: var(--text);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

/* Subtle paper grain */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.035;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

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

a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }

::selection { background: rgba(99, 102, 241, 0.22); }

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

/* ---------- Layout ---------- */
.container {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 24px;
  position: relative;
  z-index: 1;
}

.section { padding: clamp(64px, 10vw, 132px) 0; position: relative; }
.section--tight { padding: clamp(48px, 7vw, 88px) 0; }

/* ---------- Type ---------- */
h1, h2, h3 {
  font-family: var(--font-serif);
  font-weight: 460;
  line-height: 1.04;
  letter-spacing: -0.015em;
  margin: 0;
  font-optical-sizing: auto;
}

.display {
  font-size: clamp(2.7rem, 6.4vw, 4.7rem);
  line-height: 0.98;
  letter-spacing: -0.025em;
}

h2.title { font-size: clamp(2rem, 4.2vw, 3rem); }
h3 { font-size: 1.32rem; letter-spacing: -0.01em; }

.lead {
  font-size: clamp(1.08rem, 1.8vw, 1.32rem);
  line-height: 1.55;
  color: var(--muted);
  max-width: 40ch;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}
.eyebrow::before {
  content: "";
  width: 9px; height: 9px;
  border-radius: var(--pill);
  background: var(--spectrum);
  box-shadow: 0 0 12px rgba(99, 102, 241, 0.55);
}
.eyebrow--light { color: rgba(247, 245, 239, 0.62); }

.spectrum-rule {
  height: 3px;
  width: 100%;
  border: 0;
  border-radius: var(--pill);
  background: var(--spectrum);
  opacity: 0.9;
}

.gradient-text {
  background: var(--spectrum);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 0.98rem;
  line-height: 1;
  padding: 14px 24px;
  border-radius: var(--pill);
  border: 1.5px solid transparent;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.22s ease, background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
  white-space: nowrap;
}
.btn:hover { text-decoration: none; transform: translateY(-2px); }
.btn:active { transform: translateY(0); }
.btn svg { width: 18px; height: 18px; }

.btn-primary { background: var(--ink); color: var(--paper); box-shadow: var(--shadow-sm); }
.btn-primary:hover { box-shadow: 0 16px 34px -14px rgba(22, 23, 43, 0.55); }

.btn-light { background: var(--paper); color: var(--ink); box-shadow: 0 14px 34px -16px rgba(0, 0, 0, 0.6); }
.btn-light:hover { box-shadow: 0 20px 40px -16px rgba(0, 0, 0, 0.7); }

.btn-ghost { background: transparent; border-color: currentColor; color: inherit; opacity: 0.92; }
.btn-ghost:hover { opacity: 1; background: rgba(127, 127, 140, 0.10); }

/* ---------- Navigation ---------- */
.site-nav {
  position: sticky;
  top: 0;
  z-index: 50;
  transition: background 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
  border-bottom: 1px solid transparent;
}
.site-nav.is-scrolled {
  background: rgba(247, 245, 239, 0.82);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom-color: var(--line);
}
.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  height: 72px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  font-weight: 650;
  font-size: 1.06rem;
  letter-spacing: -0.01em;
  color: var(--ink);
}
.brand:hover { text-decoration: none; }
.brand .mark { width: 30px; height: 30px; border-radius: 9px; flex: none; box-shadow: var(--shadow-sm); }
.brand b { font-weight: 680; }
.brand span { color: var(--muted-2); font-weight: 500; }

.nav-links { display: flex; align-items: center; gap: 28px; }
.nav-links a:not(.btn) {
  color: var(--text);
  font-weight: 530;
  font-size: 0.96rem;
  opacity: 0.78;
  transition: opacity 0.18s ease;
}
.nav-links a:not(.btn):hover { opacity: 1; text-decoration: none; }
.nav-links .btn { padding: 10px 18px; font-size: 0.92rem; }

.nav-toggle {
  display: none;
  background: none;
  border: 0;
  padding: 8px;
  cursor: pointer;
  color: var(--ink);
}
.nav-toggle svg { width: 24px; height: 24px; }

/* ---------- Hero (dark) ---------- */
.hero {
  position: relative;
  background: var(--ink);
  color: var(--paper);
  overflow: hidden;
  isolation: isolate;
}
.hero::after { /* warm fade into paper */
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 140px;
  background: linear-gradient(to bottom, transparent, var(--paper));
  z-index: 2;
}
.hero-glow {
  position: absolute;
  z-index: 0;
  border-radius: 50%;
  filter: blur(72px);
  opacity: 0.55;
  pointer-events: none;
}
.hero-glow--1 {
  width: 560px; height: 560px;
  top: -180px; right: -120px;
  background: radial-gradient(circle at 30% 30%, rgba(99, 102, 241, 0.9), transparent 62%),
              radial-gradient(circle at 70% 70%, rgba(19, 199, 166, 0.8), transparent 60%);
  animation: drift 22s ease-in-out infinite;
}
.hero-glow--2 {
  width: 460px; height: 460px;
  bottom: -160px; left: -120px;
  background: radial-gradient(circle at 50% 50%, rgba(255, 107, 107, 0.7), transparent 62%),
              radial-gradient(circle at 30% 70%, rgba(245, 166, 35, 0.6), transparent 60%);
  animation: drift 26s ease-in-out infinite reverse;
}
@keyframes drift {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(-36px, 28px) scale(1.12); }
}

.hero-inner {
  position: relative;
  z-index: 1;
  padding: clamp(88px, 15vh, 160px) 0 clamp(120px, 16vh, 184px);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 26px;
}
.hero-inner .display { max-width: 16ch; }
.hero-inner .lead { color: rgba(247, 245, 239, 0.74); max-width: 52ch; text-align: center; }
.hero-cta { display: flex; gap: 14px; flex-wrap: wrap; justify-content: center; margin-top: 6px; }
.hero-meta {
  display: flex; gap: 10px 22px; flex-wrap: wrap; justify-content: center;
  margin-top: 14px;
  font-size: 0.86rem;
  color: rgba(247, 245, 239, 0.55);
}
.hero-meta span { display: inline-flex; align-items: center; gap: 7px; }
.hero-meta span::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: var(--teal); }

/* Product hero variant */
.hero--product .hero-inner { text-align: left; align-items: flex-start; padding-bottom: clamp(108px, 14vh, 168px); }
.hero--product .lead { text-align: left; }
.hero--product .hero-cta { justify-content: flex-start; }
.product-mark { width: 76px; height: 76px; border-radius: 20px; box-shadow: var(--shadow-ink); }

.badge {
  display: inline-flex; align-items: center; gap: 9px;
  padding: 8px 16px;
  border-radius: var(--pill);
  background: rgba(247, 245, 239, 0.08);
  border: 1px solid rgba(247, 245, 239, 0.16);
  font-size: 0.85rem; font-weight: 600; letter-spacing: 0.01em;
  color: rgba(247, 245, 239, 0.9);
}
.badge .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--teal); box-shadow: 0 0 10px var(--teal); }

/* ---------- Section header ---------- */
.section-head { max-width: 60ch; margin-bottom: clamp(36px, 5vw, 56px); display: flex; flex-direction: column; gap: 16px; }
.section-head .lead { max-width: 54ch; }
.section-head--center { margin-left: auto; margin-right: auto; text-align: center; align-items: center; }
.section-head--center .lead { text-align: center; }

/* ---------- Cards / grids ---------- */
.grid { display: grid; gap: 22px; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 32px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
}
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow); border-color: var(--line-strong); }
.card h3 { margin: 18px 0 8px; }
.card p { margin: 0; color: var(--muted); font-size: 1rem; }

.card-ico {
  width: 46px; height: 46px;
  border-radius: 13px;
  display: grid; place-items: center;
  background: linear-gradient(160deg, rgba(99, 102, 241, 0.14), rgba(19, 199, 166, 0.14));
  border: 1px solid var(--line);
  color: var(--ink);
}
.card-ico svg { width: 23px; height: 23px; }

/* numbered index for principles */
.card .num { font-family: var(--font-serif); font-size: 0.95rem; color: var(--muted-2); }

/* ---------- Feature list (litmus) ---------- */
.feature {
  display: flex; gap: 16px;
  padding: 26px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.feature:hover { transform: translateY(-3px); box-shadow: var(--shadow-sm); }
.feature .card-ico { flex: none; }
.feature h3 { font-size: 1.12rem; margin: 2px 0 6px; }
.feature p { margin: 0; color: var(--muted); font-size: 0.97rem; line-height: 1.55; }

/* ---------- Showcase panel (dark within light) ---------- */
.panel {
  position: relative;
  background: var(--ink);
  color: var(--paper);
  border-radius: var(--r-lg);
  padding: clamp(36px, 6vw, 64px);
  overflow: hidden;
  isolation: isolate;
  box-shadow: var(--shadow-ink);
}
.panel .panel-glow {
  position: absolute; z-index: 0;
  width: 420px; height: 420px; border-radius: 50%;
  filter: blur(70px); opacity: 0.5;
  top: -140px; right: -100px;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.85), transparent 60%),
              radial-gradient(circle at 70% 70%, rgba(19, 199, 166, 0.7), transparent 60%);
}
.panel > * { position: relative; z-index: 1; }
.panel-grid { display: grid; grid-template-columns: 1.1fr 1fr; gap: clamp(32px, 5vw, 56px); align-items: center; }
.panel h2 { font-size: clamp(1.9rem, 3.6vw, 2.7rem); }
.panel .lead { color: rgba(247, 245, 239, 0.74); }
.panel .product-mark { margin-bottom: 22px; }

/* chips */
.chips { display: flex; flex-wrap: wrap; gap: 10px; }
.chip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 15px;
  border-radius: var(--pill);
  font-size: 0.88rem; font-weight: 560;
  background: rgba(247, 245, 239, 0.07);
  border: 1px solid rgba(247, 245, 239, 0.16);
  color: rgba(247, 245, 239, 0.92);
}
.chip.on-light { background: var(--surface); border-color: var(--line); color: var(--text); box-shadow: var(--shadow-sm); }
.chip .swatch { width: 9px; height: 9px; border-radius: 50%; }

/* ---------- CTA band ---------- */
.cta-band { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 22px; }
.cta-band h2 { font-size: clamp(1.9rem, 4vw, 2.9rem); max-width: 18ch; }

/* ---------- Prose (legal / support) ---------- */
.page-head { padding: clamp(56px, 9vw, 104px) 0 clamp(20px, 3vw, 36px); }
.crumb { font-size: 0.84rem; color: var(--muted); margin-bottom: 18px; display: inline-flex; gap: 8px; align-items: center; }
.crumb a { color: var(--muted); }
.crumb .sep { opacity: 0.5; }

.prose { max-width: 720px; }
.prose > * + * { margin-top: 1.05em; }
.prose h2 {
  font-family: var(--font-serif);
  font-size: 1.5rem;
  letter-spacing: -0.01em;
  margin-top: 2.2em;
  margin-bottom: 0.1em;
}
.prose h2:first-of-type { margin-top: 1.4em; }
.prose p, .prose li { color: #34374a; }
.prose strong { color: var(--text); font-weight: 650; }
.prose ul { padding-left: 1.25em; margin: 0.6em 0; }
.prose li { margin: 0.4em 0; }
.prose .muted { color: var(--muted); }
.prose a { color: var(--link); font-weight: 530; }

.note-pill {
  display: inline-block;
  background: rgba(19, 199, 166, 0.14);
  color: #0c8d76;
  padding: 6px 15px;
  border-radius: var(--pill);
  font-size: 0.92rem;
  font-weight: 650;
}
.faq-q { font-weight: 650; color: var(--text); margin-top: 1.6em !important; }

.callout {
  margin-top: 2em;
  padding: 22px 26px;
  border-radius: var(--r);
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 3px solid transparent;
  border-image: var(--spectrum) 1;
  box-shadow: var(--shadow-sm);
}

/* ---------- Footer ---------- */
.site-footer {
  position: relative;
  background: var(--ink);
  color: rgba(247, 245, 239, 0.74);
  padding: 64px 0 40px;
  margin-top: 0;
}
.site-footer .spectrum-rule { position: absolute; top: 0; left: 0; right: 0; border-radius: 0; height: 3px; }
.footer-grid {
  display: grid;
  grid-template-columns: 1.6fr repeat(3, 1fr);
  gap: 40px;
  padding-bottom: 44px;
  border-bottom: 1px solid rgba(247, 245, 239, 0.12);
}
.footer-brand .brand { color: var(--paper); margin-bottom: 16px; }
.footer-brand p { color: rgba(247, 245, 239, 0.6); font-size: 0.96rem; max-width: 34ch; margin: 0; }
.footer-col h4 {
  font-family: var(--font-sans);
  font-size: 0.76rem; letter-spacing: 0.12em; text-transform: uppercase;
  color: rgba(247, 245, 239, 0.45);
  margin: 0 0 16px; font-weight: 600;
}
.footer-col a { display: block; color: rgba(247, 245, 239, 0.78); margin: 9px 0; font-size: 0.96rem; }
.footer-col a:hover { color: var(--paper); text-decoration: none; }
.footer-bottom {
  display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px;
  padding-top: 28px;
  font-size: 0.85rem; color: rgba(247, 245, 239, 0.5);
}

/* ---------- Reveal animation ----------
   Content is visible by default, so the page is fully readable with no JS
   (or if the script fails to load). main.js adds .pre to below-the-fold
   elements to hide them, then removes it as they scroll in — the transition
   below animates the reveal. */
[data-reveal] { transition: opacity 0.7s cubic-bezier(0.22, 1, 0.36, 1), transform 0.7s cubic-bezier(0.22, 1, 0.36, 1); }
[data-reveal][data-delay="1"] { transition-delay: 0.08s; }
[data-reveal][data-delay="2"] { transition-delay: 0.16s; }
[data-reveal][data-delay="3"] { transition-delay: 0.24s; }
[data-reveal].pre { opacity: 0; transform: translateY(22px); transition: none; }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .grid-3 { grid-template-columns: 1fr 1fr; }
  .panel-grid { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr 1fr; gap: 32px; }
  .footer-brand { grid-column: 1 / -1; }
}

@media (max-width: 680px) {
  body { font-size: 16px; }
  .nav-links {
    position: fixed;
    inset: 72px 0 auto 0;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    padding: 16px 24px 24px;
    background: rgba(247, 245, 239, 0.97);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--line);
    box-shadow: var(--shadow);
    transform: translateY(-12px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.22s ease, transform 0.22s ease;
  }
  .nav-links.is-open { opacity: 1; transform: none; pointer-events: auto; }
  .nav-links a:not(.btn) { padding: 12px 4px; font-size: 1.05rem; opacity: 1; border-bottom: 1px solid var(--line); }
  .nav-links .btn { margin-top: 10px; justify-content: center; }
  .nav-toggle { display: inline-flex; }
  .site-nav { background: rgba(247, 245, 239, 0.82); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-bottom-color: var(--line); }

  .grid-3, .grid-2 { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr; }
  .footer-bottom { justify-content: flex-start; }

  /* Let headings wrap naturally on small screens (drop decorative breaks) */
  h1 br, h2 br { display: none; }

  /* Keep hero content inside the viewport on small screens */
  .hero-inner .display { max-width: 100%; }
  .hero-inner .lead, .hero--product .lead { max-width: 100%; }
  .hero-cta { max-width: 100%; }
  .section-head .lead, .section-head--center .lead { max-width: 100%; }
}

/* ---------- Motion / contrast preferences ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
  [data-reveal] { opacity: 1; transform: none; }
}
