/* =========================================================================
   Tim Rawcliffe — Portfolio (v4: multi-track timeline, image galleries)
   ========================================================================= */

:root {
  --paper: oklch(0.972 0.005 80);
  --paper-2: oklch(0.95 0.006 80);
  --paper-edge: oklch(0.91 0.007 80);
  --rule: oklch(0.85 0.008 80);
  --muted: oklch(0.55 0.005 80);
  --muted-2: oklch(0.38 0.005 80);
  --ink: oklch(0.22 0 0);
  --ink-soft: oklch(0.30 0 0);
  --accent: oklch(0.58 0.18 28);
  --accent-soft: oklch(0.92 0.04 28);
  --accent-ink: oklch(0.42 0.18 28);

  --f-display: "Instrument Serif", "Times New Roman", serif;
  --f-sans: "Geist", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --f-mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --r-sm: 4px;
  --r-md: 8px;
  --r-lg: 14px;
  --shadow-1: 0 1px 2px rgba(20,20,20,0.04), 0 6px 18px rgba(20,20,20,0.06);
  --shadow-2: 0 2px 6px rgba(20,20,20,0.06), 0 20px 50px rgba(20,20,20,0.10);

  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);

  /* Drawer heights — peek hugs the strip tightly so there's no empty space above the tracks. */
  --drawer-closed: clamp(76px, 11vh, 96px);
  --drawer-peek:   clamp(250px, 32vh, 320px);
  --drawer-detail: clamp(560px, 65vh, 1100px);

  --track-label-w: 168px;
  --track-h: 32px;
  --track-h-thin: 16px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--f-sans);
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

::selection { background: var(--accent); color: var(--paper); }

/* =========================================================================
   Shell
   ========================================================================= */
.shell {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}
.shell.is-resume { overflow: auto; height: auto; min-height: 100vh; }

.topbar {
  flex: 0 0 auto;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 32px 18px;
  font-family: var(--f-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted-2);
}
.shell.is-resume .topbar {
  position: sticky; top: 0;
  background: var(--paper);
  border-bottom: 1px solid var(--rule);
  z-index: 50;
}
.topbar .mark { font-weight: 500; }
.topbar .mark .dot { color: var(--accent); }
.topbar .nav { display: flex; gap: 22px; }
.topbar .nav a { transition: color .2s var(--ease-out); }
.topbar .nav a:hover { color: var(--ink); }

.back-btn {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--f-mono); font-size: 11px;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--muted-2);
  padding: 8px 12px;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: var(--paper);
  transition: color .2s var(--ease-out), border-color .2s var(--ease-out);
}
.back-btn:hover { color: var(--ink); border-color: var(--ink); }
.back-btn .arr { transition: transform .2s var(--ease-out); display: inline-flex; }
.back-btn:hover .arr { transform: translateX(-2px); }

/* =========================================================================
   Stage — holds hero
   ========================================================================= */
.stage {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  position: relative;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0 8vw;
}

.hero {
  width: 100%;
  max-width: 1100px;
  padding: 24px 0;
  transition: opacity .45s var(--ease-out), transform .55s var(--ease-out);
}
.hero.is-hidden {
  opacity: 0;
  transform: translateY(-24px) scale(0.985);
  pointer-events: none;
  position: absolute;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-family: var(--f-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted-2);
  margin-bottom: clamp(16px, 3.2vh, 28px);
  padding: 8px 16px;
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 999px;
}

/* Hero stack — content + portrait on top, then a full-width meta row. */
.hero-stack {
  display: flex;
  flex-direction: column;
  width: 100%;
}
.hero-top {
  display: flex;
  align-items: center;
  gap: clamp(24px, 5vw, 72px);
  width: 100%;
}
.hero-left {
  flex: 1 1 auto;
  min-width: 0;
}
.portrait {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  flex: 0 0 auto;
}
.avatar-large {
  width: clamp(120px, 13vw, 160px);
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  overflow: hidden;
  background: var(--paper-2);
  border: 1px solid var(--rule);
  box-shadow: var(--shadow-1);
  transition: width .35s var(--ease-out), opacity .35s var(--ease-out);
}
.avatar-large img {
  width: 100%; height: 100%;
  object-fit: cover;
  object-position: 50% 18%;
  display: block;
}
.portrait-title {
  font-family: var(--f-mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted-2);
  white-space: nowrap;
  position: relative;
  padding-top: 10px;
}
.portrait-title::before {
  content: "";
  position: absolute;
  top: 0; left: 50%;
  width: 16px; height: 1px;
  background: var(--accent);
  transform: translateX(-50%);
}

.shell[data-drawer="peek"] .avatar-large { width: clamp(100px, 11vw, 132px); }
.shell[data-drawer="detail"] .avatar-large { width: clamp(78px, 8.4vw, 102px); }
@media (max-height: 760px) {
  .shell[data-drawer="detail"] .avatar-large { display: none; }
  .shell[data-drawer="detail"] .portrait-title { display: none; }
}

h1.name {
  font-family: var(--f-display);
  font-weight: 400;
  font-size: clamp(48px, min(8vw, 14vh), 132px);
  line-height: 0.95;
  letter-spacing: -0.01em;
  margin: 0;
  color: var(--ink);
}
h1.name .it { font-style: italic; color: var(--ink-soft); }

.lede {
  margin-top: clamp(14px, 2.4vh, 24px);
  max-width: 720px;
  font-size: clamp(15px, min(1.3vw, 2.4vh), 21px);
  color: var(--ink-soft);
  line-height: 1.55;
  text-wrap: pretty;
}
.lede .accent { color: var(--ink); border-bottom: 1px solid var(--rule); padding-bottom: 1px; }

.hero-meta {
  margin-top: clamp(20px, 4vh, 44px);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px 32px;
  border-top: 1px solid var(--rule);
  padding-top: clamp(14px, 2.6vh, 26px);
  width: 100%;
}
.hero-meta .cta-row { flex: 0 0 auto; }
.hero-meta .contact { flex: 1 1 auto; justify-content: flex-end; }

.cta-row { display: flex; gap: 12px; flex-wrap: wrap; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 22px;
  border-radius: 999px;
  font-family: var(--f-sans);
  font-size: 14px;
  font-weight: 500;
  border: 1px solid transparent;
  transition: background .2s var(--ease-out), color .2s var(--ease-out),
              border-color .2s var(--ease-out), transform .2s var(--ease-out);
}
.btn:active { transform: translateY(1px); }
.btn .icon { width: 14px; height: 14px; }
.btn-primary { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.btn-primary:hover { background: oklch(0.12 0 0); border-color: oklch(0.12 0 0); }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--rule); }
.btn-ghost:hover { border-color: var(--ink); }

.contact {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.contact-chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border: 1px solid var(--rule);
  border-radius: 999px;
  font-family: var(--f-mono);
  font-size: 14px;
  letter-spacing: -0.005em;
  color: var(--ink-soft);
  background: var(--paper);
  transition: color .2s var(--ease-out), border-color .2s var(--ease-out),
              background .2s var(--ease-out), transform .2s var(--ease-out);
}
.contact-chip:hover {
  color: var(--paper);
  background: var(--ink);
  border-color: var(--ink);
  transform: translateY(-1px);
}
.contact-chip .ci {
  width: 16px; height: 16px;
  flex: 0 0 auto;
  color: var(--muted-2);
  transition: color .2s var(--ease-out);
}
.contact-chip:hover .ci { color: var(--paper); }
.contact-chip .cv { letter-spacing: 0; }

/* ============================================================
   CTA shimmer — a subtle vermillion sheen sweeps left-to-right
   across each of the 5 call-to-action buttons in sequence,
   pauses, then repeats. Pure decoration, easy to miss but
   draws the eye on first impression.
   ============================================================ */
.cta-shimmer {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  --si: 0;
  --shimmer-color: oklch(0.58 0.18 28 / 0.20);
}
.cta-shimmer.btn-primary {
  --shimmer-color: oklch(0.95 0.02 80 / 0.55);
}
.cta-shimmer::after {
  content: "";
  position: absolute;
  top: 0; bottom: 0;
  left: 0;
  width: 60%;
  background: linear-gradient(
    100deg,
    transparent 0%,
    transparent 35%,
    var(--shimmer-color) 50%,
    transparent 65%,
    transparent 100%
  );
  pointer-events: none;
  transform: translateX(-100%);
  opacity: 0;
  animation: cta-shimmer 8s linear infinite;
  animation-delay: calc(var(--si, 0) * 0.32s);
  z-index: 0;
}
.cta-shimmer > * { position: relative; z-index: 1; }

@keyframes cta-shimmer {
  0%   { transform: translateX(-100%); opacity: 0; }
  3%   { opacity: 1; }
  18%  { opacity: 1; }
  22%  { transform: translateX(280%); opacity: 0; }
  100% { transform: translateX(280%); opacity: 0; }
}

/* Pause shimmer while user is interacting (hover / drawer open / motion-reduced). */
.cta-shimmer:hover::after { animation-play-state: paused; opacity: 0; }
.shell[data-drawer="peek"] .cta-shimmer::after,
.shell[data-drawer="detail"] .cta-shimmer::after { animation-play-state: paused; opacity: 0; }

@media (prefers-reduced-motion: reduce) {
  .cta-shimmer::after { display: none; }
}

.shell[data-drawer="detail"] h1.name { font-size: clamp(32px, min(4.5vw, 8vh), 64px); }
.shell[data-drawer="detail"] .lede { display: none; }
.shell[data-drawer="detail"] .eyebrow { margin-bottom: 12px; }
.shell[data-drawer="detail"] .hero-meta {
  opacity: 0.4;
  transition: opacity .3s var(--ease-out);
}
@media (max-height: 760px) {
  .shell[data-drawer="detail"] .hero-meta { display: none; }
  .shell[data-drawer="detail"] .hero { padding: 16px 0; }
}

/* =========================================================================
   Résumé view
   ========================================================================= */
.resume-view {
  display: none;
  background: var(--paper-2);
  padding: 32px 16px 80px;
}
.shell.is-resume .resume-view { display: block; }
.resume-frame {
  margin: 0 auto;
  max-width: 880px;
  background: var(--paper);
  box-shadow: var(--shadow-1);
  border: 1px solid var(--rule);
}

/* (Résumé doc styles unchanged from prior version) */
.resume {
  font-family: var(--f-sans);
  font-size: 10.5pt;
  line-height: 1.45;
  color: var(--ink);
  --resume-pad-x: 56px;
  --resume-pad-y: 56px;
  padding: var(--resume-pad-y) var(--resume-pad-x);
}
.resume header.r-head {
  display: grid; grid-template-columns: 1fr auto; align-items: end;
  gap: 24px; padding-bottom: 18px;
  border-bottom: 1px solid var(--ink); margin-bottom: 22px;
}
.resume .r-name {
  font-family: var(--f-display); font-weight: 400;
  font-size: 38pt; line-height: 1; letter-spacing: -0.01em; margin: 0 0 4px;
}
.resume .r-name .it { font-style: italic; color: var(--ink-soft); }
.resume .r-role {
  font-family: var(--f-mono); font-size: 9pt;
  letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted-2);
}
.resume .r-contact {
  font-family: var(--f-mono); font-size: 8.5pt;
  text-align: right; color: var(--ink-soft); line-height: 1.6;
}
.resume .r-contact a { color: inherit; }
.resume .r-contact .lab { color: var(--muted); margin-right: 6px; }
.resume .r-summary {
  font-size: 10.5pt; line-height: 1.55;
  margin: 0 0 22px; color: var(--ink-soft); text-wrap: pretty;
}
.resume h2.r-section {
  font-family: var(--f-mono); font-size: 8.5pt;
  letter-spacing: 0.2em; text-transform: uppercase; color: var(--muted-2);
  margin: 22px 0 10px; padding-bottom: 6px;
  border-bottom: 1px solid var(--rule);
  display: flex; align-items: baseline; gap: 12px;
}
.resume h2.r-section .ix { color: var(--accent-ink); }
.r-job {
  display: grid; grid-template-columns: 130px 1fr;
  gap: 18px; margin: 0 0 16px; break-inside: avoid;
}
.r-job .when {
  font-family: var(--f-mono); font-size: 8.5pt;
  color: var(--muted); letter-spacing: 0.04em; padding-top: 2px;
}
.r-job .when .place { display: block; margin-top: 4px; color: var(--muted-2); font-size: 8pt; }
.r-job .body h3 {
  font-family: var(--f-display); font-weight: 400;
  font-size: 15pt; margin: 0 0 2px; line-height: 1.15;
}
.r-job .body .role {
  font-family: var(--f-mono); font-size: 8.5pt;
  color: var(--ink-soft); letter-spacing: 0.03em; margin-bottom: 6px;
}
.r-job ul { margin: 6px 0 0; padding: 0; list-style: none; }
.r-job ul li {
  position: relative; padding-left: 14px; margin-bottom: 4px;
  font-size: 9.5pt; line-height: 1.5; color: var(--ink-soft);
}
.r-job ul li::before {
  content: ""; position: absolute; left: 0; top: 0.6em;
  width: 5px; height: 1px; background: var(--ink-soft);
}
.r-job ul li.hi::before { background: var(--accent); height: 2px; top: 0.55em; }
.r-highlights { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 24px; margin: 0 0 18px; }
.r-highlights .h { display: grid; grid-template-columns: 18px 1fr; gap: 8px; font-size: 9.5pt; color: var(--ink-soft); line-height: 1.45; }
.r-highlights .h .n { font-family: var(--f-mono); color: var(--accent-ink); font-size: 8pt; padding-top: 2px; }
.r-skills { margin-bottom: 14px; }
.r-skills-row { display: grid; grid-template-columns: 80px 1fr; gap: 8px 16px; font-size: 9.5pt; line-height: 1.5; color: var(--ink-soft); margin-bottom: 6px; }
.r-skills-row .lab { font-family: var(--f-mono); font-size: 8.5pt; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted-2); padding-top: 2px; }
.r-skills-row .sep { color: var(--rule); margin: 0 6px; }
.r-note { color: var(--muted-2); font-family: var(--f-mono); font-size: 8.5pt; margin-top: 4px; line-height: 1.5; }
.r-community { margin: 0; padding: 0; list-style: none; font-size: 9.5pt; color: var(--ink-soft); line-height: 1.5; }
.r-community li { margin-bottom: 4px; }
.r-community strong { font-weight: 500; color: var(--ink); }
.r-edu { display: grid; grid-template-columns: 130px 1fr; gap: 18px; font-size: 9.5pt; color: var(--ink-soft); }
.r-edu .when { font-family: var(--f-mono); font-size: 8.5pt; color: var(--muted); }
.r-edu h3 { font-family: var(--f-display); font-weight: 400; font-size: 13pt; margin: 0 0 4px; }
.r-foot {
  margin-top: 28px; padding-top: 12px;
  border-top: 1px solid var(--rule);
  display: flex; justify-content: space-between;
  font-family: var(--f-mono); font-size: 8pt; color: var(--muted); letter-spacing: 0.06em;
}
.r-print-break { display: none; }
@media print { .r-print-break { display: block; page-break-before: always; break-before: page; height: 0; } }

/* =========================================================================
   DRAWER
   ========================================================================= */
.drawer {
  flex: 0 0 auto;
  height: var(--drawer-closed);
  background: var(--paper);
  border-top: 1px solid var(--rule);
  position: relative;
  overflow: hidden;
  transition: height .55s var(--ease-out);
  z-index: 20;
}
.shell[data-drawer="peek"] .drawer { height: var(--drawer-peek); }
.shell[data-drawer="detail"] .drawer { height: var(--drawer-detail); }
.shell.is-resume .drawer { display: none; }

.drawer::before {
  content: ""; position: absolute;
  top: -16px; left: 0; right: 0; height: 16px;
  background: linear-gradient(to top, oklch(0.972 0.005 80 / 0.85), oklch(0.972 0.005 80 / 0));
  pointer-events: none; z-index: 1;
}

.drawer-inner {
  position: relative; height: 100%;
  display: flex; flex-direction: column;
}

.tl-head {
  position: absolute;
  top: 14px; left: 32px; right: 32px;
  display: flex; justify-content: space-between; align-items: center;
  font-family: var(--f-mono); font-size: 10px;
  letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--muted-2);
  opacity: 1; transition: opacity .3s var(--ease-out);
  pointer-events: none; z-index: 3;
}
.shell[data-drawer="detail"] .tl-head { opacity: 0; }
.tl-head .hint { color: var(--muted); display: none; }
.tl-head .legend { display: inline-flex; gap: 14px; align-items: center; }
.tl-head .legend .dot-mini { display: inline-flex; align-items: center; gap: 6px; }
.tl-head .legend i {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--ink);
}
.tl-head .legend .mile i { background: var(--accent); width: 9px; height: 9px; }
.tl-head .legend .unrel i { background: transparent; border: 1px solid var(--muted-2); }
@media (max-width: 1100px) { .tl-head .legend { display: none; } }

/* =========================================================================
   DRAWER HINT — floating above the closed drawer
   ========================================================================= */
.drawer-hint {
  position: absolute;
  left: 0; right: 0;
  bottom: calc(var(--drawer-closed) + 14px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  pointer-events: none;
  z-index: 19;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity .4s var(--ease-out), transform .4s var(--ease-out);
}
.drawer-hint.state-closed {
  opacity: 1;
  transform: translateY(0);
  animation: hint-bounce 5s var(--ease-in-out) infinite;
}
.drawer-hint-text {
  font-family: var(--f-mono);
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted-2);
  background: var(--paper);
  padding: 5px 14px;
  border-radius: 999px;
  border: 1px solid var(--rule);
  box-shadow: var(--shadow-1);
}
.drawer-hint-arrows {
  display: flex;
  flex-direction: column;
  align-items: center;
  color: var(--accent);
}
.drawer-hint-arrows svg {
  margin-top: -8px;
  filter: drop-shadow(0 1px 0 var(--paper));
  animation: chevron-fade 1.8s var(--ease-in-out) infinite;
}
.drawer-hint-arrows svg:nth-child(1) { animation-delay: 0s; }
.drawer-hint-arrows svg:nth-child(2) { animation-delay: 0.2s; }
.drawer-hint-arrows svg:nth-child(3) { animation-delay: 0.4s; }

@keyframes chevron-fade {
  0%, 60%, 100% { opacity: 0.25; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(2px); }
}
@keyframes hint-bounce {
  0%, 86%, 100% { transform: translateY(0); }
  92% { transform: translateY(-6px); }
  96% { transform: translateY(-2px); }
}

@media (prefers-reduced-motion: reduce) {
  .drawer-hint.state-closed { animation: none; }
  .drawer-hint-arrows svg { animation: none; opacity: 0.7; }
}

@media (max-width: 540px) {
  .drawer-hint-text { font-size: 10px; padding: 4px 10px; }
}

/* =========================================================================
   DETAIL PANEL
   ========================================================================= */
.detail {
  flex: 1 1 0;
  min-height: 0;
  padding: 44px 40px 16px;
  display: grid;
  grid-template-columns: minmax(420px, 38%) 1fr;
  gap: 40px;
  align-items: stretch;
  overflow: hidden;
}

.detail .cover {
  position: relative;
  width: 100%;
  aspect-ratio: 8 / 7;
  max-height: 100%;
  background: var(--paper-2);
  border: 1px solid var(--rule);
  border-radius: var(--r-md);
  overflow: hidden;
}

.carousel { position: relative; width: 100%; height: 100%; background: var(--ink); background-size: cover; background-position: center; }
/* Blurred backdrop fills the letterbox area when images use object-fit: contain.
   The carousel root carries `background-image` from inline JSX style; we replicate it blurred via ::before. */
.carousel::before {
  content: "";
  position: absolute; inset: 0;
  background-image: inherit;
  background-size: cover;
  background-position: center;
  filter: blur(28px) brightness(0.55) saturate(1.1);
  transform: scale(1.2);
  opacity: 0;
  transition: opacity .6s var(--ease-out);
  z-index: 0;
}
.carousel.has-bg::before { opacity: 1; }
.carousel img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: contain;
  opacity: 0;
  transition: opacity .8s var(--ease-out);
  z-index: 1;
}
.carousel img.is-current { opacity: 1; }
.carousel-dots {
  position: absolute; bottom: 8px; left: 0; right: 0;
  display: flex; justify-content: center; gap: 4px;
  z-index: 2;
}
.carousel-dots .cdot {
  width: 16px; height: 3px;
  background: rgba(255,255,255,0.4);
  border-radius: 1px;
  transition: background .2s, width .3s var(--ease-out);
}
.carousel-dots .cdot.is-current {
  background: rgba(255,255,255,0.95);
  width: 24px;
}
.carousel-dots .cdot:hover { background: rgba(255,255,255,0.7); }

.cover-placeholder {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; justify-content: space-between;
  padding: 14px 16px;
}
.cover-placeholder .ptag {
  font-family: var(--f-mono); font-size: 9px;
  letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--muted-2);
}
.cover-placeholder .ptitle {
  font-family: var(--f-display);
  font-size: 22px; line-height: 1;
  color: var(--ink-soft);
}
.cover-placeholder .ptitle em { font-style: italic; }

.detail .body {
  display: flex; flex-direction: column;
  min-height: 0; height: 100%;
  overflow-y: auto;
  overscroll-behavior: contain;
  mask-image: linear-gradient(to bottom, black calc(100% - 24px), transparent 100%);
  -webkit-mask-image: linear-gradient(to bottom, black calc(100% - 24px), transparent 100%);
  padding-right: 6px;
}
.detail .body::-webkit-scrollbar { width: 6px; }
.detail .body::-webkit-scrollbar-thumb { background: var(--rule); border-radius: 3px; }
.detail .body::-webkit-scrollbar-thumb:hover { background: var(--muted); }

.detail .meta {
  display: flex; align-items: center; gap: 12px;
  font-family: var(--f-mono); font-size: 11.5px;
  letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.detail .meta .tag { color: var(--accent-ink); font-weight: 500; }
.detail .meta .tag.os { color: var(--ink); }
.detail .meta .tag.unrel { color: var(--muted-2); }

.detail h3 {
  font-family: var(--f-display); font-weight: 400;
  font-size: clamp(36px, 4vw, 56px);
  line-height: 1; letter-spacing: -0.01em;
  margin: 0 0 6px;
}
.detail .role {
  font-family: var(--f-mono); font-size: 13px;
  color: var(--muted-2); letter-spacing: 0.04em;
}

/* YouTube embeds */
.videos {
  margin-top: 18px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.video {}
.video-frame {
  position: relative;
  width: 100%;
  max-width: 640px;
  aspect-ratio: 16 / 9;
  background: var(--ink);
  border-radius: var(--r-md);
  overflow: hidden;
  border: 1px solid var(--rule);
}
.video-frame iframe {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  border: 0;
}
.video-cap {
  display: inline-block;
  margin-top: 6px;
  font-family: var(--f-mono); font-size: 10px;
  letter-spacing: 0.06em;
  color: var(--accent-ink);
  border-bottom: 1px solid currentColor;
}
.video-cap:hover { color: var(--accent); }

/* Bullets — single column ALWAYS */
.detail .bullets {
  list-style: none;
  margin: 18px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.detail .bullets li {
  display: grid;
  grid-template-columns: 18px 1fr;
  gap: 12px;
  padding: 10px 0;
  font-size: 15.5px;
  line-height: 1.55;
  color: var(--ink-soft);
  border-bottom: 1px dashed var(--paper-edge);
}
.detail .bullets li:last-child { border-bottom: 0; }
.detail .bullets li .bullet-mark {
  position: relative;
  width: 9px; height: 9px;
  margin-top: 8px;
  border-radius: 50%;
  background: var(--ink-soft);
}
.detail .bullets li.is-red .bullet-mark {
  background: var(--accent);
  box-shadow: 0 0 0 3px oklch(0.58 0.18 28 / 0.15);
}
.detail .bullets li.is-red { color: var(--ink); }

.detail .platforms {
  margin-top: 18px;
  padding-top: 12px;
  border-top: 1px dashed var(--paper-edge);
  font-family: var(--f-mono);
  font-size: 11.5px;
  letter-spacing: 0.06em;
  color: var(--muted-2);
}
.detail .platforms .lab { color: var(--muted); margin-right: 10px; }

/* Links — clickable chips below platforms */
.detail .links {
  margin-top: 10px;
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
  font-family: var(--f-mono);
  font-size: 11.5px;
  letter-spacing: 0.06em;
  color: var(--muted-2);
}
.detail .links .lab { color: var(--muted); }
.detail .link-list { display: flex; flex-wrap: wrap; gap: 8px; }
.detail .link-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border: 1px solid var(--rule);
  border-radius: 999px;
  color: var(--accent-ink);
  font-family: var(--f-mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  transition: color .2s var(--ease-out), border-color .2s var(--ease-out), background .2s var(--ease-out);
}
.detail .link-chip:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: oklch(0.58 0.18 28 / 0.06);
}

/* Detail nav */
.detail-nav {
  position: absolute;
  top: 12px; right: 22px;
  display: flex; align-items: center; gap: 10px;
  font-family: var(--f-mono); font-size: 10px;
  letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--muted-2);
  z-index: 4;
}
.detail-nav .counter { padding: 0 6px; color: var(--muted); }
.detail-nav .counter .cur { color: var(--ink); }
.detail-nav button {
  width: 28px; height: 28px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--rule);
  border-radius: 999px;
  color: var(--muted-2);
  background: var(--paper);
  transition: color .2s var(--ease-out), border-color .2s var(--ease-out);
}
.detail-nav button:hover { color: var(--ink); border-color: var(--ink); }
.detail-nav button:disabled { opacity: 0.3; cursor: default; }
.detail-nav .close { margin-left: 4px; }

/* =========================================================================
   STRIP — multi-track layout for peek/detail
   ========================================================================= */
.strip-area {
  flex: 0 0 auto;
  margin-top: auto;
  padding: 0 32px 12px;
}

.tracks {
  display: flex;
  flex-direction: column;
  gap: 0;
  max-height: 100%;
}

/* Row layout: label | area */
.tracks > * {
  display: grid;
  grid-template-columns: var(--track-label-w) 1fr;
  gap: 14px;
  align-items: center;
}

.track-label {
  font-family: var(--f-mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  color: var(--muted-2);
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding-right: 8px;
  border-right: 1px solid var(--rule);
  height: 100%;
}
.track-label .hd {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  font-size: 9px;
}
.track-label .sub {
  color: var(--muted-2);
  font-size: 9px;
  margin-left: auto;
  padding-right: 4px;
}
.track-area {
  position: relative;
  height: 100%;
}

/* Year axis */
.tracks-axis { height: 18px; padding-top: 2px; }
.tracks-axis .track-label { border-right: 1px solid var(--rule); }
.tracks-axis .tl-years {
  display: flex; justify-content: space-between;
  font-family: var(--f-mono); font-size: 10px;
  color: var(--muted);
}
.tracks-axis .tl-years .y { position: relative; }
.tracks-axis .tl-years .y::after {
  content: "";
  position: absolute;
  top: calc(100% + 2px);
  left: 50%;
  width: 1px; height: 4px;
  background: var(--rule);
}

/* Employer track — Gantt-style: labels above, dates inside the bar */
.track-employer {
  height: 44px;
  padding: 0;
  align-items: stretch;
}
.track-employer .track-label { align-items: flex-end; padding-bottom: 4px; }
.tl-track {
  position: relative;
  height: 100%;
  background: transparent;
}
.tl-span {
  position: absolute;
  top: 0; bottom: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  overflow: visible;
  transition: filter .2s var(--ease-out);
}
.tl-span:hover { filter: brightness(0.94) saturate(1.05); }

/* The actual filled bar lives in .emp-bar; the .tl-span box also holds the label above. */
.tl-span .emp-bar {
  position: relative;
  height: 14px;
  background: var(--ink);
  border-radius: 3px;
  outline: 2px solid var(--paper);
  outline-offset: -1px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 6px;
  overflow: hidden;
  flex: 0 0 auto;
}
.tl-span.current .emp-bar {
  background: linear-gradient(to right, var(--ink) 0%, var(--ink) 88%, var(--accent) 88%, var(--accent) 100%);
}

/* Label sits in the span box, anchored to its left edge, can overflow up to maxWidth (set inline per-span). */
.tl-span .emp-name {
  position: absolute;
  left: 2px;
  bottom: 18px;
  font-family: var(--f-sans);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: -0.005em;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
  z-index: 2;
}

/* For spans that start BEFORE the timeline's visible range (left < 0),
   right-justify the label to the span's right edge so the company name is readable
   even though most of the bar is off-screen. */
.tl-span.is-clipped-left .emp-name {
  left: auto;
  right: 2px;
  text-align: right;
}
.tl-span.is-clipped-left .emp-overflow {
  font-style: italic;
  opacity: 0.55;
}

.tl-span .emp-start,
.tl-span .emp-end {
  font-family: var(--f-mono);
  font-size: 9px;
  letter-spacing: 0.02em;
  color: var(--paper);
  opacity: 0.7;
  white-space: nowrap;
  flex: 0 0 auto;
}

/* SpiritOnin (lane 1) — thinner bar, label ABOVE so it doesn't crash into the education track. */
.tl-span.lane-1 {
  top: auto; bottom: -4px; height: 12px;
  justify-content: flex-start;
}
.tl-span.lane-1 .emp-bar {
  height: 8px;
  background: var(--muted);
  outline-color: var(--paper);
}
.tl-span.lane-1 .emp-start,
.tl-span.lane-1 .emp-end { display: none; }
.tl-span.lane-1 .emp-name {
  position: absolute;
  left: 2px;
  bottom: 14px;
  top: auto;
  font-size: 10px;
  font-weight: 400;
  color: var(--muted);
  font-style: italic;
  max-width: 800% !important; /* small span needs room to overflow */
}

/* On narrow spans, hide the inline dates so they don't blow out the bar. */
.tl-span[data-narrow="true"] .emp-start,
.tl-span[data-narrow="true"] .emp-end { display: none; }

/* Education track */
.track-edu {
  height: var(--track-h-thin);
  padding: 2px 0;
}
.tl-track-thin {
  position: relative;
  height: 100%;
  border-top: 1px dashed var(--rule);
  border-bottom: 1px dashed var(--rule);
  background: oklch(0.972 0.005 80 / 0.5);
}
.edu-pin {
  position: absolute;
  top: 0; bottom: 0;
  transform: translateX(-50%);
  display: flex; align-items: center;
}
.edu-glyph {
  width: 0; height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-bottom: 7px solid var(--muted-2);
}
.edu-lab {
  position: absolute;
  left: 12px; top: 50%;
  transform: translateY(-50%);
  font-family: var(--f-mono);
  font-size: 9px;
  letter-spacing: 0.04em;
  color: var(--muted);
  white-space: nowrap;
  pointer-events: none;
}

/* Section divider — also holds the prominent callout for hovered/selected project */
.track-divider {
  height: 56px;
  padding: 10px 0 6px;
  margin-top: 4px;
  align-items: stretch;
}
.track-divider .track-label {
  align-items: flex-start;
  padding-top: 0;
}
.track-divider .track-label .hd {
  color: var(--ink-soft);
  font-size: 10px;
  letter-spacing: 0.14em;
  font-weight: 500;
}
.track-divider .track-label .sub {
  font-size: 9px;
  color: var(--muted-2);
  margin-left: auto;
}
.track-divider .track-area {
  border-top: 1px solid var(--ink-soft);
  position: relative;
  display: flex;
  align-items: center;
  padding-top: 6px;
}

.project-callout {
  display: flex;
  align-items: baseline;
  gap: 14px;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity .2s var(--ease-out), transform .25s var(--ease-out);
  white-space: nowrap;
  overflow: hidden;
}
.project-callout.is-visible {
  opacity: 1;
  transform: translateY(0);
}
.project-callout .pc-date {
  font-family: var(--f-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  color: var(--muted);
  text-transform: uppercase;
}
.project-callout .pc-title {
  font-family: var(--f-display);
  font-size: 28px;
  line-height: 1;
  letter-spacing: -0.01em;
  color: var(--ink);
}
.project-callout.is-milestone .pc-title {
  color: var(--accent-ink);
}
.project-callout.is-unreleased .pc-title {
  font-style: italic;
  color: var(--muted-2);
}
.project-callout .pc-role {
  font-family: var(--f-mono);
  font-size: 10px;
  letter-spacing: 0.04em;
  color: var(--muted-2);
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

/* Single-line dot tracks — all dots in a category share the same baseline. */
.track-projects {
  padding-top: 4px;
  align-items: end;
}
.track-projects-released   { height: 30px; }
.track-projects-unreleased { height: 28px; }
.track-projects-side       { height: 28px; }
.track-projects .track-label .hd-sub {
  font-family: var(--f-mono);
  font-size: 9px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted-2);
  margin-top: auto;
  padding-bottom: 4px;
}
.track-projects .track-label .sub-count {
  font-family: var(--f-mono);
  font-size: 9px;
  color: var(--muted);
  margin-top: auto;
  padding-bottom: 4px;
  margin-left: auto;
  padding-right: 4px;
}
.projects-stage {
  position: relative;
  height: 100%;
  border-bottom: 1px solid var(--rule);
}
.p-dot {
  position: absolute;
  bottom: 0;
}
/* Lighter divider between sub-tracks; solid below the last one. */
.track-projects-released .projects-stage,
.track-projects-unreleased .projects-stage {
  border-bottom: 1px dashed var(--paper-edge);
}
.track-projects-side .projects-stage { border-bottom: 1px solid var(--rule); }
.p-dot {
  position: absolute;
  transform: translateX(-50%);
  padding: 0;
  cursor: pointer;
}
.p-dot .glyph {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--ink);
  border: 2px solid var(--paper);
  box-shadow: 0 0 0 1px var(--ink);
  transition: transform .2s var(--ease-out), box-shadow .2s var(--ease-out);
}
.p-dot.is-milestone .glyph {
  background: var(--accent);
  box-shadow: 0 0 0 1px var(--accent), 0 0 0 6px oklch(0.58 0.18 28 / 0.12);
  width: 13px; height: 13px;
}
.p-dot.is-unreleased .glyph {
  background: transparent;
  border-color: var(--paper);
  box-shadow: 0 0 0 1px var(--muted-2);
}
.p-dot.is-opensource:not(.is-milestone) .glyph {
  background: var(--paper);
  border-radius: 1px;
  transform: rotate(45deg);
}
.p-dot:hover .glyph,
.p-dot.is-focused .glyph { transform: scale(1.4); }
.p-dot.is-opensource:not(.is-milestone):hover .glyph,
.p-dot.is-opensource:not(.is-milestone).is-focused .glyph {
  transform: rotate(45deg) scale(1.4);
}
.p-dot.is-selected .glyph {
  box-shadow: 0 0 0 1px var(--ink), 0 0 0 4px var(--paper), 0 0 0 5px var(--ink);
}
.p-dot.is-selected.is-milestone .glyph {
  box-shadow: 0 0 0 1px var(--accent), 0 0 0 4px var(--paper), 0 0 0 5px var(--accent);
}

/* Wrap the tracks in a scroll container if they overflow */
.tracks { overflow-y: auto; padding-right: 4px; }
.tracks::-webkit-scrollbar { width: 6px; }
.tracks::-webkit-scrollbar-thumb { background: var(--rule); border-radius: 3px; }

/* =========================================================================
   COMPACT STRIP (closed state)
   ========================================================================= */
.compact-strip {
  padding-top: 28px;
}
.compact-row {
  position: relative;
  height: 28px;
  margin-bottom: 4px;
}
.compact-track {
  position: absolute;
  left: 0; right: 0;
  top: 14px;
  height: 6px;
  background: var(--paper-2);
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}
.compact-dots {
  position: absolute;
  inset: 0;
}
.compact-dots .tl-dot {
  position: absolute;
  top: 0;
  transform: translateX(-50%);
  cursor: pointer;
  padding: 0;
}
.compact-dots .tl-dot .glyph {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--ink);
  border: 2px solid var(--paper);
  box-shadow: 0 0 0 1px var(--ink);
  transition: transform .2s var(--ease-out);
}
.compact-dots .tl-dot.milestone .glyph {
  background: var(--accent);
  box-shadow: 0 0 0 1px var(--accent), 0 0 0 6px oklch(0.58 0.18 28 / 0.10);
  width: 13px; height: 13px;
}
.compact-dots .tl-dot.unreleased .glyph {
  background: transparent;
  border-color: var(--paper);
  box-shadow: 0 0 0 1px var(--muted-2);
}
.compact-dots .tl-dot:hover .glyph { transform: scale(1.35); }
.tl-edu-compact {
  position: absolute;
  bottom: 0;
  transform: translateX(-50%);
}
.tl-edu-compact .mark {
  width: 0; height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-bottom: 6px solid var(--muted-2);
}

.compact-years {
  display: flex;
  justify-content: space-between;
  font-family: var(--f-mono);
  font-size: 10px;
  color: var(--muted);
}

/* =========================================================================
   Responsive
   ========================================================================= */
@media (max-width: 900px) {
  :root {
    --drawer-closed: clamp(64px, 10vh, 80px);
    --drawer-peek:   clamp(240px, 32vh, 320px);
    --drawer-detail: clamp(540px, 84vh, 760px);
    --track-label-w: 110px;
    --track-h: 28px;
    --track-h-thin: 14px;
  }
  .topbar { padding: 16px 20px 14px; }
  .stage { padding: 0 24px; }
  h1.name { font-size: clamp(44px, min(12vw, 13vh), 80px); }
  .hero-meta { grid-template-columns: 1fr; gap: 20px; padding-top: 22px; margin-top: 28px; }
  .contact { gap: 12px 18px; font-size: 11px; }
  .resume-view { padding: 16px 8px 80px; }
  .resume { --resume-pad-x: 28px; --resume-pad-y: 36px; font-size: 10pt; }
  .resume .r-name { font-size: 28pt; }
  .resume header.r-head { grid-template-columns: 1fr; }
  .resume .r-contact { text-align: left; }
  .r-job { grid-template-columns: 1fr; gap: 4px; }
  .r-job .when { padding-top: 0; }
  .r-highlights { grid-template-columns: 1fr; }
  .r-skills-row { grid-template-columns: 1fr; }
  .r-edu { grid-template-columns: 1fr; gap: 4px; }
  .tl-head { left: 20px; right: 20px; }
  .strip-area { padding: 0 16px 10px; }
  .detail {
    padding: 32px 20px 10px;
    grid-template-columns: 1fr;
    gap: 12px;
    align-items: start;
  }
  .detail .cover { aspect-ratio: 8 / 5; max-width: 100%; }
  .detail h3 { font-size: 24px; }
  .detail-nav { right: 16px; top: 10px; }
  .tl-span .emp-start,
  .tl-span .emp-end { display: none; }
  .tl-span .emp-name { font-size: 9px; }
  .edu-lab { font-size: 8px; }
  .project-callout .pc-title { font-size: 22px; }
  .project-callout .pc-role { display: none; }
}

@media (max-width: 720px) {
  .hero-top { flex-direction: column-reverse; align-items: flex-start; gap: 22px; }
  .portrait { flex-direction: row; gap: 14px; align-self: flex-start; }
  .avatar-large { width: 96px; }
  .portrait-title { padding-top: 0; }
  .portrait-title::before { display: none; }
  .shell[data-drawer="peek"] .avatar-large,
  .shell[data-drawer="detail"] .avatar-large { width: 76px; }
  .hero-meta { flex-direction: column; align-items: stretch; gap: 14px; }
  .hero-meta .contact { justify-content: flex-start; }
  .contact { gap: 8px; flex-wrap: wrap; }
  .contact-chip { padding: 8px 14px; font-size: 13px; }
}

@media (max-width: 540px) {
  :root { --track-label-w: 96px; }
  .tracks-axis .tl-years .y:not(.major) { display: none; }
  .compact-years .y:not(.major) { display: none; }
}

/* =========================================================================
   Print
   ========================================================================= */
@page { size: letter portrait; margin: 0; }
@media print {
  html, body { background: white; }
  .no-print { display: none !important; }
  .shell { display: block; height: auto; overflow: visible; }
  .topbar { display: none; }
  .drawer { display: none; }
  .resume-view { display: block !important; padding: 0 !important; background: white !important; }
  .resume-frame { max-width: none !important; box-shadow: none !important; border: none !important; }
  .resume { padding: 0.55in 0.6in; font-size: 10pt; }
}
