/* ============================== Tokens ============================== */
:root {
  --bg: #0c0d0f;
  --bg-2: #111215;
  --surface: #16171b;
  --surface-2: #1d1f24;
  --line: #26282e;
  --line-2: #33363d;
  --text: #ecebe4;
  --text-2: #b4b3ad;
  --muted: #7f8088;
  --accent: #c6f432;
  --accent-ink: #0c0d0f;
  --accent-text: #c6f432;
  --accent-soft: rgba(198, 244, 50, 0.12);
  --shadow: 0 1px 0 rgba(255,255,255,.03) inset, 0 20px 40px -24px rgba(0,0,0,.7);
  --page-shadow: 0 10px 40px -10px rgba(0,0,0,.6);
  --grid-dot: rgba(255,255,255,.06);

  --f-display: "Bricolage Grotesque", ui-sans-serif, system-ui, sans-serif;
  --f-body: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --f-mono: "Geist Mono", ui-monospace, "SF Mono", Consolas, monospace;

  --r-sm: 8px;
  --r: 14px;
  --r-lg: 22px;
  --wrap: 1160px;
  --gutter: clamp(16px, 4vw, 32px);
  --nav-h: 64px;
  --ease: cubic-bezier(.2,.7,.2,1);
  color-scheme: dark;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f3f2ec; --bg-2: #ebeae3; --surface: #fbfaf6; --surface-2: #f0efe8;
    --line: #dddcd3; --line-2: #c9c8bf; --text: #141415; --text-2: #45454a; --muted: #6f6f76;
    --accent: #c6f432; --accent-ink: #141415; --accent-text: #4b6a00; --accent-soft: rgba(110, 150, 0, 0.12);
    --shadow: 0 1px 2px rgba(0,0,0,.04), 0 18px 36px -24px rgba(0,0,0,.25);
    --page-shadow: 0 8px 30px -10px rgba(0,0,0,.25);
    --grid-dot: rgba(0,0,0,.07);
    color-scheme: light;
  }
}
:root[data-theme="light"] {
  --bg: #f3f2ec; --bg-2: #ebeae3; --surface: #fbfaf6; --surface-2: #f0efe8;
  --line: #dddcd3; --line-2: #c9c8bf; --text: #141415; --text-2: #45454a; --muted: #6f6f76;
  --accent: #c6f432; --accent-ink: #141415; --accent-text: #4b6a00; --accent-soft: rgba(110, 150, 0, 0.12);
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 18px 36px -24px rgba(0,0,0,.25);
  --page-shadow: 0 8px 30px -10px rgba(0,0,0,.25);
  --grid-dot: rgba(0,0,0,.07);
  color-scheme: light;
}

/* ============================== Base ============================== */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--nav-h) + 16px); -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 400 16px/1.6 var(--f-body); -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img, video, canvas, iframe { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }
h1, h2, h3, h4 { margin: 0; font-family: var(--f-display); font-weight: 700; letter-spacing: -0.02em; line-height: 1.05; }
p { margin: 0; }
ul { margin: 0; padding: 0; list-style: none; }
::selection { background: var(--accent); color: var(--accent-ink); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
.prose a, .link { color: var(--accent-text); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.prose strong { color: var(--text); font-weight: 600; }

.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 var(--gutter); }
.skip { position: absolute; left: -999px; top: 8px; z-index: 100; background: var(--accent); color: var(--accent-ink); padding: 8px 14px; border-radius: 8px; }
.skip:focus { left: 8px; }
.mono { font-family: var(--f-mono); font-size: 12.5px; letter-spacing: .02em; }
.muted { color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
svg.i { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ============================== Buttons / chips ============================== */
.btn {
  display: inline-flex; align-items: center; gap: 8px; height: 44px; padding: 0 18px;
  border-radius: 999px; border: 1px solid var(--line-2); background: var(--surface);
  font-weight: 500; font-size: 15px; white-space: nowrap;
  transition: transform .2s var(--ease), background .2s, border-color .2s;
}
.btn:hover { border-color: var(--text-2); transform: translateY(-1px); }
.btn--primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn--primary:hover { border-color: var(--accent); filter: brightness(1.05); }
.btn--ghost { background: transparent; }
.btn--sm { height: 36px; padding: 0 14px; font-size: 14px; }
.icon-btn {
  display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); transition: border-color .2s, background .2s;
}
.icon-btn:hover { border-color: var(--line-2); background: var(--surface-2); }
.icon-btn:disabled { opacity: .4; cursor: default; }

.chip {
  display: inline-flex; align-items: center; height: 26px; padding: 0 10px; border-radius: 999px;
  border: 1px solid var(--line); color: var(--text-2); font: 500 12.5px/1 var(--f-mono); white-space: nowrap;
}
.chips { display: flex; flex-wrap: wrap; gap: 6px; }

/* ============================== Nav ============================== */
.nav {
  position: sticky; top: 0; z-index: 40; height: var(--nav-h);
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: saturate(140%) blur(14px); -webkit-backdrop-filter: saturate(140%) blur(14px);
  border-bottom: 1px solid transparent; transition: border-color .3s;
}
.nav.is-scrolled { border-bottom-color: var(--line); }
.nav__inner { height: 100%; display: flex; align-items: center; gap: 20px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.brand__mark {
  display: grid; place-items: center; width: 32px; height: 32px; border-radius: 9px;
  background: var(--accent); color: var(--accent-ink); font: 800 13px/1 var(--f-display); letter-spacing: 0;
}
.brand__name { font-size: 15px; }
.nav__links { display: flex; gap: 2px; margin-left: auto; }
.nav__links a {
  padding: 8px 12px; border-radius: 999px; color: var(--text-2); font-size: 14.5px; transition: color .2s, background .2s;
}
.nav__links a:hover { color: var(--text); background: var(--surface); }
.nav__links a.is-active { color: var(--text); background: var(--surface-2); }
.nav__actions { display: flex; gap: 8px; }
.nav__menu { display: none; }

@media (max-width: 860px) {
  .nav__menu { display: inline-grid; }
  .nav__actions { margin-left: auto; }
  .nav__links {
    position: fixed; inset: var(--nav-h) 0 auto 0; flex-direction: column; gap: 0; margin: 0;
    padding: 8px var(--gutter) 20px; background: var(--bg); border-bottom: 1px solid var(--line);
    transform: translateY(-8px); opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s var(--ease);
  }
  .nav.is-open .nav__links { opacity: 1; transform: none; pointer-events: auto; }
  .nav__links a { padding: 14px 4px; border-radius: 0; border-bottom: 1px solid var(--line); font-size: 17px; }
  .nav__links a:hover, .nav__links a.is-active { background: none; }
}

/* ============================== Sections ============================== */
.section { padding: clamp(72px, 10vw, 120px) 0; border-top: 1px solid var(--line); }
.section__head { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: 40px; flex-wrap: wrap; }
.eyebrow { display: inline-flex; align-items: center; gap: 10px; color: var(--muted); font: 500 12.5px/1 var(--f-mono); text-transform: uppercase; letter-spacing: .08em; margin-bottom: 14px; }
.eyebrow b { color: var(--accent-text); font-weight: 500; }
.section__title { font-size: clamp(36px, 5.5vw, 60px); }
.section__lede { color: var(--text-2); max-width: 46ch; margin-top: 14px; }

/* ============================== Hero ============================== */
.hero { position: relative; padding: clamp(48px, 9vw, 110px) 0 clamp(64px, 9vw, 110px); overflow: hidden; }
.hero::before {
  content: ""; position: absolute; inset: 0; z-index: -2;
  background-image: radial-gradient(var(--grid-dot) 1px, transparent 1px); background-size: 22px 22px;
  mask-image: radial-gradient(ellipse 80% 70% at 30% 30%, #000 30%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse 80% 70% at 30% 30%, #000 30%, transparent 75%);
}
.hero__glow {
  position: absolute; z-index: -1; width: 620px; height: 620px; right: -160px; top: -200px; border-radius: 50%;
  background: radial-gradient(circle, var(--accent-soft), transparent 65%); filter: blur(10px);
  animation: drift 14s ease-in-out infinite alternate;
}
@keyframes drift { to { transform: translate(-120px, 80px) scale(1.1); } }
.hero__grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: clamp(32px, 5vw, 64px); align-items: end; }
.status {
  display: inline-flex; align-items: center; gap: 10px; padding: 6px 14px 6px 10px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); color: var(--text-2); font-size: 13.5px; margin-bottom: 28px;
}
.status__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 0 var(--accent); animation: ping 2.2s infinite; }
@keyframes ping { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 60%, transparent); } 70%, 100% { box-shadow: 0 0 0 8px transparent; } }
.hero__title { font-size: clamp(56px, 11vw, 136px); font-weight: 800; letter-spacing: -0.045em; line-height: .9; }
.hero__title span { display: block; }
.hero__title .accent { color: var(--accent-text); }
.hero__role { display: flex; align-items: center; gap: 12px; margin-top: 22px; font: 500 14px/1 var(--f-mono); color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.hero__role::before { content: ""; width: 28px; height: 1px; background: var(--line-2); }
.hero__tagline { font-size: clamp(18px, 2vw, 21px); color: var(--text-2); max-width: 36ch; margin-top: 22px; line-height: 1.5; }
.hero__cta { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 32px; }

.sheet { border: 1px solid var(--line); background: var(--surface); border-radius: var(--r-lg); padding: 6px; box-shadow: var(--shadow); }
.sheet__head { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px 10px; color: var(--muted); }
.sheet__rows { background: var(--bg-2); border-radius: calc(var(--r-lg) - 6px); border: 1px solid var(--line); }
.sheet__row { display: grid; grid-template-columns: 96px 1fr; gap: 12px; padding: 14px 16px; border-top: 1px solid var(--line); font-size: 14.5px; }
.sheet__row:first-child { border-top: 0; }
.sheet__row dt { color: var(--muted); font: 500 12px/1.9 var(--f-mono); text-transform: uppercase; letter-spacing: .06em; }
.sheet__row dd { margin: 0; }
.sheet__stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 6px; }
.stat { background: var(--bg-2); border: 1px solid var(--line); border-radius: 12px; padding: 14px; }
.stat b { display: block; font: 700 26px/1 var(--f-display); letter-spacing: -0.03em; }
.stat span { display: block; margin-top: 6px; color: var(--muted); font-size: 12.5px; line-height: 1.3; }

/* ============================== About ============================== */
.about { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: clamp(32px, 6vw, 80px); }
.about .prose p { font-size: clamp(17px, 1.6vw, 19px); color: var(--text-2); line-height: 1.65; }
.about .prose p + p { margin-top: 18px; }
.about .prose p:first-child { font-size: clamp(20px, 2.2vw, 25px); color: var(--text); line-height: 1.45; letter-spacing: -0.01em; }
.facts { display: grid; gap: 0; border-top: 1px solid var(--line); }
.facts div { display: flex; justify-content: space-between; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--line); font-size: 15px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; text-align: right; }
.about__aside h3 { font: 500 12.5px/1 var(--f-mono); text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 32px 0 12px; }

/* ============================== Projects ============================== */
.filters { display: flex; gap: 6px; flex-wrap: wrap; }
.filter {
  height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); color: var(--text-2); font-size: 14px;
  transition: all .2s;
}
.filter:hover { color: var(--text); border-color: var(--line-2); }
.filter[aria-pressed="true"] { background: var(--text); color: var(--bg); border-color: var(--text); }
.filter sup { font: 500 10.5px var(--f-mono); margin-left: 4px; opacity: .6; }

.projects { display: grid; grid-template-columns: repeat(6, 1fr); gap: 16px; }
.card { grid-column: span 2; display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); overflow: hidden; transition: border-color .25s, transform .35s var(--ease); }
.card.is-featured { grid-column: span 3; }
.card:hover { border-color: var(--line-2); transform: translateY(-3px); }
.card__media { position: relative; aspect-ratio: 16 / 10; overflow: hidden; background: var(--bg-2); border-bottom: 1px solid var(--line); }
.card__media img.cover { width: 100%; height: 100%; object-fit: cover; transition: transform .6s var(--ease); }
.card:hover .card__media img.cover { transform: scale(1.04); }
.card__logo { position: absolute; left: 14px; bottom: 14px; width: 48px; height: 48px; border-radius: 12px; object-fit: cover; border: 2px solid var(--surface); box-shadow: 0 6px 20px rgba(0,0,0,.4); background: var(--surface); }
.card__cat { position: absolute; right: 12px; top: 12px; background: color-mix(in srgb, var(--bg) 70%, transparent); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); color: var(--text); border-color: transparent; }
.card__body { padding: 20px 20px 22px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.card__meta { display: flex; gap: 8px; color: var(--muted); }
.card__title { font-size: 24px; display: flex; justify-content: space-between; gap: 12px; align-items: start; }
.card__title svg { margin-top: 4px; color: var(--muted); transition: transform .25s var(--ease), color .25s; }
.card:hover .card__title svg { transform: translate(3px, -3px); color: var(--accent-text); }
.card__text { color: var(--text-2); font-size: 15px; }
.card .chips { margin-top: auto; padding-top: 8px; }
.empty { padding: 40px; text-align: center; color: var(--muted); border: 1px dashed var(--line-2); border-radius: var(--r-lg); grid-column: 1 / -1; }

@media (max-width: 980px) { .card, .card.is-featured { grid-column: span 3; } }
@media (max-width: 640px) { .projects { grid-template-columns: 1fr; } .card, .card.is-featured { grid-column: auto; } }

/* ============================== Experience ============================== */
.tabs { display: inline-flex; padding: 4px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); gap: 2px; flex-wrap: wrap; }
.tab { height: 34px; padding: 0 14px; border-radius: 999px; color: var(--text-2); font-size: 14px; transition: all .2s; }
.tab:hover { color: var(--text); }
.tab[aria-selected="true"] { background: var(--surface-2); color: var(--text); box-shadow: 0 0 0 1px var(--line-2) inset; }

.timeline { border-top: 1px solid var(--line); }
.xp { display: grid; grid-template-columns: 180px minmax(0, 1fr) auto; gap: 24px; padding: 28px 0; border-bottom: 1px solid var(--line); animation: fadeUp .4s var(--ease) both; }
.xp__when { color: var(--muted); padding-top: 4px; }
.xp__when .type { display: inline-flex; align-items: center; gap: 6px; margin-top: 8px; color: var(--text-2); }
.xp__when .type::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--dot, var(--muted)); }
.xp__when .now { color: var(--accent-text); }
.xp__role { font-size: clamp(21px, 2.4vw, 26px); }
.xp__org { color: var(--text-2); margin-top: 6px; }
.xp__summary { margin-top: 12px; color: var(--text-2); }
.xp__points { margin-top: 12px; display: grid; gap: 6px; color: var(--text-2); font-size: 15px; }
.xp__points li { position: relative; padding-left: 18px; }
.xp__points li::before { content: ""; position: absolute; left: 0; top: .72em; width: 8px; height: 1px; background: var(--muted); }
.xp .chips { margin-top: 14px; }
.xp__aside { align-self: start; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } }
@media (max-width: 760px) {
  .xp { grid-template-columns: 1fr; gap: 10px; }
  .xp__when { display: flex; gap: 14px; align-items: center; padding: 0; }
  .xp__when .type { margin: 0; }
  .xp__aside { justify-self: start; }
}

/* ============================== Skills ============================== */
.skills { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.skill { border: 1px solid var(--line); border-radius: var(--r-lg); padding: 22px; background: var(--surface); }
.skill h3 { font-size: 19px; margin-bottom: 16px; display: flex; justify-content: space-between; align-items: baseline; }
.skill h3 span { color: var(--muted); font: 500 12px var(--f-mono); letter-spacing: 0; }
.skill .chip { height: 32px; font-size: 13.5px; color: var(--text); background: var(--bg-2); }

/* ============================== Documents ============================== */
.docs { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); gap: 16px; }
.doc { display: grid; grid-template-columns: 120px 1fr; gap: 20px; padding: 16px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); transition: border-color .25s; }
.doc:hover { border-color: var(--line-2); }
.doc__thumb { aspect-ratio: 1 / 1.414; border-radius: 8px; background: #fff; overflow: hidden; border: 1px solid var(--line); display: grid; place-items: center; color: #999; position: relative; }
.doc__thumb canvas { width: 100%; height: 100%; object-fit: cover; }
.doc__thumb svg.i { width: 32px; height: 32px; }
.doc__body { display: flex; flex-direction: column; gap: 8px; padding: 4px 0; }
.doc__body h3 { font-size: 22px; }
.doc__body p { color: var(--text-2); font-size: 14.5px; }
.doc__actions { display: flex; gap: 8px; margin-top: auto; flex-wrap: wrap; }

/* ============================== Contact ============================== */
.contact { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: clamp(32px, 6vw, 80px); align-items: end; }
.contact__big { font-size: clamp(44px, 8vw, 96px); font-weight: 800; letter-spacing: -0.04em; line-height: .95; }
.contact__big em { font-style: normal; color: var(--accent-text); }
.contact__mail { display: inline-flex; align-items: center; gap: 12px; margin-top: 28px; font: 500 clamp(17px, 2vw, 22px)/1.2 var(--f-body); border-bottom: 1px solid var(--line-2); padding-bottom: 6px; transition: border-color .2s; word-break: break-all; }
.contact__mail:hover { border-color: var(--accent); }
.contact__row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.methods { border-top: 1px solid var(--line); }
.method { display: flex; align-items: center; gap: 14px; padding: 16px 4px; border-bottom: 1px solid var(--line); transition: padding .25s var(--ease); }
.method:hover { padding-left: 10px; }
.method__icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); }
.method b { display: block; font-weight: 500; }
.method small { color: var(--muted); font-size: 13.5px; }
.method > svg:last-child { margin-left: auto; color: var(--muted); }

/* ============================== Footer ============================== */
.footer { border-top: 1px solid var(--line); padding: 28px 0 36px; color: var(--muted); font-size: 14px; }
.footer__inner { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.footer a:hover { color: var(--text); }
.footer nav { display: flex; gap: 18px; flex-wrap: wrap; }

@media (max-width: 900px) {
  .hero__grid, .about, .contact { grid-template-columns: 1fr; }
  .hero__grid { align-items: start; }
}

/* ============================== Project page ============================== */
.back { display: inline-flex; align-items: center; gap: 8px; color: var(--text-2); font-size: 14.5px; margin-bottom: 32px; }
.back:hover { color: var(--text); }
.p-hero { padding: 40px 0 48px; }
.p-hero__top { display: flex; gap: 22px; align-items: center; }
.p-hero__logo { width: 84px; height: 84px; border-radius: 20px; object-fit: cover; border: 1px solid var(--line); flex: none; }
.p-hero h1 { font-size: clamp(40px, 7vw, 84px); font-weight: 800; letter-spacing: -0.04em; line-height: .95; }
.p-hero__tagline { font-size: clamp(18px, 2vw, 22px); color: var(--text-2); margin-top: 20px; max-width: 48ch; }
.p-meta { display: grid; grid-template-columns: repeat(4, 1fr); margin-top: 40px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.p-meta div { padding: 18px 20px 18px 0; }
.p-meta div + div { padding-left: 20px; border-left: 1px solid var(--line); }
.p-meta dt { color: var(--muted); font: 500 12px var(--f-mono); text-transform: uppercase; letter-spacing: .08em; margin-bottom: 6px; }
.p-meta dd { margin: 0; font-size: 15px; }
.p-links { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 28px; }
.p-cover { border-radius: var(--r-lg); overflow: hidden; border: 1px solid var(--line); background: var(--bg-2); cursor: zoom-in; }
.p-cover img { width: 100%; max-height: 560px; object-fit: cover; }
.p-body { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); gap: clamp(32px, 6vw, 72px); padding: clamp(56px, 8vw, 96px) 0; }
.p-body h2 { font-size: 30px; margin-bottom: 20px; }
.p-body .prose p { color: var(--text-2); font-size: 17px; }
.p-body .prose p + p { margin-top: 14px; }
.p-features { margin-top: 28px; }
.p-features h3 { font: 500 12.5px var(--f-mono); text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: 12px; }
.contribs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; counter-reset: c; }
.contrib { border: 1px solid var(--line); border-radius: var(--r); padding: 18px; background: var(--surface); counter-increment: c; }
.contrib::before { content: counter(c, decimal-leading-zero); display: block; font: 500 12px var(--f-mono); color: var(--accent-text); margin-bottom: 10px; }
.contrib h3 { font-size: 18px; margin-bottom: 6px; }
.contrib p { color: var(--text-2); font-size: 14.5px; }
.gallery { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.gallery figure { margin: 0; }
.gallery figure.wide { grid-column: 1 / -1; }
.media { border-radius: var(--r-lg); overflow: hidden; border: 1px solid var(--line); background: var(--bg-2); aspect-ratio: 16 / 9; }
.media img, .media video, .media iframe { width: 100%; height: 100%; object-fit: cover; border: 0; }
.media img { cursor: zoom-in; }
.gallery figcaption { margin-top: 10px; color: var(--muted); }
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; padding: 48px 0 clamp(56px, 8vw, 96px); border-top: 1px solid var(--line); margin-top: clamp(56px, 8vw, 96px); }
.pager a { display: block; padding: 22px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); transition: border-color .2s; }
.pager a:hover { border-color: var(--line-2); }
.pager a:last-child { text-align: right; }
.pager small { color: var(--muted); }
.pager b { display: block; margin-top: 6px; font: 700 22px/1.1 var(--f-display); letter-spacing: -0.02em; }
@media (max-width: 860px) {
  .p-body { grid-template-columns: 1fr; }
  .p-meta { grid-template-columns: 1fr 1fr; }
  .p-meta div:nth-child(3) { padding-left: 0; border-left: 0; }
  .p-meta div:nth-child(n+3) { border-top: 1px solid var(--line); }
}
@media (max-width: 560px) {
  .contribs, .gallery { grid-template-columns: 1fr; }
  .p-hero__top { flex-direction: column; align-items: start; }
  .p-hero__logo { width: 64px; height: 64px; border-radius: 16px; }
  .pager { grid-template-columns: 1fr; }
  .pager a:last-child { text-align: left; }
  .doc { grid-template-columns: 90px 1fr; gap: 14px; }
  .sheet__stats { grid-template-columns: 1fr 1fr 1fr; }
}

/* ============================== PDF reader ============================== */
.reader { display: flex; flex-direction: column; height: calc(100dvh - var(--nav-h)); }
.reader__bar {
  display: flex; align-items: center; gap: 10px; padding: 10px var(--gutter); border-bottom: 1px solid var(--line);
  background: var(--bg); flex-wrap: wrap;
}
.reader__title { display: flex; flex-direction: column; min-width: 0; margin-right: auto; }
.reader__title b { font: 700 18px/1.15 var(--f-display); letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.reader__title small { color: var(--muted); }
.reader__group { display: inline-flex; align-items: center; gap: 4px; padding: 3px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); }
.reader__group .icon-btn { width: 34px; height: 34px; border: 0; background: none; }
.reader__group .icon-btn:hover { background: var(--surface-2); }
.reader__group output, .reader__group label { min-width: 58px; text-align: center; font: 500 13px var(--f-mono); color: var(--text-2); }
.reader__group input { width: 40px; height: 28px; text-align: center; border: 1px solid var(--line); border-radius: 6px; background: var(--bg-2); color: var(--text); font: 500 13px var(--f-mono); }
.reader__group .fit { width: auto; padding: 0 12px; border-radius: 999px; font-size: 13px; }
.reader__scroll { flex: 1; overflow: auto; background: var(--bg-2); padding: 28px 16px 56px; overscroll-behavior: contain; }
.reader__pages { display: flex; flex-direction: column; align-items: center; gap: 20px; }
.page { position: relative; background: #fff; box-shadow: var(--page-shadow); border-radius: 4px; overflow: hidden; flex: none; }
.page canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.page__num { position: absolute; right: 10px; bottom: 8px; font: 500 11px var(--f-mono); color: #888; pointer-events: none; }
.reader__state { display: grid; place-items: center; gap: 14px; text-align: center; padding: 80px 20px; color: var(--muted); }
.reader__state iframe { width: min(900px, 100%); height: 75vh; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--line-2); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (max-width: 640px) {
  .reader__bar { gap: 8px; }
  .reader__title { flex: 1 1 calc(100% - 60px); }
  .reader__hide-sm { display: none; }
  .reader__scroll { padding: 16px 8px 40px; }
}

/* pdf.js text layer (makes text selectable / copyable) */
.textLayer { position: absolute; inset: 0; overflow: hidden; line-height: 1; opacity: 1; text-align: initial; forced-color-adjust: none; transform-origin: 0 0; z-index: 2; }
.textLayer span, .textLayer br { color: transparent; position: absolute; white-space: pre; cursor: text; transform-origin: 0% 0%; }
.textLayer ::selection { background: rgba(0, 100, 255, .25); color: transparent; }
.textLayer .endOfContent { display: block; position: absolute; inset: 100% 0 0; z-index: -1; cursor: default; user-select: none; }
.annotationLayer { position: absolute; inset: 0; z-index: 3; pointer-events: none; }
.annotationLayer a { position: absolute; pointer-events: auto; }
.annotationLayer a:hover { background: rgba(198, 244, 50, .25); }

/* ============================== Lightbox / toast ============================== */
.lightbox { position: fixed; inset: 0; z-index: 80; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; padding: 20px; background: rgba(5,5,6,.92); backdrop-filter: blur(6px); animation: fade .2s; }
.lightbox[hidden] { display: none; }
.lightbox__figure { margin: 0; display: grid; place-items: center; gap: 12px; max-height: 100%; min-width: 0; }
.lightbox__figure img { max-height: calc(100dvh - 110px); max-width: 100%; border-radius: 10px; object-fit: contain; }
.lightbox__figure figcaption { color: #bbb; font: 500 13px var(--f-mono); }
.lightbox .icon-btn { background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.12); color: #fff; }
.lightbox__close { position: absolute; right: 16px; top: 16px; }
@media (max-width: 640px) { .lightbox { grid-template-columns: 1fr; } .lightbox__nav { position: absolute; bottom: 20px; } .lightbox__prev { left: 20px; } .lightbox__next { right: 20px; } }
@keyframes fade { from { opacity: 0; } }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; z-index: 90; background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 999px; font-size: 14px; transition: all .25s var(--ease); }
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }

/* reveal on scroll */
.reveal { opacity: 0; transform: translateY(16px); transition: opacity .7s var(--ease), transform .7s var(--ease); }
.reveal.is-in { opacity: 1; transform: none; }
.view { animation: fade .35s var(--ease); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; }
}
.is-reader .footer { display: none; }
