/* =========================================================================
   Semicoded — Software for learning and medicine
   Design system: the seam. "Semi" is half; the page is split down the
   middle in the hero and the split recurs as a hairline seam elsewhere.
   Palette: gauze (pale grey-green) + green-black ink + surgical green,
   with one highlighter-yellow moment reserved for the semicolon.
   Type: Bricolage Grotesque (display) · Instrument Sans (body) ·
         JetBrains Mono (labels, the "coded" half)
   ========================================================================= */

/* ---------- Tokens ---------- */
:root {
  --gauze:      #EDEFEA;   /* page background — surgical drape, not cream */
  --gauze-2:    #E2E6DF;   /* deeper gauze */
  --white:      #F8F9F6;   /* raised light surface */
  --ink:        #101613;   /* green-black */
  --ink-2:      #182019;   /* raised dark surface */
  --ink-3:      #222C25;
  --scrub:      #1F6B58;   /* surgical green — the accent */
  --scrub-deep: #164F41;
  --scrub-lite: #8FD3BE;   /* green for text on dark */
  --marker:     #F3C623;   /* highlighter yellow — semicolon only */
  --muted:      #5C665F;   /* captions on light */
  --muted-dark: #9AA69E;   /* captions on dark */
  --line:       rgba(16,22,19,.16);
  --line-dark:  rgba(237,239,234,.16);

  --maxw: 1240px;
  --gutter: clamp(20px, 5vw, 72px);
  --radius: 3px;

  --f-display: "Bricolage Grotesque", "Helvetica Neue", Arial, sans-serif;
  --f-body: "Instrument Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --f-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --ease: cubic-bezier(.22, 1, .36, 1);
  --header-h: 72px;

  color-scheme: light;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--gauze);
  color: var(--ink);
  font-family: var(--f-body);
  font-size: clamp(16px, 1.05vw, 18px);
  line-height: 1.6;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; background: none; border: 0; }
h1, h2, h3, h4 { margin: 0; font-family: var(--f-display); font-weight: 500; line-height: 1.02; letter-spacing: -.025em; }
p { margin: 0; }
ul, dl, dd { margin: 0; padding: 0; }
ul { list-style: none; }
strong { font-weight: 600; }
:focus-visible { outline: 2px solid var(--scrub); outline-offset: 3px; border-radius: 2px; }
.section--dark :focus-visible, .section--scrub :focus-visible, .site-footer :focus-visible { outline-color: var(--marker); }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}
.skip {
  position: absolute; left: 16px; top: -100px; z-index: 100;
  background: var(--ink); color: var(--gauze); padding: 10px 14px; border-radius: var(--radius);
  font-family: var(--f-mono); font-size: 13px;
}
.skip:focus { top: 12px; }

/* ---------- Layout primitives ---------- */
.wrap { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: var(--gutter); }
.section { padding-block: clamp(80px, 11vw, 160px); position: relative; }
.section--dark { background: var(--ink); color: var(--gauze); }
.section--scrub { background: var(--scrub); color: var(--white); }

.section-head { max-width: 760px; margin-bottom: clamp(44px, 6vw, 88px); }
.section-lede { margin-top: 20px; font-size: clamp(17px, 1.25vw, 20px); color: var(--muted); max-width: 58ch; }
.section--dark .section-lede { color: var(--muted-dark); }

/* ---------- Type ---------- */
.h2 { font-size: clamp(36px, 5vw, 68px); font-variation-settings: "opsz" 96; }
.h3 { font-size: clamp(22px, 2vw, 30px); font-variation-settings: "opsz" 48; line-height: 1.12; }

.eyebrow {
  font-family: var(--f-mono); font-size: 12.5px; font-weight: 500; letter-spacing: .08em;
  text-transform: lowercase; color: var(--muted); margin-bottom: 18px;
}
.eyebrow::before { content: "// "; color: var(--scrub); }
.eyebrow--scrub { color: var(--scrub); }
.eyebrow--on-dark { color: var(--muted-dark); }
.eyebrow--on-dark::before { color: var(--scrub-lite); }
.eyebrow--on-scrub { color: rgba(248,249,246,.72); }
.eyebrow--on-scrub::before { color: var(--marker); }

/* ---------- Buttons & links ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 14px 22px; border-radius: var(--radius);
  font-family: var(--f-body); font-weight: 600; font-size: 15px; line-height: 1;
  border: 1.5px solid transparent;
  transition: background-color .25s var(--ease), color .25s var(--ease), border-color .25s var(--ease), transform .25s var(--ease);
}
.btn:hover { transform: translateY(-1px); }
.btn--ink { background: var(--ink); color: var(--gauze); border-color: var(--ink); }
.btn--ink:hover { background: var(--scrub); border-color: var(--scrub); }
.btn--ghost { background: transparent; color: var(--white); border-color: rgba(248,249,246,.45); }
.btn--ghost:hover { border-color: var(--white); background: rgba(248,249,246,.08); }
.btn--ghost.is-copied { background: var(--marker); color: var(--ink); border-color: var(--marker); }

.link-arrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-weight: 600; font-size: 15px; color: inherit;
  padding-bottom: 2px; border-bottom: 1.5px solid currentColor;
  transition: gap .25s var(--ease), color .25s var(--ease);
}
.link-arrow::after { content: "→"; transition: transform .25s var(--ease); }
.link-arrow:hover { color: var(--scrub); }
.link-arrow:hover::after { transform: translateX(4px); }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--gauze) 86%, transparent);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color .3s var(--ease);
}
.site-header.is-stuck { border-bottom-color: var(--line); }
.nav { display: flex; align-items: center; justify-content: space-between; height: var(--header-h); }

.brand {
  font-family: var(--f-display); font-weight: 600; font-size: 22px; letter-spacing: -.03em;
  font-variation-settings: "opsz" 24;
}
.brand__semi { color: var(--scrub); }

.nav-links { display: flex; align-items: center; gap: 30px; }
.nav-links a:not(.btn) { font-size: 15px; font-weight: 500; color: var(--muted); transition: color .2s; }
.nav-links a:not(.btn):hover { color: var(--ink); }
.nav-cta { margin-left: 8px; }
.nav-cta .btn { padding: 11px 16px; font-size: 14px; }

.nav-toggle {
  display: none; width: 44px; height: 44px; margin-right: -10px;
  flex-direction: column; align-items: center; justify-content: center; gap: 6px;
}
.nav-toggle span { display: block; width: 22px; height: 1.5px; background: var(--ink); transition: transform .3s var(--ease); }
.nav.open .nav-toggle span:nth-child(1) { transform: translateY(3.75px) rotate(45deg); }
.nav.open .nav-toggle span:nth-child(2) { transform: translateY(-3.75px) rotate(-45deg); }

/* ---------- Hero: the seam ---------- */
.hero {
  position: relative; isolation: isolate; overflow: hidden;
  min-height: calc(100svh - var(--header-h));
  display: flex; align-items: stretch;
}
.hero__half { position: absolute; top: 0; bottom: 0; width: 50%; z-index: 0; }
.hero__half--light { left: 0; background: var(--gauze); }
.hero__half--dark { right: 0; background: var(--ink); }

.hero__content {
  position: relative;   /* no z-index: a stacking context here would trap the headline's blend */
  display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: auto 1fr;
  column-gap: var(--gutter);
  padding-top: clamp(56px, 9vh, 120px); padding-bottom: clamp(48px, 7vh, 96px);
}

.hero__title {
  grid-column: 1 / -1;
  font-size: clamp(64px, 14vw, 215px);   /* sized so "Half of it" always crosses the seam on desktop */
  font-weight: 500; letter-spacing: -.045em; line-height: .9;
  font-variation-settings: "opsz" 96;
  margin-bottom: clamp(40px, 6vh, 80px);
  /* The headline straddles the seam: ink on the light half, gauze on the dark half.
     --seam (px from the headline's left edge to the seam) is set by main.js. */
  --seam: 50%;
  color: var(--ink);
  background-image: linear-gradient(90deg, var(--ink) var(--seam), var(--gauze) var(--seam));
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
/* Without JS the seam offset is unknown: fall back to inverting the text over each half. */
html:not(.js) .hero__title { background: none; color: #fff; -webkit-text-fill-color: #fff; mix-blend-mode: difference; }
.hero__line { display: block; }
.hero__semi { color: var(--marker); -webkit-text-fill-color: var(--marker); }

.hero__lede { grid-column: 1; align-self: end; max-width: 520px; padding-right: clamp(0px, 3vw, 40px); }
.hero__sub {
  font-family: var(--f-display); font-variation-settings: "opsz" 48;
  font-size: clamp(20px, 1.9vw, 27px); font-weight: 500; letter-spacing: -.02em; line-height: 1.22;
}
.hero__desc { margin-top: 18px; color: var(--muted); font-size: clamp(15.5px, 1.05vw, 17.5px); max-width: 50ch; }
.hero__actions { margin-top: 30px; display: flex; flex-wrap: wrap; align-items: center; gap: 24px; }

.hero__mark {
  grid-column: 2; align-self: end; justify-self: end;
  display: flex; align-items: flex-end; gap: clamp(20px, 3vw, 48px);
  color: var(--gauze);
}
.hero__mark-note {
  font-family: var(--f-mono); font-size: 13px; line-height: 1.7; color: var(--scrub-lite);
  padding-bottom: clamp(20px, 3vw, 44px);
}
.hero__mark-glyph {
  font-family: var(--f-display); font-weight: 600; letter-spacing: -.05em;
  font-size: clamp(160px, 26vw, 400px); line-height: .7; color: var(--marker);
  transform: translateY(6%);
}

/* Load sequence */
.js .hero__half { transform: scaleX(0); }
.js .hero__half--light { transform-origin: left; }
.js .hero__half--dark { transform-origin: right; }
.js .hero__line, .js .hero__lede, .js .hero__mark { opacity: 0; transform: translateY(18px); }
.js .hero.is-ready .hero__half { transform: scaleX(1); transition: transform .9s var(--ease); }
.js .hero.is-ready .hero__line { opacity: 1; transform: none; transition: opacity .7s var(--ease) .45s, transform .8s var(--ease) .45s; }
.js .hero.is-ready .hero__line:nth-child(2) { transition-delay: .58s; }
.js .hero.is-ready .hero__lede { opacity: 1; transform: none; transition: opacity .7s var(--ease) .85s, transform .8s var(--ease) .85s; }
.js .hero.is-ready .hero__mark { opacity: 1; transform: none; transition: opacity .7s var(--ease) 1s, transform .8s var(--ease) 1s; }

/* ---------- Focus ---------- */
.focus__grid {
  display: grid; grid-template-columns: 1fr 1px 1fr; column-gap: clamp(32px, 5vw, 80px); row-gap: 56px;
}
.focus__seam { background: var(--line); }
.focus__col .h3 { margin-bottom: 18px; max-width: 18ch; }
.focus__col > p { color: var(--muted); max-width: 52ch; }

.semi-list { margin-top: 28px; border-top: 1px solid var(--line); }
.semi-list li {
  display: grid; grid-template-columns: 22px 1fr; gap: 12px; align-items: baseline;
  padding: 14px 0; border-bottom: 1px solid var(--line); font-weight: 500;
}
.semi-list li::before {
  content: ";"; font-family: var(--f-display); font-weight: 600; color: var(--scrub);
  font-size: 1.25em; line-height: 1;
}

/* ---------- Approach ---------- */
.principles { border-top: 1px solid var(--line-dark); }
.principle {
  display: grid; grid-template-columns: minmax(120px, 220px) 1fr; column-gap: clamp(24px, 4vw, 64px);
  padding: clamp(28px, 3.6vw, 48px) 0; border-bottom: 1px solid var(--line-dark);
}
.principle__verb {
  font-family: var(--f-mono); font-size: 14px; color: var(--scrub-lite); letter-spacing: .04em;
}
.principle__verb::after { content: "();"; color: var(--muted-dark); }
.principle dd .h3 { margin-bottom: 12px; max-width: 24ch; }
.principle dd p { color: var(--muted-dark); max-width: 56ch; }

/* ---------- Founder ---------- */
.founder__grid { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); column-gap: clamp(40px, 7vw, 120px); row-gap: 48px; align-items: start; }
.founder__text .h2 { margin-bottom: 28px; max-width: 16ch; }
.founder__text p { color: var(--muted); max-width: 58ch; }
.founder__text p + p { margin-top: 16px; }
.founder__text .link-arrow { margin-top: 28px; }

.chart { border-top: 1px solid var(--line); margin-top: 8px; }
.chart__row {
  display: grid; grid-template-columns: 110px 1fr; gap: 16px; align-items: baseline;
  padding: 16px 0; border-bottom: 1px solid var(--line);
}
.chart__row dt { font-family: var(--f-mono); font-size: 12.5px; color: var(--muted); letter-spacing: .04em; }
.chart__row dd { font-weight: 500; }

/* ---------- Contact ---------- */
.contact__grid { display: grid; grid-template-columns: 1fr 1fr; column-gap: clamp(40px, 7vw, 120px); row-gap: 40px; align-items: end; }
.contact .h2 { margin-bottom: 20px; }
.contact__lede { color: rgba(248,249,246,.78); max-width: 48ch; font-size: clamp(16px, 1.15vw, 19px); }
.contact__action { display: flex; flex-direction: column; align-items: flex-start; gap: 22px; }
.contact__email {
  font-family: var(--f-display); font-variation-settings: "opsz" 96;
  font-size: clamp(28px, 3.6vw, 52px); font-weight: 500; letter-spacing: -.03em; line-height: 1.05;
  overflow-wrap: anywhere;
  border-bottom: 2px solid rgba(248,249,246,.35); padding-bottom: 6px;
  transition: border-color .25s var(--ease);
}
.contact__email:hover { border-color: var(--marker); }

/* ---------- Footer ---------- */
.site-footer { background: var(--ink); color: var(--gauze); padding-block: 48px; border-top: 1px solid var(--line-dark); }
.footer__grid { display: grid; grid-template-columns: auto 1fr auto; align-items: center; column-gap: 40px; row-gap: 16px; }
.brand--footer { color: var(--gauze); }
.footer__line { color: var(--muted-dark); font-size: 15px; }
.footer__links { display: flex; gap: 24px; font-size: 14px; }
.footer__links a { color: var(--muted-dark); border-bottom: 1px solid transparent; transition: color .2s, border-color .2s; }
.footer__links a:hover { color: var(--gauze); border-color: var(--gauze); }
.footer__copy { grid-column: 1 / -1; font-family: var(--f-mono); font-size: 12px; color: var(--muted-dark); }

/* ---------- Scroll reveal ---------- */
.js .reveal { opacity: 0; transform: translateY(16px); transition: opacity .7s var(--ease), transform .8s var(--ease); }
.js .reveal.in { opacity: 1; transform: none; }

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
  .founder__grid, .contact__grid { grid-template-columns: 1fr; }
  .principle { grid-template-columns: 1fr; row-gap: 12px; }
  .footer__grid { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  :root { --header-h: 64px; }
  .nav-toggle { display: flex; }
  .nav-links {
    position: absolute; left: 0; right: 0; top: var(--header-h);
    flex-direction: column; align-items: stretch; gap: 0;
    background: var(--gauze); border-bottom: 1px solid var(--line);
    padding: 8px var(--gutter) 20px; display: none;
  }
  .nav-links.open { display: flex; }
  .nav-links li a:not(.btn) { display: block; padding: 14px 0; font-size: 17px; border-bottom: 1px solid var(--line); }
  .nav-cta { margin: 16px 0 0; }
  .nav-cta .btn { width: 100%; justify-content: center; padding: 14px; }

  /* Hero seam turns horizontal: the headline and lede sit on gauze,
     the semicolon block becomes a full-bleed dark band beneath them. */
  .hero { min-height: auto; background: var(--gauze); }
  .hero__half { display: none; }
  .hero__title, html:not(.js) .hero__title {
    background: none; color: var(--ink); -webkit-text-fill-color: var(--ink); mix-blend-mode: normal;
    font-size: clamp(56px, 17vw, 96px); margin-bottom: 28px;
  }
  .hero__semi { -webkit-text-fill-color: var(--marker); }
  .hero__content { grid-template-columns: 1fr; grid-template-rows: auto auto auto; padding-top: 48px; padding-bottom: 0; }
  .hero__lede { grid-column: 1; padding-right: 0; padding-bottom: 44px; }
  .hero__mark {
    grid-column: 1; justify-self: stretch; justify-content: space-between;
    margin-inline: calc(-1 * var(--gutter)); padding: 28px var(--gutter) 0;
    background: var(--ink);
  }
  .hero__mark-glyph { font-size: clamp(140px, 40vw, 220px); }
  .hero__mark-note { padding-bottom: 22px; }

  .focus__grid { grid-template-columns: 1fr; }
  .focus__seam { height: 1px; width: 100%; }
  .chart__row { grid-template-columns: 96px 1fr; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .js .hero__half, .js .hero__line, .js .hero__lede, .js .hero__mark { opacity: 1; transform: none; transition: none; }
  .js .reveal { opacity: 1; transform: none; transition: none; }
  .btn, .link-arrow, .link-arrow::after { transition: none; }
}
