/* =========================================================
   Liam Wynne — CV
   Engineered minimal. JetBrains Mono + Geist.
   ========================================================= */

:root {
  --fs-display: clamp(2.6rem, 7.5vw, 5.25rem);
  --fs-role:    clamp(1rem, 1.4vw, 1.1rem);
  --fs-h2:      0.74rem;     /* small caps section labels */
  --fs-h3:      1.05rem;
  --fs-body:    0.98rem;
  --fs-small:   0.78rem;

  --leading-tight: 1.02;
  --leading:       1.6;

  --max:    760px;
  --gutter: clamp(1.5rem, 5vw, 2.5rem);

  --ease: cubic-bezier(.2,.7,.2,1);
}

/* ---- THEMES ------------------------------------------- */
html[data-theme="light"] {
  --bg:        #f5f3ee;
  --bg-elev:   #ffffff;
  --fg:        #0f0f10;
  --fg-soft:   #38383a;
  --fg-mute:   #7a7a7e;
  --line:      #d5d2c9;
  --line-soft: #e4e1d8;
  --hover:     #0f0f10;
  color-scheme: light;
}
html[data-theme="dark"] {
  --bg:        #0e0e10;
  --bg-elev:   #161618;
  --fg:        #ededee;
  --fg-soft:   #b8b8bc;
  --fg-mute:   #7c7c82;
  --line:      #26262b;
  --line-soft: #1c1c20;
  --hover:     #ffffff;
  color-scheme: dark;
}

/* ---- RESET / BASE ------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--fg);
  font-family: "Geist", -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: var(--fs-body);
  line-height: var(--leading);
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  transition: background-color .35s var(--ease), color .35s var(--ease);
}

::selection { background: var(--fg); color: var(--bg); }

a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; background: none; border: 0; padding: 0; }

/* ---- TOPBAR ------------------------------------------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem;
  padding: 1rem var(--gutter);
  background: color-mix(in oklab, var(--bg) 92%, transparent);
  backdrop-filter: saturate(160%) blur(10px);
  -webkit-backdrop-filter: saturate(160%) blur(10px);
  border-bottom: 1px solid var(--line-soft);
}

.mark {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-weight: 700;
  font-size: 0.82rem;
  letter-spacing: 0.04em;
  color: var(--fg);
}

.navlinks {
  display: none;
  gap: 1.5rem;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.74rem;
  letter-spacing: 0.04em;
  color: var(--fg-mute);
}
.navlinks a:hover { color: var(--fg); }
@media (min-width: 720px) {
  .navlinks { display: inline-flex; }
}

.topbar__actions { display: inline-flex; gap: 0.4rem; align-items: center; }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  height: 30px; padding: 0 0.75rem;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--fg-soft);
  font-family: "JetBrains Mono", monospace;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  transition: color .2s var(--ease), border-color .2s var(--ease);
}
.btn:hover { color: var(--fg); border-color: var(--fg); }
.btn--icon { width: 30px; padding: 0; }
.btn--icon .ico-moon { display: none; }
html[data-theme="dark"] .btn--icon .ico-sun  { display: none; }
html[data-theme="dark"] .btn--icon .ico-moon { display: inline; }

/* ---- MAIN LAYOUT -------------------------------------- */
main {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

/* ---- HERO --------------------------------------------- */
.hero {
  padding: clamp(4rem, 10vw, 8rem) 0 clamp(3rem, 7vw, 5.5rem);
}
.hero__eyebrow {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.74rem;
  letter-spacing: 0.06em;
  color: var(--fg-mute);
  margin: 0 0 2rem;
  text-transform: lowercase;
}
.hero__name {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-weight: 600;
  font-size: var(--fs-display);
  line-height: var(--leading-tight);
  letter-spacing: -0.045em;
  margin: 0;
  color: var(--fg);
}
.hero__role {
  margin: 1.25rem 0 0;
  font-size: var(--fs-role);
  color: var(--fg-soft);
  font-weight: 400;
}
.hero__lede {
  max-width: 56ch;
  margin: 2rem 0 0;
  color: var(--fg-soft);
  font-size: 1.02rem;
  line-height: 1.65;
}

/* ---- SECTION FRAME ------------------------------------ */
.section {
  padding: clamp(2.5rem, 5vw, 3.5rem) 0;
  border-top: 1px solid var(--line-soft);
}

.section__title {
  font-family: "JetBrains Mono", monospace;
  font-weight: 500;
  font-size: var(--fs-h2);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--fg-mute);
  margin: 0 0 clamp(1.75rem, 3vw, 2.5rem);
}

/* ---- WORK / ROLE -------------------------------------- */
.role {
  padding: 0 0 2.25rem;
  margin: 0 0 2rem;
  border-bottom: 1px solid var(--line-soft);
}
.role:last-of-type { border-bottom: 0; padding-bottom: 0; margin-bottom: 0; }

.role__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.4rem 1.5rem;
  margin-bottom: 1.1rem;
}
.role__title {
  font-family: "Geist", sans-serif;
  font-weight: 500;
  font-size: var(--fs-h3);
  letter-spacing: -0.005em;
  margin: 0 0 0.2rem;
  color: var(--fg);
}
.role__org {
  margin: 0;
  color: var(--fg-mute);
  font-size: 0.92rem;
}
.role__years {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.78rem;
  letter-spacing: 0.02em;
  color: var(--fg-mute);
  margin: 0;
  white-space: nowrap;
}

.role__bullets {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}
.role__bullets li {
  position: relative;
  padding-left: 1.4rem;
  color: var(--fg-soft);
  line-height: 1.6;
}
.role__bullets li::before {
  content: "—";
  position: absolute;
  left: 0;
  color: var(--fg-mute);
  font-family: "JetBrains Mono", monospace;
  font-size: 0.85rem;
  top: 0.02em;
}

/* ---- STACK -------------------------------------------- */
.stack {
  margin: 0;
}
.stack__row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: baseline;
  gap: 1rem;
  padding: 0.7rem 0;
  border-top: 1px dashed var(--line-soft);
}
.stack__row:first-child { border-top: 0; padding-top: 0; }
.stack__row:last-child  { padding-bottom: 0; }
.stack__row dt {
  font-family: "Geist", sans-serif;
  font-weight: 500;
  color: var(--fg);
  font-size: 0.98rem;
}
.stack__row dd {
  margin: 0;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.74rem;
  letter-spacing: 0.04em;
  color: var(--fg-mute);
}

/* ---- PROJECT ------------------------------------------ */
.project {
  margin: 0;
}
.project__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.4rem 1.5rem;
  margin-bottom: 1rem;
}
.project__title {
  font-family: "Geist", sans-serif;
  font-weight: 500;
  font-size: var(--fs-h3);
  margin: 0;
  letter-spacing: -0.005em;
}
.project__meta {
  margin: 0;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.74rem;
  letter-spacing: 0.04em;
  color: var(--fg-mute);
}
.project__body {
  margin: 0 0 1.25rem;
  color: var(--fg-soft);
  max-width: 60ch;
  line-height: 1.6;
}
.project__demo {
  display: inline-block;
  margin: 0 0 1.25rem;
  border: 1px solid var(--line);
  background: var(--bg-elev);
  padding: 6px;
  line-height: 0;
  transition: border-color .2s var(--ease), transform .25s var(--ease);
}
.project__demo:hover {
  border-color: var(--fg);
  transform: translateY(-1px);
}
.project__demo img {
  display: block;
  width: 360px;
  max-width: 100%;
  height: auto;
}
.project__links {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.82rem;
  color: var(--fg);
  border-bottom: 1px solid var(--line);
  padding-bottom: 1px;
  transition: border-color .2s var(--ease);
}
.link:hover { border-bottom-color: var(--fg); }
.link__arr { color: var(--fg-mute); }

/* ---- EDUCATION ---------------------------------------- */
.edu {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}
.edu__item {
  padding: 0 0 1.5rem;
  border-bottom: 1px solid var(--line-soft);
}
.edu__item:last-of-type { border-bottom: 0; padding-bottom: 0; }
.edu__years {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.78rem;
  color: var(--fg-mute);
  margin: 0 0 0.4rem;
}
.edu__degree {
  font-family: "Geist", sans-serif;
  font-weight: 500;
  font-size: var(--fs-h3);
  margin: 0 0 0.25rem;
  color: var(--fg);
}
.edu__org   { margin: 0 0 0.25rem; color: var(--fg-mute); font-size: 0.92rem; }
.edu__grade { margin: 0; font-family: "JetBrains Mono", monospace; font-size: 0.74rem; letter-spacing: 0.04em; color: var(--fg-soft); }

/* ---- CONTACT ------------------------------------------ */
.contact {
  margin: 0 0 2rem;
  display: flex;
  flex-direction: column;
  gap: 0;
}
.contact__row {
  display: grid;
  grid-template-columns: 90px 1fr;
  align-items: baseline;
  gap: 1.5rem;
  padding: 0.6rem 0;
  border-top: 1px dashed var(--line-soft);
}
.contact__row:first-child { border-top: 0; padding-top: 0; }
.contact__row dt {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.74rem;
  letter-spacing: 0.04em;
  color: var(--fg-mute);
  text-transform: lowercase;
}
.contact__row dd {
  margin: 0;
  color: var(--fg);
  display: inline-flex;
  align-items: baseline;
  gap: 0.6rem;
  flex-wrap: wrap;
}
.contact__row a {
  border-bottom: 1px solid var(--line);
  padding-bottom: 1px;
  transition: border-color .2s var(--ease), color .2s var(--ease);
}
.contact__row a:hover { color: var(--fg); border-bottom-color: var(--fg); }

.contact__mask {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.92rem;
  color: var(--fg-mute);
}
.reveal-btn {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.68rem;
  letter-spacing: 0.05em;
  color: var(--fg-mute);
  border: 1px solid var(--line);
  padding: 2px 8px;
  transition: color .2s var(--ease), border-color .2s var(--ease);
}
.reveal-btn:hover { color: var(--fg); border-color: var(--fg); }

.contact__row.is-revealed .contact__mask { color: var(--fg); font-family: "Geist", sans-serif; font-size: 0.98rem; }
.contact__row.is-revealed .reveal-btn { display: none; }

/* ---- REFERENCES --------------------------------------- */
.references {
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--line-soft);
}
.references > summary {
  cursor: pointer;
  list-style: none;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.74rem;
  letter-spacing: 0.05em;
  color: var(--fg-mute);
  transition: color .2s var(--ease);
  user-select: none;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}
.references > summary::-webkit-details-marker { display: none; }
.references > summary::before {
  content: "+";
  font-size: 0.95rem;
  transition: transform .2s var(--ease);
}
.references[open] > summary::before { content: "−"; }
.references > summary:hover { color: var(--fg); }

.references__list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 1.25rem;
}
.ref {
  padding: 1rem 0 0;
  border-top: 1px dashed var(--line-soft);
}
.ref:first-child { border-top: 0; padding-top: 0; }
.ref__name { font-family: "Geist", sans-serif; font-weight: 500; font-size: 0.98rem; margin: 0 0 0.2rem; }
.ref__role { margin: 0 0 0.3rem; color: var(--fg-mute); font-size: 0.86rem; }
.ref__contact { margin: 0; font-size: 0.88rem; }
.ref__contact a { border-bottom: 1px solid var(--line); padding-bottom: 1px; }
.ref__contact a:hover { color: var(--fg); border-bottom-color: var(--fg); }

/* ---- FOOTER ------------------------------------------- */
.footer {
  max-width: var(--max);
  margin: 0 auto;
  padding: 3rem var(--gutter) 4rem;
  border-top: 1px solid var(--line-soft);
  margin-top: 2rem;
}
.footer p {
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  color: var(--fg-mute);
}
.footer__sep { color: var(--line); }

/* ---- REDUCED MOTION ----------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.001ms !important; }
}

/* ---- PRINT / PDF EXPORT ------------------------------- */
@page {
  size: A4;
  margin: 14mm 14mm 16mm 14mm;
}

@media print {
  /* Pin to light palette regardless of toggle */
  html,
  html[data-theme="light"],
  html[data-theme="dark"] {
    --bg:        #ffffff;
    --bg-elev:   #ffffff;
    --fg:        #0f0f10;
    --fg-soft:   #2a2a2c;
    --fg-mute:   #5e5e62;
    --line:      #cccccc;
    --line-soft: #e2e2e0;
  }

  body { background: #ffffff; color: var(--fg); font-size: 9.5pt; line-height: 1.5; }

  /* Strip chrome */
  .topbar, .footer, .reveal-btn, .project__demo { display: none !important; }
  .references > summary { display: none !important; }

  /* Open details defensively, in case JS didn't run */
  .references__list { display: flex !important; margin-top: 0.4rem; }
  .references { border-top: 1px solid var(--line-soft); padding-top: 0.8rem; margin-top: 0.9rem; break-inside: avoid; page-break-inside: avoid; }
  .references::before {
    content: "REFERENCES";
    display: block;
    font-family: "JetBrains Mono", monospace;
    font-size: 0.7rem;
    letter-spacing: 0.16em;
    color: var(--fg-mute);
    margin-bottom: 0.5rem;
  }

  /* Layout */
  main { max-width: 100%; padding: 0; }
  .hero { padding: 0 0 0.6rem; }
  .section { padding: 0.7rem 0; break-inside: auto; page-break-inside: auto; }
  .section__title { break-after: avoid-page; page-break-after: avoid; }
  .role { break-inside: avoid; page-break-inside: avoid; padding-bottom: 0.7rem; margin-bottom: 0.7rem; }

  /* Type scale tuned for A4 */
  .hero__name { font-size: 2.6rem; letter-spacing: -0.04em; }
  .hero__role { font-size: 0.98rem; margin-top: 0.6rem; }
  .hero__lede { font-size: 0.92rem; margin-top: 1rem; max-width: none; }
  .section__title { margin-bottom: 0.7rem; font-size: 0.7rem; }

  .role__head { margin-bottom: 0.5rem; }
  .role__title { font-size: 0.98rem; }
  .role__org   { font-size: 0.86rem; }
  .role__years { font-size: 0.74rem; }
  .role__bullets { gap: 0.32rem; }
  .role__bullets li { font-size: 0.88rem; line-height: 1.45; }

  .stack__row { padding: 0.32rem 0; }
  .stack__row dt { font-size: 0.9rem; }
  .stack__row dd { font-size: 0.7rem; }

  .project__title { font-size: 0.98rem; }
  .project__meta  { font-size: 0.7rem; }
  .project__body  { font-size: 0.9rem; line-height: 1.45; }
  .project__links { gap: 0.28rem; }
  .link { font-size: 0.78rem; }

  .edu { gap: 0.8rem; }
  .edu__item { padding-bottom: 0.8rem; }
  .edu__degree { font-size: 0.96rem; }
  .edu__org    { font-size: 0.86rem; }

  .contact__row { padding: 0.28rem 0; gap: 1rem; }
  .contact__row dt { font-size: 0.7rem; }
  .contact__row.is-revealed .contact__mask { font-size: 0.9rem; }
  .contact__mask { font-size: 0.9rem; }

  /* Links print as plain text — recruiters will type them or click in PDF */
  a { color: var(--fg); text-decoration: none; }
  .contact__row a, .link, .ref__contact a { border-bottom: none; }
}

/* When invoked headless with ?print=1, apply print rules on screen too */
html[data-print="1"] body { background: #ffffff; }
html[data-print="1"] .topbar,
html[data-print="1"] .footer,
html[data-print="1"] .reveal-btn,
html[data-print="1"] .project__demo,
html[data-print="1"] .references > summary { display: none !important; }
html[data-print="1"] .references__list { display: flex !important; }
html[data-print="1"] main { max-width: 100%; padding: 14mm; }
