/* Sethy Pagna Ung: portfolio styles.
   Light by default, with a dark theme behind the header toggle. One accent colour, one type family. */

@font-face { font-family: "Sora"; src: url("../fonts/sora.woff2") format("woff2"); font-weight: 300 800; font-display: swap; }
@font-face { font-family: "Kantumruy Pro"; src: url("../fonts/khmer.woff2") format("woff2"); font-weight: 400 700; font-display: swap; }
@font-face { font-family: "Noto Sans SC"; src: url("../fonts/han.woff2") format("woff2"); font-weight: 400 900; font-display: swap; }

:root {
  --bg: #FAF9F6;
  --surface: #FFFFFF;
  --tint: #F3F1EB;
  --ink: #15171C;
  --ink-2: #3F4552;
  --muted: #5F6673;
  --line: #E4E1D8;
  --line-strong: #C9C5B9;
  --accent: #4B3BE0;
  --accent-hover: #3A2BC4;
  --on-accent: #FFFFFF;
  --accent-soft: #ECEAFD;
  --mark: #FFE45C;
  --on-mark: #15171C;
  --live: #0B6B41;
  --live-soft: #DFF3E8;
  --wip: #7A4E00;
  --wip-soft: #FBECC8;
  --quiet: #4B5260;
  --quiet-soft: #ECEAE4;
  /* charts: one hue for amounts, and a fixed colour per language (checked for colour-blind separation) */
  --chart: #4B3BE0;
  --chart-on: #2A1E96;
  --series-1: #2a78d6; --series-2: #eb6834; --series-3: #1baf7a; --series-4: #eda100;
  --series-5: #e87ba4; --series-6: #008300; --series-7: #6250d6; --series-8: #e34948;
  --series-other: #A9A59A;
  --shadow-1: 0 1px 2px rgb(21 23 28 / .05), 0 2px 8px rgb(21 23 28 / .04);
  --shadow-2: 0 2px 4px rgb(21 23 28 / .06), 0 14px 32px rgb(21 23 28 / .10);
  --backdrop: rgb(21 23 28 / .55);

  --font: "Sora", system-ui, -apple-system, "Segoe UI", sans-serif;
  --khmer: "Kantumruy Pro", "Khmer UI", "Noto Sans Khmer", sans-serif;
  --han: "Noto Sans SC", "Microsoft YaHei", "PingFang SC", sans-serif;

  --gutter: clamp(20px, 4vw, 40px);
  --max: 1160px;
  --radius: 14px;
  --radius-sm: 10px;
  --topbar: 64px;
  --space-section: clamp(32px, 4.5vw, 52px); /* each side of a section, so about 100px between two on a desktop and 64px on a phone */
  --space-block: clamp(32px, 4vw, 48px);    /* between the parts inside a section */
  --ease: cubic-bezier(.2, .7, .2, 1);
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #121318;
  --surface: #1B1D24;
  --tint: #17181E;
  --ink: #F3F3F6;
  --ink-2: #CFD2DA;
  --muted: #A3A8B4;
  --line: #2D303B;
  --line-strong: #454956;
  --accent: #A59CFF;
  --accent-hover: #BDB6FF;
  --on-accent: #14122B;
  --accent-soft: #272548;
  --live: #6FDCA4;
  --live-soft: #153325;
  --wip: #F2C464;
  --wip-soft: #3A2E12;
  --quiet: #C3C7D1;
  --quiet-soft: #2A2D37;
  --chart: #9085E9;
  --chart-on: #C9C3FF;
  --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70; --series-4: #c98500;
  --series-5: #d55181; --series-6: #0ca30c; --series-7: #9085e9; --series-8: #e66767;
  --series-other: #6D7180;
  --shadow-1: 0 1px 2px rgb(0 0 0 / .3);
  --shadow-2: 0 2px 4px rgb(0 0 0 / .3), 0 16px 36px rgb(0 0 0 / .4);
  --backdrop: rgb(0 0 0 / .7);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--topbar) + 16px); }
/* while a window is open the page behind stays put; the padding stands in for the hidden scrollbar */
html.modal-open { overflow: hidden; }
html.modal-open body { padding-right: var(--scroll-gap, 0px); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 1rem/1.6 var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img, iframe { display: block; max-width: 100%; }
a { color: var(--accent); text-underline-offset: .18em; text-decoration-thickness: .08em; }
a:hover { color: var(--accent-hover); }
button { font: inherit; color: inherit; }
h1, h2, h3, h4, p, ul, ol, dl, dd { margin: 0; }
ul, ol { padding: 0; list-style: none; }
h1, h2, h3, h4 { line-height: 1.15; letter-spacing: -.02em; text-wrap: balance; }
p { text-wrap: pretty; }
strong { font-weight: 650; }
::selection { background: var(--mark); color: var(--on-mark); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }
.km { font-family: var(--khmer); }
.zh { font-family: var(--han); }
kbd {
  font: 600 .75rem/1 var(--font); color: var(--muted);
  padding: 4px 6px; border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 6px; background: var(--surface);
}
.visually-hidden { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.wrap { width: 100%; max-width: calc(var(--max) + var(--gutter) * 2); margin-inline: auto; padding-inline: var(--gutter); }
.skip { position: absolute; left: 12px; top: -80px; z-index: 100; padding: 10px 16px; background: var(--ink); color: var(--bg); border-radius: var(--radius-sm); font-weight: 600; text-decoration: none; }
.skip:focus { top: 12px; color: var(--bg); }

/* ------------------------------------------------------------ buttons */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 10px 18px;
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--ink);
  font: 600 .9375rem/1.2 var(--font); text-decoration: none; white-space: nowrap; cursor: pointer;
  transition: background-color .15s, border-color .15s, color .15s, transform .15s;
}
.btn:hover { border-color: var(--ink); color: var(--ink); }
.btn:active { transform: translateY(1px); }
.btn svg { flex: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--on-accent); }
.btn.lg { min-height: 52px; padding: 12px 22px; font-size: 1rem; }
.btn.sm { min-height: 36px; padding: 6px 12px; font-size: .875rem; }
.btn.plain { border-color: transparent; background: transparent; }
.btn.plain:hover { background: var(--tint); border-color: transparent; }
.icon-btn {
  display: inline-grid; place-items: center; width: 40px; height: 40px; flex: none;
  border: 1px solid transparent; border-radius: var(--radius-sm); background: transparent; color: var(--ink); cursor: pointer;
  transition: background-color .15s;
}
.icon-btn:hover { background: var(--tint); }

.badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px;
  font: 600 .8125rem/1.4 var(--font); white-space: nowrap;
  background: var(--quiet-soft); color: var(--quiet);
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.live { background: var(--live-soft); color: var(--live); }
.badge.wip { background: var(--wip-soft); color: var(--wip); }
.badge.play { background: var(--accent-soft); color: var(--accent); }
.badge.play::before { content: none; }
.badge svg { flex: none; }
.chip { display: inline-block; padding: 4px 10px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--ink-2); font-size: .875rem; line-height: 1.4; }

/* ------------------------------------------------------------ top bar */

.topbar { position: sticky; top: 0; z-index: 40; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: saturate(1.4) blur(12px); border-bottom: 1px solid transparent; transition: border-color .2s; }
.topbar.scrolled { border-bottom-color: var(--line); }
.topbar-in { display: flex; align-items: center; gap: 24px; min-height: calc(var(--topbar) - 1px); } /* the bar's bottom border makes up the rest */
.brand { display: inline-flex; align-items: center; gap: 6px; min-width: 0; }
.brand-link { display: inline-flex; align-items: center; min-width: 0; min-height: 40px; color: var(--ink-2); text-decoration: none; font-weight: 600; font-size: .9375rem; line-height: 1.25; }
.brand-link:hover { color: var(--ink); }
.brand-hello { min-width: 0; padding-block: 4px; }
/* a photo that opens the photo: the top bar's and the one in About */
.photo-btn { flex: none; display: grid; place-items: center; padding: 0; border: 0; border-radius: 50%; background: none; cursor: zoom-in; }
.photo-btn img { transition: box-shadow .15s, transform .15s var(--ease); }
.photo-btn:hover img { box-shadow: 0 0 0 2px var(--accent); }
.photo-btn:active img { transform: scale(.96); }
.photo-btn:focus-visible { outline-offset: 3px; border-radius: 50%; }
.brand-photo-btn { width: 40px; height: 40px; }
.brand-photo { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; box-shadow: 0 0 0 1px var(--line-strong); }
.nav { display: flex; gap: 4px; margin-left: auto; }
.nav a { padding: 8px 14px; border-radius: var(--radius-sm); color: var(--ink-2); font-weight: 550; font-size: .9375rem; text-decoration: none; }
.nav a:hover { background: var(--tint); color: var(--ink); }
.nav a[aria-current="true"] { color: var(--ink); background: var(--tint); }
.topbar-tools { display: flex; align-items: center; gap: 6px; }
.tool-btn { display: inline-flex; align-items: center; gap: 8px; height: 40px; min-width: 40px; padding: 0 10px; justify-content: center; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); color: var(--ink-2); font-size: .875rem; font-weight: 550; cursor: pointer; transition: border-color .15s, color .15s; }
.tool-btn:hover { border-color: var(--line-strong); color: var(--ink); }
.search-btn { padding: 0 8px 0 12px; }
.search-btn kbd { margin-left: 6px; }
.icon-sun, :root[data-theme="dark"] .icon-moon { display: none; }
:root[data-theme="dark"] .icon-sun { display: block; }
.menu-btn { display: none; }

/* ------------------------------------------------------------ hero */

.hero { padding: clamp(20px, 3vw, 36px) 0 clamp(8px, 1.5vw, 16px); }
.hero-in { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: clamp(32px, 5vw, 72px); align-items: start; }
.hero h1 { margin-top: 0; font-size: clamp(2.75rem, 6.2vw, 4.75rem); font-weight: 750; letter-spacing: -.045em; line-height: 1; }
.hero-lede { margin-top: 24px; max-width: 34em; font-size: clamp(1.125rem, 1.6vw, 1.3125rem); line-height: 1.55; color: var(--ink-2); }
mark { padding: .05em .2em; margin: 0 -.05em; border-radius: 5px; background: var(--mark); color: var(--on-mark); font-weight: 600; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
.hero-cta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 32px; }
.hero-cta .btn { min-height: 50px; padding-inline: 22px; font-size: 1rem; }
.hero-status { display: flex; align-items: center; gap: 10px; margin-top: 24px; color: var(--ink-2); font-size: .9375rem; font-weight: 500; }
.dot { flex: none; width: 10px; height: 10px; border-radius: 50%; background: #1FA463; box-shadow: 0 0 0 4px color-mix(in srgb, #1FA463 22%, transparent); }

.collage { position: relative; aspect-ratio: 10 / 8.6; }
.collage a { position: absolute; display: block; border-radius: var(--radius); overflow: hidden; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-2); color: var(--ink); text-decoration: none; transition: transform .25s var(--ease), box-shadow .25s; }
.collage a:hover, .collage a:focus-visible { transform: translateY(-4px); z-index: 3; }
.collage picture { display: block; height: 100%; }
.collage img { width: 100%; height: 100%; object-fit: cover; }
.collage span { position: absolute; left: 10px; bottom: 10px; max-width: calc(100% - 20px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 5px 10px; border-radius: 8px; background: var(--surface); color: var(--ink); font-size: .8125rem; font-weight: 600; box-shadow: var(--shadow-1); }
.collage a:nth-child(1) { top: 0; right: 0; width: 86%; aspect-ratio: 16 / 10; z-index: 1; }
.collage a:nth-child(1) span { bottom: auto; top: 10px; left: auto; right: 10px; }
.collage a:nth-child(2) { left: 0; bottom: 0; width: 58%; aspect-ratio: 16 / 10; z-index: 2; }
.collage a:nth-child(3) { right: 3%; bottom: 5%; width: 36%; aspect-ratio: 4 / 3; z-index: 2; }

.facts { display: grid; grid-template-columns: repeat(4, 1fr); margin-top: var(--space-block); border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-1); }
.facts > div { padding: 18px 22px; }
.facts > div + div { border-left: 1px solid var(--line-strong); }
.facts dt, .id-card dt { color: var(--muted); font-size: .8125rem; font-weight: 550; }
.facts dd { margin-top: 2px; font-weight: 600; font-size: .9375rem; line-height: 1.4; }

/* ------------------------------------------------------------ sections */

.section { padding: var(--space-section) 0; }
.section.tinted { background: var(--tint); border-block: 1px solid var(--line); }
.sec-head { max-width: 44em; margin-bottom: clamp(20px, 2.5vw, 28px); }
.sec-head h2, .contact h2 { font-size: clamp(1.875rem, 3.6vw, 2.75rem); font-weight: 700; letter-spacing: -.035em; }
.sec-head p { margin-top: 12px; color: var(--ink-2); font-size: 1.0625rem; }
.note { color: var(--muted); font-size: .9375rem; }

/* ------------------------------------------------------------ work */

.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }
.filters button { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 6px 14px; border: 1px solid var(--line-strong); border-radius: 999px; background: var(--surface); color: var(--ink-2); font-weight: 550; font-size: .9375rem; cursor: pointer; transition: background-color .15s, color .15s, border-color .15s; }
.filters button:hover { border-color: var(--ink); color: var(--ink); }
.filters button[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.filters .count { font-size: .8125rem; font-weight: 600; opacity: .7; }

.cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; }
.card { position: relative; display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-1); overflow: hidden; transition: transform .2s var(--ease), box-shadow .2s, border-color .2s; }
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-2); border-color: var(--line-strong); }
.card:focus-within { border-color: var(--accent); }
.card-shot { aspect-ratio: 16 / 10; background: var(--tint); border-bottom: 1px solid var(--line); overflow: hidden; }
.card-shot img { width: 100%; height: 100%; object-fit: cover; object-position: center top; }
.card.game .card-shot img { object-position: center; }
.card-body { display: flex; flex-direction: column; gap: 8px; flex: 1; padding: 18px 20px 20px; }
.card-kicker { color: var(--muted); font-size: .8125rem; font-weight: 550; }
.card h3 { font-size: 1.1875rem; font-weight: 650; letter-spacing: -.02em; }
.card h3 a { color: var(--ink); text-decoration: none; }
.card h3 a::after { content: ""; position: absolute; inset: 0; border-radius: var(--radius); }
.card h3 a:focus-visible { outline: none; }
.card h3 a:focus-visible::after { outline: 2px solid var(--accent); outline-offset: 2px; }
.card p { color: var(--ink-2); font-size: .9375rem; line-height: 1.55; }
.card-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: auto; padding-top: 8px; }
.card-more { margin-left: auto; display: inline-flex; align-items: center; gap: 4px; color: var(--accent); font-size: .875rem; font-weight: 600; transition: gap .2s var(--ease); }
.card:hover .card-more { gap: 8px; }

.course { margin-top: 24px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.course summary { display: flex; align-items: center; gap: 10px; padding: 16px 20px; font-weight: 600; cursor: pointer; list-style: none; border-radius: var(--radius); }
.course summary::-webkit-details-marker { display: none; }
.course summary::before { content: ""; width: 8px; height: 8px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(-45deg); transition: transform .2s; }
.course[open] summary::before { transform: rotate(45deg); }
.course .count { color: var(--muted); font-weight: 500; }
.course ul { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 32px; padding: 0 20px 18px 38px; }
.course li { padding: 4px 0; font-size: .9375rem; }
.course li b, .course li a { display: block; padding: 8px 0 2px; font-weight: 600; }
.course li span { color: var(--muted); }

/* ------------------------------------------------------------ play */

.tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; }
.tile { position: relative; display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-1); overflow: hidden; transition: transform .2s var(--ease), box-shadow .2s, border-color .2s; }
.tile:hover { transform: translateY(-3px); box-shadow: var(--shadow-2); border-color: var(--line-strong); }
.tile-shot { position: relative; aspect-ratio: 16 / 9; background: var(--tint); overflow: hidden; }
.tile-shot img { width: 100%; height: 100%; object-fit: cover; }
.tile-shot::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to top, rgb(0 0 0 / .28), transparent 45%); }
.tile-type { position: absolute; left: 12px; bottom: 12px; z-index: 1; padding: 4px 10px; border-radius: 8px; background: rgb(255 255 255 / .94); color: #15171C; font-size: .8125rem; font-weight: 600; }
.tile-body { display: flex; flex-direction: column; gap: 8px; flex: 1; padding: 18px 20px 20px; }
.tile h3 { font-size: 1.1875rem; font-weight: 650; }
.tile p { color: var(--ink-2); font-size: .9375rem; line-height: 1.55; }
.tile-meta { color: var(--muted); font-size: .8125rem; }
.tile-actions { display: flex; align-items: center; gap: 6px; margin-top: auto; padding-top: 10px; }
.tile-actions .btn.primary::after { content: ""; position: absolute; inset: 0; border-radius: var(--radius); }
.tile-actions .btn:active { transform: none; } /* a transform would shrink the stretched hit area mid-click */
.tile-actions .btn.plain { position: relative; z-index: 1; color: var(--accent); }

/* ------------------------------------------------------------ about */

.about { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(280px, 1fr); gap: clamp(32px, 5vw, 64px); align-items: start; }
.about-copy { display: grid; gap: 18px; font-size: 1.0625rem; line-height: 1.7; color: var(--ink-2); max-width: 40em; }
.about-copy strong { color: var(--ink); }
.id-card { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-1); overflow: hidden; }
.id-head { display: flex; align-items: center; gap: 16px; padding: 20px; border-bottom: 1px solid var(--line); }
.id-head img { width: 76px; height: 76px; border-radius: 50%; object-fit: cover; box-shadow: 0 0 0 1px var(--line-strong); }
.id-head b { display: block; font-size: 1.125rem; font-weight: 650; letter-spacing: -.02em; line-height: 1.25; }
.id-head span { color: var(--muted); font-size: .9375rem; }
.id-card dl { padding: 6px 20px 10px; }
.id-card dl > div { display: grid; grid-template-columns: 96px 1fr; gap: 12px; padding: 10px 0; align-items: baseline; }
.id-card dl > div + div { border-top: 1px solid var(--line); }
.id-card dd { font-weight: 550; font-size: .9375rem; line-height: 1.45; }

.block { margin-top: var(--space-block); }
.block h3 { font-size: 1.5rem; font-weight: 700; letter-spacing: -.03em; }
.block-hint { margin-top: 6px; color: var(--muted); font-size: .9375rem; }
.split { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: clamp(32px, 5vw, 64px); }

.steps { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-top: 20px; counter-reset: step; }
.steps li { counter-increment: step; padding: 20px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.steps li::before { content: counter(step); display: grid; place-items: center; width: 30px; height: 30px; margin-bottom: 14px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: .875rem; }
.steps b { display: block; font-weight: 650; font-size: 1.0625rem; letter-spacing: -.01em; }
.steps span { display: block; margin-top: 6px; color: var(--ink-2); font-size: .9375rem; line-height: 1.55; }
.callout { margin-top: 16px; padding: 18px 22px; border-radius: var(--radius); background: var(--tint); border: 1px solid var(--line); color: var(--ink-2); font-size: .9375rem; line-height: 1.65; }
.callout strong { color: var(--ink); }

.tools { display: grid; gap: 18px; margin-top: 20px; }
.tool-row h4 { margin-bottom: 8px; color: var(--muted); font-size: .8125rem; font-weight: 600; letter-spacing: 0; }
.tool-row div { display: flex; flex-wrap: wrap; gap: 8px; }
.tool { min-height: 36px; padding: 5px 12px; border: 1px solid var(--line-strong); border-radius: 999px; background: var(--surface); color: var(--ink-2); font-size: .875rem; font-weight: 500; cursor: pointer; transition: border-color .15s, background-color .15s, color .15s; }
.tool:hover { border-color: var(--ink); color: var(--ink); }
.tool[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.tool-result { margin-top: 18px; padding: 14px 18px; border-radius: var(--radius-sm); background: var(--accent-soft); color: var(--ink); font-size: .9375rem; line-height: 1.7; }
.tool-result a { font-weight: 600; white-space: nowrap; }

.timeline { position: relative; margin-top: 20px; }
.timeline::before { content: ""; position: absolute; left: 5px; top: 10px; bottom: 10px; width: 2px; background: var(--line); }
.timeline li { position: relative; display: grid; grid-template-columns: 84px 1fr; gap: 12px; padding: 9px 0 9px 28px; align-items: baseline; }
.timeline li::before { content: ""; position: absolute; left: 0; top: 15px; width: 12px; height: 12px; border-radius: 50%; background: var(--bg); border: 2px solid var(--line-strong); }
.timeline .when { color: var(--muted); font-size: .8125rem; font-weight: 600; white-space: nowrap; }
.timeline b { display: block; font-weight: 600; font-size: .9375rem; line-height: 1.4; }
.timeline span { color: var(--muted); font-size: .875rem; }
.timeline li.now::before { background: var(--accent); border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.timeline li.now b { color: var(--accent); }
.timeline li.future::before { border-style: dashed; }
.timeline .here { display: inline-block; margin-left: 6px; padding: 1px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-size: .75rem; font-weight: 650; vertical-align: 1px; }

/* GitHub activity: drawn from the daily numbers; .activity-pictures is the ready-made fallback.
   The min-heights hold the chart's place before it arrives, so the page below never moves. */
#activity-body { min-height: 614px; }
.act { display: grid; gap: 28px; margin-top: 20px; padding: clamp(20px, 3vw, 32px); border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-1); }
.act h4 { font-size: .9375rem; font-weight: 650; letter-spacing: 0; }
.act-top { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 20px 40px; }
.act-total b { display: block; font-size: clamp(2.5rem, 5vw, 3.5rem); font-weight: 700; letter-spacing: -.04em; line-height: 1; }
.act-total span { display: block; margin-top: 8px; color: var(--ink-2); font-size: .9375rem; }
.act-stats { display: flex; flex-wrap: wrap; gap: 12px 36px; }
.act-stats dt { color: var(--muted); font-size: .8125rem; font-weight: 550; }
.act-stats dd { font-size: 1.25rem; font-weight: 650; letter-spacing: -.02em; }
.plot { position: relative; height: 172px; margin-top: 14px; padding: 18px 0 24px 44px; border-radius: 8px; cursor: default; }
.grid { position: absolute; inset: 18px 0 24px 44px; display: flex; flex-direction: column; justify-content: space-between; pointer-events: none; }
.grid span { position: relative; border-top: 1px solid var(--line); }
.grid span:last-child { border-top-color: var(--line-strong); }
.grid i { position: absolute; right: calc(100% + 10px); top: -.7em; color: var(--muted); font-style: normal; font-size: .75rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.bars { position: relative; display: flex; align-items: flex-end; gap: 2px; height: 100%; }
.bar { position: relative; flex: 1; min-width: 0; height: max(var(--h), 2px); border-radius: 3px 3px 0 0; background: var(--chart); }
.bar.zero { background: var(--line-strong); border-radius: 0; }
.bar.on { background: var(--chart-on); }
.bar b { position: absolute; bottom: calc(100% + 4px); left: 50%; translate: -50%; color: var(--ink); font-size: .75rem; font-weight: 650; white-space: nowrap; }
.bar .tick { position: absolute; top: calc(100% + 6px); left: 0; color: var(--muted); font-size: .75rem; white-space: nowrap; }
.tip { position: absolute; top: -14px; translate: -50%; z-index: 2; padding: 6px 10px; border-radius: 8px; background: var(--ink); color: var(--bg); font-size: .8125rem; font-weight: 550; white-space: nowrap; pointer-events: none; }
.act-table { margin-top: 12px; font-size: .875rem; }
.act-table summary { display: inline-block; color: var(--accent); font-weight: 600; cursor: pointer; text-decoration: underline; text-underline-offset: .18em; }
.act-table div { max-height: 260px; margin-top: 10px; overflow: auto; border: 1px solid var(--line); border-radius: 8px; }
.act-table table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.act-table th, .act-table td { padding: 6px 14px; text-align: left; border-bottom: 1px solid var(--line); }
.act-table th { position: sticky; top: 0; background: var(--tint); font-weight: 600; }
.act-table td:last-child, .act-table th:last-child { text-align: right; }
.lang-bar { display: flex; gap: 2px; height: 14px; margin-top: 12px; border-radius: 4px; overflow: hidden; }
.lang-bar span { min-width: 3px; }
.lang-legend { display: flex; flex-wrap: wrap; gap: 8px 24px; margin-top: 12px; font-size: .9375rem; font-weight: 550; }
.lang-legend li { display: inline-flex; align-items: center; gap: 8px; }
.lang-legend i { width: 10px; height: 10px; border-radius: 3px; }
.lang-legend span { color: var(--muted); font-weight: 400; font-variant-numeric: tabular-nums; }
.act-foot { padding-top: 16px; border-top: 1px solid var(--line); color: var(--muted); font-size: .875rem; }
.activity-pictures { display: grid; gap: 12px; margin-top: 20px; padding: 12px; border-radius: var(--radius); background: #08031A; border: 1px solid var(--line); }
.activity-pictures img { width: 100%; height: auto; border-radius: 8px; }
.activity-pictures .fallback { padding: 20px; color: #C4BAEC; font-size: .9375rem; }
.activity-pictures .fallback a { color: #fff; }

/* ------------------------------------------------------------ contact */

.contact { text-align: center; border-top: 1px solid var(--line); }
.contact-lede { max-width: 34em; margin: 14px auto 0; color: var(--ink-2); font-size: 1.0625rem; }
.contact-main { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-top: 28px; }
.contact-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 28px; margin-top: 24px; }
.contact-links a { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; color: var(--ink); font-weight: 600; }
.contact-links a:hover { color: var(--accent); }
.thanks { margin-top: 32px; color: var(--muted); font-size: .9375rem; }

.foot { border-top: 1px solid var(--line); padding: 20px 0 max(20px, env(safe-area-inset-bottom)); color: var(--muted); font-size: .875rem; }
.foot-in { display: flex; justify-content: space-between; gap: 16px; }
.foot a { color: var(--ink-2); font-weight: 550; }

/* ------------------------------------------------------------ project window */

dialog { color: var(--ink); }
dialog::backdrop { background: var(--backdrop); }
.pw { width: min(1200px, 100vw - 40px); height: min(880px, 100dvh - 40px); max-width: none; max-height: none; padding: 0; border: 1px solid var(--line); border-radius: 18px; background: var(--bg); box-shadow: var(--shadow-2); overflow: hidden; }
.pw[open] { display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); } /* the column never grows past the window */
.pw.playing { width: 100vw; height: 100dvh; border: 0; border-radius: 0; }
.pw-bar { display: flex; align-items: center; gap: 8px; min-height: 60px; padding: 8px 12px 8px 22px; border-bottom: 1px solid var(--line); background: var(--surface); }
.pw-bar h2:focus { outline: none; }
.pw-bar h2 { flex: 1 1 auto; min-width: 0; font-size: 1.125rem; font-weight: 650; letter-spacing: -.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pw-bar > :not(h2) { flex: none; }
.pw-bar .spacer { flex: 1; }
.pw-bar .icon-btn { border-color: var(--line); }
.pw.playing .pw-bar { padding-left: 12px; }
.pw-body { overflow-y: auto; overscroll-behavior: contain; }
.pw-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: clamp(24px, 3vw, 40px); padding: clamp(20px, 2.6vw, 32px); align-items: start; }

.gallery { position: sticky; top: clamp(20px, 2.6vw, 32px); min-width: 0; }
.gallery-main { position: relative; aspect-ratio: 16 / 10; border: 1px solid var(--line); border-radius: var(--radius); background: var(--tint); overflow: hidden; }
.gallery-zoom { display: block; width: 100%; height: 100%; padding: 0; border: 0; background: none; cursor: zoom-in; }
.gallery-zoom img { width: 100%; height: 100%; object-fit: contain; }
.gallery-zoom:focus-visible { outline-offset: -4px; }
.gallery-step { position: absolute; top: 50%; translate: 0 -50%; width: 44px; height: 44px; border-radius: 50%; background: var(--surface); border-color: var(--line); box-shadow: var(--shadow-1); }
.gallery-step:hover { background: var(--surface); border-color: var(--ink); }
.gallery-step.prev { left: 12px; }
.gallery-step.next { right: 12px; }
.gallery-caption { display: flex; gap: 12px; margin-top: 12px; color: var(--ink-2); font-size: .9375rem; line-height: 1.5; min-height: 3em; }
.gallery-caption b { flex: none; color: var(--muted); font-weight: 600; font-variant-numeric: tabular-nums; }
.thumbs { display: flex; gap: 8px; margin-top: 8px; padding: 4px; overflow-x: auto; }
.thumbs button { flex: none; width: 84px; aspect-ratio: 16 / 10; padding: 0; border: 2px solid transparent; border-radius: 8px; background: var(--tint); overflow: hidden; cursor: pointer; opacity: .65; transition: opacity .15s, border-color .15s; }
.thumbs button:hover { opacity: 1; }
.thumbs button[aria-current="true"] { border-color: var(--accent); opacity: 1; }
.thumbs img { width: 100%; height: 100%; object-fit: cover; }
.no-shots { display: grid; place-items: center; height: 100%; color: var(--muted); font-weight: 600; }

.info { display: grid; gap: 24px; min-width: 0; }
.info-top { display: grid; gap: 10px; }
.info-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; color: var(--muted); font-size: .875rem; font-weight: 550; }
.info .tagline { font-size: clamp(1.375rem, 2.2vw, 1.75rem); font-weight: 700; letter-spacing: -.03em; line-height: 1.2; }
.info .about-text { color: var(--ink-2); line-height: 1.7; }
.info-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.info h3 { margin-bottom: 10px; font-size: .9375rem; font-weight: 650; letter-spacing: 0; }
.features { display: grid; gap: 8px; }
.features li { position: relative; padding-left: 26px; color: var(--ink-2); font-size: .9375rem; line-height: 1.55; }
.features li::before { content: ""; position: absolute; left: 4px; top: .5em; width: 12px; height: 6px; border-left: 2px solid var(--accent); border-bottom: 2px solid var(--accent); transform: rotate(-45deg); }
.stack { display: flex; flex-wrap: wrap; gap: 8px; }
.info .good-to-know { padding: 14px 18px; border-radius: var(--radius-sm); background: var(--tint); border: 1px solid var(--line); color: var(--ink-2); font-size: .875rem; line-height: 1.65; }
.info .good-to-know b { display: block; margin-bottom: 4px; color: var(--ink); }
.pw-next { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 0 clamp(20px, 2.6vw, 32px) clamp(20px, 2.6vw, 32px); }
.pw-next a { display: flex; flex-direction: column; gap: 2px; padding: 14px 18px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--ink); text-decoration: none; transition: border-color .15s; }
.pw-next a:hover { border-color: var(--ink); }
.pw-next a:last-child { text-align: right; }
.pw-next small { color: var(--muted); font-size: .8125rem; font-weight: 550; }
.pw-next b { font-weight: 650; }

.player { display: grid; grid-template-rows: minmax(0, 1fr) auto; height: 100%; background: #0C0D11; }
.frame { position: relative; min-height: 0; }
.frame iframe { width: 100%; height: 100%; border: 0; background: #0C0D11; }
.frame:fullscreen { background: #000; }
.loading, .ask { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 16px; padding: 24px; text-align: center; color: #F3F3F6; background: #0C0D11; }
.loading { pointer-events: none; }
.loading::before { content: ""; width: 32px; height: 32px; border-radius: 50%; border: 3px solid rgb(255 255 255 / .2); border-top-color: #fff; animation: spin .8s linear infinite; }
.ask p { max-width: 30em; color: #CFD2DA; }
.ask h3 { font-size: 1.25rem; }
@keyframes spin { to { rotate: 360deg; } }
.controls { display: flex; align-items: baseline; gap: 4px 10px; padding: 8px 16px max(8px, env(safe-area-inset-bottom)); background: var(--surface); border-top: 1px solid var(--line); color: var(--ink-2); font-size: .8125rem; line-height: 1.5; }
.controls summary { flex: none; display: inline-flex; align-items: center; gap: 6px; min-height: 28px; color: var(--ink); font-weight: 650; cursor: pointer; list-style: none; }
.controls summary::-webkit-details-marker { display: none; }
.controls summary::after { content: ""; width: 6px; height: 6px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; rotate: -45deg; translate: 0 -1px; transition: rotate .2s; }
.controls[open] summary::after { rotate: 45deg; }
.controls p { margin: 0; }

/* ------------------------------------------------------------ zoom, search, toast */

.zoom { width: 100vw; height: 100dvh; max-width: none; max-height: none; margin: 0; padding: clamp(12px, 3vw, 40px); border: 0; background: transparent; }
.zoom[open] { display: grid; place-items: center; }
.zoom::backdrop { background: rgb(10 10 14 / .9); }
.zoom img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 8px; cursor: zoom-out; }
.zoom-close { position: fixed; top: 16px; right: 16px; background: #fff; color: #15171C; width: 44px; height: 44px; border-radius: 50%; }
.zoom-close:hover { background: #ECEAE4; }
.zoom.portrait img { width: min(420px, 86vw, 76dvh); height: auto; aspect-ratio: 1; border-radius: 20px; box-shadow: 0 24px 60px rgb(0 0 0 / .45); }

.search { width: min(620px, 100vw - 32px); max-height: min(560px, 100dvh - 120px); margin-top: 12vh; padding: 0; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); box-shadow: var(--shadow-2); overflow: hidden; }
.search[open] { display: flex; flex-direction: column; }
.search-input { display: flex; align-items: center; gap: 12px; padding: 6px 16px 6px 18px; border-bottom: 1px solid var(--line); color: var(--muted); }
.search-input input { flex: 1; min-width: 0; height: 48px; border: 0; background: transparent; color: var(--ink); font: 500 1rem var(--font); outline: none; }
.search-input input::placeholder { color: var(--muted); }
.search-input:focus-within { box-shadow: inset 0 -2px 0 var(--accent); }
#search-list { overflow-y: auto; padding: 8px; }
#search-list li { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: var(--radius-sm); cursor: pointer; font-size: .9375rem; }
#search-list li[aria-selected="true"] { background: var(--tint); }
#search-list li b { font-weight: 600; white-space: nowrap; }
#search-list li span { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#search-list .kind { margin-left: auto; flex: none; padding: 2px 8px; border-radius: 999px; background: var(--quiet-soft); color: var(--quiet); font-size: .75rem; font-weight: 600; }
#search-list .group { padding: 10px 12px 4px; color: var(--muted); font-size: .75rem; font-weight: 650; cursor: default; }
#search-list .empty { color: var(--muted); cursor: default; }

.toast { position: fixed; left: 50%; bottom: max(24px, env(safe-area-inset-bottom)); z-index: 90; translate: -50% 16px; padding: 12px 18px; border-radius: 999px; background: var(--ink); color: var(--bg); font-weight: 600; font-size: .9375rem; box-shadow: var(--shadow-2); opacity: 0; pointer-events: none; transition: opacity .2s, translate .2s var(--ease); }
.toast.show { opacity: 1; translate: -50% 0; }

/* ------------------------------------------------------------ smaller screens */

@media (max-width: 1000px) {
  .cards, .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .steps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .facts { grid-template-columns: repeat(2, 1fr); }
  .facts > div:nth-child(3) { border-left: 0; }
  .facts > div:nth-child(n + 3) { border-top: 1px solid var(--line-strong); }
  .pw-grid { grid-template-columns: minmax(0, 1fr); }
  #activity-body { min-height: 685px; }
  .gallery { position: static; }
}
@media (max-width: 860px) {
  .hero-in, .about, .split { grid-template-columns: minmax(0, 1fr); }
  .collage { max-width: 560px; }
  .id-card { max-width: 420px; }
  .search-label, .key-hint { display: none; }
  .search-btn { padding: 0 10px; }
}
@media (max-width: 900px) {
  .pw-bar .label { display: none; }
  .pw-bar .btn.sm { padding: 6px; min-width: 40px; min-height: 40px; }
}
/* a short screen (a phone on its side): the window fills it, so none of the little height is spent on margins */
@media (max-height: 520px) {
  .pw { width: 100vw; height: 100dvh; border: 0; border-radius: 0; }
  .pw-bar { min-height: 52px; padding-block: 6px; }
  .gallery-main { max-height: 62dvh; }
}
@media (max-width: 720px) {
  :root { --topbar: 58px; }
  .menu-btn { display: inline-flex; }
  .topbar-tools { margin-left: auto; }
  .nav { position: absolute; top: 100%; left: 0; right: 0; flex-direction: column; gap: 2px; margin: 0; padding: 8px var(--gutter) 16px; background: var(--bg); border-bottom: 1px solid var(--line); box-shadow: 0 16px 24px rgb(0 0 0 / .08); display: none; }
  .topbar.open .nav { display: flex; }
  .nav a { padding: 12px 14px; font-size: 1.0625rem; }
  .pw { width: 100vw; height: 100dvh; border: 0; border-radius: 0; }
  .pw-bar { padding-left: 16px; }
  .thumbs button { width: 68px; }
  .info-actions .btn { flex: 1 1 100%; }
}
@media (max-width: 600px) {
  .cards, .tiles, .steps, .course ul { grid-template-columns: minmax(0, 1fr); }
  .facts > div { padding: 14px 16px; }
  .hero-cta .btn { flex: 1 1 100%; }
  .collage span { left: 6px; bottom: 6px; padding: 3px 7px; font-size: .75rem; }
  .collage a:nth-child(1) span { top: 6px; right: 6px; }
  .collage a:nth-child(3) span { display: none; }
  /* a phone shows the projects as a compact list: small picture, name and one line, so all 14 are a short scroll */
  .cards { gap: 12px; }
  .card { flex-direction: row; align-items: flex-start; gap: 14px; padding: 14px; }
  .card-shot { flex: none; width: 96px; aspect-ratio: 4 / 3; border: 1px solid var(--line); border-radius: 10px; }
  .card-body { min-width: 0; padding: 0; gap: 4px; }
  .card h3 { font-size: 1.0625rem; }
  .card p { font-size: .875rem; line-height: 1.5; }
  .card-foot { padding-top: 6px; }
  .card-more { display: none; }
  .contact-main .btn { width: 100%; }
  .timeline li { grid-template-columns: 76px 1fr; }
  #activity-body { min-height: 800px; }
  .plot { padding-left: 36px; }
  .grid { left: 36px; }
  .bars { gap: 1px; }
  .bar .tick.minor { display: none; }
  .pw-next { grid-template-columns: 1fr; }
  .pw-next a:last-child { text-align: left; }
}

/* the Khmer and Chinese hellos show only where they fit beside the menu: wide screens, and phones from 561 to 720px */
@media (max-width: 560px), (min-width: 721px) and (max-width: 799px) { .hello-langs { display: none; } }
@media (max-width: 420px) { .topbar-in { gap: 12px; } }
@media (max-width: 420px) {
  /* facts as label and value rows, so nothing wraps to four lines in a narrow column */
  .facts { grid-template-columns: minmax(0, 1fr); }
  .facts > div { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 12px; align-items: baseline; padding: 11px 16px; }
  .facts > div + div { border-left: 0; border-top: 1px solid var(--line-strong); }
  .facts > div:nth-child(3) { border-left: 0; }
  .facts dd { margin-top: 0; }
}
@media (max-width: 359px) { .brand-link { display: none; } } /* just the photo on the narrowest phones; Back to top is in the footer */
@media (max-width: 370px) {
  .pw-bar { gap: 4px; padding-inline: 8px; }
  .pw-bar .new-tab { display: none; } /* the details view links to the standalone build too */
  #activity-body { min-height: 916px; }
  .card { gap: 12px; padding: 12px; }
  .card-shot { width: 64px; aspect-ratio: 1; }
  .card-shot img { object-position: left top; }
  .card.game .card-shot img { object-position: center; }
  .act-stats { gap: 12px 24px; }
  .id-card dl > div { grid-template-columns: 84px minmax(0, 1fr); }
  .timeline li { grid-template-columns: 68px minmax(0, 1fr); gap: 8px; padding-left: 24px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: 1.5s !important; }
  .card:hover, .tile:hover, .collage a:hover { transform: none; }
}
@media (forced-colors: active) {
  .badge, .chip, .tool, .filters button { border: 1px solid; }
  .tool[aria-pressed="true"], .filters button[aria-pressed="true"] { outline: 2px solid; }
}
@media print {
  .topbar, .filters, .hero-cta, dialog, .toast { display: none !important; }
  .section { padding: 24px 0; }
}
