/* ===========================================================================
   David Peters, pipeline career site
   Black and white. Simple and basic. Greyscale only, no color.
   The DAG game is rendered as line art (thin strokes, circles, arrowheads),
   the way a real scheduler draws a graph. System fonts, zero dependencies.
   =========================================================================== */

:root {
  --bg:        #ffffff;
  --ink:       #141414;   /* near black text */
  --ink-soft:  #454545;
  --ink-dim:   #8a8a8a;
  --line:      #d7d7d7;   /* hairline grey */
  --line-mid:  #b0b0b0;
  --stroke:    #141414;   /* diagram strokes */
  --maxw: 68ch;
  --mono: ui-monospace, "SF Mono", "SFMono-Regular", Menlo, Consolas, "Liberation Mono", monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  font-family: var(--sans);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: var(--ink); text-decoration: underline; text-underline-offset: 2px; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
a:focus-visible,
.skip-link:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; border-radius: 1px; }

/* skip link ---------------------------------------------------------------- */
.skip-link {
  position: absolute; left: 0.75rem; top: -3rem;
  background: var(--ink); color: var(--bg);
  padding: 0.5rem 0.9rem; border-radius: 4px;
  font-family: var(--mono); font-size: 0.85rem; text-decoration: none;
  z-index: 10; transition: top 0.15s ease;
}
.skip-link:focus { top: 0.75rem; }

main { position: relative; }

/* hero --------------------------------------------------------------------- */
.hero {
  min-height: 80svh;
  display: flex; flex-direction: column; justify-content: center; align-items: center;
  text-align: center;
  padding: 6rem clamp(1.4rem, 6vw, 3rem) 4rem;
}
.mark {
  font-family: var(--mono);
  font-size: 0.82rem; letter-spacing: 0.24em; text-transform: uppercase;
  color: var(--ink-dim); margin-bottom: clamp(1.6rem, 5vh, 2.6rem);
}
.headline {
  font-weight: 600;
  font-size: clamp(2.5rem, 8vw, 5rem);
  line-height: 1.04; letter-spacing: -0.02em;
  color: var(--ink);
}
.headline em { font-style: italic; }
.lede {
  margin-top: clamp(1.4rem, 4vh, 2.2rem);
  max-width: 42ch;
  font-family: var(--mono);
  font-size: clamp(0.92rem, 2.4vw, 1.1rem);
  color: var(--ink-soft);
}

/* game / DAG (line art) ---------------------------------------------------- */
#game { display: none; }                 /* no-JS: hide the empty canvas */
html.js #game { display: block; }

.game { position: relative; padding: clamp(3.6rem, 8vh, 5.5rem) clamp(1.4rem, 6vw, 2rem) clamp(1.4rem, 4vh, 2.2rem); }
/* top rule constrained to the text column, matching the timeline/footer separators */
.game::before {
  content: ""; position: absolute; top: 0; left: 50%; transform: translateX(-50%);
  width: min(var(--maxw), 100%); border-top: 1px solid var(--line);
}
@keyframes game-arrive { from { opacity: 0.2; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.game.game-flash .stage-tabs,
.game.game-flash .stage-canvas { animation: game-arrive 0.55s cubic-bezier(0.22, 1, 0.36, 1); }

.stage-tabs {
  display: flex; flex-wrap: wrap; gap: 0.5rem;
  max-width: 820px; margin: 0 auto clamp(1.2rem, 3vh, 1.8rem);
}
.tab {
  font-family: var(--mono); font-size: 0.76rem;
  background: var(--bg); color: var(--ink-soft);
  border: 1px solid var(--line-mid); border-radius: 4px;
  padding: 0.3rem 0.7rem; cursor: pointer;
}
.tab:hover:not(:disabled) { border-color: var(--ink); color: var(--ink); }
.tab.is-current { border-color: var(--ink); color: var(--ink); font-weight: 600; }
.tab.is-done { color: var(--ink); }
.tab:disabled { color: var(--ink-dim); border-style: dashed; cursor: not-allowed; }
.tab:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

.stage-canvas { width: 100%; max-width: 820px; margin: 0 auto; }
.dag { width: 100%; height: auto; display: block; touch-action: manipulation; }

.dag-edge { fill: none; stroke: var(--stroke); stroke-width: 1.5; }
.dag-edge-hit { fill: none; stroke: transparent; stroke-width: 16; }
.dag-edge-group { cursor: pointer; }
.dag-edge-group:hover .dag-edge { stroke-width: 3; }
.dag-arrowhead { fill: var(--stroke); }

.dag-node { cursor: pointer; }
.dag-node:focus { outline: none; }
.dag-box { fill: var(--bg); stroke: var(--stroke); stroke-width: 1.5; transition: fill 0.12s ease; }
.dag-label { font-family: var(--mono); font-size: 17px; fill: var(--ink); pointer-events: none; }
.dag-node:hover .dag-box,
.dag-node:focus-visible .dag-box { fill: #f1f1f1; }
.dag-node:focus-visible .dag-box { stroke-width: 2.5; }
.dag-node.is-selected .dag-box { fill: var(--ink); }
.dag-node.is-selected .dag-label { fill: var(--bg); }
.kind-gold .dag-box { stroke-width: 3; }
.kind-hidden_unlock .dag-box { stroke-dasharray: 3 3; }

/* run states */
.dag-status { fill: var(--bg); stroke: var(--stroke); stroke-width: 1.5; opacity: 0; }
.state-queued .dag-box { fill: #f1f1f1; }
.state-queued .dag-status { opacity: 1; }
.state-running .dag-box { fill: #e4e4e4; stroke-dasharray: 5 4; animation: dag-ants 0.6s linear infinite; }
.state-running .dag-status { opacity: 1; fill: #b6b6b6; }
.state-success .dag-box { stroke-width: 2.6; }
.state-success .dag-status { opacity: 1; fill: var(--ink); stroke: var(--ink); }
.state-failed .dag-box { stroke-dasharray: 6 4; }
.state-failed .dag-label { fill: var(--ink-dim); }
.state-failed .dag-status { opacity: 1; fill: var(--bg); stroke-dasharray: 2.5 2; }
@keyframes dag-ants { to { stroke-dashoffset: -18; } }

.dag-caption {
  font-family: var(--mono); font-size: 0.76rem; letter-spacing: 0.04em;
  color: var(--ink-dim); text-align: center; margin-top: 1rem;
}

@keyframes dag-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.45; } }
.dag-node.is-entry { animation: dag-pulse 2.6s ease-in-out infinite; }
.dag.engaged .dag-node.is-entry { animation: none; }

/* the crescent moon (night shift) that opens the hidden stage.
   Hidden until the Doximity decade is complete, then it fades in. */
.moon-disc { fill: var(--stroke); }
.moon-cut { fill: var(--bg); }
.dag-moon {
  cursor: pointer; visibility: hidden; opacity: 0; pointer-events: none;
  transition: opacity 0.9s ease;
}
@keyframes moon-breathe { 0%, 100% { opacity: 0.34; } 50% { opacity: 0.58; } }
.dag.moon-lit .dag-moon { visibility: visible; opacity: 0.45; pointer-events: auto; animation: moon-breathe 3.8s ease-in-out infinite; }
.dag.moon-lit .dag-moon:hover, .dag.moon-lit .dag-moon:focus-visible { opacity: 1; animation: none; outline: none; }
.dag.moon-lit .dag-moon:focus-visible .moon-disc { stroke: var(--stroke); stroke-width: 2; }

/* rename flash */
@keyframes dag-rename { 0% { opacity: 0.2; } 100% { opacity: 1; } }
.dag-node.just-renamed .dag-label { animation: dag-rename 0.5s ease-out; }

/* stage slide-in */
@keyframes dag-slide { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.dag.slide-in { animation: dag-slide 0.4s var(--ease, ease-out); }

/* gold-exit confetti (monochrome) */
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 50; }
.confetti i {
  position: absolute; width: 7px; height: 3px; background: var(--ink);
  transform: translate(-50%, -50%); animation: confetti-fly 1s ease-out forwards;
}
.confetti i:nth-child(2n) { background: #8a8a8a; }
.confetti i:nth-child(3n) { width: 4px; height: 4px; border-radius: 50%; }
@keyframes confetti-fly {
  0% { opacity: 1; transform: translate(-50%, -50%) rotate(0); }
  100% { opacity: 0; transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy) + 70px)) rotate(var(--rot)); }
}

.game-bar {
  display: flex; align-items: center; justify-content: center;
  gap: 1.2rem; flex-wrap: wrap;
  max-width: 820px; margin: 1.3rem auto 0;
}
.game-hint { font-family: var(--mono); font-size: 0.76rem; color: var(--ink-dim); max-width: 48ch; }
.run-btn {
  font-family: var(--mono); font-size: 0.82rem;
  letter-spacing: 0.1em; text-transform: uppercase;
  background: var(--bg); color: var(--ink);
  border: 1.5px solid var(--ink); border-radius: 5px;
  padding: 0.5rem 1.4rem; cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.run-btn:hover { background: var(--ink); color: var(--bg); }
.run-btn:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
.run-btn:disabled { opacity: 0.45; cursor: default; }
.sound-toggle {
  font-family: var(--mono); font-size: 0.74rem; letter-spacing: 0.04em;
  background: none; color: var(--ink-dim); border: none;
  padding: 0.4rem 0.4rem; cursor: pointer; text-decoration: underline;
  text-underline-offset: 3px;
}
.sound-toggle:hover { color: var(--ink); }
.sound-toggle:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.hint-btn {
  font-family: var(--mono); font-size: 0.78rem; letter-spacing: 0.06em;
  background: var(--bg); color: var(--ink-soft);
  border: 1.5px solid var(--line-mid); border-radius: 5px;
  padding: 0.5rem 1rem; cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease;
}
.hint-btn:hover { color: var(--ink); border-color: var(--ink); }
.hint-btn:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
/* node flash when a hint wires it; run button nudge when the wiring is ready */
@keyframes hint-flash { 0%, 100% { fill: var(--bg); } 45% { fill: #e4e4e4; } }
.dag-node.hint-flash .dag-box { animation: hint-flash 0.6s ease-out 2; }
@keyframes run-nudge { 0%, 100% { transform: none; } 50% { transform: scale(1.07); } }
.run-btn.nudge { animation: run-nudge 0.5s ease-in-out 3; }

.log {
  font-family: var(--mono); font-size: 0.8rem; line-height: 1.75;
  color: var(--ink-soft); max-width: 820px; margin: 1.2rem auto 0;
  min-height: 1.75rem; white-space: pre-wrap;
}
.log-line.errline { color: var(--ink); font-weight: 600; }
.log-line.warnline { color: var(--ink); }
.log-line.hintline { color: var(--ink-dim); font-style: italic; }

/* next-stage call to action */
.log-cta {
  display: inline-flex; align-items: baseline; gap: 0.45rem;
  margin-top: 0.7rem; padding: 0.15rem 0;
  font-family: var(--mono); font-size: 0.86rem; font-weight: 600;
  background: none; border: none; color: var(--ink); cursor: pointer;
}
.log-cta:hover { text-decoration: underline; }
.log-cta:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
.log-cta .caret { animation: cta-blink 1.05s steps(1, end) infinite; }
@keyframes cta-blink { 50% { opacity: 0.12; } }

/* prominent next-stage CTA, placed below the milestone cards */
.stage-advance { max-width: 820px; margin: 1.8rem auto 0; text-align: center; }
.stage-advance:empty { margin: 0; }
.advance-btn {
  display: inline-flex; align-items: baseline; gap: 0.55rem;
  font-family: var(--mono); font-size: 0.9rem; letter-spacing: 0.04em;
  background: var(--ink); color: var(--bg);
  border: 1.5px solid var(--ink); border-radius: 6px;
  padding: 0.7rem 1.5rem; cursor: pointer;
  transition: opacity 0.15s ease;
}
.advance-btn:hover { opacity: 0.82; }
.advance-btn:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
.advance-btn .caret { animation: cta-blink 1.05s steps(1, end) infinite; }
/* pulse the freshly-unlocked tab so it's clear where the next stage lives */
@keyframes tab-unlock-pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(0, 0, 0, 0); } 50% { box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.14); } }
.tab.tab-unlocked { animation: tab-unlock-pulse 1.5s ease-in-out 3; }

/* milestone cards ---------------------------------------------------------- */
.cards {
  max-width: 820px; margin: 1.4rem auto 0;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(min(240px, 100%), 1fr)); gap: 0.8rem;
}
.card {
  border: 1px solid var(--line-mid); border-radius: 6px;
  padding: 0.9rem 1rem; background: var(--bg);
}
.card h4 { font-size: 0.95rem; font-weight: 600; margin-bottom: 0.35rem; }
.card p { font-size: 0.85rem; color: var(--ink-soft); margin-bottom: 0.4rem; }
.card-links { display: flex; flex-wrap: wrap; gap: 0.8rem; }
.card-links a { font-family: var(--mono); font-size: 0.76rem; }
.card-gold { border-width: 2px; border-color: var(--ink); }
.card-failed { border-style: dashed; }

/* toolchain tray ----------------------------------------------------------- */
.tray {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem;
  max-width: 820px; margin: 1.6rem auto 0;
}
.tray-label { font-family: var(--mono); font-size: 0.74rem; color: var(--ink-dim); margin-right: 0.2rem; }
.tray-pill {
  font-family: var(--mono); font-size: 0.76rem; color: var(--ink-soft);
  background: var(--bg); border: 1px solid var(--line-mid); border-radius: 999px;
  padding: 0.24rem 0.6rem;
}

/* blurb -------------------------------------------------------------------- */
.blurb {
  max-width: var(--maxw); margin: 0 auto;
  padding: clamp(1.8rem, 4.5vh, 2.6rem) clamp(1.4rem, 6vw, 2rem) clamp(3.6rem, 8vh, 5.5rem);
}
.blurb-body { border-left: 2px solid var(--line); padding-left: clamp(1rem, 3vw, 1.6rem); }
.blurb p { font-size: clamp(1.02rem, 2.4vw, 1.15rem); color: var(--ink-soft); margin-bottom: 1.1rem; }
.blurb p:last-child { margin-bottom: 0; }
/* timeline ----------------------------------------------------------------- */
.timeline {
  max-width: var(--maxw); margin: 0 auto;
  padding: clamp(3rem, 9vh, 6rem) clamp(1.4rem, 6vw, 2rem) 2rem;
  border-top: 1px solid var(--line);
}
.timeline h2, .skills h2 {
  font-family: var(--mono);
  font-size: 0.9rem; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--ink); margin-bottom: 0.9rem;
}
.timeline-intro { color: var(--ink-soft); margin-bottom: clamp(1.6rem, 4vh, 2.4rem); }

.positions { list-style: none; }
.positions > li {
  position: relative;
  padding: 1.3rem 0 1.3rem 1.4rem;
  border-left: 1.5px solid var(--line-mid);
}
.positions > li::before {
  content: ""; position: absolute; left: -6px; top: 1.75rem;
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--bg); border: 1.5px solid var(--stroke);
}
.positions > li.present::before { background: var(--stroke); }
.positions > li.next-dot::before { background: var(--stroke); animation: dag-pulse 2.6s ease-in-out infinite; }
.positions > li.next-dot time { color: var(--ink-soft); }
.positions > li.next-dot h3 em { font-style: italic; }
.positions .next-hi { margin-top: 0.5rem; }
.positions .next-hi a { font-family: var(--mono); font-size: 0.78rem; }
.positions time {
  display: block; font-family: var(--mono); font-size: 0.78rem;
  letter-spacing: 0.04em; color: var(--ink-dim); margin-bottom: 0.25rem;
}
.positions h3 { font-size: 1.06rem; font-weight: 600; color: var(--ink); margin-bottom: 0.3rem; }
.positions p { color: var(--ink-soft); font-size: 0.97rem; }
.positions .pos-links { display: flex; flex-wrap: wrap; gap: 0.9rem; margin-top: 0.4rem; }
.positions .pos-links a { font-family: var(--mono); font-size: 0.78rem; }

/* skills tray -------------------------------------------------------------- */
.skills { margin-top: clamp(2.5rem, 7vh, 4rem); }
.skill-list { list-style: none; display: flex; flex-wrap: wrap; gap: 0.5rem; }
.skill-list li {
  font-family: var(--mono); font-size: 0.78rem;
  color: var(--ink-soft); background: var(--bg);
  border: 1px solid var(--line-mid); border-radius: 3px;
  padding: 0.26rem 0.6rem;
}

/* footer ------------------------------------------------------------------- */
.site-footer {
  max-width: var(--maxw); margin: 0 auto;
  padding: clamp(2.2rem, 5.5vh, 3.2rem) clamp(1.4rem, 6vw, 2rem) clamp(2.5rem, 6vh, 3.5rem);
  border-top: 1px solid var(--line);
}
.to-top {
  display: inline-block; margin-bottom: 1.1rem;
  font-family: var(--mono); font-size: 0.78rem; color: var(--ink-dim);
}
.contact { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: center; gap: 1.4rem 1.6rem; font-family: var(--mono); font-size: 0.9rem; margin-top: clamp(1.8rem, 5vh, 2.8rem); }
.game-link { display: none; }
html.js .game-link { display: inline; }
.whoami-btn {
  font-family: var(--mono); font-size: 0.9rem;
  background: none; border: none; padding: 0; cursor: pointer;
  color: var(--ink); text-decoration: underline; text-underline-offset: 2px;
  display: none;                                   /* no-JS: hide the toggle */
}
html.js .whoami-btn { display: inline; }
.whoami-btn:hover { text-decoration-thickness: 2px; }
.whoami-btn:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
.ext, .wa-arrow { display: inline-block; font-size: 0.85em; }
.doc-ico { width: 1em; height: 1em; vertical-align: -0.14em; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.about-body {
  margin: 0.6rem 0 0; text-align: left;
  border: 1px solid var(--line-mid); border-radius: 6px;
  padding: 1.1rem 1.3rem;
  font-size: 0.92rem; color: var(--ink-soft); line-height: 1.62;
}
.about-body p { margin-bottom: 0.7rem; }
.about-body p:last-child { margin-bottom: 0; }

/* collapsing wrapper: animate grid rows 0fr -> 1fr so the reveal tracks the real
   content height (no max-height overshoot), for a soft symmetric open + close.
   reduced-motion: instant. */
.whoami-panel { width: 100%; max-width: 62ch; margin-left: auto; margin-right: auto; }
html.js .whoami-panel {
  display: grid; grid-template-rows: 0fr; opacity: 0;
  transition: grid-template-rows 0.6s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.55s ease;
}
html.js .whoami-panel.open { grid-template-rows: 1fr; opacity: 1; }
.whoami-clip { overflow: hidden; min-height: 0; }

.colophon { font-family: var(--mono); font-size: 0.79rem; color: var(--ink-dim); font-style: italic; }
.colophon .ref { font-size: 0.68em; vertical-align: 0.35em; margin-right: 0.1em; font-style: normal; }

/* mobile ------------------------------------------------------------------- */
@media (max-width: 680px) {
  .stage-canvas { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .dag { min-width: 560px; }              /* keep labels legible; scroll instead of shrink */
  .game-bar { flex-direction: column; align-items: stretch; text-align: center; }
  .game-hint { max-width: none; }
}

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

/* print: the interactive site is replaced by the resume, so Cmd+P = resume -- */
.print-resume { display: none; }
@media print {
  body > *:not(.print-resume) { display: none !important; }
  .print-resume { display: block; }
  .print-resume img { display: block; width: 100%; height: auto; }
  @page { margin: 0; }
}
