/* Tianyi Zhang — one stylesheet for the whole page.
   The hero is a sky drawn in characters: glowing on the night in the dark theme, in ink on the
   page's paper in the light one. The page follows the theme toggle (dark unless light is pinned); in
   the dark theme its background is the sky's colour at the visitor's hour (--sky, set by theme-init.js).
   Everything around the sky is set quietly: one system sans in sentence case, plain underlined links,
   rows divided by hairlines, no HUD dressing. Hooks used by the scripts are kept: .reveal/.rv-*, .panorama-*, [data-spotify-*], [data-github-*],
   .after-hours-*. */

/* ------------------------------------------------------------------ tokens */
:root {
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;

  --bg: var(--sky, #050507);
  --panel: rgba(255, 255, 255, .03);
  --ink: #ededed;
  --text: #b0b0b0;
  --muted: #808080;
  --dim: #5a5a5a;
  --line: rgba(255, 255, 255, .08);
  --line-2: rgba(255, 255, 255, .17);
  --accent: #d8c49c;
  --photo-shadow: rgba(0, 0, 0, .5);                   /* photos keep a neutral shadow, never the season's colours */

  /* the hero's sky; the light theme redraws it in ink below */
  --ascii-ink: #f0f0f0;
  --ascii-dim: #5e5e5e;
  --ascii-fire: #ff9446;
  --ascii-hot: #fff0c2;
  --ascii-planet: #d2cfc8;
  --ascii-sand: #d8c49c;
  --ascii-blink: #ff6157;
  --ascii-ember: #b8442e;
  --ascii-light: 0;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #f5f4f0;
  --panel: rgba(0, 0, 0, .025);
  --ink: #161616;
  --text: #3a3a3a;
  --muted: #6b6b6b;
  --dim: #999999;
  --line: rgba(0, 0, 0, .09);
  --line-2: rgba(0, 0, 0, .19);
  --accent: #8a6420;
  --photo-shadow: rgba(30, 34, 48, .2);
  color-scheme: light;
}

/* ------------------------------------------------------------------ base */
*, *::before, *::after { box-sizing: border-box; }
html { background: var(--bg); -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { margin: 0; color: var(--text); font: 400 16px/1.7 var(--sans); -webkit-font-smoothing: antialiased; }
img, video, canvas { display: block; max-width: 100%; }
a { color: inherit; text-underline-offset: .22em; }
h1, h2, h3 { margin: 0; color: var(--ink); }
p { margin: 0; }
:is(a, button, input, summary):focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
::selection { background: var(--accent); color: #050507; }
[hidden] { display: none !important; }

.skip-to-profile {
  position: fixed; top: 12px; left: 12px; z-index: 100; padding: 12px 20px;
  background: var(--panel); color: var(--ink); font: 14px var(--sans); transform: translateY(-180%);
}
.skip-to-profile:focus { transform: none; }

/* links in running copy: a plain underline that stays with the text, whatever the tap target's height */
.hero-links a, .entity-link, .resume-links a, .oss-actions a, .music-copy a, .after-hours a {
  color: var(--ink); text-decoration: underline; text-decoration-thickness: 1px; text-decoration-color: var(--line-2); text-underline-offset: 5px;
  transition: color .2s ease, text-decoration-color .2s ease;
}
.hero-links a:hover, .entity-link:hover, .resume-links a:hover, .oss-actions a:hover, .music-copy a:hover, .after-hours a:hover { text-decoration-color: currentColor; }

/* ------------------------------------------------------------------ top bar */
.portfolio-bar {
  position: fixed; inset: 0 0 auto; z-index: 50; height: 60px; color: #c8c8c8;
  border-bottom: 1px solid transparent; transition: background-color .3s ease, border-color .3s ease, color .3s ease;
}
.past-hero .portfolio-bar {
  background: rgba(5, 5, 7, .8); background: color-mix(in srgb, var(--bg) 82%, transparent); border-bottom-color: var(--line); color: var(--muted);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
}
.portfolio-bar-inner { display: flex; align-items: center; gap: 24px; height: 100%; max-width: 1120px; margin: 0 auto; padding: 0 clamp(20px, 5vw, 48px); }
/* the bar names the page only once the big name has scrolled away */
.portfolio-wordmark { flex: none; color: #f0f0f0; font: 600 15px/1 var(--sans); letter-spacing: -.005em; text-decoration: none; opacity: 0; transition: opacity .3s ease; }
.past-hero .portfolio-wordmark { color: var(--ink); opacity: 1; }
.section-nav { display: flex; gap: 4px; min-width: 0; margin-left: auto; overflow-x: auto; scrollbar-width: none; }
.section-nav::-webkit-scrollbar { display: none; }
.section-nav a {
  padding: 8px 10px; white-space: nowrap; text-decoration: none; color: inherit;
  font: 400 14px/1 var(--sans); transition: color .2s ease;
}
.section-nav a:hover { color: #f0f0f0; }
.past-hero .section-nav a:hover { color: var(--ink); }
.section-nav a[aria-current] { color: #f0f0f0; }
.past-hero .section-nav a[aria-current] { color: var(--ink); }
.theme-toggle {
  flex: none; display: grid; place-items: center; width: 34px; height: 34px; padding: 0;
  border: 0; border-radius: 50%; background: transparent; color: inherit; cursor: pointer; transition: color .2s ease;
}
.theme-toggle:hover { color: var(--accent); }
.theme-toggle svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; }
.theme-toggle .tt-sun { display: none; }
:root[data-theme="light"] .theme-toggle .tt-sun { display: block; }
:root[data-theme="light"] .theme-toggle .tt-moon { display: none; }

/* ------------------------------------------------------------------ hero */
.sky-hero {
  position: relative; height: 100vh; height: 100svh; min-height: 620px; max-height: 1300px; overflow: hidden;
  background: var(--sky, #050507); color: #f0f0f0; cursor: crosshair; isolation: isolate;
  /* the sky falls away into the page, glows and all */
  -webkit-mask-image: linear-gradient(to bottom, #000 88%, transparent); mask-image: linear-gradient(to bottom, #000 88%, transparent);
}
.sky-hero canvas.ascii-sky { position: absolute; inset: 0; width: 100%; height: 100%; }
/* keep the bar and the copy legible over the sky */
.sky-hero::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background:
    linear-gradient(to bottom, color-mix(in srgb, var(--sky, #050507) 55%, transparent), transparent 96px),
    radial-gradient(ellipse 58% 52% at 16% 80%, color-mix(in srgb, var(--sky, #050507) 82%, transparent), transparent 70%);
}
/* on the same left edge as the bar and the sections below */
.hero-copy { position: absolute; z-index: 1; left: max(clamp(20px, 5vw, 48px), calc((100% - 1120px) / 2 + clamp(20px, 5vw, 48px))); right: 20px; bottom: clamp(64px, 12vh, 128px); max-width: 920px; cursor: auto; }
.kicker { display: flex; align-items: center; gap: 9px; margin: 0 0 18px; color: #a6a6a6; font: 500 14px/1 var(--sans); }
.kicker img { width: 16px; height: 16px; border-radius: 3px; object-fit: contain; }
.kicker .sep { margin: 0 4px; color: #4d4d4d; }
.hero-name {
  color: #f5f5f5; font: 500 clamp(40px, 6.2vw, 88px)/1 var(--sans); letter-spacing: -.03em; white-space: nowrap;
}
.hero-line { max-width: 40em; margin-top: 20px; color: #ababab; font: 400 clamp(16px, 1.3vw, 18px)/1.55 var(--sans); }
.hero-links { display: flex; flex-wrap: wrap; gap: 10px 24px; margin-top: 26px; font: 500 15px/1 var(--sans); }
.hero-links a { color: #f0f0f0; text-decoration-color: rgba(255, 255, 255, .32); }
.hero-links a:hover { color: #fff; }

/* the light theme: the same sky, drawn in ink on the page's paper */
:root[data-theme="light"] {
  --ascii-ink: #1c1c1c;
  --ascii-dim: #a5a5a5;
  --ascii-fire: #c4501a;
  --ascii-hot: #7a2a0c;
  --ascii-planet: #2f2f2f;
  --ascii-sand: #8a6420;
  --ascii-blink: #c4301a;
  --ascii-ember: #b8442e;
  --ascii-light: 1;
}
:root[data-theme="light"] .sky-hero { background: var(--bg); color: var(--ink); }
:root[data-theme="light"] .sky-hero::after {
  background:
    linear-gradient(to bottom, color-mix(in srgb, var(--bg) 55%, transparent), transparent 96px),
    radial-gradient(ellipse 58% 52% at 16% 80%, color-mix(in srgb, var(--bg) 82%, transparent), transparent 70%);
}
:root[data-theme="light"] .kicker { color: var(--muted); }
:root[data-theme="light"] .kicker .sep { color: var(--dim); }
:root[data-theme="light"] .hero-name { color: var(--ink); }
:root[data-theme="light"] .hero-line { color: var(--text); }
:root[data-theme="light"] .hero-links a { color: var(--ink); text-decoration-color: var(--line-2); }
:root[data-theme="light"] .hero-links a:hover { text-decoration-color: currentColor; }
:root[data-theme="light"] .portfolio-bar { color: var(--muted); }
:root[data-theme="light"] :is(.portfolio-wordmark, .section-nav a:hover, .section-nav a[aria-current]) { color: var(--ink); }

/* ------------------------------------------------------------------ page */
.page { position: relative; max-width: 1120px; margin: 0 auto; padding: clamp(72px, 10vw, 136px) clamp(20px, 5vw, 48px) 24px; }
.compact-section { padding-bottom: clamp(80px, 9vw, 120px); scroll-margin-top: 80px; }
.section-title { margin-bottom: 28px; color: var(--ink); font: 600 26px/1.2 var(--sans); letter-spacing: -.02em; }
.section-heading { display: flex; align-items: baseline; gap: 20px; margin-bottom: 28px; }
.section-heading .section-title { flex: 1; margin: 0; }
.section-heading > a { color: var(--muted); font: 400 14.5px/1.4 var(--sans); text-decoration: none; white-space: nowrap; }
.section-heading > a:hover { color: var(--accent); }

.tx-reveal .compact-section { opacity: 0; transform: translateY(16px); transition: opacity .8s ease, transform .8s cubic-bezier(.2, .7, .2, 1); }
.tx-reveal .compact-section.is-in { opacity: 1; transform: none; }


/* ------------------------------------------------------------------ about */
.about-grid { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: clamp(32px, 6vw, 80px); align-items: start; }
.portrait { width: 100%; height: auto; border-radius: 10px; background: #fff; box-shadow: 0 0 0 1px var(--line-2), 0 18px 60px -18px var(--photo-shadow); }
.about-copy > p { max-width: 38em; margin-bottom: 18px; color: var(--text); font-size: 17px; line-height: 1.8; }
.entity-link img, .log-body h3 img, .log-marks img, .spec strong img { display: inline-block; width: 15px; height: 15px; margin: 0 6px 0 2px; vertical-align: -2px; border-radius: 3px; object-fit: contain; }
.entity-link strong { font-weight: 600; }
.spec { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 28px; max-width: 40em; margin: 30px 0 0; padding-top: 26px; border-top: 1px solid var(--line); }
.spec dt { color: var(--ink); font: 600 13px/1 var(--sans); }
.spec dd { margin: 14px 0 0; color: var(--muted); font-size: 14px; line-height: 1.6; }
.spec strong { display: block; color: var(--ink); font-weight: 600; }
.spec dd span { display: block; }
.spec dd span + span { color: var(--dim); }
.resume-links { display: flex; gap: 22px; }
.resume-links a, .oss-actions a, .music-copy a { font: 400 14.5px/1.4 var(--sans); }
.spec .resume-updated { color: var(--dim); }

/* ------------------------------------------------------------------ experience */
.log, .publication-list, .oss-timeline { list-style: none; margin: 0; padding: 0; }
.log-row, .publication-list li { display: grid; grid-template-columns: 190px minmax(0, 1fr); gap: 4px 28px; padding: 24px 0; border-top: 1px solid var(--line); }
.log-row:last-child, .publication-list li:last-child { border-bottom: 1px solid var(--line); }
.log-when, .oss-period, .pub-venue { padding-top: 4px; color: var(--muted); font: 400 14px/1.6 var(--sans); font-variant-numeric: tabular-nums; }
.log-body h3 { font: 600 18px/1.45 var(--sans); letter-spacing: -.005em; }
.log-body h3 a { color: inherit; text-decoration: none; }
.log-body h3 a:hover { color: var(--accent); }
.log-body h3 img, .log-marks img { width: 17px; height: 17px; margin: 0 9px 0 0; vertical-align: -3px; }
.log-marks img + img { margin-left: -4px; }
.log-body p { margin-top: 6px; color: var(--text); font-size: 15.5px; }
.tag { color: var(--muted); white-space: nowrap; }
.tag::before { content: "· "; }

/* ------------------------------------------------------------------ open source */
/* plain rows like the experience log */
.oss-entry { display: grid; grid-template-columns: 190px minmax(0, 1fr); gap: 28px; padding: 26px 0; border-top: 1px solid var(--line); }
.oss-entry:last-child { border-bottom: 1px solid var(--line); }
.oss-period-end { display: block; color: var(--dim); }
.oss-project { position: relative; }
.oss-project-heading { display: flex; align-items: center; gap: 16px; }
.oss-mark { flex: none; display: grid; place-items: center; width: 34px; height: 34px; border: 1px solid var(--line-2); border-radius: 8px; }
.oss-mark img { width: 18px; height: 18px; object-fit: contain; }
.oss-project h3 { font: 600 19px/1.3 var(--sans); }
.oss-project h3 a { color: inherit; text-decoration: none; }
.oss-project h3 a:hover { color: var(--accent); }
.oss-role { margin-top: 5px; color: var(--muted); font: 400 14px/1.4 var(--sans); }
.oss-stars { margin-left: 10px; }
.oss-description { margin-top: 12px; color: var(--text); font-size: 15.5px; line-height: 1.75; }
.oss-contributions { margin: 14px 0 0; padding: 0 0 0 1.2em; list-style: disc; }
.oss-contributions li { padding-left: 2px; color: var(--text); font-size: 15px; line-height: 1.7; }
.oss-contributions li::marker { color: var(--dim); }
.oss-contributions li + li { margin-top: 6px; }
.oss-actions { display: flex; flex-wrap: wrap; gap: 8px 20px; margin-top: 14px; }

/* ------------------------------------------------------------------ publications */
.pub-venue { grid-row: span 2; }
.pub-accent { color: var(--ink); font-weight: 600; }
.publication-list h3 { font: 600 17.5px/1.5 var(--sans); }
.publication-list h3 a { color: inherit; text-decoration: none; background: linear-gradient(var(--accent), var(--accent)) left bottom / 0 1px no-repeat; transition: background-size .35s ease, color .2s ease; }
.publication-list h3 a:hover { color: var(--accent); background-size: 100% 1px; }
.publication-authors { margin-top: 8px; color: var(--muted); font-size: 14px; line-height: 1.65; }
.publication-authors strong { color: var(--ink); font-weight: 600; }

/* ------------------------------------------------------------------ personal */
.personal-intro { max-width: 38em; margin-bottom: 30px; color: var(--text); font-size: 17px; line-height: 1.8; }
.hero-reveal { margin: 0; }
.hero-reveal figcaption {
  display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-top: 12px;
  color: var(--dim); font: 400 13.5px/1.5 var(--sans);
}
.reveal { --pos: 0%; position: relative; aspect-ratio: 16 / 9; overflow: hidden; border-radius: 10px; background: #000; touch-action: pan-y; box-shadow: 0 0 0 1px var(--line-2), 0 30px 80px -30px var(--photo-shadow); }
.rv-media { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.rv-photo { clip-path: inset(0 0 0 var(--pos)); }
/* clamp so the round grip never gets half-clipped by the figure's overflow */
.rv-handle { position: absolute; top: 0; bottom: 0; left: clamp(19px, var(--pos), calc(100% - 19px)); width: 2px; background: #fff; transform: translateX(-1px); pointer-events: none; }
.rv-grip {
  position: absolute; top: 50%; left: 50%; display: flex; align-items: center; justify-content: center; width: 36px; height: 36px;
  border-radius: 50%; background: #fff; box-shadow: 0 1px 8px rgba(0, 0, 0, .35); transform: translate(-50%, -50%);
  color: #050507; font: 700 15px var(--mono);
}
.rv-range { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: ew-resize; }
.rv-range:focus-visible { outline: 2px solid #fff; outline-offset: -4px; }
.rv-hint {
  position: absolute; left: 12px; bottom: 12px; padding: 7px 11px; border-radius: 6px; background: rgba(5, 5, 7, .6);
  color: #fff; font: 500 13px/1 var(--sans); pointer-events: none; transition: opacity .3s ease;
}
.reveal.unlocked .rv-hint { opacity: 0; }
.panorama-open-button {
  position: absolute; z-index: 3; right: 12px; bottom: 12px; display: flex; align-items: center; gap: 8px; min-height: 38px; padding: 0 14px;
  border: 1px solid rgba(255, 255, 255, .45); border-radius: 8px; background: rgba(5, 5, 7, .72); color: #fff; cursor: pointer;
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  font: 500 13px/1 var(--sans); transition: border-color .2s ease;
}
.panorama-open-button:hover { border-color: #fff; }
.panorama-open-button:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

.music-card { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.35fr); gap: 36px; align-items: center; margin-top: 56px; padding-top: 32px; border-top: 1px solid var(--line); }
.card-index { color: var(--muted); font: 500 14px/1 var(--sans); }
.music-copy h3 { margin: 14px 0 8px; font: 600 24px/1.3 var(--sans); }
.music-copy p:not(.card-index) { margin-bottom: 16px; color: var(--muted); font-size: 15px; }
.spotify-consent { display: flex; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); flex-direction: column; align-items: center; justify-content: center; gap: 12px; min-height: 180px; padding: 24px; text-align: center; }
.spotify-consent button {
  min-height: 42px; padding: 0 20px; border: 1px solid var(--line-2); border-radius: 8px; background: transparent; color: var(--ink);
  font: 500 14px/1 var(--sans); cursor: pointer; transition: border-color .2s ease, color .2s ease;
}
.spotify-consent button:hover { border-color: var(--accent); color: var(--accent); }
.spotify-consent p { color: var(--dim); font: 400 13px/1.5 var(--sans); }
.spotify-embed { display: block; border: 0; border-radius: 12px; background: #121212; }

/* ------------------------------------------------------------------ after hours */
.after-hours { position: relative; z-index: 1; max-width: 1320px; margin: 96px auto 0; padding: 0 0 24px; }
@media (max-width: 1368px) { .after-hours { padding-inline: 24px; } }
.after-hours-heading, .after-hours-footer { display: flex; align-items: center; justify-content: space-between; gap: 16px; color: var(--muted); font: 400 14px/1.5 var(--sans); }
.after-hours-heading { margin-bottom: 18px; }
.after-hours-heading p { color: var(--ink); font: 600 26px/1.2 var(--sans); letter-spacing: -.02em; }
.after-hours a { color: inherit; }
.after-hours-screen { position: relative; aspect-ratio: 16 / 9; overflow: hidden; isolation: isolate; border: 1px solid #26232e; border-radius: 10px; background: #050508; color: #f2eef7; }
.after-hours-invitation {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px; text-align: center;
  background: radial-gradient(ellipse at 35% 60%, #40203b30, transparent 60%), radial-gradient(ellipse at 80% 25%, #12294340, transparent 60%);
}
.after-hours-label { margin-bottom: 20px; color: #aba1b8; font: 400 13px/1 var(--sans); }
.after-hours #after-hours-title {
  color: #f2eef7; font: 700 clamp(38px, 6.7vw, 86px)/1.2 "Hiragino Mincho ProN", "Songti SC", "Noto Serif CJK SC", serif;
  letter-spacing: .15em; text-indent: .15em;
}
.after-hours-track { margin: 15px 0 28px; color: #bdb2c9; font-size: 16px; letter-spacing: .25em; }
.after-hours-play {
  display: inline-flex; align-items: center; gap: 12px; min-height: 48px; padding: 12px 24px; border: 1px solid #74687d; border-radius: 8px;
  background: #ffffff08; color: #f2eef7; font: 500 14px/1 var(--sans); cursor: pointer;
}
.after-hours-play:hover { border-color: #c9b8da; }
.after-hours-play:focus-visible { outline: 2px solid #dbcbec; outline-offset: 5px; }
.after-hours-privacy { margin-top: 16px; color: #a39aaa; font: 400 13px/1.5 var(--sans); }
.after-hours iframe { position: absolute; inset: 0; display: block; width: 100%; height: 100%; border: 0; }
.after-hours-footer { flex-wrap: wrap; margin-top: 16px; }
.after-hours-close { min-height: 40px; padding: 8px 14px; border: 1px solid var(--line-2); border-radius: 4px; background: var(--panel); color: var(--ink); font: 400 13px/1 var(--sans); cursor: pointer; }
.after-hours-status { margin-top: 10px; color: var(--muted); font-size: 12px; }
.after-hours-status:empty { display: none; }

/* ------------------------------------------------------------------ footer */
.onepage-footer {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  max-width: 1320px; margin: 72px auto 0; padding: 24px 0 40px; border-top: 1px solid var(--line);
  color: var(--dim); font: 400 14px/1.5 var(--sans);
}
@media (max-width: 1368px) { .onepage-footer { margin-inline: 24px; } }
.onepage-footer a { color: var(--muted); text-decoration: none; }
.onepage-footer a:hover { color: var(--accent); }

/* ------------------------------------------------------------------ panorama dialog */
.panorama-dialog {
  width: min(96vw, 1500px); height: min(92vh, 920px); max-width: none; max-height: none; margin: auto; padding: 0; overflow: hidden;
  border: 1px solid rgba(255, 255, 255, .14); border-radius: 12px; background: #0c0c0d; color: #fff; box-shadow: 0 40px 120px rgba(0, 0, 0, .55);
}
.panorama-dialog::backdrop { background: rgba(6, 6, 7, .82); -webkit-backdrop-filter: blur(9px); backdrop-filter: blur(9px); }
.panorama-shell { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; height: 100%; }
.panorama-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 16px; border-bottom: 1px solid rgba(255, 255, 255, .12); background: rgba(12, 12, 13, .94); }
.panorama-head p { color: #a3a3a3; font: 400 12.5px/1 var(--sans); }
.panorama-head h2 { margin-top: 6px; color: #fff; font: 600 18px/1.2 var(--sans); }
.panorama-controls { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 6px; }
.panorama-controls button, .panorama-controls output {
  display: grid; place-items: center; min-width: 38px; height: 34px; padding: 0 10px; border: 1px solid rgba(255, 255, 255, .14); border-radius: 8px;
  background: rgba(255, 255, 255, .06); color: #fff; font: 400 13px/1 var(--sans); font-variant-numeric: tabular-nums;
}
.panorama-controls button { cursor: pointer; }
.panorama-controls button:hover { border-color: rgba(255, 255, 255, .3); }
.panorama-controls output { min-width: 56px; color: #d0d0d0; }
.panorama-controls .panorama-close { margin-left: 6px; color: #d0d0d0; font-size: 19px; }
.panorama-viewport { position: relative; min-height: 0; overflow: hidden; background: radial-gradient(circle at 50% 50%, #1e1e20, #070708 72%); touch-action: none; cursor: grab; user-select: none; }
.panorama-viewport.is-dragging { cursor: grabbing; }
.panorama-image {
  position: absolute; left: 50%; top: 50%; display: block; width: auto; height: auto; max-width: 100%; max-height: 100%;
  transform: translate(-50%, -50%) translate3d(0, 0, 0) scale(1); transform-origin: center; will-change: transform; pointer-events: none;
}
.panorama-status {
  position: absolute; left: 14px; bottom: 12px; padding: 7px 10px; border: 1px solid rgba(255, 255, 255, .12); border-radius: 999px;
  background: rgba(10, 10, 11, .68); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  color: #dcdcdc; font: 400 12px/1 var(--sans); pointer-events: none;
}
.panorama-foot { display: flex; justify-content: space-between; gap: 16px; padding: 10px 16px; border-top: 1px solid rgba(255, 255, 255, .12); background: rgba(12, 12, 13, .94); color: #999999; font: 400 12.5px/1.5 var(--sans); }
body.panorama-open { overflow: hidden; }

/* ------------------------------------------------------------------ smaller screens */
@media (max-width: 900px) {
  .about-grid { grid-template-columns: 1fr; }
  .portrait { width: min(200px, 55vw); }
  .about-copy { margin-top: 24px; }
  .log-row, .publication-list li, .oss-entry { grid-template-columns: 1fr; gap: 6px; }
  .pub-venue { grid-row: auto; }
  .oss-period { padding-top: 0; }
  .oss-period-end { display: inline; }
  .music-card { grid-template-columns: 1fr; gap: 22px; }
}
@media (max-width: 760px) {
  .portfolio-bar-inner { gap: 10px; padding-inline: 12px; }
  .section-nav { display: none; }                                  /* a phone shows only the wordmark and the theme switch */
  .theme-toggle { width: 40px; height: 40px; margin-left: auto; }
  .hero-copy { bottom: 44px; }
  /* a shorter fade, so the links still sit on the sky when the page below is light */
  .sky-hero { -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 32px), transparent); mask-image: linear-gradient(to bottom, #000 calc(100% - 32px), transparent); }
  .hero-name { font-size: clamp(38px, 11vw, 48px); }
  .hero-line { margin-top: 14px; font-size: 16px; }
  .hero-links { gap: 8px 20px; }
  .hero-links a { display: inline-flex; align-items: center; min-height: 40px; }
  .spec { grid-template-columns: 1fr; gap: 24px; }
  .resume-links a, .oss-actions a, .music-copy a, .section-heading > a, .onepage-footer a, .after-hours-heading a, .after-hours-footer a { display: inline-flex; align-items: center; min-height: 44px; }
  .section-heading { flex-wrap: wrap; gap: 8px; }
  .section-title, .after-hours-heading p { font-size: 22px; }
  .rv-hint { display: none; }
  .panorama-open-button { right: 10px; bottom: 10px; min-height: 44px; padding: 0 12px; }
  .rv-range { touch-action: pan-y; }
  .spotify-consent button { min-height: 44px; }
  .after-hours { margin-top: 56px; padding: 0 20px 24px; }
  .after-hours-screen { aspect-ratio: auto; min-height: 330px; }
  .after-hours-screen.is-playing { aspect-ratio: 16 / 9; min-height: 0; }
  .onepage-footer { margin-inline: 20px; }
  .panorama-dialog { width: 100vw; height: 100vh; height: 100dvh; border: 0; border-radius: 0; }
  .panorama-head { position: relative; flex-direction: column; align-items: stretch; padding: max(12px, env(safe-area-inset-top)) 12px 12px; }
  .panorama-head > div:first-child { padding-right: 56px; }
  .panorama-controls { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)) 44px minmax(48px, 1fr) 44px; width: 100%; gap: 6px; }
  .panorama-controls button, .panorama-controls output { height: 44px; min-width: 0; padding-inline: 8px; }
  .panorama-controls .panorama-close { position: absolute; top: max(12px, env(safe-area-inset-top)); right: 12px; width: 44px; margin: 0; }
  .panorama-foot { padding: 9px 12px max(12px, env(safe-area-inset-bottom)); }
  .panorama-foot span:last-child { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .tx-reveal .compact-section { opacity: 1; transform: none; transition: none; }
}
@media print {
  .portfolio-bar, .sky-hero canvas, .after-hours, .skip-to-profile { display: none; }
  .sky-hero { height: auto; min-height: 0; padding: 24px 0; background: none; color: #000; }
  .sky-hero::after { display: none; }
  .hero-copy { position: static; }
  .hero-name, .hero-line, .hero-links a, .kicker { color: #000; }
}
