/* Turqoize Labs, shared tokens */
@import url('https://fonts.googleapis.com/css2?family=Fraunces:ital,opsz,wght@0,9..144,400;0,9..144,600;1,9..144,400;1,9..144,600&family=Inter:wght@400;500&family=IBM+Plex+Mono:wght@400;500&display=swap');

:root {
  --paper: #FAFAF6;
  --ink:   #0F1414;
  --turq:  #0F8479;
  --stone: #6B6B66;
  --line:  #DDD9D0;
  --soft:  #F1EFE8;
  --wash:  #E6F1EE;
  --deep:  #0A5A52;

  --serif: 'Fraunces', Georgia, serif;
  --sans:  'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --mono:  'IBM Plex Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  --s-4: 4px; --s-8: 8px; --s-12: 12px; --s-16: 16px;
  --s-24: 24px; --s-32: 32px; --s-48: 48px; --s-64: 64px; --s-96: 96px;

  --r-4: 4px; --r-8: 8px; --r-12: 12px;

  --container: 1240px;

  --ease-out-expo:  cubic-bezier(0.16, 1, 0.3, 1);
  --ease-out-quint: cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  /* Subtle floor-plan grid background */
  background-image:
    linear-gradient(to right, rgba(15,132,121,0.025) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(15,132,121,0.025) 1px, transparent 1px);
  background-size: 32px 32px;
  background-position: -1px -1px;
}

/* Typography ─────────────────────────────────────────── */
h1, h2, h3, h4 { margin: 0; font-weight: 400; line-height: 1.25; letter-spacing: -0.015em; text-wrap: balance; }
h1 { font-family: var(--serif); font-size: 36px; }
h2 { font-family: var(--serif); font-size: 22px; }
h3 { font-family: var(--sans); font-weight: 500; font-size: 16px; letter-spacing: 0; }
p  { margin: 0; }

a { color: var(--turq); text-decoration: none; border-bottom: 0.5px solid currentColor; transition: color .15s ease; }
a:hover { color: var(--deep); }
a.unstyled { color: inherit; border: none; }

.mono { font-family: var(--mono); font-size: 11px; letter-spacing: 0.02em; color: var(--stone); text-transform: lowercase; }
.mono-lg { font-family: var(--mono); font-size: 13px; letter-spacing: 0.02em; color: var(--stone); }
.stone { color: var(--stone); }
.ink   { color: var(--ink); }
.turq  { color: var(--turq); }

/* Layout ─────────────────────────────────────────────── */
.container { max-width: var(--container); margin: 0 auto; padding: 0 clamp(24px, 4vw, 48px); }
.section   { padding: 64px 0; }
.section-editorial { padding: 96px 0; }
.hairline  { border: none; border-top: 0.5px solid var(--line); margin: 0; }

/* Nav ────────────────────────────────────────────────── */
.nav {
  position: sticky; top: 0; z-index: 50;
  height: 56px;
  background: rgba(250,250,246,0.92);
  backdrop-filter: saturate(180%) blur(8px);
  border-bottom: 0.5px solid var(--line);
  transition: box-shadow .35s ease;
}
.nav.scrolled { box-shadow: 0 8px 24px rgba(15,20,20,0.06); }
.nav-inner {
  max-width: var(--container);
  margin: 0 auto; padding: 0 24px;
  height: 100%;
  display: flex; align-items: center; justify-content: space-between;
}
.nav-brand { display: flex; align-items: center; gap: 10px; border: none; color: var(--ink); }
.nav-brand .wordmark { font-family: var(--mono); font-weight: 500; font-size: 13px; letter-spacing: -0.01em; color: var(--ink); }
.nav-links { display: flex; gap: 28px; align-items: center; }
.nav-links a {
  font-family: var(--sans); font-size: 13px; color: var(--stone);
  border: none; position: relative; padding: 4px 0;
}
.nav-links a:hover { color: var(--ink); }
.nav-links a.active { color: var(--ink); }
.nav-links a::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: -2px;
  height: 1px; background: var(--turq);
  transform: scaleX(0); transform-origin: 0 50%;
  transition: transform .35s var(--ease-out-quint);
}
.nav-links a:hover::after, .nav-links a.active::after { transform: scaleX(1); }

/* Buttons ────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 16px;
  background: transparent;
  background-image: linear-gradient(var(--ink), var(--ink));
  background-size: 0% 100%;
  background-repeat: no-repeat;
  background-position: 0 0;
  border: 0.5px solid var(--ink);
  color: var(--ink);
  font: 500 13px var(--sans);
  border-radius: var(--r-8);
  cursor: pointer;
  transition: background-size .35s var(--ease-out-quint), color .2s ease, border-color .2s ease, transform .12s ease;
}
.btn:hover { background-size: 100% 100%; color: var(--paper); }
.btn { transform: translate(var(--tx, 0px), var(--ty, 0px)); }
.btn:active { transform: translate(var(--tx, 0px), var(--ty, 0px)) scale(0.98); }
.btn span[aria-hidden] { transition: transform .3s var(--ease-out-quint); }
.btn:hover span[aria-hidden] { transform: translateX(3px); }
.btn-turq { border-color: var(--turq); color: var(--turq); background-image: linear-gradient(var(--turq), var(--turq)); }
.btn-turq:hover { color: var(--paper); }

/* Cards ──────────────────────────────────────────────── */
.card {
  position: relative;
  background: var(--paper);
  border: 0.5px solid var(--line);
  border-radius: var(--r-12);
  padding: 18px;
  display: block;
  color: inherit;
  text-decoration: none;
  border-bottom: 0.5px solid var(--line);
  transition: border-color .25s ease, transform .35s var(--ease-out-quint), box-shadow .35s ease;
}
.card:hover { border-color: var(--ink); transform: translateY(-3px); box-shadow: 0 14px 32px rgba(15,20,20,0.06); }
/* Drafting-corner brackets, drawn on hover */
.card::before, .card::after {
  content: ''; position: absolute; width: 10px; height: 10px;
  opacity: 0; pointer-events: none;
  transition: opacity .3s ease, transform .35s var(--ease-out-quint);
}
.card::before {
  top: 6px; left: 6px;
  border-top: 1px solid var(--turq); border-left: 1px solid var(--turq);
  transform: translate(5px, 5px);
}
.card::after {
  bottom: 6px; right: 6px;
  border-bottom: 1px solid var(--turq); border-right: 1px solid var(--turq);
  transform: translate(-5px, -5px);
}
.card:hover::before, .card:hover::after { opacity: 1; transform: translate(0, 0); }
/* Pointer spotlight (position driven by chrome.js on fine pointers) */
@media (pointer: fine) {
  .card:hover {
    background-image: radial-gradient(
      260px circle at var(--mx, 50%) var(--my, 50%),
      rgba(15, 132, 121, 0.07), transparent 65%);
  }
}

/* Field-note row ────────────────────────────────────── */
.note-row {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 13px 0;
  border-bottom: 0.5px solid var(--line);
  color: inherit; border-left: none; border-right: none; border-top: none;
}
.note-row:hover .note-title { color: var(--turq); }
.note-row .note-title { font-size: 14px; color: var(--ink); transition: color .15s ease; }
.note-row .note-meta  { font-family: var(--mono); font-size: 12px; color: var(--stone); }

/* Pull-quote band ────────────────────────────────────── */
.quote-band {
  background: var(--soft);
  padding: 96px 24px;
  text-align: center;
}
.quote-band .quote {
  font-family: var(--serif); font-style: italic; font-size: 18px;
  max-width: 540px; margin: 0 auto 16px;
  line-height: 1.5;
  color: var(--ink);
}
.quote-band .quote-cap { font-family: var(--mono); font-size: 11px; color: var(--stone); }

/* Footer ─────────────────────────────────────────────── */
.footer {
  background: var(--soft);
  border-top: 0.5px solid var(--line);
  padding: 64px 0 32px;
  margin-top: 96px;
}
.footer-inner { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; align-items: end; }
.footer .brand { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.footer .brand .wordmark { font-family: var(--mono); font-weight: 500; font-size: 22px; color: var(--ink); }
.footer .tagline { font-size: 14px; color: var(--stone); max-width: 320px; line-height: 1.55; }
.footer .right { text-align: right; }
.footer .right a { font-family: var(--mono); font-size: 13px; color: var(--ink); border: none; }
.footer .right a:hover { color: var(--turq); }
.footer-meta {
  margin-top: 48px;
  display: flex; justify-content: space-between;
  gap: 12px 24px; flex-wrap: wrap;
  font-family: var(--mono); font-size: 10px; color: var(--stone);
}
.footer-meta a { color: var(--stone); border-bottom: 0.5px solid var(--line); }
.footer-meta a:hover { color: var(--turq); border-bottom-color: var(--turq); }

/* Mark draw-in animation ─────────────────────────────── */
@keyframes draw {
  to { stroke-dashoffset: 0; }
}
.mark-animated rect {
  stroke-dasharray: 60;
  stroke-dashoffset: 60;
  animation: draw 0.8s cubic-bezier(.7,0,.3,1) forwards;
}
.mark-animated rect:nth-child(1) { animation-delay: 0.05s; }
.mark-animated rect:nth-child(2) { animation-delay: 0.25s; }
.mark-animated rect:nth-child(3) { animation-delay: 0.45s; }
.mark-animated rect:nth-child(4) { animation-delay: 0.65s; }

/* Reveal on load ─────────────────────────────────────── */
/* Default: content is visible. JS adds .anims-on to <html> to run reveals when supported. */
.reveal { opacity: 1; transform: none; }
html.anims-on .reveal { opacity: 0; transform: translateY(8px); animation: rise 0.7s cubic-bezier(.2,.65,.3,1) forwards; }
@keyframes rise { to { opacity: 1; transform: none; } }
html.anims-on .reveal-1 { animation-delay: 0.05s; }
html.anims-on .reveal-2 { animation-delay: 0.15s; }
html.anims-on .reveal-3 { animation-delay: 0.25s; }
html.anims-on .reveal-4 { animation-delay: 0.35s; }
html.anims-on .reveal-5 { animation-delay: 0.45s; }
html.anims-on .reveal-6 { animation-delay: 0.55s; }
@media (prefers-reduced-motion: reduce) {
  html.anims-on .reveal { animation: none; opacity: 1; transform: none; }
}

/* Form ────────────────────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: 8px; margin-bottom: 24px; }
.field label { font-family: var(--mono); font-size: 11px; color: var(--stone); }
.field input, .field textarea, .field select {
  font-family: var(--sans); font-size: 15px; color: var(--ink);
  background: var(--paper);
  border: 0.5px solid var(--line);
  border-radius: var(--r-8);
  padding: 12px 14px;
  outline: none;
  transition: border-color .15s ease;
  resize: vertical;
}
.field input:focus, .field textarea:focus, .field select:focus { border-color: var(--ink); }
.field ::placeholder { color: var(--stone); opacity: 0.7; }

/* Essay pages (notes/<slug>/) ────────────────────────── */
.essay { max-width: 720px; margin: 0 auto; padding: 0 24px; }
.essay-head { padding: 64px 0 16px; }
.essay-head .essay-crumb { font-size: 11px; margin-bottom: 32px; }
.essay-head .essay-crumb a { color: var(--stone); border: none; }
.essay-head .essay-crumb a:hover { color: var(--ink); }
.essay-head h1 { font-size: 36px; max-width: 640px; margin: 16px 0 24px; line-height: 1.15; }
.essay-head .essay-lede { font-family: var(--serif); font-style: italic; font-size: 17px; line-height: 1.55; color: var(--stone); max-width: 580px; }
.essay-body { padding: 32px 0 64px; }
.essay-body p { font-size: 16px; line-height: 1.7; margin-bottom: 20px; max-width: 640px; }
.essay-body h2 { font-size: 22px; margin: 48px 0 20px; }
.essay-body ul, .essay-body ol { padding-left: 22px; margin: 0 0 20px; max-width: 620px; }
.essay-body li { font-size: 16px; line-height: 1.65; margin-bottom: 10px; }
.essay-body blockquote { margin: 32px 0; padding: 8px 0 8px 20px; border-left: 4px solid var(--turq); }
.essay-body blockquote p { font-family: var(--serif); font-style: italic; font-size: 18px; line-height: 1.55; margin-bottom: 0; }
.essay-body code { font-family: var(--mono); font-size: 13px; background: var(--soft); padding: 2px 6px; border-radius: var(--r-4); color: var(--ink); }
.essay-foot { border-top: 0.5px solid var(--line); padding: 32px 0 64px; }
.essay-foot .signature { display: flex; align-items: center; gap: 8px; margin-bottom: 32px; }
.essay-foot .signature .mono { font-size: 11px; }
.essay-foot .essay-related-label { margin-bottom: 12px; }

/* Blueprint motion system ────────────────────────────── */
/* Content is visible by default. chrome.js adds html.io only when JS runs and
   the user allows motion; elements are then drawn in as they enter the viewport. */

html.io [data-reveal] {
  opacity: 0;
  transform: translateY(16px);
  transition:
    opacity .7s var(--ease-out-quint),
    transform .85s var(--ease-out-quint),
    filter .85s var(--ease-out-quint);
  transition-delay: calc(min(var(--i, 0), 8) * 65ms);
}
html.io [data-reveal="blur"] { transform: translateY(8px); filter: blur(14px); }
html.io [data-reveal].in { opacity: 1; transform: none; filter: none; }

/* Walls: hairlines draw left to right */
html.io hr.hairline {
  opacity: 1;
  transform: scaleX(0); transform-origin: 0 50%;
  transition: transform 1.1s var(--ease-out-expo);
}
html.io hr.hairline.in { transform: scaleX(1); }

/* Plans: diagram figures stay put, their strokes draw (offsets driven by chrome.js) */
html.io [data-reveal="diagram"] { opacity: 1; transform: none; }
html.io [data-reveal="diagram"] svg text { opacity: 0; transition: opacity .6s ease 1s; }
html.io [data-reveal="diagram"].in svg text { opacity: 1; }

/* Page-to-page cross-fade (progressive enhancement) */
@view-transition { navigation: auto; }
::view-transition-old(root) { animation-duration: .18s; }
::view-transition-new(root) { animation-duration: .3s; }

/* Reading progress (essay pages), scrubbed by scroll position */
.essay-progress { display: none; }
@supports (animation-timeline: scroll()) {
  .essay-progress {
    display: block;
    position: fixed; top: 55px; left: 0; z-index: 60;
    width: 100%; height: 2px;
    background: var(--turq);
    transform: scaleX(0); transform-origin: 0 50%;
    animation: readProgress linear both;
    animation-timeline: scroll(root);
    pointer-events: none;
  }
  @keyframes readProgress { to { transform: scaleX(1); } }
}

/* Keyboard focus */
:focus-visible { outline: 2px solid var(--turq); outline-offset: 2px; border-radius: 2px; }

@media (prefers-reduced-motion: reduce) {
  html.io [data-reveal], html.io hr.hairline {
    opacity: 1; transform: none; filter: none; transition: none;
  }
  ::view-transition-old(root), ::view-transition-new(root) { animation: none; }
  .btn, .btn span[aria-hidden], .card, .card::before, .card::after, .nav-links a::after { transition: none; }
}

/* Responsive */
@media (max-width: 720px) {
  h1 { font-size: 28px; }
  .nav-links { gap: 18px; }
  .nav-links a:nth-last-child(n+3) { display: none; }
  .footer-inner { grid-template-columns: 1fr; }
  .footer .right { text-align: left; }
  .essay-head h1 { font-size: 28px; }
}

/* ═══════════════════════════════════════════════════════
   Shared motion additions, v4 (one building, two doors)
   Everything below is additive and respects reduced motion.
   ═══════════════════════════════════════════════════════ */

/* The drafting grid drifts, exactly one cell per pass, seamless */
@media (prefers-reduced-motion: no-preference) {
  body { animation: gridDrift 120s linear infinite; }
  @keyframes gridDrift {
    from { background-position: -1px -1px; }
    to   { background-position: 31px 31px; }
  }
}

/* Ticker band: a slow marquee of mono set-pieces.
   Markup: .ticker > .ticker-track > two identical .ticker-seq children. */
.ticker {
  overflow: hidden;
  border-top: 0.5px solid var(--line);
  border-bottom: 0.5px solid var(--line);
  padding: 14px 0;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
}
.ticker-track {
  display: flex;
  width: max-content;
  animation: tickerScroll 46s linear infinite;
  will-change: transform;
}
.ticker-track.reverse { animation-direction: reverse; }
.ticker:hover .ticker-track { animation-play-state: paused; }
.ticker-seq {
  display: flex; align-items: center; gap: 40px;
  padding-right: 40px;
  font-family: var(--mono); font-size: 12px;
  color: var(--stone); text-transform: lowercase; letter-spacing: 0.02em;
  white-space: nowrap;
}
.ticker-seq .tick-dot { color: var(--turq); }
@keyframes tickerScroll { to { transform: translateX(-50%); } }
@media (prefers-reduced-motion: reduce) {
  .ticker-track { animation: none; width: auto; flex-wrap: wrap; }
  .ticker, .ticker { -webkit-mask-image: none; mask-image: none; }
}

/* Note rows lean toward the pointer */
.note-row .note-title { display: inline-block; transition: color .15s ease, transform .35s var(--ease-out-quint); }
.note-row:hover .note-title { transform: translateX(5px); }

/* Turquoise wash: a slow aurora behind threshold/contact bands */
.wash-band { position: relative; overflow: hidden; }
.wash-band > * { position: relative; z-index: 1; }
.wash-band::before {
  content: '';
  position: absolute; inset: -40%;
  background:
    radial-gradient(38% 42% at 30% 40%, rgba(15,132,121,0.16), transparent 70%),
    radial-gradient(30% 36% at 72% 62%, rgba(10,90,82,0.10), transparent 70%);
  filter: blur(30px);
  z-index: 0;
  pointer-events: none;
}
@media (prefers-reduced-motion: no-preference) {
  .wash-band::before { animation: washFloat 16s ease-in-out infinite alternate; }
  @keyframes washFloat {
    from { transform: translate3d(-3%, -2%, 0) rotate(0deg); }
    to   { transform: translate3d(3%, 2%, 0) rotate(4deg); }
  }
}

/* Chips: drafting pills (stack, tags) */
.chip {
  display: inline-flex; align-items: center;
  font-family: var(--mono); font-size: 11.5px; letter-spacing: 0.02em;
  color: var(--ink); text-transform: lowercase;
  border: 0.5px solid var(--line);
  border-radius: 999px;
  padding: 6px 12px;
  background: var(--paper);
  transition: border-color .2s ease, color .2s ease, transform .3s var(--ease-out-quint);
}
.chip:hover { border-color: var(--turq); color: var(--turq); transform: translateY(-2px); }

/* Chip ticker variant: chips ride the marquee without double borders */
.chip-ticker { border: none; padding: 8px 0; }
.chip-ticker .ticker-seq { gap: 10px; padding-right: 10px; }
