/* Principia — engineering foundations site */

:root {
  --ink: #0b1220;
  --ink-2: #121c2e;
  --ink-3: #1a2740;
  --paper: #e8eef6;
  --paper-dim: #b7c4d8;
  --muted: #7d8da6;
  --line: rgba(232, 238, 246, 0.12);
  --line-strong: rgba(232, 238, 246, 0.22);
  --copper: #c47a3a;
  --copper-bright: #e09a55;
  --copper-dim: rgba(196, 122, 58, 0.18);
  --teal: #3d9b8f;
  --danger: #c45c4a;
  --font-display: "Fraunces", "Iowan Old Style", Georgia, serif;
  --font-body: "Source Sans 3", "Source Sans Pro", "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", "SF Mono", ui-monospace, monospace;
  --max: 1120px;
  --gutter: clamp(1.25rem, 4vw, 2.5rem);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --header-h: 4.25rem;
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 1rem);
}

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.55;
  color: var(--paper);
  background: var(--ink);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img,
svg {
  display: block;
  max-width: 100%;
}

a {
  color: var(--copper-bright);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

a:hover {
  color: var(--paper);
}

button {
  font: inherit;
  cursor: pointer;
  border: 0;
  background: none;
  color: inherit;
}

h1,
h2,
h3 {
  font-family: var(--font-display);
  font-weight: 500;
  line-height: 1.12;
  letter-spacing: -0.02em;
  margin: 0;
}

p {
  margin: 0;
}

ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.wrap {
  width: min(100% - 2 * var(--gutter), var(--max));
  margin-inline: auto;
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--copper);
}

/* —— Header —— */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  height: var(--header-h);
  display: flex;
  align-items: center;
  border-bottom: 1px solid transparent;
  background: transparent;
  transition: background 0.35s var(--ease), border-color 0.35s var(--ease),
    backdrop-filter 0.35s var(--ease);
}

.site-header.is-scrolled {
  background: rgba(11, 18, 32, 0.88);
  border-bottom-color: var(--line);
  backdrop-filter: blur(12px);
}

.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  width: min(100% - 2 * var(--gutter), var(--max));
}

.brand {
  display: inline-flex;
  align-items: baseline;
  gap: 0.55rem;
  text-decoration: none;
  color: var(--paper);
}

.brand__mark {
  font-family: var(--font-display);
  font-size: 1.45rem;
  font-weight: 560;
  letter-spacing: -0.03em;
}

.brand__tag {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.nav {
  display: none;
  gap: 1.5rem;
}

.nav a {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--paper-dim);
}

.nav a:hover {
  color: var(--paper);
}

.nav-toggle {
  width: 2.5rem;
  height: 2.5rem;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-strong);
}

.nav-toggle span {
  display: block;
  width: 1.1rem;
  height: 1px;
  background: var(--paper);
  position: relative;
}

.nav-toggle span::before,
.nav-toggle span::after {
  content: "";
  position: absolute;
  left: 0;
  width: 100%;
  height: 1px;
  background: var(--paper);
}

.nav-toggle span::before {
  top: -5px;
}

.nav-toggle span::after {
  top: 5px;
}

@media (min-width: 860px) {
  .nav {
    display: flex;
  }

  .nav-toggle {
    display: none;
  }
}

.nav-drawer {
  display: none;
  position: fixed;
  inset: var(--header-h) 0 auto 0;
  background: var(--ink-2);
  border-bottom: 1px solid var(--line);
  padding: 1.25rem var(--gutter) 1.5rem;
  z-index: 39;
}

.nav-drawer.is-open {
  display: block;
}

.nav-drawer a {
  display: block;
  padding: 0.7rem 0;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--paper);
  border-bottom: 1px solid var(--line);
}

/* —— Hero —— */
.hero {
  position: relative;
  min-height: calc(100svh - var(--header-h));
  display: grid;
  align-items: end;
  overflow: hidden;
  isolation: isolate;
}

.hero__canvas {
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(ellipse 80% 55% at 70% 20%, rgba(196, 122, 58, 0.16), transparent 55%),
    radial-gradient(ellipse 60% 50% at 15% 80%, rgba(61, 155, 143, 0.1), transparent 50%),
    linear-gradient(165deg, #0b1220 0%, #101a2c 45%, #0d1626 100%);
}

.hero__grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse 70% 65% at 65% 40%, #000 20%, transparent 75%);
  opacity: 0.55;
}

.hero__schematic {
  position: absolute;
  right: -5%;
  top: 8%;
  width: min(62vw, 720px);
  height: auto;
  opacity: 0.55;
  pointer-events: none;
}

.hero__schematic .trace {
  fill: none;
  stroke: var(--copper);
  stroke-width: 1.25;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 1200;
  stroke-dashoffset: 1200;
  animation: draw-trace 2.8s var(--ease) 0.3s forwards;
}

.hero__schematic .trace--dim {
  stroke: var(--teal);
  stroke-width: 1;
  opacity: 0.7;
  animation-delay: 0.7s;
}

.hero__schematic .node {
  fill: var(--ink);
  stroke: var(--copper-bright);
  stroke-width: 1.5;
  opacity: 0;
  animation: fade-node 0.6s var(--ease) forwards;
}

.hero__schematic .node:nth-child(odd) {
  animation-delay: 1.4s;
}

.hero__schematic .node:nth-child(even) {
  animation-delay: 1.8s;
}

@keyframes draw-trace {
  to {
    stroke-dashoffset: 0;
  }
}

@keyframes fade-node {
  to {
    opacity: 1;
  }
}

.hero__content {
  padding: clamp(3rem, 10vh, 6rem) 0 clamp(3.5rem, 9vh, 5.5rem);
  max-width: 38rem;
}

.hero__brand {
  font-family: var(--font-display);
  font-size: clamp(3.4rem, 9vw, 5.75rem);
  font-weight: 560;
  letter-spacing: -0.035em;
  line-height: 0.95;
  margin: 0.85rem 0 1.1rem;
  opacity: 0;
  transform: translateY(18px);
  animation: rise 0.9s var(--ease) 0.15s forwards;
}

.hero__lede {
  font-size: clamp(1.05rem, 2.2vw, 1.2rem);
  color: var(--paper-dim);
  max-width: 32rem;
  margin-bottom: 1.75rem;
  opacity: 0;
  transform: translateY(18px);
  animation: rise 0.9s var(--ease) 0.35s forwards;
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  opacity: 0;
  transform: translateY(18px);
  animation: rise 0.9s var(--ease) 0.5s forwards;
}

@keyframes rise {
  to {
    opacity: 1;
    transform: none;
  }
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-height: 2.85rem;
  padding: 0 1.25rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
  transition: background 0.25s var(--ease), color 0.25s var(--ease),
    border-color 0.25s var(--ease);
}

.btn--primary {
  background: var(--copper);
  color: var(--ink);
  border: 1px solid var(--copper);
}

.btn--primary:hover {
  background: var(--copper-bright);
  color: var(--ink);
}

.btn--ghost {
  background: transparent;
  color: var(--paper);
  border: 1px solid var(--line-strong);
}

.btn--ghost:hover {
  border-color: var(--paper-dim);
  color: var(--paper);
}

.hero__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem 2.25rem;
  margin-top: 2.75rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
  opacity: 0;
  animation: rise 0.9s var(--ease) 0.7s forwards;
}

.hero__meta dt {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.25rem;
}

.hero__meta dd {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.35rem;
  letter-spacing: -0.02em;
}

/* —— Sections —— */
.section {
  padding: clamp(4rem, 10vh, 6.5rem) 0;
  border-top: 1px solid var(--line);
}

.section__head {
  display: grid;
  gap: 0.85rem;
  margin-bottom: clamp(2rem, 5vh, 3rem);
  max-width: 40rem;
}

.section__head h2 {
  font-size: clamp(2rem, 4.5vw, 2.85rem);
}

.section__head p {
  color: var(--paper-dim);
  font-size: 1.08rem;
}

.section--ink-2 {
  background: var(--ink-2);
}

/* —— North star —— */
.north {
  display: grid;
  gap: 2rem;
}

@media (min-width: 900px) {
  .north {
    grid-template-columns: 1.2fr 0.8fr;
    align-items: end;
    gap: 3rem;
  }
}

.north__quote {
  font-family: var(--font-display);
  font-size: clamp(1.55rem, 3.2vw, 2.15rem);
  line-height: 1.25;
  letter-spacing: -0.02em;
  color: var(--paper);
}

.north__aside {
  border-left: 2px solid var(--copper);
  padding-left: 1.25rem;
  color: var(--paper-dim);
}

.north__aside strong {
  display: block;
  color: var(--paper);
  font-weight: 600;
  margin-bottom: 0.35rem;
}

/* —— Roadmap rail —— */
.roadmap-rail {
  display: grid;
  gap: 0.65rem;
  margin-bottom: 1.75rem;
}

@media (min-width: 720px) {
  .roadmap-rail {
    grid-template-columns: repeat(6, 1fr);
    gap: 0.5rem;
  }
}

.rail-btn {
  text-align: left;
  padding: 0.9rem 0.95rem;
  border: 1px solid var(--line);
  background: transparent;
  transition: border-color 0.25s var(--ease), background 0.25s var(--ease);
}

.rail-btn:hover {
  border-color: var(--line-strong);
}

.rail-btn[aria-selected="true"] {
  border-color: var(--copper);
  background: var(--copper-dim);
}

.rail-btn__num {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  color: var(--copper);
  margin-bottom: 0.35rem;
}

.rail-btn__label {
  display: block;
  font-family: var(--font-display);
  font-size: 1.05rem;
  letter-spacing: -0.01em;
}

.rail-btn__months {
  display: block;
  margin-top: 0.35rem;
  font-size: 0.8rem;
  color: var(--muted);
}

.phase-panel {
  border: 1px solid var(--line);
  background: var(--ink);
  padding: clamp(1.35rem, 3vw, 2rem);
}

.phase-panel[hidden] {
  display: none;
}

.phase-panel__top {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem 1.5rem;
  margin-bottom: 1rem;
}

.phase-panel__top h3 {
  font-size: clamp(1.55rem, 3vw, 2rem);
}

.phase-panel__months {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--copper);
}

.phase-panel__thesis {
  color: var(--paper-dim);
  max-width: 48rem;
  margin-bottom: 1.75rem;
  font-size: 1.05rem;
}

.phase-grid {
  display: grid;
  gap: 1.75rem;
}

@media (min-width: 860px) {
  .phase-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.phase-block h4 {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 0.85rem;
}

.outcome-list li,
.project-list li {
  position: relative;
  padding-left: 1rem;
  margin-bottom: 0.55rem;
  color: var(--paper-dim);
}

.outcome-list li::before,
.project-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.65em;
  width: 0.4rem;
  height: 1px;
  background: var(--copper);
}

.topic-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

.topic-table th,
.topic-table td {
  text-align: left;
  vertical-align: top;
  padding: 0.7rem 0.65rem 0.7rem 0;
  border-bottom: 1px solid var(--line);
}

.topic-table th {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.topic-table td:first-child {
  color: var(--paper);
  font-weight: 600;
  width: 28%;
}

.topic-table td {
  color: var(--paper-dim);
}

.resource-list {
  display: grid;
  gap: 0.65rem;
}

.resource {
  display: grid;
  gap: 0.2rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--line);
}

.resource__kind {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--teal);
}

.resource__title {
  color: var(--paper);
  text-decoration: none;
  font-weight: 600;
}

a.resource__title:hover {
  color: var(--copper-bright);
}

.resource__why {
  font-size: 0.92rem;
  color: var(--muted);
}

.phase-panel.is-entering {
  animation: panel-in 0.45s var(--ease);
}

@keyframes panel-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* —— Rhythm —— */
.rhythm-grid {
  display: grid;
  gap: 0.75rem;
}

@media (min-width: 720px) {
  .rhythm-grid {
    grid-template-columns: repeat(5, 1fr);
  }
}

.rhythm-item {
  padding: 1.15rem 1rem;
  border-top: 2px solid var(--copper);
  background: var(--ink);
}

.rhythm-item__time {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  color: var(--copper);
  margin-bottom: 0.45rem;
}

.rhythm-item__block {
  font-family: var(--font-display);
  font-size: 1.25rem;
  margin-bottom: 0.4rem;
}

.rhythm-item__detail {
  font-size: 0.9rem;
  color: var(--muted);
}

/* —— Anti-replace —— */
.capability-list {
  display: grid;
  gap: 0;
  border-top: 1px solid var(--line);
}

.capability {
  display: grid;
  gap: 0.35rem;
  padding: 1.25rem 0;
  border-bottom: 1px solid var(--line);
}

@media (min-width: 720px) {
  .capability {
    grid-template-columns: 12rem 1fr;
    gap: 2rem;
    align-items: baseline;
  }
}

.capability__title {
  font-family: var(--font-display);
  font-size: 1.25rem;
}

.capability__body {
  color: var(--paper-dim);
}

/* —— Quant —— */
.quant-roles {
  display: grid;
  gap: 0.75rem;
  margin-bottom: 1.75rem;
}

@media (min-width: 800px) {
  .quant-roles {
    grid-template-columns: repeat(2, 1fr);
  }
}

.role {
  padding: 1.25rem;
  border: 1px solid var(--line);
  background: var(--ink);
}

.role__code {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  color: var(--copper);
}

.role__name {
  font-family: var(--font-display);
  font-size: 1.35rem;
  margin: 0.35rem 0 0.55rem;
}

.role__job {
  color: var(--paper-dim);
  margin-bottom: 0.65rem;
}

.role__hire {
  font-size: 0.9rem;
  color: var(--muted);
}

.note {
  padding: 1.25rem 1.35rem;
  border-left: 2px solid var(--teal);
  background: rgba(61, 155, 143, 0.08);
}

.note strong {
  display: block;
  margin-bottom: 0.35rem;
  color: var(--paper);
}

.note p {
  color: var(--paper-dim);
}

.sequence {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
}

.sequence p {
  color: var(--paper-dim);
  max-width: 48rem;
}

/* —— Reveal on scroll —— */
.reveal {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
}

.reveal.is-visible {
  opacity: 1;
  transform: none;
}

/* —— Footer —— */
.site-footer {
  padding: 2.5rem 0 3rem;
  border-top: 1px solid var(--line);
}

.site-footer .wrap {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 1rem;
  align-items: baseline;
}

.site-footer p {
  color: var(--muted);
  font-size: 0.9rem;
}

.site-footer .brand__mark {
  font-size: 1.15rem;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .hero__brand,
  .hero__lede,
  .hero__actions,
  .hero__meta,
  .hero__schematic .trace,
  .hero__schematic .node,
  .reveal,
  .phase-panel.is-entering {
    animation: none !important;
    transition: none !important;
    opacity: 1 !important;
    transform: none !important;
    stroke-dashoffset: 0 !important;
  }
}
