/* ————————————————————————————————————————————————
   Endura — Editorial Ivory design system
   Shared by the landing page and the /receptive brief.
   ———————————————————————————————————————————————— */

:root {
  --paper: #f5efe3;
  --paper-2: #ede3d0;
  --ink: #211d19;
  --ink-2: #6f6459;
  --accent: #7b2c2f;
  --rule: rgba(33, 29, 25, 0.16);
  --rule-strong: rgba(33, 29, 25, 0.55);
  --serif-display: "Fraunces", "Iowan Old Style", Georgia, serif;
  --serif-text: "Newsreader", Georgia, serif;
  --sans-label: "Archivo", "Helvetica Neue", sans-serif;
  --measure: 52ch;
  --gutter: clamp(1.25rem, 5vw, 4.5rem);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif-text);
  font-size: 1.0625rem;
  line-height: 1.72;
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

/* Paper grain */
.grain {
  position: fixed;
  inset: 0;
  z-index: 40;
  pointer-events: none;
  opacity: 0.05;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ————— Typography primitives ————— */

.label {
  font-family: var(--sans-label);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-2);
}

.label--accent { color: var(--accent); }

a {
  color: inherit;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  text-decoration-color: var(--accent);
  transition: color 120ms ease;
}
a:hover { color: var(--accent); }

em { font-style: italic; }

/* ————— Page chrome ————— */

.sheet {
  max-width: 74rem;
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  padding: 1.1rem 0 0.9rem;
  border-bottom: 1px solid var(--rule-strong);
}

.topbar a { text-decoration: none; }

footer.colophon {
  border-top: 1px solid var(--rule-strong);
  margin-top: clamp(4rem, 10vw, 8rem);
  padding: 1.1rem 0 2.5rem;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

/* ————— Masthead (landing) ————— */

.masthead { padding: clamp(3rem, 9vw, 7rem) 0 clamp(2.5rem, 6vw, 4.5rem); }

.wordmark {
  font-family: var(--serif-display);
  font-variation-settings: "SOFT" 40, "WONK" 1;
  font-weight: 560;
  font-size: clamp(4rem, 14vw, 11rem);
  line-height: 0.95;
  letter-spacing: -0.025em;
}

.wordmark i {
  font-style: italic;
  font-weight: 400;
  color: var(--accent);
}

.masthead .dek {
  font-family: var(--serif-text);
  font-size: clamp(1.2rem, 2.4vw, 1.55rem);
  line-height: 1.5;
  max-width: 34em;
  margin-top: clamp(1.5rem, 3.5vw, 2.5rem);
  color: var(--ink);
}

.masthead .dek strong { font-weight: 500; font-style: italic; }

/* ————— Numbered sections ————— */

section.no {
  border-top: 1px solid var(--rule-strong);
  padding: clamp(2rem, 5vw, 3.5rem) 0 clamp(2.5rem, 6vw, 4.5rem);
  display: grid;
  grid-template-columns: minmax(9rem, 16rem) minmax(0, 1fr);
  gap: clamp(1.25rem, 4vw, 4rem);
}

section.no > header { display: flex; flex-direction: column; gap: 0.6rem; }

section.no > header .num {
  font-family: var(--serif-display);
  font-size: 1.05rem;
  font-weight: 500;
  color: var(--accent);
}

section.no h2 {
  font-family: var(--serif-display);
  font-weight: 540;
  font-size: clamp(1.6rem, 3.2vw, 2.3rem);
  line-height: 1.12;
  letter-spacing: -0.01em;
}

section.no .body > * + * { margin-top: 1.1rem; }
section.no .body p { max-width: var(--measure); }

@media (max-width: 720px) {
  section.no { grid-template-columns: 1fr; gap: 1.25rem; }
}

/* ————— Item lists (services, principles, use cases) ————— */

.items { list-style: none; }

.items > li {
  border-top: 1px solid var(--rule);
  padding: 1.15rem 0;
  display: grid;
  grid-template-columns: minmax(11rem, 15rem) minmax(0, 1fr);
  gap: 0.75rem 2rem;
}

.items > li:first-child { border-top: 0; padding-top: 0.25rem; }

.items h3 {
  font-family: var(--serif-display);
  font-weight: 540;
  font-size: 1.2rem;
  line-height: 1.3;
}

.items p { color: var(--ink); max-width: 44ch; }

@media (max-width: 720px) {
  .items > li { grid-template-columns: 1fr; gap: 0.35rem; }
}

/* People */
.people { display: grid; grid-template-columns: 1fr 1fr; gap: 2.5rem; }
.people article > * + * { margin-top: 0.55rem; }
.people h3 {
  font-family: var(--serif-display);
  font-size: 1.45rem;
  font-weight: 540;
}
.people .role { color: var(--accent); font-style: italic; }
@media (max-width: 720px) { .people { grid-template-columns: 1fr; } }

/* Experience strip */
.wall {
  display: flex;
  flex-wrap: wrap;
  gap: 1.4rem 3rem;
}
.wall figure {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  white-space: nowrap;
}
.wall svg {
  width: 30px;
  height: 30px;
  flex: none;
  stroke: var(--ink);
  fill: none;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: stroke 160ms ease;
}
.wall svg .fill { fill: var(--ink); stroke: none; transition: fill 160ms ease; }
.wall figure:hover svg { stroke: var(--accent); }
.wall figure:hover svg .fill { fill: var(--accent); }
.wall figcaption {
  font-family: var(--serif-display);
  font-size: clamp(1.2rem, 2.4vw, 1.6rem);
  font-weight: 500;
  font-style: italic;
}

/* Contact */
.contact-line {
  font-family: var(--serif-display);
  font-size: clamp(1.5rem, 3.4vw, 2.4rem);
  font-weight: 500;
  line-height: 1.25;
}

/* ————— Reveal motion ————— */

.reveal { opacity: 0; transform: translateY(14px); }
.reveal.in {
  opacity: 1;
  transform: none;
  transition: opacity 700ms cubic-bezier(0.22, 1, 0.36, 1),
    transform 700ms cubic-bezier(0.22, 1, 0.36, 1);
}
.masthead .reveal.in { transition-duration: 900ms; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
}

/* ————————————————————————————————————————————————
   /receptive — gate + brief
   ———————————————————————————————————————————————— */

.gate {
  min-height: 92vh;
  display: grid;
  place-items: center;
  padding: 2rem var(--gutter);
}

.gate-card { max-width: 30rem; width: 100%; text-align: center; }
.gate-card > * + * { margin-top: 1.1rem; }

.gate-card .seal {
  font-family: var(--serif-display);
  font-size: 1rem;
  font-weight: 500;
  color: var(--accent);
  border: 1px solid var(--rule-strong);
  border-radius: 999px;
  width: 3.4rem;
  height: 3.4rem;
  display: inline-grid;
  place-items: center;
  font-style: italic;
}

.gate-card h1 {
  font-family: var(--serif-display);
  font-weight: 540;
  font-size: clamp(1.9rem, 5vw, 2.6rem);
  line-height: 1.15;
  letter-spacing: -0.01em;
}

.gate-card .hint { color: var(--ink-2); font-size: 0.98rem; }

.gate-form { display: flex; gap: 0; margin-top: 1.6rem; border-bottom: 1px solid var(--rule-strong); }

.gate-form input {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: 0;
  outline: 0;
  font-family: var(--serif-text);
  font-size: 1.15rem;
  padding: 0.6rem 0.2rem;
  color: var(--ink);
  letter-spacing: 0.04em;
}
.gate-form input::placeholder { color: var(--ink-2); opacity: 0.7; font-style: italic; }

.gate-form button {
  background: transparent;
  border: 0;
  cursor: pointer;
  font-family: var(--sans-label);
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
  padding: 0.6rem 0.2rem;
}
.gate-form button:hover { color: var(--ink); }

.gate-error {
  color: var(--accent);
  font-style: italic;
  font-size: 0.95rem;
  min-height: 1.4em;
}

.gate-card.shake { animation: shake 320ms ease; }
@keyframes shake {
  25% { transform: translateX(-6px); }
  55% { transform: translateX(5px); }
  80% { transform: translateX(-3px); }
}

/* Brief document */

.brief { display: none; }
body.unlocked .brief { display: block; }
body.unlocked .gate { display: none; }

.brief-cover { padding: clamp(3rem, 8vw, 5.5rem) 0 clamp(2rem, 5vw, 3.5rem); }

.brief-cover h1 {
  font-family: var(--serif-display);
  font-variation-settings: "SOFT" 30, "WONK" 1;
  font-weight: 540;
  font-size: clamp(2.4rem, 7vw, 4.6rem);
  line-height: 1.03;
  letter-spacing: -0.02em;
  max-width: 18em;
}

.brief-cover .dek {
  font-size: clamp(1.1rem, 2vw, 1.3rem);
  max-width: 30em;
  margin-top: 1.4rem;
}

.brief-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: 1.4rem 2.5rem;
  margin-top: 2.4rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--rule);
}
.brief-meta .meta-item {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.brief-meta .val {
  font-family: var(--serif-text);
  font-size: 1.05rem;
  line-height: 1.45;
}

/* Drop cap on the opening paragraph */
.opening::first-letter {
  font-family: var(--serif-display);
  font-weight: 560;
  font-size: 3.4em;
  line-height: 0.82;
  float: left;
  padding: 0.06em 0.12em 0 0;
  color: var(--accent);
}

/* Department blocks inside use cases */
.dept { border-top: 1px solid var(--rule); padding-top: 1rem; margin-top: 1.4rem; }
.dept:first-of-type { border-top: 0; margin-top: 0; padding-top: 0; }
.dept h4 {
  font-family: var(--serif-display);
  font-size: 1.15rem;
  font-weight: 540;
  margin-bottom: 0.45rem;
}
.dept h4 span { color: var(--ink-2); font-weight: 400; font-style: italic; font-size: 0.95rem; }
.dept ul { list-style: none; max-width: var(--measure); }
.dept li { padding: 0.28rem 0 0.28rem 1.4rem; position: relative; }
.dept li::before {
  content: "—";
  position: absolute;
  left: 0;
  color: var(--accent);
}

/* Question list */
ol.questions { counter-reset: q; list-style: none; max-width: var(--measure); }
ol.questions li {
  counter-increment: q;
  padding: 0.85rem 0 0.85rem 2.6rem;
  position: relative;
  border-top: 1px solid var(--rule);
}
ol.questions li:first-child { border-top: 0; }
ol.questions li::before {
  content: "Q" counter(q);
  position: absolute;
  left: 0;
  top: 0.95rem;
  font-family: var(--sans-label);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--accent);
}
ol.questions li em.why { display: block; color: var(--ink-2); font-size: 0.95rem; margin-top: 0.15rem; }

/* Phases */
.phase { border-top: 1px solid var(--rule); padding: 1.1rem 0; display: grid; grid-template-columns: minmax(8.5rem, 11rem) minmax(0, 1fr); gap: 0.5rem 2rem; }
.phase:first-of-type { border-top: 0; padding-top: 0.25rem; }
.phase .when { font-family: var(--serif-display); font-style: italic; color: var(--accent); font-size: 1.05rem; }
.phase h4 { font-family: var(--serif-display); font-size: 1.15rem; font-weight: 540; margin-bottom: 0.3rem; }
.phase p { max-width: 46ch; }
.phase .ship { margin-top: 0.4rem; font-size: 0.95rem; color: var(--ink-2); font-style: italic; }
@media (max-width: 720px) { .phase { grid-template-columns: 1fr; gap: 0.3rem; } }

/* Editorial plates (images) */
.plate {
  margin: 0;
  padding: clamp(1.5rem, 4vw, 2.75rem) 0;
}
.plate img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 2.7 / 1;
  object-fit: cover;
  border: 1px solid var(--rule-strong);
  filter: sepia(0.16) saturate(0.88) contrast(0.97) brightness(1.01);
}
.plate figcaption {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 0.65rem;
}
.plate--tall img { aspect-ratio: 3 / 2; }
@media (max-width: 720px) {
  .plate img { aspect-ratio: 3 / 2; }
}

/* ————— Interactive widgets (brief) ————— */

.widget {
  border: 1px solid var(--rule-strong);
  background: var(--paper-2);
  padding: clamp(1.4rem, 3.5vw, 2.2rem);
  margin-top: 1.6rem;
}
.widget-head h3 {
  font-family: var(--serif-display);
  font-weight: 540;
  font-size: 1.35rem;
  margin-top: 0.5rem;
}
.widget-sub { color: var(--ink-2); font-size: 0.95rem; max-width: 46ch; margin-top: 0.4rem; }

.widget-grid {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
  gap: 1.8rem 2.5rem;
  margin-top: 1.5rem;
  align-items: start;
}
@media (max-width: 720px) { .widget-grid { grid-template-columns: 1fr; } }

.ctl { display: block; padding: 0.7rem 0; }
.ctl + .ctl { border-top: 1px solid var(--rule); }
.ctl-name {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  font-family: var(--sans-label);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-2);
  margin-bottom: 0.55rem;
}
.ctl-name b {
  font-family: var(--serif-display);
  font-size: 0.95rem;
  font-weight: 560;
  letter-spacing: 0;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 22px;
  background: transparent;
  cursor: pointer;
}
input[type="range"]::-webkit-slider-runnable-track {
  height: 2px;
  background: var(--rule-strong);
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  border: 2.5px solid var(--paper);
  box-shadow: 0 0 0 1px var(--rule-strong);
  margin-top: -7px;
}
input[type="range"]::-moz-range-track { height: 2px; background: var(--rule-strong); }
input[type="range"]::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
  border: 2.5px solid var(--paper);
  box-shadow: 0 0 0 1px var(--rule-strong);
}

.tiles { display: grid; grid-template-columns: 1fr; }
.tile { display: flex; flex-direction: column; gap: 0.45rem; padding: 0.95rem 0; }
.tile:first-child { padding-top: 0; }
.tile:last-child { padding-bottom: 0; }
.tile + .tile { border-top: 1px solid var(--rule); }
.tile-n {
  font-family: var(--serif-display);
  font-weight: 560;
  font-size: clamp(1.7rem, 3.4vw, 2.4rem);
  line-height: 1;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}
.tile .label { line-height: 1.5; max-width: 34ch; }

/* Before / after switch */
.switch {
  display: inline-flex;
  border: 1px solid var(--rule-strong);
  margin-top: 1.3rem;
}
.switch button {
  background: transparent;
  border: 0;
  cursor: pointer;
  font-family: var(--sans-label);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 0.6rem 1.1rem;
  color: var(--ink-2);
}
.switch button.on { background: var(--ink); color: var(--paper); }
.switch button + button { border-left: 1px solid var(--rule-strong); }

.qa { list-style: none; margin-top: 1.2rem; }
.qa li {
  display: grid;
  grid-template-columns: minmax(10rem, 16rem) minmax(0, 1fr) auto;
  gap: 0.5rem 1.8rem;
  padding: 0.95rem 0;
  border-top: 1px solid var(--rule);
  align-items: baseline;
}
.qa li:first-child { border-top: 0; }
.qa .q { font-family: var(--serif-display); font-weight: 540; font-size: 1.05rem; }
.qa .a { color: var(--ink); transition: opacity 120ms ease; }
.qa .chip {
  font-family: var(--sans-label);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-2);
  border: 1px solid var(--rule-strong);
  padding: 0.3rem 0.6rem;
  white-space: nowrap;
  transition: opacity 120ms ease;
}
.mode-after .qa .chip { color: var(--paper); background: var(--accent); border-color: var(--accent); }
.qa .swapping { opacity: 0; }
@media (max-width: 720px) {
  .qa li { grid-template-columns: 1fr; gap: 0.3rem; }
  .qa .chip { justify-self: start; }
}

/* Timeline scrubber */
.week-slider { margin-top: 1.4rem; }
.week-readout { margin-top: 0.8rem; }
.week-label { font-family: var(--serif-display); font-size: 1.15rem; font-weight: 540; }
.week-label b { color: var(--accent); font-variant-numeric: tabular-nums; }
.week-label i { font-style: italic; color: var(--ink-2); font-weight: 400; font-size: 1rem; }
.have { list-style: none; margin-top: 0.9rem; max-width: var(--measure); }
.have li { padding: 0.32rem 0 0.32rem 1.4rem; position: relative; }
.have li::before { content: "✓"; position: absolute; left: 0; color: var(--accent); font-size: 0.85em; }
.have li.new { font-weight: 600; }
.phase-track {
  display: grid;
  grid-template-columns: 2fr 4fr 4fr 2fr;
  gap: 4px;
  margin-top: 1.4rem;
}
.phase-track span {
  height: 4px;
  background: var(--rule);
  transition: background 200ms ease;
}
.phase-track span.done { background: var(--ink-2); }
.phase-track span.now { background: var(--accent); }

/* Aside / footnote */
.aside {
  border-left: 2px solid var(--accent);
  padding: 0.2rem 0 0.2rem 1.2rem;
  max-width: var(--measure);
  color: var(--ink-2);
  font-size: 0.98rem;
  font-style: italic;
}

/* ————— Print ————— */
@media print {
  .grain, .gate, .topbar .backlink, .no-print { display: none !important; }
  body { background: #fff; font-size: 10.5pt; }
  body:not(.unlocked) .brief { display: none; }
  section.no { break-inside: avoid-page; }
}
