/* Fonts are embedded in fonts.css (generated by tools/build.mjs). */

/* ── Tokens ────────────────────────────────────────────────── */
:root {
  --void: #07080a;
  --panel: rgba(17, 18, 22, 0.8);
  --panel-solid: #111216;
  --tab: #191b20;
  --line: rgba(255, 255, 255, 0.08);
  --line-2: rgba(255, 255, 255, 0.15);
  --paper: #efeae2;
  --muted: #9095a0;
  --faint: #5c616b;
  --cti: #3b8cff;
  --cti-soft: #8ab8ff;
  --amir: #ffc21a;
  --rec: #e5382d;

  --f-display: 'Fraunces Soft', Georgia, serif;
  --f-body: 'Vazirmatn', system-ui, sans-serif;
  --f-mono: 'Martian Mono', ui-monospace, monospace;

  --gutter: clamp(16px, 2.2vw, 32px);
  --r: 12px;
  --hud-h: 64px;
  --scrub-h: 46px;
  color-scheme: dark;
}
html[lang='fa'] { --f-display: 'Lalezar', 'Vazirmatn', sans-serif; }

*, *::before, *::after { box-sizing: border-box; }
html { background: var(--void); -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--void);
  color: var(--paper);
  font-family: var(--f-body);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
html[lang='fa'] body { line-height: 1.85; }
button { font: inherit; color: inherit; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--cti); outline-offset: 3px; border-radius: 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.mono { font-family: var(--f-mono); letter-spacing: 0.02em; }

#gl { position: fixed; inset: 0; width: 100%; height: 100%; display: block; z-index: 0; }
#scroll-space { width: 1px; pointer-events: none; }

/* ── Loader ────────────────────────────────────────────────── */
#loader {
  position: fixed; inset: 0; z-index: 50; background: var(--void);
  display: grid; place-items: center;
  transition: opacity 0.7s ease, visibility 0.7s;
}
#loader.done { opacity: 0; visibility: hidden; }
.loader-inner { width: min(320px, 76vw); display: grid; grid-template-columns: 1fr auto; gap: 10px 16px; align-items: baseline; }
.loader-label { font-size: 13px; color: var(--muted); }
.loader-pct { font-family: var(--f-mono); font-size: 12px; color: var(--cti-soft); }
.loader-bar { grid-column: 1 / -1; height: 2px; background: var(--line); overflow: hidden; border-radius: 2px; }
.loader-bar i { display: block; height: 100%; width: 0; background: var(--cti); transition: width 0.3s ease; }

/* ── HUD ───────────────────────────────────────────────────── */
.hud {
  position: fixed; z-index: 10; top: 0; left: 0; right: 0;
  display: flex; justify-content: space-between; align-items: flex-start;
  padding: 14px var(--gutter) 0;
  pointer-events: none;
  transition: opacity 0.6s ease 0.2s;
}
.is-loading .hud, .is-loading .scrub { opacity: 0; }
.hud > * { pointer-events: auto; }
.hud-tc { display: grid; gap: 2px; }
.hud-seq { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.hud-file { font-family: var(--f-mono); font-size: 10px; letter-spacing: 0.04em; color: var(--faint); }
.rec-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--rec); box-shadow: 0 0 10px var(--rec); }
.tc-row { display: flex; align-items: baseline; gap: 10px; }
.tc { font-family: var(--f-mono); font-weight: 500; font-size: clamp(18px, 2vw, 24px); color: var(--cti); letter-spacing: 0.02em; font-variant-numeric: tabular-nums; }
.speed { font-family: var(--f-mono); font-size: 11px; color: var(--amir); }
.hud-nav { display: flex; gap: 6px; }
.hud-btn {
  height: 34px; padding: 0 14px; border-radius: 8px; cursor: pointer;
  background: rgba(20, 21, 26, 0.72); border: 1px solid var(--line);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  font-size: 13px; transition: border-color 0.2s, background 0.2s;
}
.hud-btn:hover { border-color: var(--line-2); background: rgba(34, 36, 42, 0.8); }
.hud-lang { font-family: var(--f-body); min-width: 44px; }
html[lang='fa'] .hud-lang { font-family: var(--f-mono); font-size: 11px; }

/* ── Panels (shared) ───────────────────────────────────────── */
#panels { position: fixed; inset: 0; z-index: 5; pointer-events: none; }
[data-panel] { --vis: 0; opacity: var(--vis); visibility: hidden; }
[data-panel].on { visibility: visible; }
[data-panel].on.live { pointer-events: auto; }

.panel {
  position: fixed;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r);
  backdrop-filter: blur(20px) saturate(1.25); -webkit-backdrop-filter: blur(20px) saturate(1.25);
  box-shadow: 0 40px 90px -40px rgba(0, 0, 0, 0.9), inset 0 1px 0 rgba(255, 255, 255, 0.04);
  overflow: hidden;
}
.panel.side {
  inset-inline-start: var(--gutter);
  top: 50%;
  width: min(440px, 34vw);
  max-height: calc(100vh - var(--hud-h) - var(--scrub-h) - 60px);
  display: flex; flex-direction: column;
  transform: translate3d(0, calc(-50% + (1 - var(--vis)) * 28px), 0);
}
.panel-tab {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  height: 36px; padding: 0 14px; flex: none;
  background: var(--tab); border-bottom: 1px solid var(--line);
  font-family: var(--f-mono); font-size: 10.5px; letter-spacing: 0.04em; color: var(--muted);
  direction: ltr;
}
.panel-tab .tab-name { position: relative; flex: none; white-space: nowrap; color: var(--paper); }
.panel-tab .tab-name::after { content: ''; position: absolute; left: 0; right: 0; bottom: -12px; height: 2px; background: var(--cti); border-radius: 2px; }
.panel-tab .tab-extra { min-width: 0; color: var(--faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.panel-body { padding: 20px 22px 22px; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: #2c2f36 transparent; }
.eyebrow { margin: 0 0 6px; font-family: var(--f-mono); font-size: 10.5px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
html[lang='fa'] .eyebrow { font-family: var(--f-body); font-size: 12.5px; letter-spacing: 0; text-transform: none; }
.panel h2 {
  margin: 0 0 10px; font-family: var(--f-display); font-weight: 900; font-size: clamp(26px, 2.4vw, 34px);
  line-height: 1.05; letter-spacing: -0.01em;
}
html[lang='fa'] .panel h2 { font-weight: 400; line-height: 1.35; letter-spacing: 0; }
.panel p { margin: 0 0 12px; color: #cfcbc4; font-size: 15px; }
.lead { font-size: 16px !important; color: var(--paper) !important; }

.btn {
  display: inline-flex; align-items: center; gap: 10px; height: 42px; padding: 0 18px;
  border-radius: 9px; border: 1px solid var(--line-2); background: #1d1f25; cursor: pointer;
  text-decoration: none; font-size: 14px; font-weight: 500; transition: transform 0.15s, background 0.2s, border-color 0.2s;
}
.btn:hover { background: #262930; border-color: rgba(255, 255, 255, 0.25); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--cti); border-color: transparent; color: #fff; }
.btn.primary:hover { background: #5a9fff; }
.btn .k { font-family: var(--f-mono); font-size: 10px; padding: 3px 6px; border-radius: 4px; background: rgba(0, 0, 0, 0.28); }

.chip {
  display: inline-flex; align-items: center; gap: 7px; padding: 5px 10px; border-radius: 7px;
  background: rgba(255, 255, 255, 0.05); border: 1px solid var(--line); font-size: 13px; line-height: 1.3;
}
.chip i { width: 8px; height: 8px; border-radius: 2px; background: var(--c, var(--muted)); flex: none; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }

/* ── Hero ──────────────────────────────────────────────────── */
.hero {
  position: fixed; left: 0; right: 0; bottom: calc(var(--scrub-h) + 9vh);
  display: grid; justify-items: center; gap: 6px; text-align: center; padding: 0 var(--gutter);
  transform: translate3d(0, calc((1 - var(--vis)) * 18px), 0);
}
.hero::before {
  content: ''; position: absolute; z-index: -1; left: 50%; top: 50%; width: min(760px, 110vw); height: 150%;
  transform: translate(-50%, -50%);
  background: radial-gradient(closest-side, rgba(7, 8, 10, 0.78), rgba(7, 8, 10, 0.5) 55%, transparent);
  pointer-events: none;
}
.hero-name { display: none; margin: 0; font-family: var(--f-display); font-size: clamp(34px, 4.4vw, 54px); line-height: 1.2; color: var(--amir); }
html[lang='fa'] .hero-name { display: block; }
.hero-roles { margin: 0; font-family: var(--f-mono); font-size: clamp(11px, 1vw, 13px); letter-spacing: 0.18em; text-transform: uppercase; color: var(--paper); }
html[lang='fa'] .hero-roles { font-family: var(--f-body); font-size: clamp(15px, 1.4vw, 18px); letter-spacing: 0.02em; font-weight: 500; }
.hero-hint { margin: 18px 0 0; display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 10px 16px; font-size: 13px; color: var(--muted); }
.hero-keys { display: inline-flex; gap: 10px; direction: ltr; }
.kbd { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.kbd b {
  display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 6px;
  font-family: var(--f-mono); font-size: 11px; font-weight: 700; color: var(--cti-soft);
  background: #1a1c22; border: 1px solid var(--line-2); box-shadow: 0 2px 0 #0c0d10;
}
html[lang='fa'] .kbd { direction: rtl; }

/* ── Quote (kinetic) ───────────────────────────────────────── */
.quote {
  position: fixed; left: 0; right: 0; top: calc(var(--hud-h) + 8vh);
  display: grid; justify-items: center; padding: 0 var(--gutter);
}
.quote-text {
  margin: 0; max-width: 13ch; text-align: center; perspective: 900px;
  font-family: var(--f-display); font-weight: 900; font-size: clamp(44px, 7.6vw, 124px); line-height: 0.98; letter-spacing: -0.02em;
}
html[lang='fa'] .quote-text { max-width: 12ch; font-weight: 400; line-height: 1.3; letter-spacing: 0; font-size: clamp(44px, 7vw, 112px); }
.quote-text .w {
  --k: 0;
  display: inline-block; margin: 0 0.12em;
  color: var(--c, var(--paper));
  opacity: var(--k);
  transform: translate3d(0, calc((1 - var(--k)) * 0.55em), 0) rotateX(calc((1 - var(--k)) * -75deg));
  transform-origin: 50% 90%;
  text-shadow: 0 1px 0 var(--s1, #cdc6b8), 0 2px 0 var(--s2, #b3ac9f), 0 3px 0 var(--s3, #9a9386), 0 4px 0 var(--s4, #7f786c), 0 14px 30px rgba(0, 0, 0, 0.55);
}
.quote-text .w.hot { --c: var(--amir); --s1: #e0a50c; --s2: #c48d06; --s3: #a67503; --s4: #875e02; }
.quote-text .w.robot {
  --c: var(--cti-soft); --s1: #5f8fd6; --s2: #4a77bd; --s3: #3a62a0; --s4: #2c4c7f;
  font-family: var(--f-mono); font-weight: 400; font-size: 0.62em; letter-spacing: -0.04em;
}
html[lang='fa'] .quote-text .w.robot { font-family: var(--f-body); font-weight: 300; font-size: 0.8em; }
.quote-text .w.robot::after {
  content: ''; display: inline-block; width: 0.5em; height: 0.9em; margin-inline-start: 0.08em; vertical-align: -0.1em;
  background: var(--cti-soft); animation: blink 1s steps(2, start) infinite;
}
@keyframes blink { to { visibility: hidden; } }

/* ── About ─────────────────────────────────────────────────── */
.portrait { display: flex; gap: 14px; align-items: center; margin: 0 0 16px; }
.portrait img { width: 64px; height: 64px; border-radius: 10px; object-fit: cover; background: var(--amir); flex: none; }
.portrait figcaption { display: grid; gap: 2px; font-size: 12px; color: var(--muted); }
.portrait figcaption b { font-family: var(--f-display); font-size: 22px; line-height: 1.1; color: var(--paper); font-weight: 900; }
html[lang='fa'] .portrait figcaption b { font-weight: 400; font-size: 24px; }
.portrait figcaption .mono { font-size: 10px; color: var(--faint); }
.subtab { margin: 18px 0 8px; font-family: var(--f-mono); font-size: 10.5px; letter-spacing: 0.05em; color: var(--muted); direction: ltr; text-align: start; }
html[lang='fa'] .subtab { text-align: right; }
.meta { margin: 0; display: grid; grid-template-columns: auto 1fr; border-top: 1px solid var(--line); }
.meta dt, .meta dd { margin: 0; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 13.5px; line-height: 1.5; }
.meta dt { color: var(--muted); padding-inline-end: 18px; white-space: nowrap; }

/* ── Career ────────────────────────────────────────────────── */
.clip-list { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 6px; }
.clip-list button {
  width: 100%; display: grid; grid-template-columns: 10px 1fr auto; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: 8px; background: rgba(255, 255, 255, 0.03); border: 1px solid var(--line);
  cursor: pointer; text-align: start; transition: background 0.2s, border-color 0.2s;
}
.clip-list button:hover { background: rgba(255, 255, 255, 0.07); border-color: var(--line-2); }
.clip-list i { width: 10px; height: 26px; border-radius: 3px; background: var(--c); }
.clip-list b { display: block; font-size: 14px; font-weight: 700; line-height: 1.3; }
.clip-list small { display: block; font-size: 12px; color: var(--muted); line-height: 1.4; }
.clip-list .d { font-family: var(--f-mono); font-size: 10px; color: var(--faint); direction: ltr; }
html[lang='fa'] .clip-list .d { font-family: var(--f-body); font-size: 12px; }
.job { animation: swap 0.45s cubic-bezier(0.2, 0.7, 0.2, 1); }
@keyframes swap { from { opacity: 0; transform: translateY(10px); } }
.job-head { display: grid; grid-template-columns: 6px 1fr; gap: 14px; margin-bottom: 12px; }
.job-head > i { border-radius: 4px; background: var(--c); }
.job .role { margin: 0 0 6px; font-family: var(--f-display); font-weight: 900; font-size: clamp(22px, 1.9vw, 28px); line-height: 1.1; direction: ltr; text-align: start; }
html[lang='fa'] .job .role { font-family: 'Fraunces Soft', Georgia, serif; text-align: right; }
.job .co { margin: 0 !important; font-size: 14px !important; color: var(--paper) !important; font-weight: 700; }
.job .dates { margin: 2px 0 0 !important; font-family: var(--f-mono); font-size: 11px !important; color: var(--cti-soft) !important; }
html[lang='fa'] .job .dates { font-family: var(--f-body); font-size: 13px !important; }
.job h3 { margin: 16px 0 8px; font-family: var(--f-mono); font-weight: 500; font-size: 10.5px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
html[lang='fa'] .job h3 { font-family: var(--f-body); font-size: 12.5px; letter-spacing: 0; }
.job ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; }
.job li { position: relative; padding-inline-start: 18px; font-size: 14px; line-height: 1.55; color: #d6d2cb; }
.job li::before { content: ''; position: absolute; inset-inline-start: 2px; top: 0.62em; width: 8px; height: 2px; background: var(--c); border-radius: 2px; }
.job .chips { margin-top: 8px; }
.job .ext { display: inline-block; margin-top: 14px; font-family: var(--f-mono); font-size: 12px; color: var(--cti-soft); text-decoration: none; direction: ltr; }
.job .ext:hover { text-decoration: underline; }
.job-nav { display: flex; gap: 8px; justify-content: space-between; align-items: center; padding: 12px 22px; border-top: 1px solid var(--line); flex: none; }
.job-nav .count { font-family: var(--f-mono); font-size: 11px; color: var(--muted); direction: ltr; }
.icon-btn {
  width: 34px; height: 34px; display: grid; place-items: center; border-radius: 8px; cursor: pointer;
  background: #1c1e24; border: 1px solid var(--line); transition: background 0.2s;
}
.icon-btn:hover { background: #272a31; }
.icon-btn:disabled { opacity: 0.35; cursor: default; }
.icon-btn svg { width: 14px; height: 14px; }
html[lang='fa'] .icon-btn svg { transform: scaleX(-1); }

/* ── Skills ────────────────────────────────────────────────── */
.skill-group { margin-top: 14px; }
.skill-group h3 { margin: 0 0 8px; font-family: var(--f-mono); font-weight: 500; font-size: 10.5px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
html[lang='fa'] .skill-group h3 { font-family: var(--f-body); font-size: 12.5px; letter-spacing: 0; }

/* ── Contact / export dialog ───────────────────────────────── */
.panel.dialog {
  left: 50%; top: 50%;
  width: min(540px, calc(100vw - 2 * var(--gutter)));
  transform: translate3d(-50%, calc(-50% + (1 - var(--vis)) * 30px), 0) scale(calc(0.97 + var(--vis) * 0.03));
}
.export h2 { font-size: clamp(34px, 4vw, 52px) !important; margin-bottom: 8px; }
.export-rows { margin: 16px 0; display: grid; grid-template-columns: auto 1fr; border-top: 1px solid var(--line); }
.export-rows dt, .export-rows dd { margin: 0; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.export-rows dt { color: var(--muted); padding-inline-end: 22px; }
.export-rows dd { font-family: var(--f-mono); font-size: 12.5px; direction: ltr; text-align: end; overflow-wrap: anywhere; }
html[lang='fa'] .export-rows dd { text-align: left; }
.export-rows a { color: var(--cti-soft); text-decoration: none; }
.export-rows a:hover { text-decoration: underline; }
.render { margin: 6px 0 18px; }
.render-top { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--muted); margin-bottom: 7px; }
.render-top .pct { font-family: var(--f-mono); font-size: 11px; color: var(--paper); direction: ltr; }
.render-bar { height: 6px; border-radius: 4px; background: rgba(255, 255, 255, 0.07); overflow: hidden; }
.render-bar i { display: block; height: 100%; width: calc(var(--p, 0) * 100%); background: linear-gradient(90deg, var(--cti), var(--cti-soft)); border-radius: 4px; }
.render.done .render-bar i { background: linear-gradient(90deg, #2fbf71, #7ee2a8); }
.render.done .render-top span:first-child { color: #7ee2a8; }
.export-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.export-foot { margin-top: 16px !important; font-size: 12px !important; color: var(--faint) !important; }

/* ── Scrubber (site timeline) ──────────────────────────────── */
.scrub {
  position: fixed; z-index: 10; left: var(--gutter); right: var(--gutter); bottom: 14px;
  height: var(--scrub-h);
  transition: opacity 0.6s ease 0.3s;
}
.scrub-ruler {
  position: relative; height: 100%; border-radius: 10px; cursor: ew-resize; touch-action: none;
  background: rgba(15, 16, 20, 0.78); border: 1px solid var(--line);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
}
.scrub-ticks {
  position: absolute; left: 12px; right: 12px; top: 0; height: 10px;
  background: repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.18) 0 1px, transparent 1px 2%);
  mask: linear-gradient(#000, transparent);
}
.scrub-markers { position: absolute; left: 12px; right: 12px; top: 0; bottom: 0; }
.mk {
  position: absolute; left: calc(var(--x) * 100%); top: 50%; transform: translateY(-50%);
  display: flex; align-items: center; gap: 7px; padding: 4px 8px 4px 0; border: 0; background: none; cursor: pointer;
  font-size: 12px; color: var(--muted); white-space: nowrap; transition: color 0.2s;
}
.mk i { width: 9px; height: 12px; background: var(--c); clip-path: polygon(0 0, 100% 0, 100% 65%, 50% 100%, 0 65%); flex: none; }
.mk:hover, .mk.on { color: var(--paper); }
html[lang='en'] .mk { font-family: var(--f-mono); font-size: 10px; letter-spacing: 0.06em; text-transform: uppercase; }
.scrub-head { position: absolute; top: -6px; bottom: -2px; left: calc(12px + var(--x, 0) * (100% - 24px)); width: 2px; margin-left: -1px; background: var(--cti); pointer-events: none; box-shadow: 0 0 12px var(--cti); }
.scrub-head i { position: absolute; top: -2px; left: -6px; width: 14px; height: 12px; background: var(--cti); clip-path: polygon(0 0, 100% 0, 100% 60%, 50% 100%, 0 60%); }

/* ── Overlays: bin + player ────────────────────────────────── */
.overlay {
  position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; padding: var(--gutter);
  background: rgba(4, 5, 7, 0.72); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  animation: fade 0.25s ease;
}
.overlay[hidden] { display: none; }
@keyframes fade { from { opacity: 0; } }
.overlay .panel { position: relative; width: min(1100px, 100%); max-height: calc(100vh - 2 * var(--gutter)); display: flex; flex-direction: column; }
@supports (height: 1dvh) { .overlay .panel { max-height: calc(100dvh - 2 * var(--gutter)); } }
.close-btn { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 7px; border: 1px solid var(--line); background: #1e2026; cursor: pointer; color: var(--paper); }
.close-btn:hover { background: #2a2d34; }
.bin-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 22px 0; }
.bin-head h2 { margin: 0 !important; }
.filters { display: flex; flex-wrap: wrap; gap: 6px; }
.filters button { cursor: pointer; }
.filters button[aria-pressed='true'] { background: var(--cti); border-color: transparent; color: #fff; }
.bin-grid { padding: 18px 22px 24px; display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 16px; overflow-y: auto; }
.card { display: grid; gap: 8px; text-align: start; background: none; border: 0; padding: 0; cursor: pointer; }
.card .thumb {
  position: relative; aspect-ratio: 16 / 10; border-radius: 9px; overflow: hidden; border: 1px solid var(--line);
  background: linear-gradient(150deg, var(--c) 0%, #15161b 58%, #0b0c0f 100%);
  display: grid; place-items: center; transition: transform 0.25s ease, border-color 0.25s;
}
.card:hover .thumb { transform: translateY(-3px); border-color: var(--line-2); }
.card .thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.card .thumb .ph { font-family: var(--f-display); font-weight: 900; font-size: 22px; line-height: 1.1; padding: 0 16px; text-align: center; }
html[lang='fa'] .card .thumb .ph { font-weight: 400; font-size: 24px; }
.card .badge { position: absolute; inset-inline-end: 8px; bottom: 8px; font-family: var(--f-mono); font-size: 9.5px; padding: 3px 6px; border-radius: 4px; background: rgba(0, 0, 0, 0.6); direction: ltr; }
.card .off { position: absolute; inset-inline-start: 8px; top: 8px; font-family: var(--f-mono); font-size: 9px; font-weight: 700; padding: 3px 6px; border-radius: 4px; background: var(--rec); color: #fff; direction: ltr; }
.card b { font-size: 14px; line-height: 1.3; }
.card small { font-size: 12px; color: var(--muted); line-height: 1.4; }

.player .panel { width: auto; max-width: 100%; }
.stage { position: relative; background: #000; display: grid; place-items: center; }
.stage video, .stage iframe { display: block; width: 100%; height: 100%; border: 0; background: #000; }
.stage.wide { width: min(1100px, calc(100vw - 2 * var(--gutter) - 2px)); aspect-ratio: 16 / 9; max-height: calc(100vh - 220px); }
.stage.tall { height: min(78vh, calc(100vh - 220px)); aspect-ratio: 9 / 16; max-width: calc(100vw - 2 * var(--gutter) - 2px); }
.offline-slate { position: absolute; inset: 0; display: grid; place-content: center; gap: 10px; text-align: center; background: repeating-linear-gradient(45deg, #1a0808 0 14px, #140606 14px 28px); }
.offline-slate b { font-family: var(--f-mono); font-size: clamp(18px, 3vw, 30px); color: var(--rec); letter-spacing: 0.06em; }
.offline-slate span { font-size: 14px; color: #d8c9c7; padding: 0 20px; }
.player-meta { display: flex; flex-wrap: wrap; gap: 6px 18px; align-items: baseline; justify-content: space-between; padding: 14px 18px 16px; }
.player-meta h2 { margin: 0 !important; font-size: clamp(20px, 2vw, 26px) !important; }
.player-meta p { margin: 0 !important; font-size: 13px !important; color: var(--muted) !important; }
.player-tc { font-family: var(--f-mono); font-size: 13px; color: var(--cti); direction: ltr; }

/* ── Sheet button (only shown on phones) ───────────────────── */
.sheet-btn {
  display: none; align-items: center; gap: 6px; height: 26px; padding: 0 10px; margin-inline-start: auto;
  border-radius: 7px; border: 1px solid rgba(59, 140, 255, 0.35); background: rgba(59, 140, 255, 0.12);
  color: var(--cti-soft); font-family: var(--f-body); font-size: 12px; font-weight: 500; letter-spacing: 0; cursor: pointer;
}
.sheet-btn svg { transition: transform 0.25s ease; }
.sheet-btn .l, .expanded .sheet-btn .m { display: none; }
.expanded .sheet-btn .l { display: inline; }
.expanded .sheet-btn svg { transform: rotate(180deg); }

/* ── Portrait / narrow: panels dock under the 3D view ──────── */
/* Keep this query in sync with PORTRAIT in src/util.js. */
@media (max-aspect-ratio: 1/1), (max-width: 599px) {
  :root { --scrub-h: 40px; --hud-h: 70px; --sheet-h: clamp(236px, 34vh, 310px); --dock: calc(var(--scrub-h) + 22px + env(safe-area-inset-bottom)); }
  @supports (height: 1svh) { :root { --sheet-h: clamp(236px, 34svh, 310px); } }
  .hud { padding-top: max(12px, env(safe-area-inset-top)); }
  .hud-file { display: none; }
  .hud-btn { padding: 0 11px; }
  .scrub { left: 10px; right: 10px; bottom: calc(12px + env(safe-area-inset-bottom)); }
  .mk span { display: none; }
  .mk.on span { display: inline; position: relative; z-index: 1; padding: 1px 5px; border-radius: 4px; background: rgba(15, 16, 20, 0.92); }
  .mk.on { z-index: 1; }
  .hero-roles { font-size: 10.5px; letter-spacing: 0.1em; }
  html[lang='fa'] .hero-roles { font-size: 15px; letter-spacing: 0.02em; }

  /* Collapsed: a fixed-height docked panel that never scrolls on its own, so a swipe that
     starts on it still moves the timeline. "More" (or a tap) expands it. */
  .panel.side {
    inset-inline: 10px; top: auto; bottom: var(--dock); width: auto;
    height: var(--sheet-h); max-height: none;
    transform: translate3d(0, calc((1 - var(--vis)) * 30px), 0);
  }
  .panel.side .sheet-btn { display: inline-flex; }
  .panel.side .panel-tab .tab-extra { display: none; }
  .panel.side .eyebrow { display: none; }
  .panel.side:not(.expanded) { cursor: pointer; }
  .panel.side:not(.expanded) .panel-body {
    flex: 1 1 auto; min-height: 0; overflow: hidden; overscroll-behavior: auto;
    -webkit-mask-image: linear-gradient(#000 calc(100% - 28px), transparent);
    mask-image: linear-gradient(#000 calc(100% - 28px), transparent);
  }
  .panel.side:not(.expanded) .x { display: none; }
  .panel.side:not(.expanded) :is(.clamp2, .clamp3) { display: -webkit-box; -webkit-box-orient: vertical; overflow: hidden; }
  .panel.side:not(.expanded) .clamp2 { -webkit-line-clamp: 2; line-clamp: 2; }
  .panel.side:not(.expanded) .clamp3 { -webkit-line-clamp: 3; line-clamp: 3; }
  .panel.side.expanded {
    height: auto; max-height: calc(100vh - var(--hud-h) - var(--dock) - 12px);
    animation: sheet-up 0.32s cubic-bezier(0.2, 0.7, 0.2, 1);
  }
  @supports (height: 1svh) { .panel.side.expanded { max-height: calc(100svh - var(--hud-h) - var(--dock) - 12px); } }

  /* Touch: once a panel has nothing left to scroll, the swipe moves the timeline instead. */
  .panel-body { padding: 14px 16px 16px; overscroll-behavior: auto; }
  .panel h2 { font-size: 24px; margin-bottom: 6px; }
  .panel p { font-size: 14.5px; margin-bottom: 10px; }
  .lead { font-size: 15px !important; }
  .portrait { margin-bottom: 12px; }
  .portrait img { width: 56px; height: 56px; }

  /* Career overview: the clip list becomes a strip you swipe sideways. */
  .panel.side:not(.expanded) .clip-list {
    display: flex; gap: 6px; margin-top: 8px; overflow-x: auto; scrollbar-width: none; overscroll-behavior-x: contain;
  }
  .panel.side:not(.expanded) .clip-list::-webkit-scrollbar { display: none; }
  .panel.side:not(.expanded) .clip-list { -webkit-mask-image: linear-gradient(to right, #000 82%, transparent); mask-image: linear-gradient(to right, #000 82%, transparent); }
  html[dir='rtl'] .panel.side:not(.expanded) .clip-list { -webkit-mask-image: linear-gradient(to left, #000 82%, transparent); mask-image: linear-gradient(to left, #000 82%, transparent); }
  .panel.side:not(.expanded) .clip-list li { flex: none; }
  .panel.side:not(.expanded) .clip-list button { grid-template-columns: 6px auto; gap: 9px; padding: 9px 12px 9px 10px; }
  .panel.side:not(.expanded) .clip-list i { width: 6px; height: 20px; }
  .panel.side:not(.expanded) .clip-list :is(small, .d) { display: none; }
  .panel.side:not(.expanded) .clip-list b { font-size: 13px; white-space: nowrap; }
  .job .role { font-size: 20px; }
  .job-head { margin-bottom: 8px; }
  .job-nav { padding: 8px 14px; }
  .job-nav .icon-btn { width: 44px; height: 36px; }

  .panel.dialog { display: flex; flex-direction: column; max-height: calc(100vh - var(--hud-h) - var(--dock) - 12px); }
  @supports (height: 1svh) { .panel.dialog { max-height: calc(100svh - var(--hud-h) - var(--dock) - 12px); } }
  .panel.dialog .panel-body { min-height: 0; }
  .export h2 { font-size: 34px !important; }
  .export-rows { margin: 12px 0; }
  .export-rows dt, .export-rows dd { padding: 7px 0; }
  .export-rows dt { padding-inline-end: 14px; }

  .quote { top: calc(var(--hud-h) + 4vh); }
  .hero { bottom: calc(var(--dock) + 5vh); }
  .bin-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; padding: 14px 14px 18px; }
  .bin-head { padding: 14px 14px 0; }
  .card .thumb .ph, html[lang='fa'] .card .thumb .ph { font-size: 18px; padding: 18px 10px 0; }
  .overlay { padding: 10px; }
}
@keyframes sheet-up { from { transform: translate3d(0, 24px, 0); opacity: 0.6; } }

/* ── Landscape phones: side panels, everything tighter ─────── */
@media (max-height: 560px) and (min-aspect-ratio: 1/1) and (min-width: 600px) {
  :root { --hud-h: 56px; --scrub-h: 36px; }
  .hud { padding-top: 10px; padding-inline: max(var(--gutter), env(safe-area-inset-left)) max(var(--gutter), env(safe-area-inset-right)); }
  .hud-file { display: none; }
  .tc { font-size: 17px; }
  .hud-btn { height: 30px; padding: 0 11px; }
  .scrub { bottom: 8px; }
  .mk span { display: none; }
  .mk.on span { display: inline; }
  .panel.side {
    width: min(390px, 40vw); top: calc(var(--hud-h) + 4px); bottom: calc(var(--scrub-h) + 18px); max-height: none;
    transform: translate3d(0, calc((1 - var(--vis)) * 20px), 0);
  }
  .panel-tab { height: 32px; }
  .panel-body { padding: 12px 16px 14px; overscroll-behavior: auto; }
  .panel .eyebrow { display: none; }
  .panel h2 { font-size: 22px; margin-bottom: 6px; }
  .panel p { font-size: 14px; margin-bottom: 8px; }
  .portrait img { width: 48px; height: 48px; }
  .job .role { font-size: 19px; }
  .job-nav { padding: 6px 14px; }
  .panel.dialog { display: flex; flex-direction: column; top: calc(var(--hud-h) + 4px); bottom: calc(var(--scrub-h) + 16px); max-height: none; transform: translate3d(-50%, calc((1 - var(--vis)) * 20px), 0); }
  .panel.dialog .panel-body { min-height: 0; }
  .panel.dialog { width: min(680px, calc(100vw - 2 * var(--gutter))); }
  .export h2 { font-size: 26px !important; margin-bottom: 2px; }
  .export > p { display: none; }
  .export-rows dd { white-space: nowrap; overflow-wrap: normal; }
  .export-rows { margin: 8px 0 10px; grid-template-columns: auto 1fr auto 1fr; column-gap: 14px; }
  .export-rows dt, .export-rows dd { padding: 6px 0; font-size: 13px; }
  .render { margin: 4px 0 12px; }
  .quote { top: calc(var(--hud-h) + 2vh); }
  .quote-text, html[lang='fa'] .quote-text { font-size: clamp(32px, 10vh, 60px); max-width: 18ch; }
  .hero { bottom: calc(var(--scrub-h) + 16px); }
  .hero-hint { margin-top: 6px; }
  .stage.wide { max-height: calc(100vh - 150px); }
  .stage.tall { height: calc(100vh - 150px); }
}

@media (hover: none) {
  .hero-keys { display: none; }
}
@media (max-width: 480px) {
  .hud-nav [data-goto='contact'] { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .quote-text .w.robot::after { animation: none; }
  .job { animation: none; }
  .overlay { animation: none; }
}

/* ── No WebGL: plain document ──────────────────────────────── */
.no-webgl #gl, .no-webgl .scrub, .no-webgl #scroll-space { display: none; }
.no-webgl #panels { position: static; display: grid; gap: 16px; padding: 96px var(--gutter) 48px; justify-items: center; }
.no-webgl [data-panel] { position: relative !important; inset: auto !important; transform: none !important; opacity: 1 !important; visibility: visible !important; pointer-events: auto !important; width: min(640px, 100%) !important; max-height: none !important; }
.no-webgl .quote-text .w { --k: 1; }
.no-webgl .hero-name { display: block; }
.no-webgl .hero-hint { display: none; }
.noscript { padding: 40px; }
