/* ============================================================
   Thales Savkli · thales.savkli.com
   "The Flight Plan" · light drafting-paper editorial system
   Zero dependencies · no build step · one self-hosted font
   ============================================================ */

/* ---------- Font (single self-hosted asset) ---------- */
@font-face {
  font-family: "Archivo";
  font-style: normal;
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-display: swap;
  src: url("/fonts/archivo-var.woff2") format("woff2");
}

/* ---------- Tokens ---------- */
:root {
  --paper: #f7f8f6;
  --plate: #ffffff;
  --ink: #16191d;
  --ink-2: #565d66;
  --line: #dee1de;
  --blue: #2a4b9b;
  --blue-soft: rgba(42, 75, 155, 0.16);
  --red: #c63b2f;

  --disp: "Archivo", system-ui, "Segoe UI", Roboto, sans-serif;
  --body: system-ui, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", Consolas, "SF Mono", Menlo, monospace;

  --pad: clamp(20px, 5vw, 48px);
  --rail: 44px;
}

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

html { -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 16.5px/1.65 var(--body);
  -webkit-font-smoothing: antialiased;
  overflow-wrap: break-word;
}

h1, h2, h3 { margin: 0; font-family: var(--disp); }
p, ul, ol, figure { margin: 0; }
img { max-width: 100%; height: auto; display: block; }
svg { display: block; }

::selection { background: var(--blue); color: #fff; }

a { color: var(--blue); text-decoration-thickness: 1px; text-underline-offset: 3px; }

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

.container {
  max-width: 1140px;
  margin-inline: auto;
  padding-inline: var(--pad);
}

/* mono annotation voice */
.anno {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-2);
}

.skip-link {
  position: absolute;
  left: 12px; top: -48px;
  z-index: 100;
  background: var(--ink); color: #fff;
  padding: 10px 16px;
  border-radius: 0 0 8px 8px;
  font: 600 14px var(--disp);
  text-decoration: none;
}
.skip-link:focus { top: 0; }

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(247, 248, 246, 0.94);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--line);
}

.nav-wrap {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 20px;
  padding-block: 10px;
}

.wordmark {
  font: 650 16px var(--disp);
  font-stretch: 110%;
  letter-spacing: -0.01em;
  color: var(--ink);
  text-decoration: none;
  margin-right: auto;
}

.nav-links {
  display: flex;
  gap: clamp(12px, 2.4vw, 26px);
  list-style: none;
  margin: 0;
  padding: 0;
}
.nav-links a {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-2);
  text-decoration: none;
  padding: 6px 0;
}
.nav-links a:hover { color: var(--blue); }

.nav-cta {
  font: 600 13px var(--disp);
  background: var(--blue);
  color: #fff;
  text-decoration: none;
  padding: 9px 16px;
  border-radius: 7px;
  white-space: nowrap;
}
.nav-cta:hover { background: #223e82; }

@media (max-width: 700px) {
  .nav-wrap { padding-block: 9px 0; }
  .nav-wrap nav {
    order: 3;
    flex-basis: 100%;
    border-top: 1px solid var(--line);
    margin-inline: calc(-1 * var(--pad));
    padding-inline: var(--pad);
  }
  .nav-links { justify-content: space-between; flex-wrap: wrap; gap: 0 10px; }
  .nav-links a { padding: 8px 0; font-size: 10px; }
}

/* ---------- Plates (white document panels) ---------- */
.plate {
  background:
    repeating-linear-gradient(to right, transparent 0 23px, rgba(42, 75, 155, 0.05) 23px 24px),
    repeating-linear-gradient(to bottom, transparent 0 23px, rgba(42, 75, 155, 0.05) 23px 24px),
    var(--plate);
  border: 1px solid var(--line);
  border-radius: 10px;
}

/* ---------- Hero ---------- */
.hero { padding-block: clamp(40px, 7vw, 88px) clamp(48px, 7vw, 80px); }
.hero .container { position: relative; }

.stamp {
  font-family: var(--mono);
  font-weight: 700;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  border: 1.5px solid currentColor;
  border-radius: 3px;
  padding: 7px 12px 7px 15px;
  display: inline-block;
}
.stamp--folio {
  position: absolute;
  top: 4px;
  right: var(--pad);
  font-size: 10px;
  color: var(--ink-2);
  opacity: 0.55;
  transform: rotate(4deg);
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(230px, 25vw, 310px);
  gap: clamp(28px, 5vw, 72px);
  align-items: center;
}

.eyebrow { margin-bottom: 18px; color: var(--blue); }

.hero-name {
  font-size: clamp(56px, 9.5vw, 108px);
  font-weight: 780;
  font-stretch: 122%;
  line-height: 0.97;
  letter-spacing: -0.022em;
}

.hero-statement {
  margin-top: 26px;
  max-width: 30ch;
  font-family: var(--disp);
  font-size: clamp(18px, 2.2vw, 23px);
  font-weight: 520;
  font-stretch: 104%;
  line-height: 1.45;
  text-wrap: balance;
}

.hero-profile {
  margin-top: 16px;
  max-width: 54ch;
  color: var(--ink-2);
}

.cred {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  list-style: none;
  padding: 0;
  margin-top: 24px;
}
.cred li {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  color: var(--ink-2);
  background: var(--plate);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 6px 10px;
  white-space: nowrap;
}
.cred b { color: var(--blue); font-weight: 700; }

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 28px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font: 600 15px var(--disp);
  text-decoration: none;
  padding: 13px 20px;
  border-radius: 8px;
}
.btn svg { width: 17px; height: 17px; }
.btn--primary { background: var(--blue); color: #fff; }
.btn--primary:hover { background: #223e82; }
.btn--ghost { color: var(--ink); border: 1px solid var(--ink); }
.btn--ghost:hover { border-color: var(--blue); color: var(--blue); }

.wpnote {
  margin-top: 40px;
  line-height: 1.7;
  letter-spacing: 0.1em;
}

.portrait { padding: 10px 10px 0; }
.portrait img { border-radius: 4px; }
.portrait figcaption {
  padding: 10px 4px 12px;
  letter-spacing: 0.14em;
}

/* ---------- Planner ---------- */
.planner {
  position: relative;
  margin-top: clamp(44px, 6vw, 72px);
  overflow: hidden;
}

.planner-cta {
  display: none;
  position: absolute;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.14em;
  color: var(--blue);
  background: var(--plate);
  border: 1px solid var(--blue);
  border-radius: 6px;
  padding: 8px 13px;
  cursor: pointer;
  transition: opacity 0.4s ease;
}
.js .planner-cta { display: block; }
.planner-cta.gone { opacity: 0; pointer-events: none; }
.cta-coarse { display: none; }
@media (pointer: coarse) {
  .cta-fine { display: none; }
  .cta-coarse { display: inline; }
}
.plate-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--plate);
}
.plate-head span:last-child { color: var(--blue); }

#dubins {
  width: 100%;
  height: clamp(250px, 36vw, 400px);
  cursor: crosshair;
  touch-action: pan-y;
}

.planner-noscript { padding: 16px; }

.fig-note {
  margin-top: 14px;
  max-width: 74ch;
  font-size: 14.5px;
  color: var(--ink-2);
}

/* ---------- Route spine ---------- */
.route { position: relative; }
.route::before {
  content: "";
  position: absolute;
  left: calc(var(--pad) + 5px);
  top: 0;
  bottom: 140px;
  width: 2px;
  background: linear-gradient(to bottom, transparent, var(--blue-soft) 60px, var(--blue-soft));
}

.section { padding: clamp(64px, 9vw, 112px) 0 0 var(--rail); }
.section:last-child { padding-bottom: clamp(72px, 10vw, 128px); }

.wp-label {
  position: relative;
  color: var(--blue);
  margin-bottom: 14px;
}
.wp-dot {
  position: absolute;
  left: calc(-1 * var(--rail) + 1px);
  top: 2px;
  width: 10px;
  height: 10px;
  border: 2px solid var(--blue);
  border-radius: 50%;
  background: var(--paper);
}
.wp-dot--end { background: var(--blue); }

.section h2 {
  font-size: clamp(30px, 4.4vw, 46px);
  font-weight: 730;
  font-stretch: 116%;
  letter-spacing: -0.015em;
  line-height: 1.08;
}

.section-lead {
  margin-top: 12px;
  max-width: 62ch;
  color: var(--ink-2);
}

/* ---------- Timeline ---------- */
.timeline {
  list-style: none;
  margin: 44px 0 0;
  padding: 0;
  display: grid;
  gap: 42px;
}
.timeline li { position: relative; max-width: 68ch; }
.timeline li::before {
  content: "";
  position: absolute;
  left: calc(-1 * var(--rail) + 2px);
  top: 5px;
  width: 8px;
  height: 8px;
  border: 2px solid var(--blue);
  border-radius: 50%;
  background: var(--paper);
  opacity: 0.8;
}
.timeline .meta { margin-bottom: 8px; }
.timeline h3 {
  font-size: clamp(19px, 2.2vw, 23px);
  font-weight: 680;
  font-stretch: 108%;
  letter-spacing: -0.01em;
}
.role-sub {
  margin-top: 3px;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-2);
}
.timeline h3 + p, .role-sub + p { margin-top: 10px; }
.timeline-now p:last-child { color: var(--ink-2); }

/* ---------- Work spreads ---------- */
.spread {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  gap: clamp(28px, 4vw, 60px);
  align-items: center;
  padding-block: clamp(40px, 5vw, 60px);
  border-bottom: 1px solid var(--line);
  scroll-margin-top: 90px;
  border-radius: 4px;
}
.spread:first-of-type { margin-top: 28px; border-top: 1px solid var(--line); }
.spread:last-of-type { border-bottom: none; }
.spread:nth-of-type(even) .spread-copy { order: 2; }

.spread--flagship .spread-copy .meta { color: var(--blue); }

.spread h3 {
  font-size: clamp(24px, 3vw, 32px);
  font-weight: 700;
  font-stretch: 112%;
  letter-spacing: -0.012em;
  line-height: 1.12;
  margin-top: 10px;
}
.spread-copy > p:not(.meta) { margin-top: 14px; max-width: 58ch; }

.tech {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  list-style: none;
  padding: 0;
  margin-top: 20px;
}
.tech li {
  letter-spacing: 0.06em;
  border: 1px solid var(--line);
  background: var(--plate);
  border-radius: 6px;
  padding: 5px 9px;
}

.card-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 18px;
  font: 600 14.5px var(--disp);
  color: var(--blue);
}
.card-link svg { width: 15px; height: 15px; }

.spread-note {
  margin-top: 18px;
  letter-spacing: 0.14em;
  opacity: 0.8;
}

.diagram { padding: 14px 14px 0; }
.diagram svg { width: 100%; height: auto; }
.diagram figcaption {
  padding: 10px 4px 12px;
  letter-spacing: 0.14em;
}

/* diagram ink */
.dg-faint  { stroke: var(--blue); fill: none; opacity: 0.3; stroke-dasharray: 4 5; stroke-width: 1.3; }
.dg-route  { stroke: var(--blue); fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.dg-node   { stroke: var(--blue); fill: var(--plate); stroke-width: 1.5; }
.dg-fill   { fill: var(--blue); stroke: none; }
.dg-text   { font: 600 11px var(--mono); fill: var(--ink-2); letter-spacing: 0.06em; }

/* cross-highlight target */
.spread.hl, .paper.hl {
  outline: 2px solid var(--blue);
  outline-offset: 4px;
}

/* ---------- Research ---------- */
.paper {
  position: relative;
  margin-top: 40px;
  padding: clamp(26px, 4vw, 46px);
  max-width: 860px;
  scroll-margin-top: 90px;
}
.paper h3 {
  font-size: clamp(22px, 2.8vw, 30px);
  font-weight: 700;
  font-stretch: 110%;
  letter-spacing: -0.012em;
  line-height: 1.15;
  margin-top: 12px;
  max-width: 24ch;
}
.paper > p:not(.meta):not(.paper-foot) { margin-top: 16px; max-width: 62ch; }
.paper-foot {
  margin-top: 26px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.stamp--submitted {
  position: absolute;
  top: clamp(18px, 3vw, 30px);
  right: clamp(18px, 3vw, 30px);
  font-size: 13px;
  color: var(--red);
  border-width: 2px;
  transform: rotate(-7deg);
  opacity: 0.9;
}

/* ---------- Skills ---------- */
.skill-groups {
  display: grid;
  gap: 30px;
  margin-top: 44px;
}
.skill-group h3 { font-family: var(--mono); margin-bottom: 12px; }

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  list-style: none;
  padding: 0;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--ink);
  background: var(--plate);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 7px 11px;
}
button.chip--link {
  cursor: pointer;
  border-color: var(--blue-soft);
}
.chip--link::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--blue);
  flex: none;
}
.chip--link:hover { border-color: var(--blue); background: #eef1f8; }

.skill-where {
  margin-top: 22px;
  min-height: 1.6em;
  color: var(--blue);
  letter-spacing: 0.08em;
}

.skill-note {
  margin-top: 12px;
  max-width: 62ch;
  color: var(--ink-2);
  font-size: 15px;
}

/* ---------- Contact ---------- */
.contact-links {
  list-style: none;
  padding: 0;
  margin-top: 36px;
  display: grid;
  gap: 4px;
  justify-items: start;
}
.contact-links a {
  display: inline-flex;
  align-items: center;
  gap: 13px;
  font: 600 clamp(16px, 2vw, 19px) var(--disp);
  color: var(--ink);
  text-decoration: none;
  padding: 10px 0;
}
.contact-links svg { width: 20px; height: 20px; color: var(--blue); flex: none; }
.contact-links a:hover { color: var(--blue); }

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--line);
  padding-block: 26px;
}
.site-footer .container {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
  justify-content: space-between;
  font-size: 13.5px;
  color: var(--ink-2);
}

/* ---------- Motion ---------- */
.js .reveal {
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.55s ease, transform 0.55s ease;
}
.js .reveal.in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: no-preference) {
  @keyframes rise {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: none; }
  }
  .hero-copy > * { animation: rise 0.55s ease-out both; }
  .hero-copy > *:nth-child(1) { animation-delay: 0.05s; }
  .hero-copy > *:nth-child(2) { animation-delay: 0.12s; }
  .hero-copy > *:nth-child(3) { animation-delay: 0.22s; }
  .hero-copy > *:nth-child(4) { animation-delay: 0.30s; }
  .hero-copy > *:nth-child(5) { animation-delay: 0.38s; }
  .hero-copy > *:nth-child(6) { animation-delay: 0.46s; }
  .hero-copy > *:nth-child(7) { animation-delay: 0.60s; }
  .portrait { animation: rise 0.6s 0.35s ease-out both; }
  .planner, .planner + .fig-note { animation: rise 0.6s 0.55s ease-out both; }
  .skip-link { transition: top 0.15s ease; }

  @keyframes cta-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(42, 75, 155, 0.3); }
    60% { box-shadow: 0 0 0 8px rgba(42, 75, 155, 0); }
  }
  .planner-cta { animation: cta-pulse 2.4s ease-out infinite; }
}

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

/* ---------- Responsive ---------- */
@media (min-width: 901px) {
  /* experience entries: dates in a left rail, content beside them */
  .timeline li {
    max-width: none;
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr);
    column-gap: 48px;
  }
  .timeline .meta { grid-column: 1; grid-row: 1; margin: 4px 0 0; }
  .timeline h3, .timeline .role-sub, .timeline li > p:not(.meta) { grid-column: 2; }
  .timeline li > p:not(.meta):not(.role-sub) { max-width: 58ch; }
  .timeline .meta { display: grid; gap: 2px; }
}

@media (max-width: 900px) {
  .spread { grid-template-columns: 1fr; align-items: start; }
  .spread:nth-of-type(even) .spread-copy { order: 0; }
  .diagram { max-width: 520px; }
}

@media (max-width: 760px) {
  :root { --rail: 30px; }

  .hero { padding-top: 24px; }
  .hero-grid { grid-template-columns: 1fr; gap: 34px; }
  .portrait { max-width: 300px; }
  .stamp--folio { display: none; }
  .hero-name { font-size: clamp(50px, 15vw, 76px); }
  .hero-statement { max-width: 34ch; }
  .wpnote { margin-top: 32px; }

  #dubins { height: clamp(230px, 58vw, 320px); }

  /* stamp above the text instead of over it */
  .stamp--submitted {
    position: static;
    align-self: start;
    font-size: 11px;
    margin-bottom: 16px;
    transform: rotate(-3deg);
  }
  .paper { display: flex; flex-direction: column; align-items: flex-start; }
}

@media (max-width: 520px) {
  .plate-head span:last-child { display: none; }
}

@media (max-width: 400px) {
  .btn { padding: 12px 15px; font-size: 14px; }
  .cred { gap: 6px; }
  .cred li { font-size: 10px; padding: 5px 8px; }
}
