/* ==========================================================================
   StickyBlurb — editorial design system
   Fraunces (display serif) · Inter (text) · Geist Mono (labels)
   ========================================================================== */

/* --------------------------------------------------------------------------
   Tokens
   -------------------------------------------------------------------------- */
:root {
  /* Warm "paper & ink" light palette */
  --paper:        #f3f1ea;   /* warm bone */
  --paper-2:      #eceae1;   /* slightly deeper panel */
  --surface:      #faf9f5;   /* raised card */
  --ink:          #14130f;   /* near-black, warm */
  --ink-2:        #3a382f;   /* secondary text */
  --ink-3:        #6f6c5f;   /* muted / captions */
  --hairline:     #d7d3c6;   /* hairline rules */
  --hairline-2:   #c7c2b2;

  /* Inverted (dark) block */
  --night:        #14130f;
  --night-2:      #1d1c17;
  --night-text:   #f3f1ea;
  --night-muted:  #a8a496;
  --night-line:   #34322a;

  /* One confident accent — electric cobalt */
  --accent:       #2b2bff;
  --accent-ink:   #1a1ad6;
  --accent-soft:  #e3e2ff;

  --font-display: 'Fraunces', 'Times New Roman', Georgia, serif;
  --font-text:    'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --font-mono:    'Geist Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  /* Fluid type scale */
  --t-micro:  0.72rem;
  --t-label:  clamp(0.72rem, 0.9vw, 0.8rem);
  --t-sm:     clamp(0.85rem, 1.1vw, 0.95rem);
  --t-body:   clamp(1rem, 1.2vw, 1.1rem);
  --t-lead:   clamp(1.15rem, 1.8vw, 1.4rem);
  --t-h3:     clamp(1.3rem, 2.4vw, 1.75rem);
  --t-h2:     clamp(2rem, 5vw, 3.4rem);
  --t-h1:     clamp(2.8rem, 8.5vw, 7.5rem);
  --t-num:    clamp(2.5rem, 6vw, 5rem);

  --maxw:        80rem;     /* 1280 */
  --maxw-text:   46rem;
  --gutter:      clamp(1.25rem, 5vw, 4rem);
  --header-h:    72px;

  --ease:        cubic-bezier(0.22, 1, 0.36, 1);
  --dur:         0.7s;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper:      #100f0c;
    --paper-2:    #16140f;
    --surface:    #1a1813;
    --ink:        #f3f1ea;
    --ink-2:      #cdc9bc;
    --ink-3:      #8e8a7c;
    --hairline:   #2c2a23;
    --hairline-2: #3a382e;

    --night:      #050505;
    --night-2:    #0f0e0b;
    --night-text: #f3f1ea;
    --night-muted:#9a968a;
    --night-line: #2a2823;

    --accent:     #6f6fff;
    --accent-ink: #9a9aff;
    --accent-soft:#1a1937;
  }
}

/* --------------------------------------------------------------------------
   Reset / base
   -------------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  color-scheme: light dark;
  -webkit-text-size-adjust: 100%;
}
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

body {
  font-family: var(--font-text);
  font-size: var(--t-body);
  line-height: 1.6;
  font-feature-settings: 'ss01', 'cv05';
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100dvh;
  overflow-x: hidden;
}

/* Subtle film grain — gives the page tactile, "art-directed" feel */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%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%; }

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

a { color: inherit; text-decoration: none; }
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
  border-radius: 2px;
}

/* --------------------------------------------------------------------------
   Layout primitives
   -------------------------------------------------------------------------- */
.wrap {
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.rule { height: 1px; background: var(--hairline); border: 0; }

/* Reusable mono label / eyebrow */
.label {
  font-family: var(--font-mono);
  font-size: var(--t-label);
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.label--accent { color: var(--accent); }

/* --------------------------------------------------------------------------
   Header
   -------------------------------------------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: color-mix(in oklab, var(--paper) 80%, transparent);
  backdrop-filter: blur(14px) saturate(160%);
  -webkit-backdrop-filter: blur(14px) saturate(160%);
  border-bottom: 1px solid var(--hairline);
}
.site-header__inner {
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--gutter);
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.35rem;
  letter-spacing: -0.02em;
  color: var(--ink);
}
.wordmark__glyph {
  width: 22px; height: 22px;
  color: var(--accent);
  flex-shrink: 0;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: clamp(0.5rem, 2vw, 2rem);
}
.site-nav__link {
  font-family: var(--font-mono);
  font-size: var(--t-label);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-2);
  position: relative;
  padding: 0.4rem 0;
  transition: color 0.25s var(--ease);
}
.site-nav__link::after {
  content: '';
  position: absolute;
  left: 0; bottom: -2px;
  width: 100%; height: 1px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.35s var(--ease);
}
.site-nav__link:hover { color: var(--ink); }
.site-nav__link:hover::after { transform: scaleX(1); }
.site-nav__link--cta {
  color: var(--accent);
}

.nav-toggle {
  display: none;
  width: 40px; height: 40px;
  border: 1px solid var(--hairline-2);
  border-radius: 999px;
  background: transparent;
  cursor: pointer;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  color: var(--ink);
}
.nav-toggle span {
  display: block;
  width: 15px; height: 1.5px;
  background: currentColor;
  transition: transform 0.3s var(--ease), opacity 0.2s;
}
.nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(5.5px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-5.5px) rotate(-45deg); }

@media (max-width: 720px) {
  .nav-toggle { display: flex; }
  .site-nav {
    position: fixed;
    inset: var(--header-h) 0 auto 0;
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    background: var(--surface);
    border-bottom: 1px solid var(--hairline);
    padding: var(--gutter);
    transform: translateY(-8px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s var(--ease), transform 0.3s var(--ease);
  }
  .site-nav.is-open { opacity: 1; transform: none; pointer-events: auto; }
  .site-nav__link {
    font-size: 1rem;
    padding: 0.85rem 0;
    width: 100%;
    border-bottom: 1px solid var(--hairline);
  }
  .site-nav__link::after { display: none; }
}

/* --------------------------------------------------------------------------
   Buttons / link-arrows
   -------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--font-mono);
  font-size: var(--t-label);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 0.95rem 1.6rem;
  border-radius: 999px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.3s var(--ease), background 0.3s var(--ease), color 0.3s var(--ease), border-color 0.3s var(--ease);
}
.btn:hover { transform: translateY(-2px); }
.btn__arrow { transition: transform 0.3s var(--ease); }
.btn:hover .btn__arrow { transform: translate(3px, -3px); }

.btn--solid { background: var(--ink); color: var(--paper); }
.btn--solid:hover { background: var(--accent); color: #fff; }

.btn--ghost { border-color: var(--hairline-2); color: var(--ink); }
.btn--ghost:hover { border-color: var(--ink); }

.btn--accent { background: var(--accent); color: #fff; }
.btn--accent:hover { background: var(--accent-ink); }

.btn--on-night { background: var(--night-text); color: var(--night); }
.btn--on-night:hover { background: var(--accent); color: #fff; }

.btn--ghost-night { border-color: var(--night-line); color: var(--night-text); }
.btn--ghost-night:hover { border-color: var(--night-text); }

/* Inline editorial link */
.ilink {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-family: var(--font-mono);
  font-size: var(--t-sm);
  letter-spacing: 0.04em;
  color: var(--ink);
  border-bottom: 1px solid var(--hairline-2);
  padding-bottom: 2px;
  transition: color 0.25s var(--ease), border-color 0.25s var(--ease);
}
.ilink:hover { color: var(--accent); border-color: var(--accent); }
.ilink__arrow { transition: transform 0.3s var(--ease); }
.ilink:hover .ilink__arrow { transform: translate(2px, -2px); }

/* --------------------------------------------------------------------------
   Sections / shared
   -------------------------------------------------------------------------- */
.section { padding-block: clamp(4rem, 11vw, 9rem); }
.section--tight { padding-block: clamp(3rem, 7vw, 6rem); }

.section-head {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  margin-bottom: clamp(2.5rem, 6vw, 4.5rem);
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--hairline);
}
.section-head__index {
  font-family: var(--font-mono);
  font-size: var(--t-label);
  color: var(--accent);
  letter-spacing: 0.12em;
}
.section-head__title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: var(--t-h2);
  line-height: 1.02;
  letter-spacing: -0.02em;
  color: var(--ink);
  margin-left: auto;
  text-align: right;
  max-width: 60%;
}
@media (max-width: 640px) {
  .section-head { flex-direction: column; gap: 0.5rem; }
  .section-head__title { margin-left: 0; text-align: left; max-width: 100%; }
}

/* --------------------------------------------------------------------------
   Hero
   -------------------------------------------------------------------------- */
.hero {
  position: relative;
  padding-block: clamp(3rem, 9vw, 8rem) clamp(3rem, 7vw, 6rem);
  min-height: calc(100svh - var(--header-h));
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.hero__eyebrow {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  margin-bottom: clamp(1.5rem, 4vw, 2.5rem);
}
.hero__eyebrow .dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px color-mix(in oklab, var(--accent) 20%, transparent);
}

.hero__title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: var(--t-h1);
  line-height: 0.95;
  letter-spacing: -0.035em;
  color: var(--ink);
  max-width: 16ch;
}
.hero__title em {
  font-style: italic;
  font-weight: 300;
  color: var(--accent);
}

.hero__lead {
  font-size: var(--t-lead);
  line-height: 1.45;
  color: var(--ink-2);
  max-width: 40ch;
  margin-top: clamp(1.75rem, 4vw, 2.75rem);
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: clamp(2rem, 5vw, 3rem);
}

.hero__foot {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 1rem;
  margin-top: clamp(3rem, 8vw, 6rem);
  padding-top: 1.25rem;
  border-top: 1px solid var(--hairline);
  flex-wrap: wrap;
}
.hero__foot .label { line-height: 1.5; }

/* big ghost pause glyph, decorative */
.hero__mark {
  position: absolute;
  right: calc(-1 * var(--gutter));
  top: 50%;
  transform: translateY(-50%);
  width: min(42vw, 30rem);
  height: auto;
  color: var(--ink);
  opacity: 0.04;
  pointer-events: none;
  z-index: -1;
}
@media (max-width: 900px) { .hero__mark { opacity: 0.03; right: -10%; } }

/* --------------------------------------------------------------------------
   Patent — editorial spec sheet
   -------------------------------------------------------------------------- */
.spec {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: clamp(2rem, 6vw, 5rem);
  align-items: start;
}
@media (max-width: 860px) { .spec { grid-template-columns: 1fr; } }

.spec__title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: var(--t-h3);
  line-height: 1.1;
  letter-spacing: -0.015em;
  color: var(--ink);
  margin-bottom: 1.5rem;
}
.spec__abstract {
  font-size: var(--t-body);
  color: var(--ink-2);
  line-height: 1.7;
  margin-bottom: 2rem;
  max-width: 50ch;
}
.spec__actions { display: flex; flex-wrap: wrap; gap: 1.25rem 2rem; }

/* the data table */
.datasheet { border-top: 1px solid var(--ink); }
.datasheet__row {
  display: grid;
  grid-template-columns: 1fr 1.3fr;
  gap: 1rem;
  padding: 0.95rem 0;
  border-bottom: 1px solid var(--hairline);
  align-items: baseline;
}
.datasheet__key {
  font-family: var(--font-mono);
  font-size: var(--t-label);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.datasheet__val {
  font-size: var(--t-sm);
  color: var(--ink);
}
.datasheet__val--accent { color: var(--accent); font-family: var(--font-mono); }

.status-dot {
  display: inline-flex; align-items: center; gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: var(--t-sm);
}
.status-dot::before {
  content: '';
  width: 7px; height: 7px; border-radius: 50%;
  background: #16a34a;
  box-shadow: 0 0 0 3px color-mix(in oklab, #16a34a 25%, transparent);
}

/* --------------------------------------------------------------------------
   Process — numbered editorial index
   -------------------------------------------------------------------------- */
.process { border-top: 1px solid var(--hairline); }

.step {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: clamp(1.5rem, 5vw, 4rem);
  padding: clamp(1.75rem, 4vw, 2.75rem) 0;
  border-bottom: 1px solid var(--hairline);
  align-items: start;
  transition: background 0.4s var(--ease);
}
.step:hover { background: color-mix(in oklab, var(--accent) 4%, transparent); }
.step__num {
  font-family: var(--font-display);
  font-weight: 300;
  font-size: var(--t-num);
  line-height: 0.85;
  color: var(--accent);
  letter-spacing: -0.03em;
}
.step__body { max-width: 60ch; }
.step__title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: var(--t-h3);
  letter-spacing: -0.01em;
  color: var(--ink);
  margin-bottom: 0.6rem;
}
.step__desc { color: var(--ink-2); line-height: 1.65; }

/* --------------------------------------------------------------------------
   CTA — inverted night block
   -------------------------------------------------------------------------- */
.cta {
  background: var(--night);
  color: var(--night-text);
  border-radius: clamp(20px, 3vw, 36px);
  padding: clamp(3rem, 9vw, 7rem) var(--gutter);
  position: relative;
  overflow: hidden;
}
.cta::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(60% 80% at 85% 15%, color-mix(in oklab, var(--accent) 35%, transparent) 0%, transparent 60%),
    radial-gradient(50% 60% at 10% 90%, color-mix(in oklab, var(--accent) 18%, transparent) 0%, transparent 55%);
  pointer-events: none;
}
.cta__inner { position: relative; max-width: var(--maxw-text); }
.cta__label { color: var(--accent-ink); }
.cta__title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: var(--t-h2);
  line-height: 1.0;
  letter-spacing: -0.025em;
  margin: 1.25rem 0 1.5rem;
}
.cta__title em { font-style: italic; font-weight: 300; }
.cta__lead {
  color: var(--night-muted);
  font-size: var(--t-lead);
  line-height: 1.5;
  max-width: 42ch;
  margin-bottom: clamp(2rem, 5vw, 3rem);
}
.cta__actions { display: flex; flex-wrap: wrap; gap: 1rem; }

/* --------------------------------------------------------------------------
   Other developments
   -------------------------------------------------------------------------- */
.projects { display: grid; gap: 1px; background: var(--hairline); border-block: 1px solid var(--hairline); }
.project {
  background: var(--paper);
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: clamp(1rem, 4vw, 3rem);
  align-items: center;
  padding: clamp(1.75rem, 4vw, 2.5rem) 0;
  transition: background 0.4s var(--ease);
}
.project:hover { background: var(--surface); }
.project__tag {
  font-family: var(--font-mono);
  font-size: var(--t-label);
  letter-spacing: 0.12em;
  color: var(--ink-3);
  white-space: nowrap;
}
.project__main { max-width: 60ch; }
.project__name {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: var(--t-h3);
  color: var(--ink);
  margin-bottom: 0.4rem;
}
.project__desc { color: var(--ink-2); font-size: var(--t-sm); line-height: 1.6; }
.project__links { display: flex; gap: 1.5rem; flex-shrink: 0; }
@media (max-width: 760px) {
  .project { grid-template-columns: 1fr; gap: 1rem; }
  .project__links { flex-wrap: wrap; }
}

/* --------------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------------- */
.site-footer {
  background: var(--night);
  color: var(--night-text);
  padding-block: clamp(3rem, 8vw, 6rem);
  margin-top: clamp(4rem, 10vw, 8rem);
}
.site-footer__top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 2rem;
  flex-wrap: wrap;
  padding-bottom: clamp(2.5rem, 6vw, 4rem);
  border-bottom: 1px solid var(--night-line);
}
.site-footer__brand {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(2rem, 7vw, 4rem);
  line-height: 0.95;
  letter-spacing: -0.03em;
}
.site-footer__cols {
  display: flex;
  gap: clamp(2rem, 6vw, 5rem);
  flex-wrap: wrap;
}
.fcol { display: flex; flex-direction: column; gap: 0.85rem; }
.fcol__h {
  font-family: var(--font-mono);
  font-size: var(--t-label);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--night-muted);
  margin-bottom: 0.25rem;
}
.fcol a {
  font-size: var(--t-sm);
  color: var(--night-text);
  transition: color 0.25s var(--ease);
  width: fit-content;
}
.fcol a:hover { color: var(--accent-ink); }
.site-footer__bottom {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: clamp(2rem, 5vw, 3rem);
}
.site-footer__bottom .label { color: var(--night-muted); }

/* --------------------------------------------------------------------------
   Legal page
   -------------------------------------------------------------------------- */
.legal { padding-block: clamp(3rem, 7vw, 6rem); }
.legal__head { margin-bottom: clamp(2.5rem, 6vw, 4rem); padding-bottom: 2rem; border-bottom: 1px solid var(--ink); }
.legal__back { margin-bottom: 2rem; }
.legal__title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: var(--t-h2);
  line-height: 1.02;
  letter-spacing: -0.025em;
  color: var(--ink);
}
.legal__meta { font-family: var(--font-mono); font-size: var(--t-label); letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-3); margin-top: 1rem; }

.prose { max-width: var(--maxw-text); }
.prose h2 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: var(--t-h3);
  letter-spacing: -0.01em;
  color: var(--ink);
  margin-top: clamp(2.5rem, 6vw, 3.5rem);
  margin-bottom: 0.85rem;
}
.prose p { color: var(--ink-2); margin-bottom: 1rem; line-height: 1.7; }
.prose ul { padding-left: 1.4rem; margin-bottom: 1rem; }
.prose li { color: var(--ink-2); margin-bottom: 0.5rem; line-height: 1.6; }
.prose strong { color: var(--ink); font-weight: 600; }
.prose a { color: var(--accent); border-bottom: 1px solid var(--accent-soft); }
.prose a:hover { border-color: var(--accent); }

/* --------------------------------------------------------------------------
   Scroll reveal
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: no-preference) {
  [data-reveal] {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity var(--dur) var(--ease), transform var(--dur) var(--ease);
    transition-delay: var(--reveal-delay, 0s);
  }
  [data-reveal].is-in { opacity: 1; transform: none; }
}

/* --------------------------------------------------------------------------
   Utility
   -------------------------------------------------------------------------- */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
