/* ==========================================================================
   Manuel Alvarado — structural & mechanical design
   Design tokens. Palette derives from the von Mises result ramp: cool = within
   limits, warm = governing. Used semantically, never decoratively.
   ========================================================================== */

:root {
  --paper:   #e6eaec;
  --sheet:   #ffffff;
  --ink:     #12171b;
  --ink-2:   #5c666e;
  --ink-3:   #8b959c;
  --rule:    #c4ccd1;
  --rule-2:  #dde3e6;

  --vm-low:  #2b4ce0;
  --vm-mid:  #12a594;
  --vm-warn: #d99226;
  --vm-high: #cf3823;

  --ramp: linear-gradient(90deg, var(--vm-low) 0%, #1b7fc4 26%,
          var(--vm-mid) 48%, var(--vm-warn) 74%, var(--vm-high) 100%);

  --display: "Archivo", system-ui, sans-serif;
  --body:    "Source Serif 4", Georgia, serif;
  --mono:    "IBM Plex Mono", ui-monospace, monospace;

  --gut: 2rem;
  --max: 74rem;
  --measure: 40rem;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  font-size: 1.0625rem;
  line-height: 1.62;
  font-optical-sizing: auto;
}

img { max-width: 100%; height: auto; display: block; }

a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { text-decoration-color: var(--vm-low); }

:focus-visible { outline: 2px solid var(--vm-low); outline-offset: 3px; }

.wrap { max-width: var(--max); margin-inline: auto; padding-inline: var(--gut); }
.narrow { max-width: var(--measure); }

/* --- utility type ------------------------------------------------------- */

.mono {
  font-family: var(--mono);
  font-size: 0.6875rem;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--ink-2);
}

.display {
  font-family: var(--display);
  font-weight: 700;
  letter-spacing: -0.028em;
  line-height: 1.03;
  margin: 0;
}

/* --- masthead ----------------------------------------------------------- */

.masthead {
  border-bottom: 1px solid var(--rule);
  background: var(--paper);
}
.masthead .wrap {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding-block: 1.15rem;
}
.masthead__name {
  font-family: var(--display);
  font-weight: 700;
  font-size: 0.9rem;
  letter-spacing: 0.02em;
  text-decoration: none;
}
.masthead__nav { display: flex; gap: 1.5rem; }
.masthead__nav a { text-decoration: none; }
.masthead__nav a:hover { color: var(--ink); }

/* --- hero --------------------------------------------------------------- */

.hero { padding-block: clamp(3.5rem, 9vw, 7rem) 0; }
.hero__eyebrow { display: block; margin-bottom: 1.75rem; }
.hero__thesis {
  font-size: clamp(2.1rem, 6.2vw, 4.15rem);
  max-width: 20ch;
}
.hero__lede {
  max-width: 34rem;
  margin: 2rem 0 0;
  color: var(--ink-2);
  font-size: 1.15rem;
}
.hero__lede strong { color: var(--ink); font-weight: 600; }

/* Signature: the result ramp, drawn as a hairline rule under the thesis. */
.ramp {
  height: 5px;
  background: var(--ramp);
  margin-top: clamp(2.5rem, 6vw, 4rem);
  transform-origin: left;
  animation: ramp-in 900ms cubic-bezier(.16,.84,.44,1) both;
}
@keyframes ramp-in { from { transform: scaleX(0); } to { transform: scaleX(1); } }

/* --- generic section ---------------------------------------------------- */

.section { padding-block: clamp(3rem, 7vw, 5.5rem); }
.section__head h2 {
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: 0.01em;
  margin: 0;
}
.section__head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  padding-bottom: 0.9rem;
  border-bottom: 1px solid var(--rule);
  margin-bottom: 2.5rem;
}

/* --- capabilities ------------------------------------------------------- */

.caps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2.5rem; }
.caps__col h3 {
  font-family: var(--display);
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0 0 0.9rem;
}
.caps__col ul { list-style: none; margin: 0; padding: 0; }
.caps__col li {
  font-family: var(--mono);
  font-size: 0.775rem;
  line-height: 1.5;
  color: var(--ink-2);
  padding: 0.42rem 0;
  border-top: 1px solid var(--rule-2);
}

/* --- work card ---------------------------------------------------------- */

.card {
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  background: var(--sheet);
  border: 1px solid var(--rule);
  text-decoration: none;
  transition: border-color 180ms ease, transform 180ms ease;
}
.card:hover { border-color: var(--ink); transform: translateY(-2px); }
.card__media { overflow: hidden; background: #f4f6f7; }
.card__media img { width: 100%; height: 100%; object-fit: cover; }
.card__body { padding: clamp(1.5rem, 3vw, 2.5rem); }
.card__title {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(1.4rem, 2.6vw, 1.95rem);
  letter-spacing: -0.022em;
  line-height: 1.1;
  margin: 0.85rem 0 0.9rem;
}
.card__note { color: var(--ink-2); margin: 0 0 1.6rem; font-size: 0.98rem; }
.card__meta { display: flex; flex-wrap: wrap; gap: 0.4rem 1.4rem; }
.card__cta {
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  margin-top: 1.7rem;
  color: var(--vm-low);
}

.pipeline {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--rule-2);
}

/* --- title-block footer (drawing sheet vernacular) ---------------------- */

.titleblock {
  border-top: 1px solid var(--ink);
  background: var(--sheet);
}
.titleblock__grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-left: 1px solid var(--rule);
}
.titleblock__cell {
  border-right: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  padding: 1rem 1.1rem 1.15rem;
  min-height: 5.2rem;
}
.titleblock__cell span { display: block; margin-bottom: 0.4rem; }
.titleblock__cell p {
  margin: 0;
  font-family: var(--display);
  font-weight: 500;
  font-size: 0.94rem;
  line-height: 1.35;
  letter-spacing: -0.005em;
}
.titleblock__cell a { text-decoration-color: var(--rule); }
.titleblock__foot {
  display: flex;
  border-top: 0;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding-block: 1.15rem 1.4rem;
}

/* --- case study --------------------------------------------------------- */

.case-hero { padding-block: clamp(3rem, 7vw, 5rem) 0; }
.case-hero__title {
  font-size: clamp(2rem, 5.2vw, 3.5rem);
  max-width: 18ch;
  margin-top: 1.5rem;
}
.case-hero__sub {
  font-size: 1.2rem;
  color: var(--ink-2);
  max-width: 38rem;
  margin: 1.3rem 0 0;
}

.datastrip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: var(--rule);
  border: 1px solid var(--rule);
  margin-top: 2.75rem;
}
.datastrip > div { background: var(--paper); padding: 0.95rem 1.1rem 1.1rem; }
.datastrip span { display: block; margin-bottom: 0.35rem; }
.datastrip p {
  margin: 0;
  font-family: var(--mono);
  font-size: 0.8rem;
  line-height: 1.45;
  color: var(--ink);
}

/* Signature moment: the result the whole study turns on. */
.result {
  background: var(--sheet);
  border: 1px solid var(--rule);
  padding: clamp(1.6rem, 4vw, 2.6rem);
  margin-top: 1.5rem;
}
.result__row { display: flex; align-items: flex-end; gap: clamp(1.5rem, 5vw, 4rem); flex-wrap: wrap; }
.result__item { flex: 0 1 auto; }
.result__num {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(2.4rem, 7vw, 4rem);
  letter-spacing: -0.04em;
  line-height: 0.95;
  display: block;
}
.result__num sub {
  font-size: 0.28em;
  font-weight: 500;
  letter-spacing: 0.02em;
  vertical-align: baseline;
  margin-left: 0.3em;
}
.result__num--high { color: var(--vm-high); }
.result__num--warn { color: var(--vm-warn); }
.result__num--target { color: var(--vm-low); }
.result__lab { display: block; margin-top: 0.7rem; }
.result__arrow { font-family: var(--mono); color: var(--ink-3); font-size: 1.5rem; padding-bottom: 1.1rem; }
.result__track { height: 5px; background: var(--ramp); margin-top: 2rem; }
.result__caption { margin: 0.85rem 0 0; }

/* revision table */
.revtable { width: 100%; border-collapse: collapse; margin-top: 1.5rem; }
.revtable th, .revtable td {
  text-align: left;
  padding: 0.75rem 1rem 0.8rem 0;
  border-bottom: 1px solid var(--rule-2);
  font-family: var(--mono);
  font-size: 0.8rem;
  vertical-align: baseline;
}
.revtable th {
  font-size: 0.6875rem;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--ink-2);
  border-bottom-color: var(--rule);
}
.revtable td:first-child { font-weight: 600; width: 5.5rem; }
.revtable td:last-child { width: 9rem; }
.dot {
  display: inline-block;
  width: 7px; height: 7px;
  border-radius: 50%;
  margin-right: 0.55rem;
  vertical-align: 1px;
}
.dot--done    { background: var(--ink-3); }
.dot--current { background: var(--vm-warn); }
.dot--open    { background: transparent; box-shadow: inset 0 0 0 1.5px var(--vm-low); }

/* prose */
.prose { max-width: var(--measure); }
.prose h2 {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(1.5rem, 3.4vw, 2.05rem);
  letter-spacing: -0.025em;
  line-height: 1.12;
  margin: 3.5rem 0 1.1rem;
}
.prose h3 {
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.08rem;
  letter-spacing: -0.008em;
  margin: 2.4rem 0 0.7rem;
}
.prose h2:first-child { margin-top: 0; }
.prose p { margin: 0 0 1.15rem; }
.prose ul { margin: 0 0 1.3rem; padding-left: 1.15rem; }
.prose li { margin-bottom: 0.55rem; }
.prose .mono-note {
  font-family: var(--mono);
  font-size: 0.82rem;
  line-height: 1.6;
  color: var(--ink-2);
  border-left: 2px solid var(--rule);
  padding: 0.15rem 0 0.15rem 1.1rem;
  margin: 1.8rem 0;
}

/* chapter rule */
.chapter {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  border-top: 1px solid var(--ink);
  padding-top: 0.85rem;
  margin-top: clamp(3.5rem, 8vw, 6rem);
  margin-bottom: 2.5rem;
}
.chapter h2 {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(1.6rem, 3.6vw, 2.2rem);
  letter-spacing: -0.028em;
  margin: 0;
}

/* figures */
figure { margin: 2.5rem 0; }
figure img { width: 100%; border: 1px solid var(--rule); background: var(--sheet); }
figcaption {
  font-family: var(--mono);
  font-size: 0.73rem;
  line-height: 1.55;
  color: var(--ink-2);
  margin-top: 0.7rem;
  max-width: var(--measure);
}
figcaption b { color: var(--ink); font-weight: 600; letter-spacing: 0.06em; }
.fig-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
.fig-wide { max-width: none; }

.reveal { opacity: 0; transform: translateY(10px); transition: opacity 500ms ease, transform 500ms ease; }
.reveal.is-in { opacity: 1; transform: none; }

/* disclosure notice */
.notice {
  border: 1px solid var(--rule);
  padding: 1.15rem 1.3rem 1.25rem;
  margin-top: 3.5rem;
  font-family: var(--mono);
  font-size: 0.75rem;
  line-height: 1.65;
  color: var(--ink-2);
  max-width: var(--measure);
}
.notice b { color: var(--ink); }

/* --- responsive --------------------------------------------------------- */

@media (max-width: 60rem) {
  .caps { grid-template-columns: 1fr; gap: 1.75rem; }
  .card { grid-template-columns: 1fr; }
  .card__media { aspect-ratio: 16 / 10; }
  .datastrip { grid-template-columns: repeat(2, 1fr); }
  .titleblock__grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 44rem) {
  /* Stack the revision table: fixed column widths cannot fit a phone. */
  .revtable thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .revtable tr { display: block; padding: 1rem 0 1.1rem; border-bottom: 1px solid var(--rule-2); }
  .revtable tr:first-child { border-top: 1px solid var(--rule); }
  .revtable td { display: block; border: 0; padding: 0 0 0.5rem; }
  .revtable td:first-child,
  .revtable td:last-child { width: auto; }
  .revtable td::before {
    content: attr(data-l) " ";
    color: var(--ink-3);
    letter-spacing: 0.11em;
    text-transform: uppercase;
    font-size: 0.625rem;
    display: block;
    margin-bottom: 0.2rem;
  }
  .revtable td:first-child::before { content: none; }
}

@media (max-width: 34rem) {
  :root { --gut: 1.25rem; }
  .masthead .wrap { flex-direction: column; align-items: flex-start; gap: 0.6rem; }
  .masthead__nav { gap: 1.1rem; }
  .datastrip { grid-template-columns: 1fr; }
  .titleblock__grid { grid-template-columns: 1fr; }
  .fig-pair { grid-template-columns: 1fr; }
  .result__arrow { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .ramp { animation: none; }
  .reveal { opacity: 1; transform: none; transition: none; }
  .card { transition: none; }
}
