/* =========================================================================
   Ryan Wright — Resume
   Design language: adapted from Pi.dev (Pi Harness)
   - Serif: Newsreader (Plantin-feel free alternative, Google Fonts)
   - Code:  Commit Mono (self-hosted)
   - Label: Departure Mono (self-hosted)
   ========================================================================= */

/* ---------- Local font faces -------------------------------------------- */
@font-face {
  font-family: "Commit Mono";
  src: url("./fonts/CommitMono-400-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Commit Mono";
  src: url("./fonts/CommitMono-700-Regular.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Departure Mono";
  src: url("./fonts/DepartureMono-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

/* ---------- Design tokens ----------------------------------------------- */
:root {
  /* Light theme (default) */
  --bg:            #f4f2f0;
  --surface:       #eef1f3;
  --text:          #252f3d;
  --secondary:     #4b607c;
  --muted:         #394352;
  --accent:        #09090b;
  --hairline:      rgba(37, 47, 61, 0.12);
  --hairline-soft: rgba(37, 47, 61, 0.06);
  --link:          #252f3d;
  --link-hover:    #09090b;
  --terminal-bg:   #ffffff;
  --terminal-shadow: 0 4px 40px rgba(20, 36, 51, 0.08);
  --selection-bg:  rgba(106, 159, 204, 0.35);
  --glow:          rgba(255, 196, 138, 0.20); /* warm sunrise glow */
  --grid-dot:      rgba(37, 47, 61, 0.05);
  --accent-italic: #3a6088;
  --nav-bg:        rgba(244, 242, 240, 0.82);
  --book-shadow:   0 8px 30px rgba(28, 27, 26, 0.16);

  /* Type families */
  --serif: "Newsreader", "Plantin MT Pro", "EB Garamond", Georgia, "Times New Roman", serif;
  --mono-code: "Commit Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --mono-label: "Departure Mono", "Commit Mono", ui-monospace, SFMono-Regular, monospace;

  /* Type scale (from Pi spec) */
  --t-h1-size: 49.5px;     --t-h1-lh: 47.52px;   --t-h1-tracking: -1.98px;
  --t-h2-size: 27px;       --t-h2-lh: 27px;      --t-h2-tracking: -0.405px;
  --t-body-lg-size: 21.96px; --t-body-lg-lh: 34.038px;
  --t-body-size: 18px;     --t-body-lh: 28.8px;
  --t-code-size: 17.1px;   --t-code-lh: 27.36px; --t-code-tracking: 0.2565px;
  --t-code-lg-size: 17.13px; --t-code-lg-lh: 26.55px;
  --t-code-sm-size: 14.4px; --t-code-sm-lh: 21.6px;

  /* Spacing (Pi 4.5px grid) */
  --s-xs:  4.5px;
  --s-sm:  6.9px;
  --s-md:  9.9px;
  --s-lg:  18px;
  --s-xl:  27px;
  --s-2xl: 36px;
  --s-3xl: 72px;
  --s-4xl: 117px;

  /* Radii */
  --r-sm: 4px;
  --r-md: 10px;
  --r-full: 999px;

  /* Layout */
  --col-width: 640px;
  --gutter: clamp(20px, 5vw, 36px);
}

[data-theme="dark"] {
  --bg:            #142433;
  --surface:       #1b2f43;
  --text:          #ffffff;
  --secondary:     #8aa2bd;
  --muted:         #b5c1d1;
  --accent:        #ffffff;
  --hairline:      rgba(255, 255, 255, 0.12);
  --hairline-soft: rgba(255, 255, 255, 0.06);
  --link:          #ffffff;
  --link-hover:    #6a9fcc;
  --terminal-bg:   #0f1b27;
  --terminal-shadow: 0 4px 40px rgba(0, 0, 0, 0.35);
  --selection-bg:  rgba(106, 159, 204, 0.45);
  --glow:          rgba(106, 159, 204, 0.16); /* cool blue glow */
  --grid-dot:      rgba(255, 255, 255, 0.05);
  --accent-italic: #6a9fcc;
  --nav-bg:        rgba(20, 36, 51, 0.78);
  --book-shadow:   0 8px 30px rgba(0, 0, 0, 0.45);
}

/* ---------- Reset & base ------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; -moz-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background:
    radial-gradient(ellipse 900px 440px at 50% -100px, var(--glow), transparent 70%) no-repeat top center,
    radial-gradient(circle at 1px 1px, var(--grid-dot) 1px, transparent 0) 0 0 / 22px 22px,
    var(--bg);
  color: var(--text);
  font-family: var(--serif);
  font-size: var(--t-body-size);
  line-height: var(--t-body-lh);
  font-weight: 400;
  font-feature-settings: "kern", "liga";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* Anchor jump offset under sticky nav */
section[id],
.footer[id] { scroll-margin-top: 80px; }
::selection { background: var(--selection-bg); }

p, h1, h2, h3, h4, h5, h6, ul, ol, dl, dt, dd, figure { margin: 0; padding: 0; }
ul { list-style: none; }
a {
  color: var(--link);
  text-decoration: none;
  border-bottom: 1px solid var(--hairline);
  transition: color 120ms ease, border-color 120ms ease;
}
a:hover { color: var(--link-hover); border-bottom-color: currentColor; }
em { font-style: italic; }
strong { font-weight: 600; }

/* ---------- Skip link --------------------------------------------------- */
.skip-link {
  position: absolute;
  top: -100px;
  left: var(--gutter);
  background: var(--text);
  color: var(--bg);
  padding: var(--s-sm) var(--s-md);
  border: none;
  border-radius: var(--r-sm);
  font-family: var(--mono-label);
  font-size: var(--t-code-sm-size);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  z-index: 100;
}
.skip-link:focus { top: var(--s-md); }

/* ---------- Top nav ---------------------------------------------------- */
.topnav {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--nav-bg);
  -webkit-backdrop-filter: blur(10px) saturate(140%);
          backdrop-filter: blur(10px) saturate(140%);
  border-bottom: 1px solid var(--hairline-soft);
}
.topnav-inner {
  max-width: calc(var(--col-width) + var(--gutter) * 2);
  margin: 0 auto;
  padding: var(--s-md) var(--gutter);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: var(--s-md);
}
.topnav-spacer { display: block; min-width: 36px; }
.topnav-items {
  list-style: none;
  display: flex;
  gap: var(--s-xl);
  margin: 0;
  padding: 0;
  justify-content: center;
}
.topnav-items a {
  font-family: var(--mono-label);
  font-size: var(--t-code-sm-size);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--secondary);
  border: none;
  text-decoration: none;
  padding: var(--s-xs) 0;
  display: inline-block;
  transition: color 120ms ease;
}
.topnav-items a:hover { color: var(--text); }

/* ---------- Theme toggle ----------------------------------------------- */
.theme-toggle {
  justify-self: end;
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  color: var(--secondary);
  border: 1px solid var(--hairline);
  border-radius: var(--r-full);
  cursor: pointer;
  transition: color 150ms ease, border-color 150ms ease, background 150ms ease;
}
.theme-toggle:hover { color: var(--text); border-color: var(--text); }
.theme-toggle .icon { width: 16px; height: 16px; }
[data-theme="light"] .icon-moon { display: none; }
[data-theme="dark"]  .icon-sun  { display: none; }

/* ---------- Page container --------------------------------------------- */
.page {
  max-width: calc(var(--col-width) + var(--gutter) * 2);
  margin: 0 auto;
  padding: clamp(var(--s-2xl), 8vw, var(--s-4xl)) var(--gutter) var(--s-3xl);
}

/* ---------- Hero -------------------------------------------------------- */
.hero { text-align: center; }

.brand {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: var(--s-lg);
  margin-bottom: var(--s-2xl);
}

.monogram {
  display: inline-block;
  width: 56px;
  height: 22px;
  background-color: var(--text);
  -webkit-mask: url("./images/monogram.png") no-repeat left center / contain;
          mask: url("./images/monogram.png") no-repeat left center / contain;
  transition: background-color 150ms ease;
}

/* Every wordmark (theme-adaptive via mask) — used in Why this role */
.every-logo {
  display: block;
  width: 132px;
  height: 36px;
  margin: var(--s-md) 0 var(--s-lg);
  background-color: var(--text);
  -webkit-mask: url("./images/every-logo.svg") no-repeat left center / contain;
          mask: url("./images/every-logo.svg") no-repeat left center / contain;
}

.brand-status {
  font-family: var(--mono-label);
  font-size: var(--t-code-sm-size);
  line-height: var(--t-code-sm-lh);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--secondary);
}

.hero-name {
  font-family: var(--serif);
  font-size: clamp(38px, 8vw, var(--t-h1-size));
  line-height: 1.02;
  letter-spacing: var(--t-h1-tracking);
  font-weight: 500;
  color: var(--text);
  margin-bottom: var(--s-lg);
}

.hero-tagline {
  font-family: var(--serif);
  font-size: var(--t-body-lg-size);
  line-height: var(--t-body-lg-lh);
  font-weight: 450;
  color: var(--text);
  margin: 0 auto var(--s-sm);
  max-width: 32ch;
}
.hero-tagline em {
  font-style: italic;
  color: var(--accent-italic);
}

.hero-descriptor {
  font-family: var(--serif);
  font-size: var(--t-body-size);
  line-height: var(--t-body-lh);
  color: var(--secondary);
  margin-bottom: var(--s-2xl);
}

.hero-meta {
  font-family: var(--mono-label);
  font-size: var(--t-code-sm-size);
  line-height: var(--t-code-sm-lh);
  letter-spacing: 0.04em;
  color: var(--secondary);
  margin: var(--s-xl) auto 0;
}

/* Terminal block stays the same width but centered in the hero */
.hero .terminal { margin-left: auto; margin-right: auto; text-align: left; }

/* ---------- Terminal contact block ------------------------------------- */
.terminal {
  background: var(--terminal-bg);
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  box-shadow: var(--terminal-shadow);
  font-family: var(--mono-code);
  overflow: hidden;
}

.terminal-tabs {
  display: flex;
  align-items: stretch;
  gap: 0;
  border-bottom: 1px solid var(--hairline-soft);
  padding: 0 var(--s-sm);
}

.tab {
  appearance: none;
  background: transparent;
  border: 0;
  padding: var(--s-md) var(--s-md);
  font-family: var(--mono-label);
  font-size: var(--t-code-sm-size);
  line-height: var(--t-code-sm-lh);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--secondary);
  cursor: pointer;
  position: relative;
  transition: color 120ms ease;
}
.tab:hover { color: var(--text); }
.tab.is-active { color: var(--text); }
.tab.is-active::after {
  content: "";
  position: absolute;
  left: var(--s-md);
  right: var(--s-md);
  bottom: -1px;
  height: 1px;
  background: var(--text);
}

.terminal-spacer { flex: 1; }

.terminal-copy {
  appearance: none;
  background: transparent;
  border: 0;
  padding: var(--s-sm);
  color: var(--secondary);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  border-radius: var(--r-sm);
  transition: color 120ms ease, background 120ms ease;
}
.terminal-copy:hover { color: var(--text); background: var(--hairline-soft); }
.terminal-copy svg { width: 15px; height: 15px; }
.terminal-copy.is-copied { color: #2f8a3b; }
[data-theme="dark"] .terminal-copy.is-copied { color: #7dd17f; }

.terminal-pane {
  padding: var(--s-lg) var(--s-xl);
  font-family: var(--mono-code);
  font-size: var(--t-code-lg-size);
  line-height: var(--t-code-lg-lh);
  color: var(--text);
}
.terminal-pane a {
  color: var(--text);
  border-bottom-color: var(--hairline);
}
.terminal-pane a:hover { color: var(--link-hover); border-bottom-color: currentColor; }

.prompt {
  color: var(--secondary);
  margin-right: var(--s-sm);
  user-select: none;
}

/* ---------- Section blocks --------------------------------------------- */
.block {
  margin-top: var(--s-3xl);
  padding-top: var(--s-2xl);
  border-top: 1px solid var(--hairline);
}

.section-label {
  font-family: var(--mono-label);
  font-size: var(--t-code-sm-size);
  line-height: 1;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--secondary);
  margin-bottom: var(--s-xl);
}

.prose-large {
  font-family: var(--serif);
  font-size: var(--t-body-lg-size);
  line-height: var(--t-body-lg-lh);
  font-weight: 450;
  color: var(--text);
  max-width: 60ch;
  text-wrap: pretty;
}
.prose-large + .prose-large { margin-top: var(--s-lg); }

/* ---------- Selected systems (dl) -------------------------------------- */
.systems {
  display: block; /* margins control rhythm; grid row-gap was applying
                     equally between dt↔dd and dd↔next-dt */
}
.systems dt {
  font-family: var(--serif);
  font-size: var(--t-h2-size);
  line-height: 1.15;
  letter-spacing: var(--t-h2-tracking);
  font-weight: 500;
  color: var(--text);
  margin-top: var(--s-2xl);   /* generous gap before each new system */
  margin-bottom: var(--s-sm); /* tight gap to its own description */
}
.systems dt:first-child { margin-top: 0; }
.systems dd {
  font-family: var(--serif);
  font-size: var(--t-body-size);
  line-height: var(--t-body-lh);
  color: var(--muted);
  margin: 0;
  max-width: 60ch;
  text-wrap: pretty;
}

/* Small mono "visit URL" affordance after a system description */
.visit-link {
  display: inline-block;
  margin-top: var(--s-sm);
  font-family: var(--mono-label);
  font-size: var(--t-code-sm-size);
  line-height: var(--t-code-sm-lh);
  letter-spacing: 0.04em;
  color: var(--secondary);
  border-bottom: 1px solid var(--hairline);
  transition: color 120ms ease, border-color 120ms ease;
}
.visit-link:hover {
  color: var(--accent-italic);
  border-bottom-color: currentColor;
}

/* ---------- Roles ------------------------------------------------------ */
.role { margin-bottom: var(--s-2xl); }
.role:last-child { margin-bottom: 0; }

.role-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s-lg);
  flex-wrap: wrap;
  margin-bottom: var(--s-md);
}

.role-title {
  font-family: var(--serif);
  font-size: 22px;
  line-height: 1.25;
  letter-spacing: -0.2px;
  font-weight: 500;
  color: var(--text);
}
.role-co {
  font-style: italic;
  font-weight: 400;
  color: var(--secondary);
}

.role-date {
  font-family: var(--mono-label);
  font-size: var(--t-code-sm-size);
  letter-spacing: 0.04em;
  color: var(--secondary);
  white-space: nowrap;
}

.role-list {
  display: grid;
  row-gap: var(--s-md);
  color: var(--muted);
  max-width: 64ch;
}
.role-list li {
  padding-left: 1.25em;
  position: relative;
  text-wrap: pretty;
}
.role-list li::before {
  content: "–";
  position: absolute;
  left: 0;
  color: var(--secondary);
}

.role-compact p {
  color: var(--muted);
  max-width: 64ch;
  text-wrap: pretty;
}
.role-compact { margin-bottom: var(--s-xl); }

/* ---------- Capabilities (2x2 grid) ------------------------------------ */
.capabilities {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  column-gap: var(--s-2xl);
  row-gap: var(--s-xl);
}
.capabilities h4 {
  font-family: var(--serif);
  font-size: 20px;
  line-height: 1.25;
  font-weight: 500;
  color: var(--text);
  margin-bottom: var(--s-sm);
}
.capabilities p {
  font-family: var(--serif);
  color: var(--muted);
  max-width: 40ch;
  text-wrap: pretty;
}

/* ---------- Writing & Education ---------------------------------------- */
.we-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  column-gap: var(--s-2xl);
  row-gap: var(--s-xl);
}

.book {
  float: right;
  shape-outside: margin-box;
  margin: var(--s-xs) 0 var(--s-md) var(--s-lg);
  width: 130px;
}
.book img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 2px;
  box-shadow: var(--book-shadow);
  transition: transform 200ms ease, box-shadow 200ms ease;
}
.book img:hover {
  transform: translateY(-2px) rotate(-0.4deg);
}
.book figcaption {
  font-family: var(--mono-label);
  font-size: 11px;
  line-height: 1.4;
  color: var(--secondary);
  margin-top: var(--s-sm);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-align: center;
}
.we-grid h4 {
  font-family: var(--serif);
  font-size: 20px;
  line-height: 1.3;
  font-weight: 500;
  color: var(--text);
  margin-bottom: var(--s-md);
  clear: both; /* never sit alongside the floated book */
}
.we-grid h4 .h4-meta {
  font-family: var(--mono-label);
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--secondary);
  margin-left: var(--s-sm);
  vertical-align: 0.18em;
}
.we-grid > div > h4 ~ h4 { margin-top: var(--s-2xl); } /* breathing room before any later sub-heading */
.we-grid p { color: var(--muted); text-wrap: pretty; margin-bottom: var(--s-md); }
.we-grid p:last-of-type { margin-bottom: 0; }
.plain-list { display: grid; row-gap: var(--s-md); color: var(--muted); }
.plain-list li { line-height: 1.5; }
.plain-list strong { color: var(--text); font-weight: 500; }

/* ---------- Footer ----------------------------------------------------- */
.footer {
  margin-top: var(--s-3xl);
  padding-top: var(--s-xl);
  border-top: 1px solid var(--hairline);
  font-family: var(--mono-code);
  font-size: var(--t-code-lg-size);
  line-height: var(--t-code-lg-lh);
  color: var(--text);
}
.footer-line { margin-bottom: var(--s-xs); }
.footer-line.muted { color: var(--secondary); }
.footer-line.muted a { color: var(--text); }

/* ---------- Mobile ----------------------------------------------------- */
@media (max-width: 720px) {
  .capabilities { grid-template-columns: 1fr; row-gap: var(--s-lg); }
  .we-grid { grid-template-columns: 1fr; row-gap: var(--s-lg); }
  .terminal-pane { padding: var(--s-md) var(--s-lg); }
  .hero-tagline { max-width: none; }
  .role-head { gap: var(--s-xs); }
  .book { width: 110px; margin-left: var(--s-md); }
  .topnav-items { gap: var(--s-lg); }
  .topnav-inner { padding: var(--s-sm) var(--s-md); }
}

@media (max-width: 540px) {
  /* Drop the secondary section labels from the nav, keep core ones */
  .topnav-items li:nth-child(2),
  .topnav-items li:nth-child(4) { display: none; }
}

/* ---------- Print ------------------------------------------------------ */
@media print {
  :root { --bg: #ffffff; --text: #000000; --secondary: #444; --muted: #333; --hairline: #ccc; --terminal-shadow: none; --glow: transparent; --grid-dot: transparent; }
  .topnav, .theme-toggle, .skip-link, .terminal-tabs, .terminal-copy { display: none !important; }
  .terminal { box-shadow: none; border: 1px solid var(--hairline); }
  .terminal-pane[hidden] { display: block !important; }
  .terminal-pane { padding: var(--s-sm) var(--s-md); border-top: 1px solid var(--hairline); }
  .terminal-pane:first-of-type { border-top: 0; }
  a { color: var(--text); border-bottom: 0; }
  .block { break-inside: avoid; }
  .page { padding: 0; max-width: none; }
}
