/* ==========================================================================
   Connor Armstrong: portfolio site
   Design tokens, layout, components, print.
   Fonts are self-hosted (Fraunces + Hanken Grotesk, SIL OFL 1.1).
   ========================================================================== */

@font-face {
  font-family: "Fraunces";
  src: url("../fonts/fraunces-latin-wght-normal.woff2") format("woff2");
  font-weight: 100 900; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Fraunces";
  src: url("../fonts/fraunces-latin-wght-italic.woff2") format("woff2");
  font-weight: 100 900; font-style: italic; font-display: swap;
}
@font-face {
  font-family: "Hanken Grotesk";
  src: url("../fonts/hanken-grotesk-latin-wght-normal.woff2") format("woff2");
  font-weight: 100 900; font-style: normal; font-display: swap;
}

:root {
  /* Color */
  --night:   #0a1126;   /* page */
  --deep:    #0f1a38;   /* panels */
  --raise:   #16234a;   /* raised / hover */
  --rule:    #263561;   /* hairlines */
  --ink:     #e8eefb;   /* text */
  --mute:    #93a3c2;   /* secondary text */
  --blue:    #6c9bff;   /* links on dark */
  --royal:   #1e3a8a;   /* deep brand blue */
  --gold:    #D4AF37;   /* the accent */
  --gold-lt: #F3E3A3;

  /* Type */
  --serif: "Fraunces", Georgia, "Times New Roman", serif;
  --sans:  "Hanken Grotesk", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  --step--1: clamp(0.84rem, 0.82rem + 0.1vw, 0.9rem);
  --step-0:  clamp(1rem, 0.97rem + 0.15vw, 1.0625rem);
  --step-1:  clamp(1.2rem, 1.1rem + 0.5vw, 1.45rem);
  --step-2:  clamp(1.55rem, 1.3rem + 1.2vw, 2.2rem);
  --step-3:  clamp(2.1rem, 1.6rem + 2.4vw, 3.3rem);
  --step-hero: clamp(3rem, 1.5rem + 7.5vw, 7rem);

  --wrap: 1120px;
  --gutter: clamp(1.25rem, 4vw, 3rem);
  --radius: 10px;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--night);
  color: var(--ink);
  font: 400 var(--step-0)/1.65 var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img, svg, object { max-width: 100%; display: block; }
h1, h2, h3 { font-family: var(--serif); font-weight: 500; line-height: 1.12; margin: 0; letter-spacing: -0.01em; }
p { margin: 0 0 1em; max-width: 68ch; }
a { color: var(--blue); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { color: var(--gold-lt); }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; border-radius: 3px; }
::selection { background: var(--gold); color: var(--night); }

.wrap { width: min(100% - 2 * var(--gutter), var(--wrap)); margin-inline: auto; }
.skip { position: absolute; left: -999px; top: 0; background: var(--gold); color: var(--night); padding: .6rem 1rem; z-index: 99; }
.skip:focus { left: 1rem; top: 1rem; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 20;
  background: rgba(10, 17, 38, .86);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--rule);
}
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; min-height: 64px; gap: 1rem; }
.brand { font-family: var(--serif); font-size: 1.15rem; font-weight: 500; color: var(--ink); text-decoration: none; letter-spacing: .005em; }
.brand:hover { color: var(--gold-lt); }
.site-nav ul { display: flex; gap: clamp(1rem, 3vw, 2.2rem); list-style: none; margin: 0; padding: 0; }
.site-nav a {
  color: var(--mute); text-decoration: none; font-size: var(--step--1); font-weight: 500;
  padding: .35rem 0; border-bottom: 2px solid transparent; transition: color .2s, border-color .2s;
}
.site-nav a:hover { color: var(--ink); }
.site-nav a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--gold); }

/* ---------- Hero (Resume) ---------- */
.hero { padding: clamp(3.5rem, 9vw, 7rem) 0 clamp(2.5rem, 6vw, 4.5rem); position: relative; overflow: hidden; }
.hero::before { /* quiet blue glow, top-right */
  content: ""; position: absolute; inset: -20% -10% auto auto; width: 60vw; height: 60vw; max-width: 760px; max-height: 760px;
  background: radial-gradient(closest-side, rgba(30, 58, 138, .55), rgba(30, 58, 138, 0));
  pointer-events: none;
}
.hero .wrap { position: relative; }
.hero h1 { font-size: var(--step-hero); font-weight: 400; letter-spacing: -0.025em; line-height: .98; }
.hero h1 span { display: block; }
.hero h1 .last { font-style: italic; color: var(--gold-lt); }
.gold-rule { height: 2px; width: min(100%, 420px); margin: clamp(1.5rem, 3vw, 2.2rem) 0 1.25rem; background: linear-gradient(90deg, var(--gold), rgba(212,175,55,0)); transform-origin: left; }
.hero .title { font-family: var(--serif); font-size: var(--step-1); color: var(--ink); margin: 0 0 .35rem; max-width: none; }
.hero .where { color: var(--mute); font-size: var(--step--1); margin: 0 0 2rem; max-width: none; }
.hero .summary { font-size: clamp(1.05rem, 1rem + .3vw, 1.2rem); line-height: 1.7; max-width: 62ch; color: #d3dcf0; }
.actions { display: flex; flex-wrap: wrap; gap: .8rem; margin-top: 2rem; }
.btn {
  display: inline-flex; align-items: center; gap: .5rem; cursor: pointer;
  font: 600 var(--step--1)/1 var(--sans); letter-spacing: .01em;
  padding: .95rem 1.35rem; border-radius: 999px; text-decoration: none;
  border: 1px solid var(--gold); transition: background .2s, color .2s, border-color .2s;
}
.btn-gold { background: var(--gold); color: var(--night); }
.btn-gold:hover { background: var(--gold-lt); color: var(--night); border-color: var(--gold-lt); }
.btn-ghost { background: transparent; color: var(--gold-lt); }
.btn-ghost:hover { background: rgba(212,175,55,.12); color: var(--gold-lt); }
.btn svg { width: 1.05em; height: 1.05em; }

/* ---------- Sections (ledger layout) ---------- */
.section { padding: clamp(2.5rem, 6vw, 4.5rem) 0; border-top: 1px solid var(--rule); }
.section .wrap { display: grid; grid-template-columns: minmax(0, 220px) minmax(0, 1fr); gap: clamp(1.5rem, 5vw, 4.5rem); }
.section-head h2 { font-size: var(--step-2); }
.section-head p { color: var(--mute); font-size: var(--step--1); margin-top: .75rem; }
.section-head { align-self: start; position: sticky; top: 92px; }

/* ---------- Entries ---------- */
.entry { position: relative; padding-bottom: clamp(2rem, 4vw, 3rem); }
.entry:last-child { padding-bottom: 0; }
.entry-top { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: .25rem 1.5rem; }
.entry h3 { font-size: var(--step-1); }
.entry .org { color: var(--gold-lt); }
.entry .dates { color: var(--mute); font-size: var(--step--1); white-space: nowrap; font-variant-numeric: tabular-nums; }
.entry .meta { color: var(--mute); font-size: var(--step--1); margin: .3rem 0 1rem; max-width: none; }
.entry ul { margin: 0; padding: 0; list-style: none; }
.entry li { position: relative; padding-left: 1.3rem; margin-bottom: .65rem; max-width: 70ch; }
.entry li::before { content: ""; position: absolute; left: 0; top: .72em; width: 6px; height: 6px; border-radius: 50%; background: var(--gold); }
.proj-link {
  display: inline-block; margin-left: .45rem; font-size: var(--step--1); font-weight: 600;
  color: var(--gold-lt); text-decoration: none; padding: .05rem .55rem; border: 1px solid rgba(212,175,55,.45);
  border-radius: 999px; white-space: nowrap; transition: background .2s, border-color .2s;
}
.proj-link:hover { background: rgba(212,175,55,.16); border-color: var(--gold); color: var(--gold-lt); }

/* Experience timeline line (drawn on scroll) */
.timeline { position: relative; padding-left: 1.6rem; }
.timeline::before { content: ""; position: absolute; left: 0; top: .5rem; bottom: .5rem; width: 1px; background: var(--rule); }
.timeline .progress { position: absolute; left: -1px; top: .5rem; width: 3px; height: 0; background: linear-gradient(var(--gold), var(--gold-lt)); border-radius: 2px; }
.timeline .entry::before { content: ""; position: absolute; left: calc(-1.6rem - 4px); top: .55rem; width: 9px; height: 9px; border-radius: 50%; background: var(--night); border: 2px solid var(--gold); }

/* Freelance cards */
.service-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1.25rem; }
.service { background: var(--deep); border: 1px solid var(--rule); border-radius: var(--radius); padding: 1.5rem; }
.service h3 { font-size: var(--step-1); margin-bottom: .6rem; }
.service p { color: #c3cee6; margin: 0; }
.service .tag { display: inline-block; margin-top: 1rem; font-size: var(--step--1); color: var(--gold-lt); }

/* Skills & certs */
.skill-groups { display: grid; gap: 1.1rem; margin: 0 0 2.5rem; }
.skill-row { display: grid; grid-template-columns: 11rem 1fr; gap: .4rem 1.5rem; padding-bottom: 1.1rem; border-bottom: 1px solid var(--rule); }
.skill-row:last-child { border-bottom: 0; }
.skill-row dt { font-family: var(--serif); color: var(--gold-lt); font-size: 1.05rem; }
.skill-row dd { margin: 0; color: #d3dcf0; }
.sub-h { font-size: var(--step-1); margin: 0 0 1rem; }
.cert-list { list-style: none; margin: 0; padding: 0; }
.cert-list li { display: flex; justify-content: space-between; gap: 1rem; padding: .7rem 0; border-bottom: 1px solid var(--rule); max-width: 640px; }
.cert-list li:last-child { border-bottom: 0; }
.cert-list .yr { color: var(--mute); font-variant-numeric: tabular-nums; }

/* Contact */
.contact-list { list-style: none; margin: 0 0 1rem; padding: 0; display: grid; gap: .5rem; font-size: var(--step-1); font-family: var(--serif); }
.contact-list span { display: block; font: 500 var(--step--1)/1.3 var(--sans); color: var(--mute); }
.contact-list a { color: var(--ink); text-decoration-color: var(--gold); text-decoration-thickness: 2px; }
.contact-list a:hover { color: var(--gold-lt); }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--rule); padding: 2rem 0 2.5rem; color: var(--mute); font-size: var(--step--1); }
.site-footer .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .75rem 2rem; }
.site-footer a { color: var(--mute); }
.site-footer a:hover { color: var(--gold-lt); }
.site-footer p { margin: 0; max-width: none; }

/* ---------- Project pages ---------- */
.page-hero { padding: clamp(3rem, 7vw, 5.5rem) 0 clamp(2rem, 4vw, 3rem); position: relative; overflow: hidden; }
.page-hero::before { content: ""; position: absolute; inset: -30% -10% auto auto; width: 50vw; height: 50vw; max-width: 620px; max-height: 620px; background: radial-gradient(closest-side, rgba(30,58,138,.5), rgba(30,58,138,0)); pointer-events: none; }
.page-hero .wrap { position: relative; }
.crumb { font-size: var(--step--1); color: var(--mute); margin: 0 0 1.5rem; }
.crumb a { color: var(--mute); }
.crumb a:hover { color: var(--gold-lt); }
.page-hero h1 { font-size: var(--step-3); font-weight: 400; letter-spacing: -.02em; max-width: 18ch; }
.page-hero .lede { font-size: clamp(1.1rem, 1rem + .4vw, 1.3rem); color: #d3dcf0; max-width: 60ch; margin-top: 1.25rem; }
.facts { display: flex; flex-wrap: wrap; gap: .5rem 2.5rem; margin: 1.75rem 0 0; padding: 1.1rem 0 0; border-top: 1px solid var(--rule); }
.facts div { min-width: 9rem; }
.facts dt { font-size: var(--step--1); color: var(--mute); }
.facts dd { margin: .1rem 0 0; color: var(--ink); font-weight: 500; }
.ext-link { margin-top: 1.5rem; }

.pj-section { padding: clamp(2.25rem, 5vw, 3.75rem) 0; border-top: 1px solid var(--rule); scroll-margin-top: 70px; }
.pj-section .wrap { display: grid; grid-template-columns: minmax(0, 220px) minmax(0, 1fr); gap: clamp(1.5rem, 5vw, 4.5rem); }
.pj-section h2 { font-size: var(--step-2); align-self: start; position: sticky; top: 92px; }
.pj-body ul { padding-left: 1.2rem; max-width: 66ch; }
.pj-body li { margin-bottom: .6rem; }
.pj-body li::marker { color: var(--gold); }
.pj-body strong { color: var(--gold-lt); font-weight: 600; }
.pj-body em { color: var(--mute); }

.figure { margin: 2rem 0 0; background: var(--deep); border: 1px solid var(--rule); border-radius: var(--radius); padding: clamp(.5rem, 1.5vw, 1rem); overflow: hidden; }
.figure object, .figure img { width: 100%; height: auto; }
.figure object { aspect-ratio: var(--ar); }
.figure figcaption { padding: .8rem .5rem .4rem; color: var(--mute); font-size: var(--step--1); max-width: none; }
.figure.shot { max-width: 720px; }
.figure.shot .crop { max-height: 640px; overflow: auto; border-radius: 6px; }
.figure.shot img { height: auto; }
.wide-figs .wrap { display: block; }

/* Project index */
.proj-grid { display: grid; gap: 1.5rem; padding: 0 0 clamp(3rem, 7vw, 5rem); }
.proj-card {
  display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 0; text-decoration: none; color: inherit;
  background: var(--deep); border: 1px solid var(--rule); border-radius: var(--radius); overflow: hidden;
  transition: border-color .25s, transform .25s;
}
.proj-card:hover { border-color: var(--gold); color: inherit; transform: translateY(-2px); }
.proj-card .copy { padding: clamp(1.5rem, 3vw, 2.5rem); }
.proj-card h2 { font-size: var(--step-2); margin-bottom: .75rem; }
.proj-card p { color: #c3cee6; }
.proj-card .go { color: var(--gold-lt); font-weight: 600; font-size: var(--step--1); }
.proj-card .jump { margin: 1rem 0 0; padding: 0; list-style: none; display: flex; flex-wrap: wrap; gap: .4rem; }
.proj-card .jump li { font-size: var(--step--1); color: var(--mute); border: 1px solid var(--rule); border-radius: 999px; padding: .15rem .65rem; }
.proj-card .art { background: #0c1530; display: grid; place-items: center; padding: 1rem; border-left: 1px solid var(--rule); }
.proj-card .art img { width: 100%; height: auto; max-height: 280px; object-fit: contain; object-position: top; }

/* ---------- Motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; animation: none !important; }
}

/* ---------- Responsive ---------- */
@media (max-width: 820px) {
  .section .wrap, .pj-section .wrap { grid-template-columns: 1fr; gap: 1.25rem; }
  .section-head, .pj-section h2 { position: static; }
  .skill-row { grid-template-columns: 1fr; }
  .proj-card { grid-template-columns: 1fr; }
  .proj-card .art { border-left: 0; border-top: 1px solid var(--rule); }
  .site-header .wrap { min-height: 56px; }
}

/* ---------- Print ---------- */
.print-only { display: none; }
@media print {
  @page { size: letter; margin: 0.55in 0.6in; }
  :root { color-scheme: light; }
  html, body { background: #fff !important; color: #111 !important; font-size: 9.6pt; line-height: 1.42; }
  *, *::before, *::after { animation: none !important; transition: none !important; box-shadow: none !important; text-shadow: none !important; }
  .portrait, .site-header, .site-footer, .skip, .actions, .proj-link, .hero::before, .gold-rule, .timeline .progress, .section-head p, .no-print { display: none !important; }
  .print-only { display: block !important; }
  .print-only.inl { display: inline !important; }
  .wrap { width: 100% !important; margin: 0 !important; }
  .hero { padding: 0 0 8pt; overflow: visible; }
  .hero h1 { font-size: 24pt; color: #111; letter-spacing: 0; line-height: 1.05; }
  .hero h1 span { display: inline; }
  .hero h1 span + span::before { content: " "; }
  .hero h1 .last { color: #111; font-style: normal; }
  .hero .title { font-size: 11pt; color: #111; margin: 2pt 0; }
  .hero .where { color: #333; margin: 0 0 6pt; font-size: 9pt; }
  .hero .summary { font-size: 9.6pt; color: #111; max-width: none; line-height: 1.42; margin-bottom: 0; }
  .print-contact { font-size: 9pt; color: #111; margin: 0 0 6pt; max-width: none; }
  .section { padding: 8pt 0 0; border-top: 0.75pt solid #999; margin-top: 8pt; }
  .section .wrap { display: block; }
  .section-head { position: static; }
  .section-head h2 { font-size: 11.5pt; text-transform: none; margin-bottom: 4pt; color: #111; }
  .entry { padding-bottom: 6pt; break-inside: avoid; }
  .entry h3 { font-size: 10.5pt; color: #111; }
  .entry .org, .entry .dates, .entry .meta { color: #333 !important; font-size: 9pt; }
  .entry .meta { margin: 0 0 3pt; }
  .entry li { margin-bottom: 2pt; padding-left: 11pt; }
  .entry li::before { content: "\2022"; background: none; width: auto; height: auto; top: 0; left: 2pt; color: #111; border-radius: 0; }
  .timeline { padding-left: 0; }
  .timeline::before, .timeline .entry::before { display: none; }
  .service-grid { display: block; }
  .service { background: none; border: 0; padding: 0 0 4pt; }
  .service h3 { font-size: 10pt; display: inline; }
  .service h3::after { content: ": "; }
  .service p { display: inline; color: #111; }
  .service .tag { display: none; }
  .skill-groups { gap: 3pt; margin-bottom: 6pt; }
  .skill-row { display: block; padding-bottom: 2pt; border: 0; }
  .skill-row dt { display: inline; color: #111; font-family: var(--sans); font-weight: 700; font-size: 9.4pt; }
  .skill-row dt::after { content: ": "; }
  .skill-row dd { display: inline; color: #111; }
  .sub-h { font-size: 10.5pt; margin-bottom: 3pt; color: #111; }
  .cert-list li { padding: 1pt 0; border: 0; max-width: none; }
  .cert-list .yr { color: #333; }
  .contact-list { font-family: var(--sans); font-size: 9.6pt; gap: 2pt; }
  .contact-list a { color: #111; text-decoration: none; }
  .contact-list span { display: inline; color: #333; }
  .contact-list span::after { content: ": "; }
  .contact-list li > span + a, .contact-list li > span + b { display: inline; }
  a { color: #111 !important; text-decoration: none; }
}

/* ---------- Hero portrait ---------- */
.hero-grid { display: grid; grid-template-columns: minmax(0, 1fr) 200px; gap: clamp(1.5rem, 4vw, 4rem); align-items: start; }
.portrait { margin: 0; position: relative; order: 2; }
.portrait img { width: 100%; height: auto; aspect-ratio: 1/1; object-fit: cover; border-radius: var(--radius); border: 1px solid rgba(212,175,55,.55); box-shadow: 0 24px 60px rgba(0,0,0,.45); }
.portrait::after { content: ""; position: absolute; inset: 14px -14px -14px 14px; border: 1px solid var(--rule); border-radius: var(--radius); z-index: -1; }

/* ---------- Selected work ---------- */
.work-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 1rem; }
.work-card { display: flex; flex-direction: column; background: var(--deep); border: 1px solid var(--rule); border-radius: var(--radius); overflow: hidden; text-decoration: none; color: inherit; transition: border-color .25s, transform .25s; }
.work-card:hover { border-color: var(--gold); color: inherit; transform: translateY(-2px); }
.work-card.feat { grid-row: span 2; }
.work-card img { width: 100%; height: auto; background: #0c1530; border-bottom: 1px solid var(--rule); }
.wc-copy { padding: 1.25rem 1.4rem 1.4rem; display: flex; flex-direction: column; gap: .35rem; flex: 1; }
.wc-copy h3 { font-size: var(--step-1); }
.wc-copy p { color: #c3cee6; margin: 0; font-size: var(--step--1); }
.wc-copy .go { margin-top: auto; padding-top: .6rem; color: var(--gold-lt); font-weight: 600; font-size: var(--step--1); }
.work-card.feat h3 { font-size: var(--step-2); }
.work-card.feat p { font-size: var(--step-0); }

/* ---------- Entrance state (only when JS + motion allowed) ---------- */
.anim [data-in] { opacity: 0; }
.anim .gold-rule { transform: scaleX(0); }
@media print {
  .anim [data-in] { opacity: 1 !important; transform: none !important; }
  .anim .gold-rule { transform: none !important; }
}

/* ---------- Phone and tablet overrides (kept last so they win) ---------- */
@media (max-width: 820px) {
  .section .wrap, .pj-section .wrap { grid-template-columns: minmax(0, 1fr); }
  .pj-body { min-width: 0; }
  .hero-grid { grid-template-columns: minmax(0, 1fr); }
  .portrait { order: -1; max-width: 140px; margin-bottom: 1.5rem; }
  .portrait::after { display: none; }
  .work-grid { grid-template-columns: 1fr; }
  .work-card.feat { grid-row: auto; }
  .figure { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .figure object { min-width: 760px; }
  .figure figcaption { position: sticky; left: 0; }
  .figure:not(.shot) figcaption::after { content: " Swipe sideways to see the full diagram."; color: var(--gold-lt); }
}
@media print { .portrait { display: none !important; } }
