/* =====================================================================
   Md Parvej — portfolio styles
   Tokens first, then base, layout, components, pages.
   ===================================================================== */

:root {
  /* Warm-black neutral ramp */
  --bg: #0c0b0a;
  --bg-deep: #080807;
  --surface: #151412;
  --raised: #1d1b19;
  --line: rgba(239, 233, 222, 0.08);
  --line-strong: rgba(239, 233, 222, 0.16);

  /* Text roles */
  --text: #efe9de;
  --text-2: #aaa398;
  --muted: #8a847a;

  /* One accent, used rarely */
  --accent: #ff7a45;
  --accent-ink: #1a0c05;

  /* Type */
  --serif: "Instrument Serif", "Times New Roman", serif;
  --sans: "Geist", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Geist Mono", ui-monospace, "SFMono-Regular", Consolas, monospace;

  /* Layout */
  --max: 1240px;
  --gutter: clamp(16px, 4vw, 40px);
  --section: clamp(80px, 11vw, 144px);

  /* Radius */
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 16px;
  --r-xl: 20px;

  /* Motion */
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --fast: 160ms;
  --enter: 520ms;
}

/* ---------- Base ---------- */
*,
*::before,
*::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
html.motion-off { scroll-behavior: auto; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text-2);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

img, svg, canvas { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
h1, h2, h3, h4, p, ul, ol, figure { margin: 0; }
ul, ol { 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;
}

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip-link {
  position: fixed; left: 16px; top: -64px; z-index: 100;
  padding: 10px 16px; border-radius: var(--r-md);
  background: var(--text); color: var(--bg); font-weight: 500;
  transition: top var(--fast) var(--ease);
}
.skip-link:focus { top: 16px; }

/* ---------- Background layers ---------- */
.bg-guides {
  position: fixed; inset: 0; z-index: -2; pointer-events: none;
  display: flex; justify-content: center;
}
.bg-guides span {
  width: min(var(--max), 100% - 2 * var(--gutter));
  height: 100%;
  background-image: linear-gradient(to right, var(--line) 1px, transparent 1px);
  background-size: 25% 100%;
  border-right: 1px solid var(--line);
  opacity: 0.45;
}

.bg-glow {
  position: fixed; inset: -20vmax; z-index: -3; pointer-events: none;
  background:
    radial-gradient(38vmax 30vmax at 30% 25%, rgba(255, 122, 69, 0.07), transparent 70%),
    radial-gradient(34vmax 28vmax at 75% 70%, rgba(70, 110, 255, 0.04), transparent 70%);
  animation: glow-drift 48s var(--ease) infinite alternate;
}
@keyframes glow-drift {
  from { transform: translate3d(-3%, -2%, 0) scale(1); }
  to   { transform: translate3d(3%, 3%, 0) scale(1.06); }
}

/* ---------- Layout ---------- */
.wrap {
  width: 100%;
  max-width: calc(var(--max) + 2 * var(--gutter));
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.section { padding-block: var(--section); }
.section + .section { padding-top: 0; }

.rule { border: 0; border-top: 1px solid var(--line); margin: 0; }

/* ---------- Type ---------- */
.display {
  font-family: var(--serif);
  font-weight: 400;
  color: var(--text);
  line-height: 0.95;
  letter-spacing: -0.02em;
}
.display em { font-style: italic; }

.h-page { font-size: clamp(56px, 9vw, 128px); }
.h-section { font-size: clamp(40px, 5.2vw, 72px); line-height: 1; }
.h-card { font-size: clamp(30px, 3vw, 40px); line-height: 1.05; }

.lead {
  font-size: clamp(17px, 1.6vw, 20px);
  line-height: 1.55;
  color: var(--text-2);
  max-width: 36rem;
}

.meta {
  font-family: var(--mono);
  font-size: 12px;
  line-height: 16px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}
.meta--accent { color: var(--accent); }

.dot {
  display: inline-block; width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent); vertical-align: middle;
}

/* Section header: label + title */
.sec-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 24px;
  margin-bottom: clamp(40px, 5vw, 64px);
}
.sec-head .meta { display: block; margin-bottom: 20px; }

/* ---------- Icons ---------- */
.i { width: 18px; height: 18px; flex: none; stroke: currentColor; stroke-width: 1.5; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.i--sm { width: 16px; height: 16px; }
.logo-svg { width: 20px; height: 20px; fill: currentColor; flex: none; }

/* ---------- Buttons & links ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 12px;
  height: 52px; padding: 0 24px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--raised);
  color: var(--text);
  font-size: 15px; font-weight: 500; line-height: 1;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
  transition: background-color var(--fast) var(--ease), border-color var(--fast) var(--ease), transform var(--fast) var(--ease);
  white-space: nowrap;
}
.btn:hover { background: #262421; border-color: rgba(239, 233, 222, 0.24); }
.btn:active { transform: scale(0.98); }
.btn .i { transition: transform var(--fast) var(--ease); }
.btn:hover .i--ne { transform: translate(2px, -2px); }
.btn:hover .i--down { transform: translateY(2px); }

.btn--accent {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
  box-shadow: 0 0 0 0 rgba(255, 122, 69, 0), 0 8px 32px -12px rgba(255, 122, 69, 0.55);
}
.btn--accent:hover { background: #ff8a5b; border-color: #ff8a5b; }

.btn--sm { height: 44px; padding: 0 18px; font-size: 14px; }

.link {
  display: inline-flex; align-items: center; gap: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line-strong);
  color: var(--text);
  font-size: 15px; font-weight: 500;
  transition: border-color var(--fast) var(--ease), color var(--fast) var(--ease);
}
.link:hover { border-color: var(--text); }
.link .i { transition: transform var(--fast) var(--ease); }
.link:hover .i--ne { transform: translate(2px, -2px); }

/* ---------- Navigation ---------- */
.nav {
  position: fixed; top: 16px; left: 0; right: 0; z-index: 50;
  pointer-events: none;
}
.nav__bar {
  pointer-events: auto;
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
  height: 68px;
  padding: 0 10px 0 28px;
  border-radius: var(--r-xl);
  border: 1px solid var(--line);
  background: rgba(21, 20, 18, 0.6);
  -webkit-backdrop-filter: blur(16px) saturate(1.2);
  backdrop-filter: blur(16px) saturate(1.2);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
  transition: background-color 300ms var(--ease), border-color 300ms var(--ease), transform 300ms var(--ease);
  transform-origin: top center;
}
.nav.is-scrolled .nav__bar {
  background: rgba(14, 13, 12, 0.86);
  border-color: var(--line-strong);
  transform: scale(0.985);
}

.brand {
  font-family: var(--serif);
  font-size: 26px; line-height: 1;
  color: var(--text);
  letter-spacing: 0.035em;   /* the condensed serif needs air at this small size */
  word-spacing: 0.12em;
  white-space: nowrap;
}

.nav__links { display: flex; align-items: center; gap: 4px; }
.nav__links a {
  position: relative;
  display: inline-flex; align-items: center;
  height: 40px; padding: 0 16px;
  border-radius: var(--r-md);
  font-size: 15px; color: var(--text-2);
  transition: color var(--fast) var(--ease), background-color var(--fast) var(--ease);
}
.nav__links a:hover { color: var(--text); }
.nav__links a[aria-current="page"] { color: var(--text); }
.nav__links a[aria-current="page"]::after {
  content: ""; position: absolute; left: 50%; bottom: 4px;
  width: 4px; height: 4px; margin-left: -2px; border-radius: 50%;
  background: var(--accent);
}
.nav__cta { margin-left: 12px; }

.nav__menu { display: none; width: 44px; height: 44px; border-radius: var(--r-md); align-items: center; justify-content: center; color: var(--text); }
.nav__menu:hover { background: var(--raised); }

.nav__panel {
  pointer-events: auto;
  display: none;
  margin-top: 8px;
  padding: 8px;
  border-radius: var(--r-xl);
  border: 1px solid var(--line);
  background: rgba(14, 13, 12, 0.96);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
}
.nav__panel a {
  display: flex; align-items: center; justify-content: space-between;
  height: 48px; padding: 0 16px; border-radius: var(--r-md);
  color: var(--text); font-size: 16px;
}
.nav__panel a:hover, .nav__panel a[aria-current="page"] { background: var(--raised); }

@media (max-width: 860px) {
  .nav__links, .nav__cta { display: none; }
  .nav__menu { display: inline-flex; }
  .nav__bar { height: 60px; padding-left: 20px; }
  .nav.is-open .nav__panel { display: block; animation: panel-in 220ms var(--ease); }
}
@keyframes panel-in { from { opacity: 0; transform: translateY(-6px); } }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  min-height: 100svh;
  min-height: max(100svh, 720px);
  display: flex; flex-direction: column;
}
.hero__canvas {
  position: absolute; inset: 0; z-index: -1;
  width: 100%; height: 100%;
}
.hero__glow {
  position: absolute; z-index: -2; left: 50%; top: 10%;
  width: min(760px, 90vw); aspect-ratio: 1;
  transform: translateX(-50%);
  background: radial-gradient(closest-side, rgba(255, 122, 69, 0.10), transparent 72%);
  pointer-events: none;
}

/* The finished portrait: the real photo, positioned by portrait.js over the particle face.
   Soft oval + bottom fade so it melts into the page with no visible edges. */
.hero__photo {
  position: absolute; z-index: -1;
  object-fit: cover; object-position: 50% 0;
  pointer-events: none; user-select: none;
  /* "lighten" drops the photo's near-black backdrop, so no box shows around the face */
  mix-blend-mode: lighten;
  -webkit-mask-image:
    radial-gradient(ellipse 50% 60% at 50% 40%, #000 52%, transparent 92%),
    linear-gradient(to bottom, #000 62%, transparent 96%);
  -webkit-mask-composite: source-in;
  mask-image:
    radial-gradient(ellipse 50% 60% at 50% 40%, #000 52%, transparent 92%),
    linear-gradient(to bottom, #000 62%, transparent 96%);
  mask-composite: intersect;
}
.hero__photo.is-bw { filter: grayscale(1) contrast(1.12) brightness(0.95); }

.hero__inner {
  position: relative;
  flex: 1;
  display: grid;
  grid-template-rows: 1fr auto auto;
  padding-top: 120px;
}

.hero__side {
  position: absolute; top: 132px;
  display: grid; gap: 16px;
}
.hero__side--left { left: var(--gutter); }
.hero__side--right { right: var(--gutter); text-align: right; }
.hero__focus { margin-top: 120px; display: grid; gap: 14px; }
.hero__focus .plus { color: var(--accent); font-family: var(--mono); font-size: 20px; line-height: 1; letter-spacing: 0; }
.hero__focus ul { display: grid; gap: 8px; }

.hero__copy {
  grid-row: 2;
  text-align: center;
  padding-bottom: clamp(24px, 3.2vh, 40px);
}
.hero__kicker { display: block; margin-top: clamp(16px, 2.2vh, 24px); color: var(--text-2); }
.hero__name {
  font-size: clamp(72px, 11.5vw, 176px);
  line-height: 0.86;
  letter-spacing: -0.03em;
  text-shadow: 0 2px 40px rgba(8, 8, 7, 0.6);
}
.hero__intro {
  margin: clamp(20px, 2.6vh, 28px) auto 0;
  max-width: 30rem;
  font-size: clamp(17px, 1.5vw, 19px);
  line-height: 1.55;
  color: var(--text);
  opacity: 0.86;
}
.hero__actions {
  margin-top: clamp(24px, 3vh, 32px);
  display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 16px 32px;
}

.hero__strip {
  grid-row: 3;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 24px;
  height: 72px;
  border-top: 1px solid var(--line);
}
.hero__strip > :last-child { justify-self: end; }
.hero__scroll { display: inline-flex; align-items: center; gap: 12px; padding-left: 16px; border-left: 1px solid var(--accent); }
.hero__strip a { transition: color var(--fast) var(--ease); }
.hero__strip a:hover { color: var(--text); }

@media (max-width: 1100px) {
  .hero__focus { display: none; }
}
@media (max-width: 760px) {
  .hero__inner { padding-top: 96px; }
  .hero__side { position: static; }
  .hero__top { display: flex; justify-content: space-between; gap: 16px; padding-top: 8px; }
  .hero__strip { grid-template-columns: 1fr auto; }
  .hero__strip > :nth-child(2) { display: none; }
  .hero__name { font-size: clamp(64px, 19vw, 104px); }
  .hero__side--right { display: none; }
  .hero__kicker { letter-spacing: 0.04em; white-space: nowrap; }
  .motion-toggle { width: 44px; padding: 0; justify-content: center; font-size: 0; letter-spacing: 0; }
}
@media (min-width: 761px) {
  .hero__top { display: contents; }
}

/* ---------- Stats ---------- */
.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr)) minmax(0, 1.1fr);
  border-bottom: 1px solid var(--line);
}
.stat {
  padding: 40px 24px 44px;
  border-left: 1px solid var(--line);
  text-align: center;
}
.stat:first-child { border-left: 0; }
.stat__num {
  font-family: var(--serif);
  font-size: clamp(48px, 5vw, 68px);
  line-height: 1;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}
.stat__num sup { font-size: 0.6em; color: var(--accent); vertical-align: 0.5em; margin-left: 2px; }
.stat__label { margin: 14px auto 0; font-size: 14px; line-height: 20px; color: var(--muted); max-width: 14rem; }
.stat--link {
  display: flex; align-items: center; justify-content: center; gap: 16px;
  text-align: left;
  color: var(--text-2);
  transition: color var(--fast) var(--ease), background-color var(--fast) var(--ease);
}
.stat--link .meta { color: inherit; line-height: 1.7; }
.stat--link:hover { color: var(--text); }
.stat--link:hover .i--ne { transform: translate(2px, -2px); }
.stat--link .i { transition: transform var(--fast) var(--ease); }

@media (max-width: 1000px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat { border-left: 0; border-top: 1px solid var(--line); padding: 32px 12px; }
  .stat:nth-child(even) { border-left: 1px solid var(--line); }
  .stat:nth-child(-n+2) { border-top: 0; }
  .stat--link { grid-column: 1 / -1; border-left: 0 !important; }
}

/* ---------- Stack ---------- */
.stack {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: clamp(40px, 6vw, 96px);
}
.stack__intro .lead { margin-top: 24px; }
.stack__groups { display: grid; gap: 0; }
.stack__row {
  display: grid; grid-template-columns: 140px minmax(0, 1fr); gap: 24px;
  padding: 24px 0;
  border-top: 1px solid var(--line);
}
.stack__row:last-child { border-bottom: 1px solid var(--line); }
.stack__row h3 { font-size: 15px; font-weight: 500; color: var(--text); line-height: 32px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 8px;
  height: 32px; padding: 0 12px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  background: var(--surface);
  font-size: 14px; color: var(--text-2);
  transition: color var(--fast) var(--ease), border-color var(--fast) var(--ease);
}
.chip .logo-svg { width: 14px; height: 14px; color: var(--muted); transition: color var(--fast) var(--ease); }
.chip:hover { color: var(--text); border-color: var(--line-strong); }
.chip:hover .logo-svg { color: var(--text); }

@media (max-width: 900px) {
  .stack { grid-template-columns: 1fr; }
  .stack__row { grid-template-columns: 1fr; gap: 12px; }
  .stack__row h3 { line-height: 1.4; }
}

/* ---------- Marquee ---------- */
.marquee {
  position: relative;
  overflow: hidden;
  padding-block: 32px;
  border-block: 1px solid var(--line);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
}
.marquee__track {
  display: flex; width: max-content;
  animation: marquee 60s linear infinite;
}
.marquee:hover .marquee__track { animation-play-state: paused; }
.marquee__set { display: flex; align-items: center; gap: 56px; padding-right: 56px; }
.marquee__item { display: inline-flex; align-items: center; gap: 12px; color: var(--muted); font-size: 15px; white-space: nowrap; transition: color var(--fast) var(--ease); }
.marquee__item .logo-svg { width: 22px; height: 22px; }
.marquee__item:hover { color: var(--text); }
@keyframes marquee { to { transform: translateX(-50%); } }

/* ---------- Work cards ---------- */
.work-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
}
.work {
  position: relative;
  display: flex; flex-direction: column;
  padding: 24px;
  border-radius: var(--r-xl);
  border: 1px solid var(--line);
  background: var(--surface);
  transition: border-color 220ms var(--ease), transform 300ms var(--ease);
}
.work:hover { border-color: var(--line-strong); transform: translateY(-4px); }
.work--wide { grid-column: 1 / -1; display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: 40px; align-items: center; padding: 24px 40px 24px 24px; }

.work__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin-bottom: 20px; }
.work__meta .sep { width: 3px; height: 3px; border-radius: 50%; background: var(--muted); }
.work__body { display: flex; flex-direction: column; }
.work--wide .work__body { padding-block: 16px; }
.work__title { margin-bottom: 16px; }
.work__title small { font-family: var(--mono); font-size: 13px; letter-spacing: 0; color: var(--muted); margin-left: 8px; vertical-align: middle; }
.work__summary { color: var(--text-2); max-width: 32rem; }
.work__tags { margin-top: 24px; }
.work__tags .chip { height: 28px; font-family: var(--mono); font-size: 12px; }
.work__links { margin-top: 32px; display: flex; flex-wrap: wrap; gap: 16px 28px; }
.work__open {
  position: absolute; inset: 0; z-index: 1; border-radius: inherit;
}
.work__links { position: relative; z-index: 2; }
.work__media { position: relative; }

/* Wide card on desktop: locked to 1783 × 508 (the YouTube-row reference, ≈3.5 : 1).
   The thumbnail takes the full card height and sizes its width from that,
   the details fill the rest. */
@media (min-width: 1200px) {
  .work--wide {
    aspect-ratio: 1783 / 508;
    grid-template-columns: auto minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr);
    align-items: stretch;
    gap: 40px;
    padding: 20px 40px 20px 20px;
  }
  .work--wide .work__media { height: 100%; aspect-ratio: 16 / 10; }
  .work--wide .frame { height: 100%; display: flex; flex-direction: column; }
  .work--wide .frame__screen { flex: 1; min-height: 0; aspect-ratio: auto; }
  .work--wide .work__body { padding-block: 0; justify-content: center; min-height: 0; }
  .work--wide .work__meta { margin-bottom: 14px; }
  .work--wide .work__title { margin-bottom: 10px; font-size: clamp(30px, 2.6vw, 38px); }
  .work--wide .work__tags { margin-top: 16px; }
  .work--wide .work__links { margin-top: 20px; }
}

@media (max-width: 900px) {
  .work-grid { grid-template-columns: 1fr; }
  .work--wide { grid-template-columns: 1fr; gap: 24px; padding: 20px; }
  .work { padding: 20px; }
}

/* Device frames */
.frame {
  position: relative;
  border-radius: 14px;
  border: 1px solid var(--line-strong);
  background: #0a0a09;
  overflow: hidden;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05), 0 30px 60px -30px rgba(0, 0, 0, 0.8);
}
.frame__bar {
  display: flex; align-items: center; gap: 12px;
  height: 36px; padding: 0 14px;
  border-bottom: 1px solid var(--line);
  background: #121110;
}
.frame__dots { display: flex; gap: 6px; }
.frame__dots i { width: 9px; height: 9px; border-radius: 50%; background: #2c2a27; }
.frame__title { flex: 1; text-align: center; font-family: var(--mono); font-size: 12px; color: var(--muted); margin-right: 39px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.frame--browser .frame__title {
  flex: 0 1 320px; margin: 0 auto; padding: 0 12px; height: 22px; line-height: 22px;
  border-radius: var(--r-sm); background: #1b1a18;
}
.frame__screen { overflow: hidden; aspect-ratio: 16 / 11; background: #0c0c0c; }
.frame__screen img {
  width: 100%; height: 100%; object-fit: cover; object-position: top left;
  transform: scale(1.04);
  transition: transform 900ms var(--ease);
}
.frame--terminal .frame__screen img { object-fit: contain; object-position: top left; background: #0c0c0c; }
.is-in .frame__screen img, .modal .frame__screen img { transform: scale(1); }
.work:hover .frame__screen img { transform: scale(1.02); }

.frame--phone { width: min(280px, 80%); margin-inline: auto; border-radius: 36px; padding: 10px; }
.frame--phone .frame__bar { display: none; }
.frame--phone .frame__screen { aspect-ratio: 9 / 19.5; border-radius: 28px; }

/* ---------- CTA ---------- */
.cta {
  text-align: center;
  padding-block: clamp(96px, 14vw, 176px);
}
.cta .meta { display: inline-flex; align-items: center; gap: 10px; margin-bottom: 28px; }
.cta .lead { margin: 28px auto 0; }
.cta__actions { margin-top: 40px; display: flex; justify-content: center; flex-wrap: wrap; gap: 16px 32px; align-items: center; }

/* ---------- Footer ---------- */
.footer { padding-top: 0; }
.footer__actions {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 24px;
  padding: 40px 0;
  border-top: 1px solid var(--line);
}
.footer__actions p { font-family: var(--serif); font-size: clamp(28px, 3vw, 40px); line-height: 1.1; color: var(--text); }
.footer__actions p em { font-style: italic; }
.footer__actions .btns { display: flex; flex-wrap: wrap; gap: 12px; }
.footer__main {
  display: flex; align-items: center; justify-content: space-between; gap: 32px;
  padding: 40px 0;
  border-top: 1px solid var(--line);
}
.footer__main .brand { font-size: 34px; }
.footer__right { display: flex; align-items: center; gap: 40px; }
.footer__links { display: flex; flex-wrap: wrap; gap: 12px 36px; }
.footer__links a {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 16px; color: var(--text-2);
  transition: color var(--fast) var(--ease);
}
.footer__links a .i { transition: transform var(--fast) var(--ease); }
.footer__links a:hover { color: var(--text); }
.footer__links a:hover .i { transform: translate(2px, -2px); }
.to-top {
  width: 64px; height: 64px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--line-strong);
  color: var(--text);
  transition: background-color 220ms var(--ease), border-color 220ms var(--ease), color 220ms var(--ease), box-shadow 220ms var(--ease);
}
.to-top:hover { background: var(--text); color: var(--bg); border-color: var(--text); }
.to-top .i { width: 22px; height: 22px; }
.footer__bottom {
  display: grid; grid-template-columns: 1fr auto 1fr; gap: 16px; align-items: center;
  padding: 24px 0 88px;
  border-top: 1px solid var(--line);
}
.footer__bottom > :last-child { justify-self: end; }

@media (max-width: 860px) {
  .footer__main { flex-direction: column; align-items: flex-start; }
  .footer__right { width: 100%; justify-content: space-between; align-items: flex-end; }
  .footer__bottom { grid-template-columns: 1fr; gap: 8px; }
  .footer__bottom > :last-child { justify-self: start; }
}

/* ---------- Motion toggle ---------- */
.motion-toggle {
  position: fixed; right: 16px; bottom: 16px; z-index: 40;
  display: inline-flex; align-items: center; gap: 10px;
  height: 44px; padding: 0 16px;
  border-radius: var(--r-md);
  border: 1px solid var(--line-strong);
  background: rgba(21, 20, 18, 0.85);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  color: var(--text-2);
  transition: color var(--fast) var(--ease), border-color var(--fast) var(--ease);
}
.motion-toggle:hover { color: var(--text); border-color: rgba(239, 233, 222, 0.28); }
.motion-toggle .i { width: 14px; height: 14px; }

/* ---------- Reveal on scroll ---------- */
.js [data-reveal] {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity var(--enter) var(--ease), transform var(--enter) var(--ease);
  transition-delay: calc(var(--i, 0) * 60ms);
}
.js [data-reveal].is-in { opacity: 1; transform: none; }

/* ---------- Inner page header ---------- */
.page-head {
  padding-top: clamp(150px, 20vw, 220px);
  padding-bottom: clamp(56px, 7vw, 96px);
  border-bottom: 1px solid var(--line);
}
.page-head .meta { display: block; margin-bottom: 28px; }
.page-head .lead { margin-top: 32px; }

/* ---------- Filters ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 40px; }
.filter {
  height: 40px; padding: 0 18px;
  border-radius: 999px;
  border: 1px solid var(--line);
  font-size: 14px; color: var(--text-2);
  transition: color var(--fast) var(--ease), border-color var(--fast) var(--ease), background-color var(--fast) var(--ease);
}
.filter:hover { color: var(--text); border-color: var(--line-strong); }
.filter[aria-pressed="true"] { background: var(--text); border-color: var(--text); color: var(--bg); }
.filter span { font-family: var(--mono); font-size: 12px; opacity: 0.6; margin-left: 6px; }
.work.is-hidden { display: none; }
.work.is-filtering { animation: work-in 420ms var(--ease) both; animation-delay: calc(var(--i, 0) * 50ms); }
@keyframes work-in { from { opacity: 0; transform: translateY(10px); } }

.empty {
  padding: 64px 32px;
  border-radius: var(--r-xl);
  border: 1px dashed var(--line-strong);
  text-align: center;
}
.empty h3 { font-family: var(--serif); font-weight: 400; font-size: 32px; color: var(--text); margin-bottom: 8px; }

/* ---------- Modal (dialog) ---------- */
.modal {
  width: min(760px, calc(100vw - 32px));
  max-height: min(680px, calc(100svh - 160px));
  padding: 0;
  border-radius: var(--r-xl);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--text-2);
  overflow: auto;
}
.modal::backdrop { background: rgba(6, 6, 5, 0.78); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.modal[open] { animation: modal-in 280ms var(--ease); }
@keyframes modal-in { from { opacity: 0; transform: translateY(12px) scale(0.99); } }
.modal__close {
  position: sticky; top: 16px; float: right; margin: 16px 16px 0 0; z-index: 2;
  width: 44px; height: 44px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--line-strong); background: var(--raised); color: var(--text);
  transition: background-color var(--fast) var(--ease);
}
.modal__close:hover { background: #2a2826; }
.modal__body { padding: clamp(20px, 3vw, 32px); }
.modal__grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 32px; margin-top: 28px; }
/* Project preview: compact title and a shorter screenshot so it never fills the screen */
.modal .h-section { font-size: clamp(28px, 3.2vw, 40px); margin-right: 56px; }
.modal .work__meta { margin-right: 56px; }
.modal .frame__screen { aspect-ratio: 16 / 7; }
.modal .lead { font-size: 17px; }
.modal ul.features { font-size: 15px; }
.modal h4 { font-size: 15px; font-weight: 500; color: var(--text); margin-bottom: 12px; }
.modal ul.features { display: grid; gap: 10px; }
.modal ul.features li { position: relative; padding-left: 20px; }
.modal ul.features li::before { content: ""; position: absolute; left: 0; top: 0.75em; width: 8px; height: 1px; background: var(--accent); }
@media (max-width: 760px) { .modal__grid { grid-template-columns: 1fr; } }

/* ---------- About ---------- */
.about {
  display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: clamp(40px, 7vw, 112px);
  align-items: start;
}
.portrait {
  position: sticky; top: 120px;
  border-radius: var(--r-xl);
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--surface);
}
.portrait img { width: 100%; aspect-ratio: 4 / 5; object-fit: cover; object-position: 50% 30%; filter: grayscale(0.15) contrast(1.05); }
.portrait figcaption { display: flex; justify-content: space-between; padding: 16px 20px; border-top: 1px solid var(--line); }
.story p { font-size: clamp(19px, 1.8vw, 23px); line-height: 1.6; color: var(--text); }
.story p + p { margin-top: 1.1em; }
.story p:not(:first-child) { color: var(--text-2); }
@media (max-width: 900px) {
  .about { grid-template-columns: 1fr; }
  .portrait { position: static; max-width: 420px; }
}

/* Timeline */
.timeline { position: relative; }
.timeline li {
  display: grid; grid-template-columns: 160px 56px minmax(0, 1fr);
  padding: 28px 0;
  border-top: 1px solid var(--line);
}
.timeline li:last-child { border-bottom: 1px solid var(--line); }
.timeline .when { font-family: var(--mono); font-size: 13px; color: var(--muted); line-height: 28px; }
.timeline .idx { font-family: var(--mono); font-size: 13px; color: var(--accent); line-height: 28px; }
.timeline h3 { font-family: var(--serif); font-weight: 400; font-size: 28px; line-height: 1.1; color: var(--text); }
.timeline p { margin-top: 6px; color: var(--text-2); max-width: 36rem; }
@media (max-width: 700px) {
  .timeline li { grid-template-columns: 40px minmax(0, 1fr); row-gap: 4px; }
  .timeline .when { grid-column: 2; grid-row: 1; }
  .timeline .idx { grid-row: 1 / span 2; }
  .timeline li > div { grid-column: 2; }
}

.learning {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 24px;
  padding: 28px 32px;
  border-radius: var(--r-xl);
  border: 1px solid var(--line);
  background: var(--surface);
}
.learning h3 { font-size: 15px; font-weight: 500; color: var(--text); display: inline-flex; align-items: center; gap: 10px; }

/* ---------- Experience ---------- */
.edu {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 32px;
  padding: clamp(24px, 4vw, 48px);
  border-radius: var(--r-xl);
  border: 1px solid var(--line);
  background: var(--surface);
}
.edu .h-card { margin: 12px 0 8px; }
.edu .status { display: inline-flex; align-items: center; gap: 10px; height: 32px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line-strong); font-size: 13px; color: var(--text); white-space: nowrap; }
.edu .chips { margin-top: 28px; }
@media (max-width: 700px) { .edu { grid-template-columns: 1fr; } .edu .status { justify-self: start; } }

.xp li {
  display: grid; grid-template-columns: minmax(0, 4fr) minmax(0, 6fr); gap: 24px 48px;
  padding: 36px 0;
  border-top: 1px solid var(--line);
}
.xp li:last-child { border-bottom: 1px solid var(--line); }
.xp h3 { font-family: var(--serif); font-weight: 400; font-size: clamp(28px, 2.6vw, 36px); line-height: 1.05; color: var(--text); }
.xp .org { margin-top: 10px; display: block; }
.xp p { color: var(--text-2); max-width: 36rem; }
@media (max-width: 760px) { .xp li { grid-template-columns: 1fr; gap: 12px; } }

.cert-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.cert {
  text-align: left;
  display: flex; flex-direction: column;
  border-radius: var(--r-lg);
  border: 1px solid var(--line);
  background: var(--surface);
  overflow: hidden;
  transition: border-color 220ms var(--ease), transform 300ms var(--ease);
}
.cert:hover { border-color: var(--line-strong); transform: translateY(-4px); }
.cert__thumb { aspect-ratio: 4 / 3; background: #0f0e0d; display: flex; align-items: center; justify-content: center; overflow: hidden; color: var(--muted); }
.cert__thumb img { width: 100%; height: 100%; object-fit: cover; }
.cert__text { padding: 16px 20px 20px; }
.cert__text h3 { font-size: 16px; font-weight: 500; color: var(--text); line-height: 1.4; }
.cert__text p { margin-top: 6px; font-size: 14px; color: var(--muted); }
@media (max-width: 900px) { .cert-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .cert-grid { grid-template-columns: 1fr; } }

.lightbox { width: min(1100px, calc(100vw - 32px)); background: var(--bg-deep); }
.lightbox__stage { padding: 72px 72px 24px; display: flex; align-items: center; justify-content: center; }
.lightbox__stage img { max-height: 72svh; width: auto; border-radius: var(--r-md); cursor: zoom-in; transition: transform 300ms var(--ease); }
.lightbox__stage img.is-zoomed { transform: scale(1.6); cursor: zoom-out; }
.lightbox__foot { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 24px 24px; }
.lightbox__nav { display: flex; gap: 8px; }
.lightbox__nav button { width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line-strong); display: inline-flex; align-items: center; justify-content: center; color: var(--text); }
.lightbox__nav button:hover { background: var(--raised); }
@media (max-width: 600px) { .lightbox__stage { padding: 64px 16px 16px; } }

/* ---------- Contact ---------- */
.contact {
  display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: clamp(40px, 7vw, 112px);
  align-items: start;
}
.contact__list { display: grid; }
.contact__list a, .contact__list div {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 20px 0;
  border-top: 1px solid var(--line);
  color: var(--text);
}
.contact__list > :last-child { border-bottom: 1px solid var(--line); }
.contact__list .meta { display: block; margin-bottom: 4px; }
.contact__list a .i { color: var(--muted); transition: transform var(--fast) var(--ease), color var(--fast) var(--ease); }
.contact__list a:hover .i { color: var(--text); transform: translate(2px, -2px); }
.contact__book { margin-top: 32px; padding: 28px; border-radius: var(--r-xl); border: 1px solid var(--line); background: var(--surface); }
.contact__book h3 { font-family: var(--serif); font-weight: 400; font-size: 30px; line-height: 1.1; color: var(--text); margin-bottom: 8px; }
.contact__book .btn { margin-top: 20px; }

.form {
  padding: clamp(24px, 4vw, 40px);
  border-radius: var(--r-xl);
  border: 1px solid var(--line);
  background: var(--surface);
  display: grid; gap: 20px;
}
.form__row { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.field { display: grid; gap: 8px; }
.field label { font-size: 14px; font-weight: 500; color: var(--text); }
.field input, .field select, .field textarea {
  width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  border-radius: var(--r-md);
  border: 1px solid var(--line-strong);
  background: var(--bg);
  color: var(--text);
  font: inherit; font-size: 16px;
  transition: border-color var(--fast) var(--ease), box-shadow 220ms var(--ease), background-color var(--fast) var(--ease);
}
.field textarea { min-height: 160px; resize: vertical; line-height: 1.5; }
.field select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%238a847a' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m4 6 4 4 4-4'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 40px; }
.field input::placeholder, .field textarea::placeholder { color: #6a655e; }
.field input:hover, .field select:hover, .field textarea:hover { border-color: rgba(239, 233, 222, 0.24); }
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none;
  border-color: var(--accent);
  background: #0f0e0c;
  box-shadow: 0 0 0 4px rgba(255, 122, 69, 0.14);
}
.field .err { font-size: 13px; color: #f08a6a; min-height: 0; }
.field.has-error input, .field.has-error textarea { border-color: #e5484d; }
.form__foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; }
.form__note { font-size: 14px; color: var(--muted); max-width: 22rem; }
.form__done { display: none; text-align: center; padding: 48px 16px; }
.form.is-done > :not(.form__done) { display: none; }
.form.is-done .form__done { display: block; animation: modal-in 420ms var(--ease); }
.form__done .check {
  width: 64px; height: 64px; margin: 0 auto 24px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--accent); color: var(--accent);
}
.form__done .check path { stroke-dasharray: 30; stroke-dashoffset: 30; animation: draw 600ms 200ms var(--ease) forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
.form__done h3 { font-family: var(--serif); font-weight: 400; font-size: 36px; color: var(--text); margin-bottom: 8px; }
@media (max-width: 900px) { .contact { grid-template-columns: 1fr; } }
@media (max-width: 560px) { .form__row { grid-template-columns: 1fr; } }

/* ---------- Reduced motion / Motion off ---------- */
.motion-off .bg-glow,
.motion-off .marquee__track { animation: none; }
.motion-off [data-reveal] { opacity: 1 !important; transform: none !important; transition: none !important; }
.motion-off .work, .motion-off .cert { transition: border-color var(--fast) var(--ease); }
.motion-off .work:hover, .motion-off .cert:hover { transform: none; }
.motion-off .frame__screen img { transform: none; transition: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; scroll-behavior: auto !important; }
  .js [data-reveal] { opacity: 1; transform: none; }
}
