/* dcor.dev
   Layout: fixed WebGL terrain behind everything. Each view opens with a hero that sits directly
   on the terrain (clicks pass through to it), then a dark sheet carries the long-form content.
   Single dark look by design, taken from the Ridgeline Terrain artifact. */

:root {
  --bg: #0b0d0f;
  --ink: #e8edf0;
  --ink-2: #cfd6da;
  --ink-dim: #8b9298;
  --line: #22272b;
  --line-2: #2f363b;
  --panel: rgba(10, 12, 14, 0.82);
  --accent: #3fe0ff;
  --on-accent: #03151a;
  --font-display: "Geist", "Helvetica Neue", Arial, sans-serif;
  --font-mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --gut-l: max(16px, env(safe-area-inset-left, 0px));
  --gut-r: max(16px, env(safe-area-inset-right, 0px));
  --top-h: 56px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: var(--top-h); overflow-x: clip; }
body {
  margin: 0;
  min-height: 100svh; display: flex; flex-direction: column;  /* the footer always reaches the bottom edge */
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 var(--font-display);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, p, ul, figure, blockquote { margin: 0; }
ul { padding: 0; list-style: none; }
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-underline-offset: 3px; text-decoration-thickness: 1px; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
h1, h2, h3 { text-wrap: balance; }
.num { font-variant-numeric: tabular-nums; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
[tabindex="-1"]:focus { outline: none; }
.skip { position: fixed; z-index: 20; top: 8px; left: 8px; padding: 10px 14px; border-radius: 4px; background: var(--ink); color: var(--bg); transform: translateY(-200%); }
.skip:focus { transform: none; }
@media (forced-colors: active) { .tabs a[aria-current="page"] { outline: 2px solid CanvasText; } }

.inner { max-width: 1240px; margin: 0 auto; padding-left: var(--gut-l); padding-right: var(--gut-r); }

#gl { position: fixed; inset: 0; width: 100%; height: 100%; display: block; z-index: 0; cursor: crosshair; touch-action: pan-y; }
.fallback { position: fixed; inset: 0; z-index: 0; background: var(--bg); }

/* ---------- top bar + tabs ---------- */
.topbar {
  position: sticky; top: 0; z-index: 4;
  padding-top: env(safe-area-inset-top, 0px);
  background: linear-gradient(to bottom, rgba(11, 13, 15, 0.85), rgba(11, 13, 15, 0));
}
.topbar .inner { height: var(--top-h); display: flex; align-items: center; justify-content: flex-end; gap: 16px; }
.tabs { display: flex; gap: 4px; padding: 4px; border: 1px solid var(--line); border-radius: 999px; background: var(--panel); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.tabs a {
  font: 500 0.72rem/1 var(--font-mono); letter-spacing: 0.12em; text-transform: uppercase;
  padding: 9px 14px; border-radius: 999px; color: var(--ink-dim); text-decoration: none; white-space: nowrap;
  transition: color .2s, background-color .2s;
}
.tabs a:hover { color: var(--ink); }
.tabs a[aria-current="page"] { background: var(--ink); color: var(--bg); }

/* Layout wrappers let pointer events fall through to the terrain canvas;
   only real content (sheets, links, buttons, text) takes them back. */
main, .view { pointer-events: none; }
main { position: relative; z-index: 1; }
.sheet { pointer-events: auto; }

/* ---------- hero: on the terrain ---------- */
.hero {
  min-height: calc(100svh - var(--top-h) - env(safe-area-inset-top, 0px));
  display: flex; flex-direction: column; justify-content: flex-end;
  padding-block: 48px 72px;
  text-shadow: 0 1px 14px rgba(0, 0, 0, 0.85);
  pointer-events: none;
  /* quiets the terrain only behind the text, so small type stays readable over the lines */
  background: linear-gradient(to top, rgba(11, 13, 15, 0.78) 0, rgba(11, 13, 15, 0.64) 48%, rgba(11, 13, 15, 0) 78%);
}
.hero a, .hero button, .hero .lede { pointer-events: auto; }
.hero .inner { width: 100%; }

.role {
  font: 500 0.78rem/1.4 var(--font-mono); letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink-dim);
  display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center;
}
.role b { color: var(--accent); font-weight: 500; }
.name {
  margin-top: 22px;
  font: 600 clamp(3rem, 11.4vw, 10.5rem)/0.86 var(--font-display);
  letter-spacing: -0.055em;
}
.name span { display: block; }
.grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: 24px; }
.hero-foot { margin-top: 48px; align-items: end; }
.lede { grid-column: 1 / span 6; font: 500 clamp(1.3rem, 2.2vw, 1.9rem)/1.2 var(--font-display); letter-spacing: -0.02em; max-width: 26ch; color: var(--ink); }
.photo { grid-column: 9 / span 2; }
.photo img { aspect-ratio: 1; object-fit: cover; filter: grayscale(1) contrast(1.05) brightness(0.92); border-radius: 2px; }
/* social links, as on the original dcor.dev: no underline, a small nudge on hover */
.links a { display: inline-flex; align-items: center; gap: 6px; color: var(--ink); text-decoration: none; transition: transform .2s cubic-bezier(.19, 1, .22, 1); }
.links a:hover { transform: translateX(2px); }
.copy {
  font: 500 0.62rem/1 var(--font-mono); letter-spacing: 0.1em; text-transform: uppercase;
  padding: 5px 8px; border: 1px solid var(--line-2); border-radius: 999px; color: var(--ink-dim); background: var(--panel);
  text-shadow: none;
}
.copy:hover { color: var(--ink); border-color: var(--ink-dim); }
.reveal {
  font: 500 0.66rem/1 var(--font-mono); letter-spacing: 0.12em; text-transform: uppercase;
  padding: 7px 11px; border: 1px solid var(--line-2); border-radius: 999px; color: var(--ink); background: var(--panel);
  text-shadow: none; transition: border-color .2s, color .2s;
}
.reveal:hover { border-color: var(--accent); color: var(--accent); }

/* ---------- sheet: long-form content over a dark veil ---------- */
.sheet {
  position: relative;
  background: var(--bg);  /* one continuous solid colour: the terrain stops at the end of the hero */
  padding-block: 96px 120px;
}
.sec + .sec { margin-top: 104px; }
.sec > h2, .eyebrow {
  font: 500 0.72rem/1.4 var(--font-mono); letter-spacing: 0.16em; text-transform: uppercase; color: var(--accent);
}
.sec > h2 { grid-column: 1 / span 3; padding-top: 6px; }
.sec > .sec-side { grid-column: 1 / span 3; }
.sec-side > h2 { padding-top: 6px; font: 500 0.72rem/1.4 var(--font-mono); letter-spacing: 0.16em; text-transform: uppercase; color: var(--accent); }
/* CV rail: same component as Journey, sized to sit beside the experience list */
/* CV rail: full viewport height while the experience list scrolls past */
.jr.jr-cv { margin-top: 20px; height: calc(100svh - var(--top-h) - 48px); width: 160px; }
.sec > .body { grid-column: 4 / span 9; }
.about { columns: 2; column-gap: 32px; font-size: 17px; color: var(--ink-2); }
.about p { margin-bottom: 1em; break-inside: avoid; }
.about a { color: var(--ink); text-decoration-color: var(--accent); }

.job { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr) minmax(0, 4fr); column-gap: 24px; padding: 34px 0 40px; }
.job + .job { box-shadow: inset 0 1px 0 var(--line-2); }
/* the role you're reading is gently lit, driven by the same scroll position as the rail */
.job { position: relative; }
.job::before { content: ""; position: absolute; inset: 0 -24px; border-radius: 6px; background: rgba(255, 255, 255, 0.035); opacity: 0; transition: opacity .35s; pointer-events: none; }
.job.is-current::before { opacity: 1; }
.job .when { transition: color .35s; }
.job.is-current .when { color: var(--accent); }
.job .when { font: 500 0.8rem/1.4 var(--font-mono); color: var(--ink); }
.now { display: inline-block; margin-top: 8px; font: 500 0.62rem/1 var(--font-mono); letter-spacing: 0.14em; text-transform: uppercase; color: var(--on-accent); background: var(--accent); padding: 5px 8px; border-radius: 2px; }
.job h3, .h3 { font: 600 21px/1.15 var(--font-display); letter-spacing: -0.02em; }
.job .org { margin-top: 6px; font-size: 14px; color: var(--ink-dim); }
.job p { font-size: 15.5px; color: var(--ink-2); }
.job p a { color: var(--ink); text-decoration-color: var(--accent); }
.job .tech, .cite { margin-top: 10px; font: 400 0.78rem/1.5 var(--font-mono); color: var(--ink-dim); }
.quote { font: 500 clamp(1.45rem, 2.5vw, 2.2rem)/1.24 var(--font-display); letter-spacing: -0.025em; max-width: 36ch; }
.quote + .cite { margin-top: 18px; }
.stack { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 44px 40px; }
.stack h3 { font: 600 21px/1.15 var(--font-display); letter-spacing: -0.02em; margin-bottom: 10px; }
.stack p { color: var(--ink-2); font-size: 15.5px; }
.stack .tech { margin-top: 10px; font: 400 0.78rem/1.5 var(--font-mono); color: var(--ink-dim); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- home: one text block on the left, the portrait closing the right edge ---------- */
.home-main { display: flex; justify-content: space-between; align-items: flex-end; gap: 48px; }
.home-text .lede { margin-top: 36px; max-width: 30ch; }
.home-links { margin-top: 32px; display: flex; flex-wrap: wrap; align-items: center; gap: 12px 28px; font-size: 16px; }
.home-links li { display: flex; align-items: center; gap: 8px; }
.home-links li:nth-child(1) { --j: 1; } .home-links li:nth-child(2) { --j: 2; }
.home-links li:nth-child(3) { --j: 3; } .home-links li:nth-child(4) { --j: 4; }
@media (prefers-reduced-motion: no-preference) {
  .home-links li { animation: shwoopLeft calc(1.7s + var(--j) * .05s) cubic-bezier(.19, 1, .22, 1) calc(var(--j) * .2s) backwards; }
  @keyframes shwoopLeft { 0% { opacity: 0; transform: translateY(2px) translateX(10px) skewY(1deg); } }
}
.home-main .photo { flex: none; width: clamp(180px, 20vw, 280px); }

/* ---------- career timeline ---------- */


/* ---------- time rail: sticks beside Chapters while it scrolls past ---------- */
.jr {
  position: sticky; top: calc(var(--top-h) + env(safe-area-inset-top, 0px) + 24px);
  height: calc(100svh - var(--top-h) - 48px);
  align-self: start;
}
.jr-track { position: absolute; inset: 0 auto 0 0; width: 100%; }
.jr-track::before { content: ""; position: absolute; left: 61px; top: 0; bottom: 0; width: 1px; background: var(--line-2); }
.jr-fill { position: absolute; left: 61px; top: 0; width: 1px; height: var(--p, 0%); background: var(--accent); box-shadow: 0 0 10px var(--accent); }
.jr-seg { position: absolute; left: 56px; top: var(--s); height: var(--h); width: calc(100% - 56px); display: flex; align-items: flex-start; gap: 10px; }
.jr-seg::before { content: ""; flex: none; width: 11px; height: 100%; border-radius: 6px; border: 1px solid var(--line-2); background: rgba(11, 13, 15, 0.7); transition: background-color .3s, border-color .3s; }
.jr-seg span { margin-top: -2px; font: 500 0.66rem/1.2 var(--font-mono); letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-dim); transition: color .3s; text-shadow: 0 1px 10px #000; }
.jr-lab { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.jr-map { display: block; fill: rgba(232, 237, 240, 0.2); transition: fill .3s; }
.jr-seg.on .jr-map { fill: var(--accent); }
.jr-place { margin-top: -6px; font: 400 0.66rem/1.2 var(--font-mono); color: var(--ink-dim); white-space: nowrap; transition: color .3s; }
.jr-seg.on .jr-place { color: var(--ink); }
.jr-seg.on::before { background: var(--accent); border-color: var(--accent); }
.jr-seg.on span { color: var(--ink); }
.jr-dot { position: absolute; left: 56px; top: var(--p, 0%); width: 11px; height: 11px; margin-top: -5px; border-radius: 50%; background: var(--ink); box-shadow: 0 0 0 3px rgba(63, 224, 255, 0.35), 0 0 16px var(--accent); }
/* year label sits left of the dot, so it never covers the job names */
.jr-read { position: absolute; left: -9px; top: 50%; transform: translate(-100%, -50%); white-space: nowrap;
  font: 500 0.72rem/1 var(--font-mono); color: var(--on-accent); background: var(--accent); padding: 5px 8px; border-radius: 3px; }


/* ---------- footer ---------- */
.foot { flex: 1 0 auto; position: relative; z-index: 1; background: var(--bg); border-top: 1px solid var(--line); }
.foot .inner { display: flex; justify-content: space-between; gap: 8px 24px; flex-wrap: wrap; padding-block: 22px calc(22px + env(safe-area-inset-bottom, 0px)); font: 400 0.72rem/1.4 var(--font-mono); color: var(--ink-dim); }

/* ---------- tuning panel (half hidden) ---------- */
.tune-btn {
  position: fixed; z-index: 6;
  right: calc(16px + env(safe-area-inset-right, 0px));
  bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  height: 32px; min-width: 32px; padding: 0 11px; border-radius: 999px;
  font: 500 0.66rem/1 var(--font-mono); letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--ink); background: transparent; border: 1px solid transparent;
  display: flex; gap: 8px; align-items: center; justify-content: center;
  opacity: 0.75;
  transition: opacity .25s, background-color .25s, border-color .25s;
}
.tune-btn .lbl { max-width: 0; overflow: hidden; white-space: nowrap; transition: max-width .35s cubic-bezier(.22, 1, .36, 1); }
.tune-btn:hover, .tune-btn:focus-visible, .tune-btn[aria-expanded="true"] { opacity: 1; background: var(--panel); border-color: var(--line); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.tune-btn:hover .lbl, .tune-btn:focus-visible .lbl, .tune-btn[aria-expanded="true"] .lbl { max-width: 60px; }
.tune-btn .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 8px var(--accent); flex: none; }
.panel {
  position: fixed; z-index: 5;
  right: calc(16px + env(safe-area-inset-right, 0px));
  bottom: calc(60px + env(safe-area-inset-bottom, 0px));
  width: 300px; max-width: calc(100vw - 32px);
  max-height: calc(100% - 140px); overflow-y: auto;
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  padding: 14px 16px 16px;
  font-family: var(--font-mono); font-size: 0.74rem; color: var(--ink-dim);
  display: grid; gap: 14px;
}
.panel h2 { margin: 0; font: 500 0.66rem/1 var(--font-mono); letter-spacing: 0.18em; text-transform: uppercase; color: var(--ink-dim); }
.group { display: grid; gap: 9px; }
.panel .row { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; align-items: center; }
.panel .row label, .panel .lbl-plain { color: var(--ink); }
.panel .row output { font-variant-numeric: tabular-nums; color: var(--ink-dim); }
.panel .row input[type=range] { grid-column: 1 / -1; width: 100%; accent-color: var(--accent); margin: 0; }
.toggles { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.chip { position: relative; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip label { display: flex; gap: 7px; align-items: center; padding: 7px 9px; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; color: var(--ink-dim); user-select: none; }
.chip label::before { content: ""; width: 7px; height: 7px; border-radius: 50%; border: 1px solid #4a5258; flex: none; }
.chip input:checked + label { color: var(--ink); border-color: #2f3a40; }
.chip input:checked + label::before { background: var(--accent); border-color: var(--accent); box-shadow: 0 0 6px var(--accent); }
.chip input:focus-visible + label { outline: 2px solid var(--accent); outline-offset: 2px; }
.actions { display: flex; gap: 8px; }
.actions button { flex: 1; font: 500 0.7rem/1 var(--font-mono); letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink); border: 1px solid var(--line); border-radius: 8px; padding: 9px 8px; }
.actions button:hover { border-color: #3a454b; }
.note { margin: 0; line-height: 1.5; color: var(--ink-dim); }
.note b { color: var(--ink-dim); font-weight: 500; }
#copyOut { width: 100%; height: 90px; background: var(--bg); color: var(--ink-dim); border: 1px solid var(--line); border-radius: 8px; font: 0.68rem/1.4 var(--font-mono); padding: 8px; resize: vertical; }

/* ---------- motion ---------- */
@media (prefers-reduced-motion: no-preference) {
  .view:not([hidden]) .hero .inner > * { animation: rise .7s cubic-bezier(.22, 1, .36, 1) both; }
  .view:not([hidden]) .hero .inner > :nth-child(2) { animation-delay: .06s; }
  .view:not([hidden]) .hero .inner > :nth-child(3) { animation-delay: .12s; }

  @keyframes rise { from { opacity: .001; transform: translateY(12px); } to { opacity: 1; transform: none; } }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ---------- small screens ---------- */
@media (max-width: 860px) {
  .grid, .stack { display: block; }
  .hero-foot { margin-top: 32px; }
  .photo { width: 112px; margin-top: 28px; }
  .home-main { flex-direction: column-reverse; align-items: flex-start; gap: 28px; }
  .home-main .photo { width: 112px; margin-top: 0; }
  .sec + .sec { margin-top: 72px; }
  .sec > h2 { margin-bottom: 16px; }
  .about { columns: 1; }
  .job { grid-template-columns: 1fr; row-gap: 6px; }
  .stack > * + * { margin-top: 24px; }

  .panel { left: calc(16px + env(safe-area-inset-left, 0px)); width: auto; max-height: 62%; }

  /* the rail becomes a slim horizontal progress strip under the top bar */
  .jr { position: sticky; top: calc(var(--top-h) + env(safe-area-inset-top, 0px)); height: 34px; z-index: 3; margin-inline: calc(-1 * var(--gut-l)) calc(-1 * var(--gut-r)); background: rgba(11, 13, 15, 0.8); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
  .jr-track { inset: auto 16px 8px 16px; width: auto; height: 6px; }
  .jr-track::before { left: 0; right: 0; top: 2px; bottom: auto; width: auto; height: 1px; }
  .jr-fill { left: 0; top: 2px; height: 1px; width: var(--p, 0%); }
  .jr-seg { top: 0; height: 6px; left: var(--s); width: var(--h); }
  .jr-seg::before { width: calc(100% - 2px); height: 5px; }
  .jr-seg span, .jr-map, .jr-place, .jr-yr { display: none; }
  .jr-dot { top: auto; bottom: 6px; left: calc(16px + (100% - 32px) * var(--pf, 0)); margin: 0 0 0 -5px; }
  .jr-read { left: 50%; top: auto; bottom: 14px; transform: translateX(-50%); font-size: 0.62rem; padding: 3px 6px; }

  /* CV rail on phones: the side column dissolves so the rail can stick across the whole
     experience section, as the same slim progress strip Journey uses */
  .sec-side { display: contents; }
  .sec-side > h2 { margin-bottom: 16px; }
  .jr.jr-cv { height: 34px; width: auto; margin-top: 0; margin-bottom: 8px; }

}
@media (max-width: 420px) {
  .tabs a { padding: 9px 10px; letter-spacing: 0.08em; }
}

/* Home and Career share the same modest header so the landscape carries the page */
.home .name { font-size: clamp(2.6rem, 6.2vw, 5.6rem); }

/* small type that sits on the terrain */
.hero .role, .hero small { color: var(--ink-2); }
/* the links' brand icons */
.ico { flex: none; }

/* Home fits one screen with its footer: 10% shorter than a full-height hero */
[data-view="home"] .hero { min-height: calc((100svh - var(--top-h) - env(safe-area-inset-top, 0px)) * 0.9); }

/* phones: the content leads, the landscape stays behind it */
@media (max-width: 860px) {
  [data-view="home"] .hero { justify-content: center; padding-block: 24px; background: linear-gradient(to top, rgba(11, 13, 15, 0.25) 0, rgba(11, 13, 15, 0.58) 28%, rgba(11, 13, 15, 0.58) 72%, rgba(11, 13, 15, 0.1) 100%); }
  .home .name { font-size: clamp(2.6rem, 13vw, 4.4rem); }
  .home-main .photo { width: 136px; }
  .home-links { gap: 12px 16px; }
}

/* short phones: tighten so Home still fits without scrolling */
@media (max-width: 860px) and (max-height: 720px) {
  [data-view="home"] .hero { padding-block: 12px; }
  .home-main { gap: 16px; }
  .home-main .photo { width: 84px; }
  .home-text .lede { margin-top: 20px; }
  .home-links { margin-top: 18px; }
  .foot .inner { padding-block: 10px calc(10px + env(safe-area-inset-bottom, 0px)); }
}

/* Career is a regular page: no landscape, no Tune control, and the header takes only the room it needs */
body[data-page="career"] #gl, body[data-page="career"] .tune-btn, body[data-page="career"] .panel { display: none; }
[data-view="career"] .hero { min-height: 0; justify-content: flex-start; padding-block: 56px 0; background: none; text-shadow: none; pointer-events: auto; }

@media (max-width: 860px) {
  .job::before { inset: 0 -12px; }
  html { scroll-padding-top: calc(var(--top-h) + 42px); }  /* keeps focused links clear of the sticky tabs and rail strip */
}

/* Tune sliders: comfortable minimum target height */
.panel input[type="range"] { height: 24px; }
