/* =========================================================================
   Peptiq — design system
   Zero dependencies. Zero third-party requests. System fonts only.
   ========================================================================= */

/* ---------- 1. Reset ---------------------------------------------------- */

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

* { margin: 0; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 6.5rem;
}

body {
  min-height: 100svh;
  font-synthesis-weight: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

button, input, select, textarea { font: inherit; color: inherit; }

h1, h2, h3, h4 { text-wrap: balance; }

p, li { text-wrap: pretty; }

/* ---------- 2. Tokens --------------------------------------------------- */

:root {
  /* Type families. On Apple hardware this resolves to New York + SF Pro,
     which is the exact pairing this layout was spaced for. */
  --font-display: ui-serif, "New York", "Iowan Old Style", Charter, "Palatino Linotype", Palatino, Georgia, serif;
  --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Inter, Roboto, "Helvetica Neue", system-ui, sans-serif;
  --font-mono: ui-monospace, "SF Mono", SFMono-Regular, "JetBrains Mono", Menlo, Consolas, monospace;

  /* Fluid type scale — 1.24 ratio at the small end, 1.32 at the large end. */
  --fs-hero: clamp(2.85rem, 1.55rem + 5.4vw, 5.75rem);
  --fs-h1:   clamp(2.25rem, 1.50rem + 3.2vw, 3.75rem);
  --fs-h2:   clamp(1.75rem, 1.32rem + 1.9vw, 2.65rem);
  --fs-h3:   clamp(1.18rem, 1.08rem + 0.5vw, 1.45rem);
  --fs-lead: clamp(1.06rem, 0.99rem + 0.42vw, 1.28rem);
  --fs-body: 1rem;
  --fs-sm:   0.9375rem;
  --fs-xs:   0.8125rem;
  --fs-micro: 0.6875rem;

  /* Spacing — 4px base, named by t-shirt size to keep rhythm consistent. */
  --s-1: 0.25rem;  --s-2: 0.5rem;   --s-3: 0.75rem;  --s-4: 1rem;
  --s-5: 1.5rem;   --s-6: 2rem;     --s-7: 3rem;     --s-8: 4rem;
  --s-9: 6rem;     --s-10: 8rem;

  --section-y: clamp(4.5rem, 3rem + 7vw, 9rem);

  /* Layout */
  --wrap: 1180px;
  --wrap-narrow: 780px;
  --measure: 68ch;
  --gutter: clamp(1.25rem, 0.75rem + 2.2vw, 2.5rem);

  /* Shape */
  --r-1: 6px;  --r-2: 10px; --r-3: 14px; --r-4: 20px; --r-5: 28px; --r-full: 999px;

  /* Motion */
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
  --dur: 240ms;
}

/* Dark is the default; light is opt-in via toggle or system preference. */
:root,
[data-theme="dark"] {
  color-scheme: dark;
  --bg: #070809;
  --bg-elev: #0C0E11;
  --surface: rgba(255, 255, 255, 0.026);
  --surface-hi: rgba(255, 255, 255, 0.05);
  --line: rgba(255, 255, 255, 0.085);
  --line-hi: rgba(255, 255, 255, 0.16);
  --ink: #EDF0F2;
  --ink-2: #A5AEB6;
  --ink-3: #6A737C;
  --accent: #6EE7C0;
  --accent-2: #8FAEFF;
  --accent-ink: #04231B;
  --accent-soft: rgba(110, 231, 192, 0.12);
  --warn: #F0B866;
  --warn-soft: rgba(240, 184, 102, 0.1);
  --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-2: 0 18px 40px -18px rgba(0, 0, 0, 0.8);
  --shadow-3: 0 50px 100px -40px rgba(0, 0, 0, 0.9);
  --noise-opacity: 0.035;
  --glow-1: rgba(110, 231, 192, 0.16);
  --glow-2: rgba(143, 174, 255, 0.14);
}

[data-theme="light"] {
  color-scheme: light;
  --bg: #FBFAF7;
  --bg-elev: #FFFFFF;
  --surface: rgba(12, 18, 24, 0.028);
  --surface-hi: rgba(12, 18, 24, 0.055);
  --line: rgba(12, 22, 32, 0.11);
  --line-hi: rgba(12, 22, 32, 0.22);
  --ink: #0E1216;
  --ink-2: #4B555E;
  --ink-3: #78828B;
  --accent: #0C8F6B;
  --accent-2: #3A66D8;
  --accent-ink: #FFFFFF;
  --accent-soft: rgba(12, 143, 107, 0.09);
  --warn: #A56410;
  --warn-soft: rgba(165, 100, 16, 0.08);
  --shadow-1: 0 1px 2px rgba(16, 24, 32, 0.06);
  --shadow-2: 0 18px 40px -20px rgba(16, 24, 32, 0.22);
  --shadow-3: 0 50px 100px -45px rgba(16, 24, 32, 0.3);
  --noise-opacity: 0.028;
  --glow-1: rgba(12, 143, 107, 0.1);
  --glow-2: rgba(58, 102, 216, 0.08);
}

/* ---------- 3. Base ----------------------------------------------------- */

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  line-height: 1.6;
  letter-spacing: -0.006em;
  overflow-x: hidden;
}

/* Film grain. Kills the flat-gradient look that screams "template". */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  opacity: var(--noise-opacity);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.82' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

a { color: inherit; text-decoration-color: color-mix(in srgb, currentColor 35%, transparent); text-underline-offset: 0.22em; }
a:hover { text-decoration-color: currentColor; }

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

::selection { background: var(--accent); color: var(--accent-ink); }

hr { border: 0; height: 1px; background: var(--line); margin: var(--s-7) 0; }

/* ---------- 4. Layout primitives ---------------------------------------- */

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

.wrap--narrow { max-width: var(--wrap-narrow); }

.section { padding-block: var(--section-y); position: relative; }

.section + .section { padding-top: 0; }

.skip-link {
  position: absolute;
  left: var(--s-4);
  top: var(--s-4);
  z-index: 200;
  padding: var(--s-3) var(--s-5);
  background: var(--ink);
  color: var(--bg);
  border-radius: var(--r-2);
  font-weight: 600;
  transform: translateY(-160%);
  transition: transform var(--dur) var(--ease);
}
.skip-link:focus-visible { transform: translateY(0); }

/* ---------- 5. Typography components ------------------------------------ */

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-2);
}

.eyebrow::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.eyebrow--plain::before { display: none; }

.display {
  font-family: var(--font-display);
  font-size: var(--fs-hero);
  line-height: 0.98;
  letter-spacing: -0.032em;
  font-weight: 400;
}

.display em {
  font-style: italic;
  background: linear-gradient(100deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  padding-right: 0.06em; /* italic overhang clips without this */
}

.h1 { font-family: var(--font-display); font-size: var(--fs-h1); line-height: 1.04; letter-spacing: -0.028em; font-weight: 400; }
.h2 { font-family: var(--font-display); font-size: var(--fs-h2); line-height: 1.1;  letter-spacing: -0.024em; font-weight: 400; }
.h3 { font-size: var(--fs-h3); line-height: 1.28; letter-spacing: -0.018em; font-weight: 600; }

.lead {
  font-size: var(--fs-lead);
  line-height: 1.55;
  color: var(--ink-2);
  max-width: 56ch;
  letter-spacing: -0.011em;
}

.muted { color: var(--ink-2); }
.faint { color: var(--ink-3); }
.small { font-size: var(--fs-sm); }
.xs { font-size: var(--fs-xs); }

.mono {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
}

.section-head { max-width: 60ch; margin-bottom: clamp(2.5rem, 1.6rem + 3vw, 4rem); }
.section-head .h2 { margin-top: var(--s-4); }
.section-head .lead { margin-top: var(--s-4); }
.section-head--center { margin-inline: auto; text-align: center; }
.section-head--center .lead { margin-inline: auto; }

/* ---------- 6. Buttons -------------------------------------------------- */

.btn {
  --btn-bg: var(--ink);
  --btn-fg: var(--bg);
  --btn-line: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  padding: 0.82rem 1.4rem;
  border: 1px solid var(--btn-line);
  border-radius: var(--r-full);
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-size: var(--fs-sm);
  font-weight: 590;
  letter-spacing: -0.012em;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  transition: transform var(--dur) var(--ease), background var(--dur) var(--ease),
              border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease), opacity var(--dur) var(--ease);
}

.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0) scale(0.985); }

.btn--primary {
  --btn-bg: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent-2) 55%, var(--accent)));
  --btn-fg: var(--accent-ink);
  box-shadow: 0 10px 30px -12px var(--glow-1);
}
.btn--primary:hover { box-shadow: 0 16px 40px -14px var(--glow-1); }

.btn--ghost {
  --btn-bg: transparent;
  --btn-fg: var(--ink);
  --btn-line: var(--line-hi);
}
.btn--ghost:hover { --btn-bg: var(--surface-hi); --btn-line: var(--ink-3); }

.btn--sm { padding: 0.55rem 1rem; font-size: var(--fs-xs); }
.btn--lg { padding: 1rem 1.75rem; font-size: var(--fs-body); }
.btn--block { width: 100%; }

.btn__icon { width: 16px; height: 16px; flex: none; }

/* App Store badge — swap for Apple's official artwork before launch. */
.appstore {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.62rem 1.15rem 0.66rem;
  border: 1px solid var(--line-hi);
  border-radius: var(--r-3);
  background: var(--surface);
  color: var(--ink);
  text-decoration: none;
  transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.appstore:hover { border-color: var(--ink-3); background: var(--surface-hi); transform: translateY(-1px); }
.appstore svg { width: 24px; height: 24px; flex: none; }
.appstore__txt { display: grid; line-height: 1.15; }
.appstore__txt small { font-size: 0.6rem; letter-spacing: 0.09em; text-transform: uppercase; color: var(--ink-2); }
.appstore__txt strong { font-size: 1.02rem; font-weight: 600; letter-spacing: -0.02em; }

.btn-row { display: flex; flex-wrap: wrap; gap: var(--s-3); align-items: center; }

/* ---------- 7. Header --------------------------------------------------- */

.header {
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid transparent;
  transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease);
}

.header[data-stuck="true"] {
  border-bottom-color: var(--line);
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: saturate(1.6) blur(14px);
  -webkit-backdrop-filter: saturate(1.6) blur(14px);
}

.header__inner {
  display: flex;
  align-items: center;
  gap: var(--s-5);
  height: 4.25rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
  font-weight: 620;
  font-size: 1.06rem;
  letter-spacing: -0.03em;
  flex: none;
}
.brand svg { width: 26px; height: 26px; }

.nav { display: flex; align-items: center; gap: var(--s-2); margin-left: auto; }

.nav__link {
  padding: 0.45rem 0.75rem;
  border-radius: var(--r-2);
  font-size: var(--fs-sm);
  color: var(--ink-2);
  text-decoration: none;
  transition: color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.nav__link:hover,
.nav__link[aria-current="page"] { color: var(--ink); background: var(--surface-hi); }

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  border: 1px solid var(--line);
  border-radius: var(--r-full);
  background: transparent;
  color: var(--ink-2);
  cursor: pointer;
  flex: none;
  transition: color var(--dur) var(--ease), border-color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.icon-btn:hover { color: var(--ink); border-color: var(--line-hi); background: var(--surface-hi); }
.icon-btn svg { width: 17px; height: 17px; }

[data-theme="dark"] .icon-btn__sun { display: block; }
[data-theme="dark"] .icon-btn__moon { display: none; }
[data-theme="light"] .icon-btn__sun { display: none; }
[data-theme="light"] .icon-btn__moon { display: block; }

.nav-toggle { display: none; }

@media (max-width: 860px) {
  .nav-toggle { display: inline-grid; margin-left: auto; }

  .nav {
    position: fixed;
    inset: 4.25rem 0 auto;
    flex-direction: column;
    align-items: stretch;
    gap: var(--s-1);
    margin: 0;
    padding: var(--s-4) var(--gutter) var(--s-6);
    background: color-mix(in srgb, var(--bg) 96%, transparent);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--line);
    transform: translateY(-8px);
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--dur) var(--ease), transform var(--dur) var(--ease), visibility var(--dur);
  }
  .nav[data-open="true"] { opacity: 1; visibility: visible; transform: translateY(0); }
  .nav__link { padding: 0.7rem 0.75rem; font-size: 1rem; }
  .nav .btn { margin-top: var(--s-3); }
  /* Keep the toggle a circle rather than letting align-items: stretch pull it wide. */
  .nav__theme { align-self: flex-start; margin-top: var(--s-3); }
}

/* ---------- 8. Hero ----------------------------------------------------- */

.hero { position: relative; padding-block: clamp(3rem, 2rem + 5vw, 6rem) clamp(4rem, 3rem + 5vw, 7rem); overflow: hidden; }

.hero__glow {
  position: absolute;
  inset: -30% -10% auto;
  height: 720px;
  pointer-events: none;
  background:
    radial-gradient(46% 52% at 22% 34%, var(--glow-1) 0%, transparent 68%),
    radial-gradient(40% 46% at 76% 20%, var(--glow-2) 0%, transparent 66%);
  filter: blur(24px);
}

.hero__grid {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: clamp(2rem, 1rem + 4vw, 4.5rem);
  align-items: center;
}

.hero__copy > * + * { margin-top: var(--s-5); }
.hero__copy .display { margin-top: var(--s-4); }

.hero__proof {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2) var(--s-5);
  margin-bottom: 0;
  padding: var(--s-5) 0 0;
  border-top: 1px solid var(--line);
}

.hero__proof li {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  list-style: none;
  font-size: var(--fs-xs);
  color: var(--ink-2);
}
.hero__proof svg { width: 14px; height: 14px; color: var(--accent); flex: none; }

@media (max-width: 940px) {
  .hero__grid { grid-template-columns: 1fr; }
  .hero__visual { order: -1; }
}

/* ---------- 9. Device mockup -------------------------------------------- */

.device-stage {
  position: relative;
  display: grid;
  place-items: center;
  padding: var(--s-6) 0;
  perspective: 1600px;
}

.device {
  position: relative;
  width: min(300px, 76vw);
  aspect-ratio: 300 / 612;
  border-radius: 46px;
  padding: 10px;
  background: linear-gradient(160deg, #3A3F45, #131619 32%, #0A0C0E 64%, #2C3136);
  box-shadow: var(--shadow-3), 0 0 0 1px rgba(255, 255, 255, 0.06);
  transform: rotateY(-13deg) rotateX(5deg) rotateZ(0.6deg);
  transform-style: preserve-3d;
  transition: transform 900ms var(--ease-out-expo);
}
.device:hover { transform: rotateY(-6deg) rotateX(2deg); }

.device__screen {
  position: relative;
  height: 100%;
  border-radius: 37px;
  overflow: hidden;
  background: #08090B;
  color: #EDF0F2;
  display: flex;
  flex-direction: column;
  font-size: 11px;
  line-height: 1.4;
}

.device__island {
  position: absolute;
  top: 9px;
  left: 50%;
  transform: translateX(-50%);
  width: 78px;
  height: 22px;
  border-radius: var(--r-full);
  background: #000;
  z-index: 4;
}

/* --- in-device UI --- */
.ui { display: flex; flex-direction: column; height: 100%; }

.ui__status {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 20px 0;
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: #EDF0F2;
}
.ui__status-icons { display: flex; gap: 3px; align-items: center; }
.ui__status-icons i { width: 3px; border-radius: 1px; background: currentColor; display: block; }
.ui__status-icons i:nth-child(1) { height: 4px; }
.ui__status-icons i:nth-child(2) { height: 6px; }
.ui__status-icons i:nth-child(3) { height: 8px; }
.ui__status-icons i:nth-child(4) { height: 10px; }
.ui__battery { width: 18px; height: 9px; border: 1px solid currentColor; border-radius: 2.5px; padding: 1px; margin-left: 2px; }
.ui__battery span { display: block; height: 100%; width: 72%; background: currentColor; border-radius: 1px; }

.ui__head { padding: 22px 20px 12px; }
.ui__date { font-family: var(--font-mono); font-size: 8.5px; letter-spacing: 0.13em; text-transform: uppercase; color: #6A737C; }
.ui__title { font-family: var(--font-display); font-size: 22px; letter-spacing: -0.03em; margin-top: 4px; line-height: 1.05; }

.ui__body { flex: 1; overflow: hidden; padding: 0 14px; display: flex; flex-direction: column; gap: 8px; }

.ui-card {
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 15px;
  padding: 12px 13px;
  background: rgba(255, 255, 255, 0.028);
}

.ui-card--now {
  background: linear-gradient(150deg, rgba(110, 231, 192, 0.15), rgba(143, 174, 255, 0.08));
  border-color: rgba(110, 231, 192, 0.3);
}

.ui-card__top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.ui-card__name { font-size: 12.5px; font-weight: 600; letter-spacing: -0.02em; }
.ui-card__dose { font-family: var(--font-mono); font-size: 10px; color: #6EE7C0; font-variant-numeric: tabular-nums; }
.ui-card__meta { font-size: 9.5px; color: #8B949C; margin-top: 3px; display: flex; align-items: center; gap: 5px; }
.ui-card__meta::before { content: ""; width: 4px; height: 4px; border-radius: 50%; background: #6EE7C0; flex: none; }
.ui-card--muted .ui-card__meta::before { background: #4C555D; }
.ui-card--muted .ui-card__dose { color: #8B949C; }

.ui-log { display: flex; gap: 4px; margin-top: 10px; }
.ui-log i {
  flex: 1;
  height: 26px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.07);
  display: block;
  position: relative;
  overflow: hidden;
}
.ui-log i::after {
  content: "";
  position: absolute;
  inset: auto 0 0 0;
  background: linear-gradient(180deg, #6EE7C0, #4FBFA0);
  border-radius: 4px;
  animation: bar-rise 1400ms var(--ease-out-expo) backwards;
}
.ui-log i:nth-child(1)::after { height: 44%; animation-delay: 120ms; }
.ui-log i:nth-child(2)::after { height: 72%; animation-delay: 200ms; }
.ui-log i:nth-child(3)::after { height: 58%; animation-delay: 280ms; }
.ui-log i:nth-child(4)::after { height: 86%; animation-delay: 360ms; }
.ui-log i:nth-child(5)::after { height: 66%; animation-delay: 440ms; }
.ui-log i:nth-child(6)::after { height: 94%; animation-delay: 520ms; }
.ui-log i:nth-child(7)::after { height: 38%; animation-delay: 600ms; background: rgba(255,255,255,0.16); }

@keyframes bar-rise { from { transform: translateY(100%); } to { transform: translateY(0); } }

.ui-section-label {
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #5C656D;
  padding: 6px 2px 0;
}

.ui__tabs {
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding: 10px 12px 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  margin-top: 8px;
}
.ui__tabs span { width: 17px; height: 17px; border-radius: 5px; background: rgba(255, 255, 255, 0.12); display: block; }
.ui__tabs span:first-child { background: #6EE7C0; }

.device__home {
  position: absolute;
  bottom: 7px;
  left: 50%;
  transform: translateX(-50%);
  width: 100px;
  height: 4px;
  border-radius: var(--r-full);
  background: rgba(255, 255, 255, 0.35);
  z-index: 5;
}

/* Floating annotation chips around the device */
.device-note {
  position: absolute;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.42rem 0.75rem;
  border: 1px solid var(--line-hi);
  border-radius: var(--r-full);
  background: color-mix(in srgb, var(--bg-elev) 88%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: var(--shadow-2);
  font-size: var(--fs-micro);
  font-family: var(--font-mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-2);
  white-space: nowrap;
  animation: float 7s ease-in-out infinite;
}
.device-note::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: var(--accent); flex: none; }
.device-note--a { top: 14%; left: -4%; }
.device-note--b { bottom: 20%; right: -6%; animation-delay: -3.5s; }

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-9px); }
}

@media (max-width: 520px) {
  .device-note--a { left: -2%; }
  .device-note--b { right: -2%; }
}

/* ---------- 10. Cards & grids ------------------------------------------- */

.grid { display: grid; gap: var(--s-4); }
.grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }

@media (max-width: 900px) { .grid--3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 620px) { .grid--3, .grid--2 { grid-template-columns: 1fr; } }

.card {
  position: relative;
  padding: clamp(1.35rem, 1rem + 1vw, 1.9rem);
  border: 1px solid var(--line);
  border-radius: var(--r-4);
  background: var(--surface);
  transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.card:hover { border-color: var(--line-hi); background: var(--surface-hi); transform: translateY(-2px); }
.card .h3 { margin-top: var(--s-4); }
.card p { margin-top: var(--s-2); color: var(--ink-2); font-size: var(--fs-sm); }

.card__icon {
  display: grid;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: var(--r-3);
  border: 1px solid var(--line);
  background: var(--accent-soft);
  color: var(--accent);
}
.card__icon svg { width: 18px; height: 18px; }

.card--flat:hover { transform: none; }

/* Numbered steps */
.steps { counter-reset: step; display: grid; gap: var(--s-4); grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 820px) { .steps { grid-template-columns: 1fr; } }

.step {
  counter-increment: step;
  position: relative;
  padding: var(--s-5) 0 0;
  border-top: 1px solid var(--line);
}
.step::before {
  content: counter(step, decimal-leading-zero);
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  letter-spacing: 0.14em;
  color: var(--accent);
}
.step .h3 { margin-top: var(--s-3); }
.step p { margin-top: var(--s-2); color: var(--ink-2); font-size: var(--fs-sm); }

/* Split feature band */
.split {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(2rem, 1rem + 4vw, 4rem);
  align-items: center;
}
@media (max-width: 860px) { .split { grid-template-columns: 1fr; } }

.checklist { display: grid; gap: var(--s-3); margin: var(--s-5) 0 0; padding: 0; }
.checklist li { display: flex; gap: var(--s-3); list-style: none; font-size: var(--fs-sm); color: var(--ink-2); }
.checklist svg { width: 18px; height: 18px; flex: none; color: var(--accent); margin-top: 2px; }
.checklist strong { color: var(--ink); font-weight: 590; }

/* ---------- 11. Callouts ------------------------------------------------ */

.callout {
  display: flex;
  gap: var(--s-4);
  padding: clamp(1.25rem, 1rem + 1vw, 1.75rem);
  border: 1px solid var(--line);
  border-left: 2px solid var(--warn);
  border-radius: var(--r-3);
  background: var(--warn-soft);
}
.callout svg { width: 20px; height: 20px; flex: none; color: var(--warn); margin-top: 1px; }
.callout p { font-size: var(--fs-sm); color: var(--ink-2); }
.callout p + p { margin-top: var(--s-3); }
.callout strong { color: var(--ink); }

.callout--info { border-left-color: var(--accent); background: var(--accent-soft); }
.callout--info svg { color: var(--accent); }

.grid + .callout,
.split + .callout { margin-top: var(--s-6); }

/* ---------- 12. FAQ ----------------------------------------------------- */

.faq { border-top: 1px solid var(--line); }

.faq details { border-bottom: 1px solid var(--line); }

.faq summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-4);
  padding: var(--s-5) 0;
  cursor: pointer;
  list-style: none;
  font-size: var(--fs-h3);
  font-weight: 560;
  letter-spacing: -0.018em;
  transition: color var(--dur) var(--ease);
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary:hover { color: var(--accent); }

.faq summary::after {
  content: "";
  width: 12px;
  height: 12px;
  flex: none;
  background: currentColor;
  transition: transform var(--dur) var(--ease);
  /* plus sign drawn as a mask so it inherits colour */
  -webkit-mask: linear-gradient(currentColor 0 0) center/12px 1.5px no-repeat,
                linear-gradient(currentColor 0 0) center/1.5px 12px no-repeat;
  mask: linear-gradient(currentColor 0 0) center/12px 1.5px no-repeat,
        linear-gradient(currentColor 0 0) center/1.5px 12px no-repeat;
}
.faq details[open] summary::after { transform: rotate(135deg); }

.faq details > div { padding-bottom: var(--s-5); max-width: var(--measure); }
.faq details p { color: var(--ink-2); font-size: var(--fs-sm); }
.faq details p + p { margin-top: var(--s-3); }

/* ---------- 13. CTA band ------------------------------------------------ */

.cta {
  position: relative;
  overflow: hidden;
  padding: clamp(2.75rem, 2rem + 4vw, 5rem);
  border: 1px solid var(--line);
  border-radius: var(--r-5);
  background: var(--bg-elev);
  text-align: center;
}
.cta::before {
  content: "";
  position: absolute;
  inset: -50% -10% auto;
  height: 420px;
  background: radial-gradient(50% 60% at 50% 40%, var(--glow-1), transparent 70%);
  pointer-events: none;
}
.cta > * { position: relative; }
.cta .lead { margin: var(--s-4) auto 0; }
.cta .btn-row { justify-content: center; margin-top: var(--s-6); }

/* ---------- 14. Footer -------------------------------------------------- */

.footer { border-top: 1px solid var(--line); padding-block: var(--s-8) var(--s-6); margin-top: var(--section-y); }

.footer__grid {
  display: grid;
  grid-template-columns: 1.4fr repeat(3, minmax(0, 1fr));
  gap: var(--s-6);
}
@media (max-width: 820px) { .footer__grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 520px) { .footer__grid { grid-template-columns: 1fr; } }

.footer__about p { margin-top: var(--s-4); font-size: var(--fs-sm); color: var(--ink-2); max-width: 34ch; }

.footer__col h4 {
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
  font-weight: 400;
}
.footer__col ul { list-style: none; padding: 0; margin-top: var(--s-4); display: grid; gap: var(--s-3); }
.footer__col a { font-size: var(--fs-sm); color: var(--ink-2); text-decoration: none; transition: color var(--dur) var(--ease); }
.footer__col a:hover { color: var(--ink); }

.footer__bottom {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-4);
  justify-content: space-between;
  align-items: center;
  margin-top: var(--s-8);
  padding-top: var(--s-5);
  border-top: 1px solid var(--line);
  font-size: var(--fs-xs);
  color: var(--ink-3);
}

.footer__legal { max-width: 78ch; margin-top: var(--s-5); font-size: var(--fs-xs); color: var(--ink-3); line-height: 1.6; }

/* ---------- 15. Document / legal pages ---------------------------------- */

.doc-hero { padding-block: clamp(3rem, 2rem + 4vw, 5rem) var(--s-6); border-bottom: 1px solid var(--line); }
.doc-hero .h1 { margin-top: var(--s-4); }
.doc-hero .lead { margin-top: var(--s-4); }

.doc-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2) var(--s-5);
  margin-top: var(--s-5);
}
.doc-meta > div { display: flex; gap: 0.4rem; }
.doc-meta dt { color: var(--ink-3); }
.doc-meta dd { margin: 0; color: var(--ink-2); }

.doc-layout {
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr);
  gap: clamp(2rem, 1rem + 4vw, 4.5rem);
  padding-block: var(--s-8);
  align-items: start;
}
@media (max-width: 940px) { .doc-layout { grid-template-columns: 1fr; gap: var(--s-6); } }

.toc { position: sticky; top: 6rem; }
@media (max-width: 940px) {
  .toc { position: static; padding: var(--s-4); border: 1px solid var(--line); border-radius: var(--r-3); background: var(--surface); }
  .toc__list { max-height: 15rem; overflow-y: auto; }
}

.toc h2 {
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
  font-weight: 400;
  margin-bottom: var(--s-4);
}
.toc__list { list-style: none; padding: 0; display: grid; gap: 1px; border-left: 1px solid var(--line); }
.toc__list a {
  display: block;
  padding: 0.42rem 0 0.42rem var(--s-4);
  margin-left: -1px;
  border-left: 1px solid transparent;
  font-size: var(--fs-xs);
  line-height: 1.45;
  color: var(--ink-3);
  text-decoration: none;
  transition: color var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.toc__list a:hover { color: var(--ink-2); }
.toc__list a[aria-current="true"] { color: var(--ink); border-left-color: var(--accent); }

.prose { max-width: var(--measure); font-size: var(--fs-sm); line-height: 1.72; color: var(--ink-2); }
.prose > * + * { margin-top: var(--s-4); }

.prose h2 {
  font-family: var(--font-display);
  font-size: clamp(1.35rem, 1.2rem + 0.7vw, 1.7rem);
  line-height: 1.2;
  letter-spacing: -0.022em;
  font-weight: 400;
  color: var(--ink);
  margin-top: var(--s-8);
  padding-top: var(--s-5);
  border-top: 1px solid var(--line);
}
.prose > h2:first-child { margin-top: 0; padding-top: 0; border-top: 0; }

.prose h3 {
  font-size: 1.02rem;
  font-weight: 620;
  letter-spacing: -0.015em;
  color: var(--ink);
  margin-top: var(--s-6);
}

.prose a { color: var(--ink); font-weight: 500; }
.prose strong { color: var(--ink); font-weight: 620; }

.prose ul, .prose ol { padding-left: 1.25rem; display: grid; gap: var(--s-3); }
.prose li::marker { color: var(--ink-3); }
.prose li > ul, .prose li > ol { margin-top: var(--s-3); }

.prose code {
  font-family: var(--font-mono);
  font-size: 0.86em;
  padding: 0.12em 0.4em;
  border: 1px solid var(--line);
  border-radius: var(--r-1);
  background: var(--surface-hi);
  color: var(--ink);
}

.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--line); border-radius: var(--r-3); }

.prose table { width: 100%; border-collapse: collapse; font-size: var(--fs-xs); min-width: 480px; }
.prose th, .prose td { text-align: left; vertical-align: top; padding: 0.7rem 0.9rem; border-bottom: 1px solid var(--line); }
.prose thead th {
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-3);
  font-weight: 400;
  background: var(--surface);
}
.prose tbody tr:last-child td { border-bottom: 0; }
.prose td strong { color: var(--ink); }

.anchor {
  scroll-margin-top: 6.5rem;
}

.back-top {
  position: fixed;
  right: var(--gutter);
  bottom: var(--gutter);
  z-index: 90;
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: opacity var(--dur) var(--ease), transform var(--dur) var(--ease), visibility var(--dur);
  background: var(--bg-elev);
  box-shadow: var(--shadow-2);
}
.back-top[data-show="true"] { opacity: 1; visibility: visible; transform: translateY(0); }

/* ---------- 16. Contact / support --------------------------------------- */

.contact-card {
  display: grid;
  gap: var(--s-4);
  padding: clamp(1.5rem, 1.1rem + 1.4vw, 2.25rem);
  border: 1px solid var(--line);
  border-radius: var(--r-4);
  background: var(--surface);
}
.contact-card__label {
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.contact-card__value { font-size: clamp(1.05rem, 0.98rem + 0.5vw, 1.3rem); font-weight: 560; letter-spacing: -0.02em; word-break: break-word; }
.contact-card__value a { text-decoration: none; }
.contact-card__value a:hover { color: var(--accent); }

.copy-btn { justify-self: start; }
.copy-btn[data-copied="true"] { color: var(--accent); border-color: var(--accent); }

.kv {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: var(--s-3) var(--s-5);
  font-size: var(--fs-sm);
}
.kv dt { color: var(--ink-3); }
.kv dd { margin: 0; color: var(--ink); }
@media (max-width: 520px) { .kv { grid-template-columns: 1fr; gap: var(--s-1) 0; } .kv dd { margin-bottom: var(--s-3); } }

/* ---------- 17. Status / 404 -------------------------------------------- */

.center-page {
  min-height: 74svh;
  display: grid;
  place-content: center;
  justify-items: center;
  text-align: center;
  gap: var(--s-5);
  padding-block: var(--s-9);
}
.center-page .lead { margin-inline: auto; }

/* ---------- 18. Reveal animation ---------------------------------------- */

[data-reveal] {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 700ms var(--ease-out-expo), transform 700ms var(--ease-out-expo);
}
[data-reveal][data-visible="true"] { opacity: 1; transform: none; }

[data-reveal-group] > * { transition-delay: 0ms; }
[data-reveal-group] > *:nth-child(2) { transition-delay: 70ms; }
[data-reveal-group] > *:nth-child(3) { transition-delay: 140ms; }
[data-reveal-group] > *:nth-child(4) { transition-delay: 210ms; }
[data-reveal-group] > *:nth-child(5) { transition-delay: 280ms; }
[data-reveal-group] > *:nth-child(6) { transition-delay: 350ms; }

/* Animated peptide chain in the brand mark / hero */
.chain-dash { stroke-dasharray: 4 6; animation: dash 3.2s linear infinite; }
@keyframes dash { to { stroke-dashoffset: -20; } }

/* ---------- 19. Accessibility & print ----------------------------------- */

@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; }
  .device { transform: none; }
}

@media print {
  body::before, .header, .footer, .back-top, .toc, .cta, .device-stage { display: none !important; }
  :root { --ink: #000; --ink-2: #222; --ink-3: #555; --line: #ccc; }
  body { background: #fff; color: #000; font-size: 10.5pt; }
  .doc-layout { display: block; padding-block: 0; }
  .prose { max-width: none; }
  .prose h2 { break-after: avoid; page-break-after: avoid; }
  a[href^="http"]::after { content: " (" attr(href) ")"; font-size: 8pt; color: #555; }
}
