/* =========================================================================
   Clarissa Rosen — portfolio
   Editorial, warm, precise. Fraunces display + Inter body. Single accent.
   ========================================================================= */

/* ---------- Design tokens ---------- */
:root {
  /* Inverted (dark) scheme: the committed look.
     Previous light palette, kept for easy revert:
       --bg #FAF8F4 · --bg-panel #F3EFE7 · --ink #1A1815 · --muted #6B655C
       --accent #25406E · --accent-ink #1E3358 · --hairline #E4DED4 · --on-accent #FFFFFF */
  --bg:        #1A1712;   /* warm near-black */
  --bg-panel:  #24201A;   /* raised warm panel */
  --ink:       #F1ECE2;   /* warm off-white text */
  --muted:     #ADA595;   /* warm muted */
  --accent:    #7CA0DA;   /* navy lifted to a periwinkle that reads on dark */
  --accent-ink:#A9C5F2;   /* brighter blue for links and small accents */
  --on-accent: #17140F;   /* dark text on accent-filled buttons */
  --hairline:  #3A352C;   /* warm dark border */

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

  --measure: 68ch;
  --wrap-max: 1120px;
  --nav-h: 64px;

  /* type scale */
  --step--1: clamp(0.83rem, 0.8rem + 0.15vw, 0.9rem);
  --step-0:  clamp(1rem, 0.96rem + 0.2vw, 1.12rem);
  --step-1:  clamp(1.2rem, 1.1rem + 0.5vw, 1.4rem);
  --step-2:  clamp(1.5rem, 1.3rem + 1vw, 2rem);
  --step-3:  clamp(2rem, 1.6rem + 2vw, 3rem);
  --step-4:  clamp(2.6rem, 1.9rem + 3.4vw, 4.4rem);
}

/* ---------- Reset-ish ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; background: var(--bg); }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: var(--step-0);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 { font-family: var(--serif); font-weight: 500; line-height: 1.1; margin: 0; }
p { margin: 0 0 1.1em; }
a { color: var(--accent-ink); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--accent); }
img, svg { max-width: 100%; height: auto; }
ul, ol { margin: 0; }

/* Scroll-margin so anchored sections clear the sticky nav */
:target { scroll-margin-top: calc(var(--nav-h) + 12px); }
section[id], article[id] { scroll-margin-top: calc(var(--nav-h) + 12px); }

/* ---------- Accessibility helpers ---------- */
.skip-link {
  position: absolute; left: -999px; top: 0; z-index: 1000;
  background: var(--ink); color: var(--bg);
  padding: 0.6em 1em; border-radius: 0 0 6px 0;
}
.skip-link:focus { left: 0; }

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

/* ---------- Layout wrap ---------- */
.wrap {
  width: 100%;
  max-width: var(--wrap-max);
  margin-inline: auto;
  padding-inline: clamp(1.25rem, 5vw, 3rem);
}

/* ---------- Header / nav ---------- */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(140%) blur(8px);
  border-bottom: 1px solid var(--hairline);
}
@supports not (backdrop-filter: blur(1px)) {
  .site-header { background: var(--bg); }
}
.nav {
  display: flex; align-items: center; justify-content: space-between;
  height: var(--nav-h);
  max-width: var(--wrap-max); margin-inline: auto;
  padding-inline: clamp(1.25rem, 5vw, 3rem);
}
.nav__brand {
  font-family: var(--serif); font-size: var(--step-1); font-weight: 600;
  color: var(--ink); text-decoration: none; letter-spacing: -0.01em;
}
.nav__brand:hover { color: var(--ink); }
.nav__links {
  list-style: none; display: flex; gap: clamp(1.2rem, 3vw, 2.4rem);
  margin: 0; padding: 0;
}
.nav__links a {
  color: var(--muted); text-decoration: none; font-size: var(--step--1);
  letter-spacing: 0.04em; text-transform: uppercase; font-weight: 500;
  padding: 0.4em 0; position: relative;
}
.nav__links a:hover { color: var(--ink); }
.nav__links a::after {
  content: ""; position: absolute; left: 0; right: 100%; bottom: -2px;
  height: 1px; background: var(--accent); transition: right 0.25s ease;
}
.nav__links a:hover::after, .nav__links a:focus-visible::after { right: 0; }

/* mobile toggle */
.nav__toggle {
  display: none;
  background: none; border: 0; cursor: pointer;
  width: 40px; height: 40px; padding: 8px;
}
.nav__toggle-bar {
  display: block; width: 100%; height: 2px; background: var(--ink);
  border-radius: 2px; transition: transform 0.25s ease, opacity 0.2s ease;
}
.nav__toggle-bar + .nav__toggle-bar { margin-top: 5px; }
.nav__toggle[aria-expanded="true"] .nav__toggle-bar:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav__toggle[aria-expanded="true"] .nav__toggle-bar:nth-child(2) { opacity: 0; }
.nav__toggle[aria-expanded="true"] .nav__toggle-bar:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

@media (max-width: 680px) {
  .nav__toggle { display: block; }
  .nav__links {
    position: absolute; top: var(--nav-h); left: 0; right: 0;
    flex-direction: column; gap: 0;
    background: var(--bg); border-bottom: 1px solid var(--hairline);
    padding: 0.5rem clamp(1.25rem, 5vw, 3rem) 1rem;
    /* collapsed by default; expanded via [data-open] */
    display: none;
  }
  .nav__links[data-open="true"] { display: flex; }
  .nav__links a {
    padding: 0.85em 0; width: 100%; border-bottom: 1px solid var(--hairline);
    font-size: 0.95rem;
  }
  .nav__links li:last-child a { border-bottom: 0; }
  .nav__links a::after { display: none; }
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-block; text-decoration: none; cursor: pointer;
  font-size: var(--step--1); font-weight: 600; letter-spacing: 0.02em;
  padding: 0.85em 1.5em; border-radius: 999px;
  border: 1px solid transparent; transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}
.btn--primary { background: var(--accent); color: var(--on-accent); }
.btn--primary:hover { background: var(--accent-ink); color: var(--on-accent); }
.btn--ghost { border-color: var(--hairline); color: var(--ink); background: transparent; }
.btn--ghost:hover { border-color: var(--ink); color: var(--ink); }

/* ---------- Section labels ---------- */
.section-label, .case__kicker {
  font-family: var(--sans); font-size: var(--step--1); letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--accent-ink); font-weight: 600;
  margin: 0 0 1rem;
}

/* ---------- Hero ---------- */
.hero { padding: clamp(4rem, 12vh, 8rem) 0 clamp(3rem, 8vh, 6rem); }
.hero__eyebrow {
  font-size: var(--step--1); letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--muted); font-weight: 600; margin: 0 0 1.5rem;
}
.hero__heading {
  font-size: var(--step-4);
  font-optical-sizing: auto;
  letter-spacing: -0.015em;
  max-width: 16ch;
  margin-bottom: 1.5rem;
}
.hero__subhead {
  font-size: var(--step-1); color: var(--muted); max-width: 54ch;
  line-height: 1.55; margin-bottom: 2.25rem;
}
.hero__actions { display: flex; flex-wrap: wrap; gap: 0.9rem; }

/* ---------- Case study ---------- */
.case { padding: clamp(3rem, 8vh, 6rem) 0; border-top: 1px solid var(--hairline); }
.case__intro { max-width: 60ch; margin-bottom: clamp(2.5rem, 6vh, 4rem); }
.case__title {
  font-size: var(--step-4); letter-spacing: -0.015em; margin: 0.4rem 0 1.5rem;
}
.case__lede { font-size: var(--step-1); line-height: 1.5; margin-bottom: 1.5rem; }
.case__note {
  font-size: var(--step--1); color: var(--muted);
  border-left: 2px solid var(--hairline); padding-left: 1rem; line-height: 1.55;
  max-width: 62ch;
}

/* At a glance strip */
.glance {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 1px; background: var(--hairline);
  border: 1px solid var(--hairline); border-radius: 10px; overflow: hidden;
  margin: 0 0 clamp(3rem, 8vh, 5rem);
}
.glance__item { background: var(--bg); padding: 1.25rem 1.25rem 1.4rem; }
.glance__item dt {
  font-size: var(--step--1); letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--accent-ink); font-weight: 600; margin-bottom: 0.5rem;
}
.glance__item dd { margin: 0; font-size: 0.95rem; color: var(--ink); line-height: 1.45; }
@media (max-width: 900px) {
  .glance { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 440px) {
  .glance { grid-template-columns: 1fr; }
}

/* Case sections: two-column grid, sticky heads on wide screens */
.case__section { padding: clamp(2rem, 5vh, 3.5rem) 0; border-top: 1px solid var(--hairline); }
.case__grid {
  display: grid;
  grid-template-columns: minmax(0, 260px) minmax(0, 1fr);
  gap: clamp(1.5rem, 4vw, 3.5rem);
  align-items: start;
}
.case__head { position: sticky; top: calc(var(--nav-h) + 1.5rem); }
.case__kicker { margin-bottom: 0.6rem; font-size: 0.78rem; }
.case__head h3 { font-size: var(--step-2); letter-spacing: -0.01em; }
.case__head-sub { color: var(--muted); font-size: 0.95rem; margin-top: 0.75rem; line-height: 1.5; }
.case__body { max-width: var(--measure); font-size: var(--step-0); }
.case__body > p:last-child { margin-bottom: 0; }
.case__emphasis {
  font-family: var(--serif); font-size: var(--step-1); line-height: 1.4;
  color: var(--ink); margin-top: 0.5rem;
}
.case__aside { color: var(--muted); font-size: 0.95rem; margin-top: 1.25rem; }
.case__body strong { font-weight: 600; }

@media (max-width: 820px) {
  .case__grid { grid-template-columns: 1fr; gap: 1rem; }
  .case__head { position: static; }
  .case__head h3 { font-size: var(--step-2); }
}

/* Judgment calls */
.calls { display: grid; gap: 1.75rem; }
.call h4 {
  font-family: var(--sans); font-weight: 600; font-size: var(--step-0);
  margin-bottom: 0.4rem; color: var(--ink);
}
.call p { margin: 0; color: var(--ink); }
.call + .call { padding-top: 1.75rem; border-top: 1px solid var(--hairline); }

/* Lists */
.built-list, .loop-list { list-style: none; padding: 0; display: grid; gap: 1.1rem; }
.built-list li { padding-left: 1.25rem; position: relative; }
.built-list li::before {
  content: ""; position: absolute; left: 0; top: 0.65em;
  width: 6px; height: 6px; border-radius: 50%; background: var(--accent);
}
.loop-list { counter-reset: loop; gap: 0.75rem; }
.loop-list li {
  counter-increment: loop; padding-left: 2.5rem; position: relative; line-height: 1.5;
}
.loop-list li::before {
  content: counter(loop); position: absolute; left: 0; top: 0.05em;
  width: 1.7rem; height: 1.7rem; border-radius: 50%;
  border: 1px solid var(--accent); color: var(--accent-ink);
  font-family: var(--sans); font-size: 0.8rem; font-weight: 600;
  display: grid; place-items: center;
}
.loop-list li span { font-weight: 600; }

.skills {
  list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 0.6rem;
}
.skills li {
  border: 1px solid var(--hairline); border-radius: 999px;
  padding: 0.5em 1em; font-size: 0.9rem; color: var(--ink); background: var(--bg-panel);
}

/* Pull quotes */
.pullquote { margin: clamp(2rem, 6vh, 4rem) 0; }
.pullquote blockquote { margin: 0; }
.pullquote p {
  font-family: var(--serif); font-weight: 500;
  font-size: var(--step-3); line-height: 1.2; letter-spacing: -0.01em;
  color: var(--ink); max-width: 20ch; margin: 0;
  border-left: 3px solid var(--accent); padding-left: clamp(1rem, 3vw, 2rem);
}
.pullquote--wide p { max-width: 28ch; }

/* Diagrams */
.diagram {
  margin: clamp(2rem, 5vh, 3.25rem) 0 0;
  background: var(--bg-panel);
  border: 1px solid var(--hairline); border-radius: 14px;
  padding: clamp(1.25rem, 4vw, 2.25rem);
}
.diagram__svg { display: block; width: 100%; height: auto; }
.diagram figcaption {
  margin-top: 1.25rem; color: var(--muted); font-size: 0.9rem; line-height: 1.5;
  max-width: 62ch;
}

/* SVG element styling (theme via CSS so diagrams stay monochrome + one accent) */
.d-box { fill: var(--bg); stroke: var(--hairline); stroke-width: 1.5; }
.d-box--store { fill: var(--bg-panel); }
.d-box--ai { fill: var(--bg-panel); stroke: var(--accent); stroke-width: 1.5; }
.d-box--human { fill: var(--bg); stroke: var(--muted); stroke-dasharray: 4 4; }
.d-title { fill: var(--ink); font-family: var(--sans); font-size: 16px; font-weight: 600; }
.d-sub { fill: var(--muted); font-family: var(--sans); font-size: 12.5px; }
.d-sub--accent { fill: var(--accent-ink); font-weight: 600; }
.d-line { stroke: var(--muted); stroke-width: 1.5; fill: none; }
.d-line--dash { stroke-dasharray: 4 4; }
.d-arrowhead { fill: var(--muted); }
.d-boundary { stroke: var(--accent); stroke-width: 1.5; stroke-dasharray: 5 5; }
.d-boundary-label {
  fill: var(--accent-ink); font-family: var(--sans); font-size: 11px;
  font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase;
}
.d-human-tag {
  fill: var(--muted); font-family: var(--sans); font-size: 11px; font-weight: 600;
  letter-spacing: 0.06em; text-transform: uppercase;
}
/* loop */
.d-ring { fill: none; stroke: var(--hairline); stroke-width: 1.5; }
.d-center { fill: var(--bg-panel); stroke: var(--accent); stroke-width: 1.5; }
.d-center-title { fill: var(--accent-ink); font-family: var(--sans); font-size: 14px; font-weight: 600; }
.d-node { fill: var(--bg); stroke: var(--hairline); stroke-width: 1.5; }
.d-node--human { stroke: var(--accent); }
.d-node-num { fill: var(--accent-ink); font-family: var(--sans); font-size: 12px; font-weight: 700; }
.d-node-label { fill: var(--ink); font-family: var(--sans); font-size: 12.5px; font-weight: 500; }
.d-arc { fill: none; stroke: var(--muted); stroke-width: 1.5; }

/* ---------- About ---------- */
.about { padding: clamp(3.5rem, 9vh, 6rem) 0; border-top: 1px solid var(--hairline); background: var(--bg-panel); }
.about__head { max-width: 40rem; margin-bottom: clamp(2rem, 4vw, 3rem); }
.about__head h2 { margin-bottom: 0; }
.about__grid {
  display: grid; grid-template-columns: minmax(0, 320px) minmax(0, 1fr);
  gap: clamp(1.5rem, 4vw, 4rem); align-items: start;
}
.about__body p { margin-bottom: 1.45em; }
.about__body p:last-child { margin-bottom: 0; }
.about__head h2 { font-size: var(--step-3); letter-spacing: -0.015em; }
.about__photo { margin: 0; max-width: 320px; }
.about__photo img {
  display: block; width: 100%; height: auto; aspect-ratio: 2 / 3;
  object-fit: cover; border-radius: 12px;
  border: 1px solid var(--hairline);
  box-shadow: 0 12px 30px -18px rgba(26, 24, 21, 0.4);
  background: var(--bg-panel);
}
@media (max-width: 820px) {
  .about__photo { max-width: 240px; margin-top: 0; }
  .about__head { margin-bottom: 2.25rem; }
}
.about__body { max-width: 60ch; font-size: clamp(1.1rem, 1rem + 0.55vw, 1.3rem); line-height: 1.7; }
.facts { list-style: none; padding: 0; margin: 1.75rem 0 0; display: grid; gap: 0.7rem; }
.facts li { padding-left: 1.5rem; position: relative; color: var(--ink); }
.facts li::before {
  content: ""; position: absolute; left: 0; top: 0.7em; width: 10px; height: 1px; background: var(--accent);
}
@media (max-width: 820px) { .about__grid { grid-template-columns: 1fr; gap: 1.25rem; } }

/* ---------- Contact ---------- */
.contact { padding: clamp(3.5rem, 9vh, 6rem) 0; border-top: 1px solid var(--hairline); }
.contact__heading { font-size: var(--step-3); letter-spacing: -0.015em; max-width: 18ch; margin-bottom: 2rem; }
.contact__list { list-style: none; padding: 0; display: grid; gap: 0; max-width: 640px; }
.contact__list li {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.5rem 1.5rem;
  padding: 1.1rem 0; border-top: 1px solid var(--hairline);
}
.contact__list li:last-child { border-bottom: 1px solid var(--hairline); }
.contact__label {
  font-size: var(--step--1); letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--muted); font-weight: 600; flex: 0 0 6rem;
}
.contact__value { font-size: var(--step-1); color: var(--accent-ink); word-break: break-word; }

/* ---------- Footer ---------- */
.site-footer { padding: clamp(2.5rem, 6vh, 4rem) 0; border-top: 1px solid var(--hairline); background: var(--bg-panel); color: var(--ink); }
.site-footer__name { font-family: var(--serif); font-size: var(--step-1); font-weight: 600; margin: 0 0 0.5rem; color: var(--ink); }
.site-footer__meta { color: var(--muted); font-size: 0.95rem; margin: 0 0 1.25rem; }
.site-footer__copy { color: var(--muted); font-size: 0.85rem; margin: 0; }

/* ---------- Motion / reveal ---------- */
/* Reveal is opt-in via the .js class, so content is fully visible without JavaScript. */
.js .reveal { opacity: 0; transform: translateY(14px); transition: opacity 0.6s ease, transform 0.6s ease; }
.js .reveal.is-visible { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .js .reveal { opacity: 1; transform: none; transition: none; }
  * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}
