/* ==========================================================================
   Nafis Hasrat Arnob - portfolio
   Plain CSS, no framework. Design tokens first, then layout, then sections.
   ========================================================================== */

/* ---------- Self-hosted fonts (latin subsets, preloaded from each page) ---------- */
@font-face { font-family: "Inter"; font-style: normal; font-weight: 400 600; font-display: swap; src: url("../fonts/inter-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Plus Jakarta Sans"; font-style: normal; font-weight: 600 800; font-display: swap; src: url("../fonts/plus-jakarta-sans-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Instrument Serif"; font-style: italic; font-weight: 400; font-display: swap; src: url("../fonts/instrument-serif-italic.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root {
  --bg: #fafafc;
  --surface: #ffffff;
  --surface-2: #f3f2f8;
  --text: #100e1c;
  --text-2: #4d4b5e;
  --muted: #7b7990;
  --border: #e6e5ef;
  --accent: #6d28d9;
  --accent-hover: #5b21b6;
  --accent-soft: #f0e9ff;
  --accent-text: #5b21b6;
  --ring: rgba(109, 40, 217, 0.28);
  --shadow-sm: 0 1px 2px rgba(16, 14, 28, 0.05), 0 1px 3px rgba(16, 14, 28, 0.04);
  --shadow-md: 0 8px 24px -8px rgba(16, 14, 28, 0.12), 0 2px 6px rgba(16, 14, 28, 0.05);
  --shadow-lg: 0 24px 48px -16px rgba(16, 14, 28, 0.18);
  --header-bg: rgba(250, 250, 252, 0.8);
  --glow-1: rgba(109, 40, 217, 0.16);
  --glow-2: rgba(59, 130, 246, 0.12);
  --radius: 18px;
  --radius-sm: 12px;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: "Plus Jakarta Sans", "Inter", system-ui, sans-serif;
  --font-serif: "Instrument Serif", Georgia, "Times New Roman", serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --container: 100%;
  --gutter: 24px;
  --header-h: 72px;
  --vh: 100vh;                 /* replaced by svh below where supported */
  color-scheme: light;
}

/* svh is the viewport with the browser's own chrome showing - the smallest it
   gets, and crucially a fixed number. dvh tracks the chrome as it slides in and
   out, which resized the pinned showcase by 400px mid-scroll and shifted the
   mapping from scroll position to screen; vh is the largest, which put the app
   rail below the fold while the URL bar was up. svh fits in both states and
   never moves. */
@supports (height: 100svh) { :root { --vh: 100svh; } }

:root[data-theme="dark"] {
  --bg: #0b0a12;
  --surface: #14131d;
  --surface-2: #1b1a26;
  --text: #f2f1f7;
  --text-2: #b9b7c9;
  --muted: #8f8da3;
  --border: #25242f;
  --accent: #a78bfa;
  --accent-hover: #c4b5fd;
  --accent-soft: #221a3a;
  --accent-text: #c4b5fd;
  --ring: rgba(167, 139, 250, 0.35);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 8px 24px -8px rgba(0, 0, 0, 0.6);
  --shadow-lg: 0 24px 48px -16px rgba(0, 0, 0, 0.7);
  --header-bg: rgba(11, 10, 18, 0.75);
  --glow-1: rgba(139, 92, 246, 0.22);
  --glow-2: rgba(59, 130, 246, 0.14);
  color-scheme: dark;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
/* The page scrolls inside <body>, not the document. iOS only grows and shrinks
   its URL bar when the document itself scrolls, and that resizing - about
   100px of viewport across one upward flick on an iPhone - ate the start of
   every backwards gesture before the page caught up in a lurch. With the
   document fixed the viewport never moves. The cost is that the browser's own
   bar is always on screen; --vh is svh, which is exactly that case. */
html { height: var(--vh); overflow: hidden; -webkit-text-size-adjust: 100%; }
body {
  height: var(--vh); overflow-y: auto; overflow-x: hidden;
  overscroll-behavior-y: none; scroll-behavior: smooth;
  margin: 0;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  transition: background-color .3s ease, color .3s ease;
}
img, svg { 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 { font-family: var(--font-display); line-height: 1.15; margin: 0; letter-spacing: -0.02em; }
p { margin: 0; }
ul { margin: 0; padding: 0; list-style: none; }
code { font-family: var(--font-mono); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }
::selection { background: var(--accent); color: #fff; }

.container { width: 100%; max-width: var(--container); margin-inline: auto; padding-inline: var(--gutter); }
.section { padding-block: 96px; }
.section + .section { padding-top: 0; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Typography helpers ---------- */
.serif { font-family: var(--font-serif); font-style: italic; font-weight: 400; letter-spacing: 0; font-size: 1.08em; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 13px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase;
  color: var(--accent-text);
}
.eyebrow::before { content: ""; width: 20px; height: 2px; background: var(--accent); border-radius: 2px; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 40px; }
.section-head h2 { font-size: clamp(28px, 4vw, 40px); margin-top: 10px; }
.section-head p { color: var(--text-2); max-width: 560px; margin-top: 12px; font-size: 17px; }

.link-arrow { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; color: var(--accent-text); white-space: nowrap; }
.link-arrow svg { width: 16px; height: 16px; transition: transform .2s ease; }
.link-arrow:hover svg { transform: translate(2px, -2px); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 48px; padding: 0 22px; border-radius: 999px;
  font-weight: 600; font-size: 15px; white-space: nowrap;
  transition: transform .15s ease, background-color .2s ease, border-color .2s ease, box-shadow .2s ease, color .2s ease;
}
.btn svg { width: 18px; height: 18px; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); color: #fff; box-shadow: 0 6px 16px -6px var(--ring); }
.btn-primary:hover { background: var(--accent-hover); box-shadow: 0 10px 22px -8px var(--ring); transform: translateY(-1px); }
:root[data-theme="dark"] .btn-primary { color: #150d2e; }
.btn-secondary { background: var(--surface); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { border-color: var(--muted); transform: translateY(-1px); }
.btn-sm { height: 40px; padding: 0 16px; font-size: 14px; }

/* Store-style buttons (Google Play / App Store / GitHub ...) */
.btn-store {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 8px 16px 8px 12px; border-radius: 12px; line-height: 1.1;
  background: var(--text); color: var(--bg); border: 1px solid transparent;
  transition: transform .15s ease, box-shadow .2s ease, background-color .2s ease;
}
.btn-store svg { width: 22px; height: 22px; flex: none; }
.btn-store span { display: block; font-weight: 600; font-size: 15px; }
.btn-store small { display: block; font-size: 10px; letter-spacing: .05em; text-transform: uppercase; opacity: .7; margin-bottom: 2px; }
.btn-store:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  height: var(--header-h);
  background: var(--header-bg);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color .2s ease, background-color .3s ease;
}
.site-header.scrolled { border-bottom-color: var(--border); }
.site-header .container { height: 100%; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.brand { display: inline-flex; align-items: center; gap: 10px; white-space: nowrap; font-family: var(--font-display); font-weight: 700; font-size: 17px; letter-spacing: -0.01em; }
.brand-mark {
  width: 36px; height: 36px; border-radius: 10px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, #7c3aed, #4f46e5);
  color: #fff;
  box-shadow: 0 6px 14px -6px var(--ring);
}
.brand-mark svg { width: 20px; height: 20px; }
.nav { display: flex; align-items: center; gap: 4px; }
.nav a { padding: 8px 14px; border-radius: 999px; font-size: 15px; font-weight: 500; color: var(--text-2); transition: color .2s ease, background-color .2s ease; }
.nav a:hover, .nav a.active { color: var(--text); background: var(--surface-2); }
.header-actions { display: flex; align-items: center; gap: 8px; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 999px; display: grid; place-items: center;
  color: var(--text-2); border: 1px solid transparent;
  transition: background-color .2s ease, color .2s ease, border-color .2s ease;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn svg { width: 20px; height: 20px; }
.theme-toggle { position: relative; }
.theme-toggle .sun, .theme-toggle .moon { position: absolute; transition: transform .3s ease, opacity .2s ease; }
:root[data-theme="dark"] .theme-toggle .sun { opacity: 1; transform: rotate(0) scale(1); }
:root[data-theme="dark"] .theme-toggle .moon { opacity: 0; transform: rotate(90deg) scale(.6); }
:root:not([data-theme="dark"]) .theme-toggle .sun { opacity: 0; transform: rotate(-90deg) scale(.6); }
:root:not([data-theme="dark"]) .theme-toggle .moon { opacity: 1; transform: rotate(0) scale(1); }
.menu-btn { display: none; flex-direction: column; align-items: center; justify-content: center; gap: 5px; }
.menu-btn span { display: block; width: 18px; height: 2px; background: currentColor; border-radius: 2px; transition: transform .25s ease, opacity .2s ease; }
.menu-btn.is-open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.menu-btn.is-open span:nth-child(2) { opacity: 0; }
.menu-btn.is-open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
.header-cta { display: inline-flex; }

.mobile-nav {
  display: none; position: fixed; inset: var(--header-h) 0 auto 0; z-index: 49;
  background: var(--surface); border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-lg); padding: 12px var(--gutter) 20px;
}
.mobile-nav.open { display: block; }
.mobile-nav a { display: block; padding: 12px 8px; font-size: 17px; font-weight: 500; border-radius: 10px; }
.mobile-nav a:hover { background: var(--surface-2); }
.mobile-nav .btn { margin-top: 8px; width: 100%; }

/* ---------- Hero ---------- */
.hero { position: relative; overflow: hidden; padding: 72px 0 96px; }
.hero::before, .hero::after { content: ""; position: absolute; border-radius: 50%; filter: blur(80px); pointer-events: none; z-index: 0; }
.hero::before { width: 560px; height: 560px; right: -120px; top: -160px; background: var(--glow-1); }
.hero::after { width: 420px; height: 420px; left: -180px; bottom: -200px; background: var(--glow-2); }
.hero .container { position: relative; z-index: 1; display: grid; grid-template-columns: 1.15fr .85fr; align-items: center; gap: 56px; }
.hero-badge {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 14px 6px 8px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-sm);
  font-size: 13px; font-weight: 500; color: var(--text-2);
}
.hero-badge .dot { width: 8px; height: 8px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 0 4px rgba(34, 197, 94, .18); }
.hero-badges { display: flex; flex-wrap: wrap; gap: 8px; }
.hero-badge svg { width: 14px; height: 14px; color: var(--accent-text); }
.hero-badge .time { font-variant-numeric: tabular-nums; color: var(--text); font-weight: 600; }
.hero h1 { font-size: clamp(38px, 6vw, 64px); font-weight: 800; margin-top: 22px; }
.hero h1 .accent { color: var(--accent-text); }
.hero .lead { margin-top: 20px; font-size: 18px; color: var(--text-2); max-width: 540px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 32px; }
.hero-social { display: flex; align-items: center; gap: 6px; margin-top: 36px; }
.hero-social span { font-size: 13px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-right: 8px; }
.hero-social a { width: 40px; height: 40px; border-radius: 999px; display: grid; place-items: center; color: var(--text-2); border: 1px solid var(--border); background: var(--surface); transition: all .2s ease; }
.hero-social a:hover { color: var(--accent-text); border-color: var(--accent); transform: translateY(-2px); }
.hero-social svg { width: 18px; height: 18px; }

.hero-visual { position: relative; display: grid; place-items: center; }
.hero-photo { position: relative; width: min(100%, 400px); aspect-ratio: 800 / 835; }
.hero-photo .portrait {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain;
  filter: drop-shadow(0 22px 44px rgba(16, 14, 28, .28));
  transition: opacity .35s ease;
}
.portrait-dark { opacity: 0; }
:root[data-theme="dark"] .portrait-light { opacity: 0; }
:root[data-theme="dark"] .portrait-dark { opacity: 1; }
:root[data-theme="dark"] .hero-photo .portrait { filter: drop-shadow(0 22px 44px rgba(0, 0, 0, .55)); }
.hero-glow {
  position: absolute; width: min(100%, 400px); aspect-ratio: 800 / 835; border-radius: 44px;
  top: 50%; left: 50%; transform: translate(-50%, -50%) rotate(-4deg) scale(1.04);
  background: linear-gradient(135deg, var(--accent), #3b82f6); opacity: .16;
}
.hero-visual .ring { position: absolute; inset: 0; margin: auto; width: 480px; height: 480px; border-radius: 50%; border: 1px dashed var(--border); pointer-events: none; }
.hero-cards { display: contents; }
.float-card {
  position: absolute; display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; border-radius: 14px;
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-md);
  animation: float 6s ease-in-out 3;
}
.float-card .ic { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-text); }
.float-card .ic svg { width: 20px; height: 20px; }
.float-card strong { display: block; font-family: var(--font-display); font-size: 18px; line-height: 1.1; }
.float-card small { color: var(--muted); font-size: 12.5px; }
.float-card.one { top: 6%; right: -2%; }
.float-card.two { bottom: 6%; left: -4%; animation-delay: -3s; }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }

/* ---------- Stats ---------- */
.stats { padding-bottom: 96px; }
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(230px, 100%), 1fr)); gap: 16px; }
.stat { padding: 24px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-sm); }
.stat strong { display: block; font-family: var(--font-display); font-size: 36px; font-weight: 800; letter-spacing: -0.03em; line-height: 1; color: var(--text); }
.stat strong em { font-style: normal; color: var(--accent-text); }
.stat > span { display: block; margin-top: 10px; color: var(--text-2); font-size: 14.5px; }
.stat strong span { font-variant-numeric: tabular-nums; }

/* ---------- Phone frame ---------- */
.phone {
  --phone-w: 290px;
  position: relative; width: var(--phone-w); aspect-ratio: 9 / 19.2; flex: none;
  border-radius: calc(var(--phone-w) * .155); background: #17171c; padding: calc(var(--phone-w) * .034);
  box-shadow: 0 30px 60px -22px rgba(0, 0, 0, .5), inset 0 0 0 2px #3b3b45, inset 0 0 0 5px #0a0a0e;
}
.phone::after { content: ""; position: absolute; right: -3px; top: 28%; width: 3px; height: 14%; border-radius: 2px; background: #2c2c34; }
.phone-screen { position: absolute; inset: calc(var(--phone-w) * .034); border-radius: calc(var(--phone-w) * .125); overflow: hidden; background: #0b0b0f; }
/* The cross-fade is driven by scroll position, so it has to settle before the
   next step arrives. At .55s it did not: measured on a phone, a new screen
   took ~446ms to become visible and most changes never finished before the
   following one began, leaving a permanent half-blend. The scale stays - it
   is what gives each screen its own compositor layer. */
.phone-screen img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: top center; opacity: 0; transform: scale(1.04); transition: opacity .18s ease, transform .18s ease; }
.phone-screen img.is-on { opacity: 1; transform: none; }

/* ---------- Featured showcase (home): pinned, scroll steps through screens ---------- */
.showcase { --step: calc(var(--vh) * .24); position: relative; height: calc(var(--vh) - var(--header-h) + var(--steps) * var(--step)); }
.showcase-pin {
  position: sticky; top: var(--header-h); height: calc(var(--vh) - var(--header-h));
  display: grid; grid-template-rows: 1fr auto; padding: 16px 0 18px; overflow: hidden;
}
.stage-phone { position: relative; perspective: 1200px; }
.stage-phone::before {
  content: ""; position: absolute; z-index: -1; pointer-events: none;
  width: 78vmin; height: 78vmin; max-width: 900px; max-height: 900px;
  left: 50%; top: 46%; transform: translate(-50%, -50%);
  border-radius: 50%; filter: blur(90px); opacity: .55;
  background: var(--stage-color, var(--accent));
  transition: background-color .6s ease;
}
:root[data-theme="dark"] .stage-phone::before { opacity: .32; }
.showcase-stage { display: grid; grid-template-columns: 1.05fr .95fr; gap: 48px; align-items: center; min-height: 0; }
.stage-text { position: relative; min-height: 540px; }
.stage-copy {
  position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: center;
  opacity: 0; transform: translateY(18px); pointer-events: none;
  transition: opacity .45s ease, transform .45s ease;
}
.stage-copy.is-active { opacity: 1; transform: none; pointer-events: auto; }
.stage-phone { display: grid; justify-items: center; gap: 14px; }
.phone-lg { --phone-w: clamp(180px, calc((var(--vh) - var(--header-h) - 170px) / 2.13), 300px); transform-style: preserve-3d; transition: transform .35s ease; will-change: transform; }
.screen-empty { position: absolute; inset: 0; opacity: 0; transition: opacity .5s ease; }
.screen-empty.is-on { opacity: 1; }
.device-caption { display: flex; align-items: center; gap: 14px; font-size: 13.5px; font-weight: 600; color: var(--text-2); }
.device-dots { display: flex; gap: 6px; }
.device-dots i { width: 6px; height: 6px; border-radius: 999px; background: color-mix(in srgb, var(--text) 26%, transparent); transition: width .25s ease, background-color .25s ease; }
.device-dots i.on { width: 18px; background: var(--accent); }
.panel-index { font-family: var(--font-display); font-weight: 700; font-size: 13px; letter-spacing: .12em; color: var(--accent-text); }
.panel-index .sep { color: var(--muted); font-weight: 400; margin: 0 2px; }
.panel-title { display: flex; align-items: center; gap: 16px; margin-top: 16px; }
.panel-title img { width: 56px; height: 56px; border-radius: 15px; box-shadow: var(--shadow-md); border: 1px solid var(--border); }
.panel-title h3 { font-size: clamp(28px, 3.4vw, 40px); }
.panel-client { display: block; font-size: 14px; color: var(--muted); margin-top: 2px; }
.panel-tagline { font-family: var(--font-serif); font-style: italic; font-size: clamp(22px, 2.4vw, 28px); line-height: 1.25; color: var(--text); margin-top: 18px; }
.panel-desc { color: var(--text-2); margin-top: 14px; font-size: 16.5px; max-width: 520px; }
.panel-highlights { display: grid; gap: 8px; margin-top: 20px; }
.panel-highlights li { display: flex; align-items: flex-start; gap: 10px; font-size: 15.5px; color: var(--text); }
.panel-highlights svg { width: 15px; height: 15px; flex: none; margin-top: 5px; color: var(--accent-text); }
.stage-copy .chips { margin-top: 20px; }
.panel-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; margin-top: 26px; }
.showcase-rail { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 10px; }
.rail-item {
  display: inline-flex; align-items: center; gap: 10px; padding: 8px 14px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface); color: var(--muted);
  font-size: 13px; font-weight: 600; transition: color .25s ease, border-color .25s ease;
}
.rail-item .rail-num { font-family: var(--font-display); color: var(--accent-text); }
.rail-item .rail-bar { width: 44px; height: 3px; border-radius: 3px; background: var(--border); overflow: hidden; }
.rail-item .rail-bar i { display: block; height: 100%; width: var(--fill, 0%); background: var(--accent); transition: width .12s linear; }
.rail-item.is-active { color: var(--text); border-color: var(--accent); }
.rail-item.is-done .rail-bar i { width: 100%; }
.rail-item:hover { color: var(--text); }
.scroll-hint {
  position: absolute; right: 24px; bottom: 22px; display: flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted);
  transition: opacity .3s ease;
}
.scroll-hint svg { width: 14px; height: 14px; animation: nudge 1.6s ease-in-out infinite; }
.scroll-hint.is-hidden { opacity: 0; }
@keyframes nudge { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(4px); } }

/* ---------- Packages (pub.dev) ---------- */
#open-source.section { padding-top: 96px; }
.packages-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(440px, 100%), 1fr)); gap: 24px; }
.pkg { display: flex; flex-direction: column; gap: 16px; padding: 28px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-sm); transition: transform .25s ease, box-shadow .25s ease, border-color .25s ease; }
.pkg:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--muted); }
.pkg-head { display: flex; gap: 14px; align-items: flex-start; }
.pkg-head > div { min-width: 0; }
.pkg h3 code { overflow-wrap: anywhere; }
.pkg-icon { width: 46px; height: 46px; border-radius: 13px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-text); flex: none; }
.pkg-icon svg { width: 22px; height: 22px; }
.pkg h3 { font-size: 20px; }
.pkg h3 code { font-weight: 700; letter-spacing: -0.01em; }
.pkg-tagline { color: var(--text-2); margin-top: 4px; font-size: 15px; }
.pkg-desc { color: var(--text-2); font-size: 15px; }
.pkg-badges { display: flex; flex-wrap: wrap; gap: 8px; }
.pkg-badges img { height: 20px; border-radius: 4px; }
.pkg-install { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-width: 0; padding: 10px 10px 10px 14px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); font-size: 14px; }
.pkg-install code { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.copy-btn { flex: none; font-size: 12.5px; font-weight: 600; padding: 6px 12px; border-radius: 8px; background: var(--surface); border: 1px solid var(--border); color: var(--text-2); transition: all .2s ease; }
.copy-btn:hover { color: var(--text); border-color: var(--muted); }
.copy-btn.copied { color: #16a34a; border-color: #16a34a; }
.pkg-links { display: flex; flex-wrap: wrap; gap: 10px; margin-top: auto; }

/* ---------- Shelves (home: the other projects, swipeable) ---------- */
.shelf + .shelf { margin-top: 56px; }
.group-head { display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px 12px; margin-bottom: 16px; }
.group-head h2, .group-head h3 { font-size: 24px; }
.group-cards .group-head h2 { font-size: clamp(24px, 3vw, 30px); }
.group-count { font-size: 12.5px; font-weight: 700; color: var(--muted); background: var(--surface-2); padding: 2px 10px; border-radius: 999px; }
.group-head p { flex-basis: 100%; color: var(--text-2); font-size: 15px; }
.shelf-nav { margin-left: auto; display: flex; gap: 6px; align-self: center; }
.shelf-btn { width: 38px; height: 38px; border-radius: 999px; display: grid; place-items: center; background: var(--surface); border: 1px solid var(--border); color: var(--text-2); transition: all .2s ease; }
.shelf-btn:hover { color: var(--text); border-color: var(--muted); }
.shelf-btn svg { width: 18px; height: 18px; }
.shelf-track { display: flex; gap: 16px; overflow-x: auto; scroll-snap-type: x mandatory; padding: 4px 2px 14px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.shelf-track::-webkit-scrollbar { display: none; }
.shelf-wrap { position: relative; }
.shelf-wrap::before, .shelf-wrap::after {
  content: ""; position: absolute; top: 0; bottom: 14px; width: 64px; z-index: 1; pointer-events: none;
  transition: opacity .25s ease;
}
.shelf-wrap::before { left: 0; background: linear-gradient(to right, var(--bg), transparent); }
.shelf-wrap::after { right: 0; background: linear-gradient(to left, var(--bg), transparent); }
.shelf-wrap.at-start::before, .shelf-wrap.at-end::after { opacity: 0; }
@media (pointer: fine) { .shelf-track { cursor: grab; } }
.shelf-track.is-grabbing { cursor: grabbing; scroll-snap-type: none; user-select: none; }
.shelf-track.is-grabbing .shelf-card { pointer-events: none; }
.shelf-card {
  flex: 0 0 300px; scroll-snap-align: start; display: flex; flex-direction: column;
  border-radius: var(--radius); overflow: hidden;
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-sm);
  transition: transform .25s ease, box-shadow .25s ease, border-color .25s ease;
}
.shelf-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); border-color: var(--muted); }
.shelf-card:hover .card-media > img { transform: scale(1.04); }
.shelf-card:hover .media-screens img { transform: translateY(-6px); }
.shelf-body { display: grid; gap: 6px; padding: 16px 16px 18px; }
.shelf-body h3 { font-size: 17px; }
.shelf-meta { font-size: 13px; color: var(--muted); }
.shelf-more { display: inline-flex; align-items: center; gap: 6px; font-size: 13.5px; font-weight: 600; color: var(--accent-text); margin-top: 6px; }
.shelf-more svg { width: 14px; height: 14px; transition: transform .2s ease; }
.shelf-card:hover .shelf-more svg { transform: translateX(3px); }

/* ---------- Project cards ---------- */
.projects-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(290px, 100%), 1fr)); gap: 24px; }
.group-cards + .group-cards { margin-top: 72px; }
.card {
  position: relative; display: flex; flex-direction: column;
  border-radius: var(--radius); overflow: hidden;
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-sm);
  transition: transform .25s ease, box-shadow .25s ease, border-color .25s ease;
}
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); border-color: var(--muted); }
.card-media { position: relative; aspect-ratio: 3 / 2; overflow: hidden; background: var(--surface-2); }
.card-media > img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s ease; }
.card:hover .card-media > img { transform: scale(1.04); }
.media-screens { position: relative; width: 100%; height: 100%; display: flex; justify-content: center; align-items: flex-end; gap: 4%; padding: 8% 8% 0; background: linear-gradient(135deg, hsl(var(--h) 70% 92%), hsl(calc(var(--h) + 40) 60% 88%)); }
:root[data-theme="dark"] .media-screens { background: linear-gradient(135deg, hsl(var(--h) 40% 22%), hsl(calc(var(--h) + 40) 40% 16%)); }
.media-screens img { width: 30%; border-radius: 10px 10px 0 0; box-shadow: 0 12px 30px -10px rgba(0,0,0,.4); transition: transform .5s ease; }
.media-screens img:nth-child(2) { width: 34%; margin-bottom: -2%; }
.card:hover .media-screens img { transform: translateY(-6px); }
.featured-badge { position: absolute; left: 12px; top: 12px; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; padding: 5px 10px; border-radius: 999px; background: var(--accent); color: #fff; }
:root[data-theme="dark"] .featured-badge { color: #150d2e; }
.card-body { display: flex; flex-direction: column; gap: 10px; padding: 20px 20px 22px; flex: 1; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-text); }
.tag.neutral { background: var(--surface-2); color: var(--text-2); }
.card h3 { font-size: 19px; font-weight: 700; }
.card h3 a::after { content: ""; position: absolute; inset: 0; }
.card h3 a:hover { color: var(--accent-text); }
.card p { color: var(--text-2); font-size: 14.5px; line-height: 1.6; }
.card-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: auto; padding-top: 10px; font-size: 13px; color: var(--muted); }
.card-foot .link-arrow { font-size: 14px; position: relative; z-index: 1; }

/* Placeholder art for projects without a screenshot */
.card-placeholder {
  position: relative; width: 100%; height: 100%; overflow: hidden;
  display: grid; place-items: center;
  background: linear-gradient(135deg, hsl(var(--h) 70% 55%), hsl(calc(var(--h) + 40) 70% 45%));
}
.card-placeholder span { font-family: var(--font-display); font-weight: 800; font-size: clamp(40px, 8vw, 64px); color: rgba(255,255,255,.92); letter-spacing: -0.04em; position: relative; z-index: 1; }
.card-placeholder.small span { font-size: 16px; }
.card-placeholder i { position: absolute; border-radius: 22%; background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.18); width: 42%; aspect-ratio: 9 / 16; transform: rotate(-12deg); }
.card-placeholder i:nth-child(2) { left: -8%; top: 22%; }
.card-placeholder i:nth-child(3) { right: -6%; top: -30%; width: 34%; }
.card-placeholder i:nth-child(4) { right: 18%; bottom: -55%; width: 30%; transform: rotate(18deg); }

/* ---------- Experience ---------- */
.timeline { position: relative; display: grid; gap: 20px; max-width: 1000px; }
.timeline::before { content: ""; position: absolute; left: 19px; top: 16px; bottom: 16px; width: 2px; background: var(--border); }
.tl-item { position: relative; display: grid; grid-template-columns: 40px 1fr; gap: 20px; }
.tl-dot { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--surface); border: 2px solid var(--border); color: var(--accent-text); z-index: 1; }
.tl-dot svg { width: 18px; height: 18px; }
.tl-item.current .tl-dot { border-color: var(--accent); background: var(--accent-soft); }
.tl-dot.logo { background: #fff; border-color: var(--border); }
.tl-dot.logo img { width: 28px; height: 28px; object-fit: contain; }
.tl-item.current .tl-dot.logo { border-color: var(--accent); }
.tl-card { padding: 22px 24px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-sm); }
.tl-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 16px; }
.tl-card h3 { font-size: 19px; }
.tl-card .company { color: var(--accent-text); font-weight: 600; font-size: 15px; }
.tl-card .period { font-size: 13.5px; color: var(--muted); white-space: nowrap; }
.tl-card p { margin-top: 10px; color: var(--text-2); font-size: 15px; }
.tl-card .tags { margin-top: 14px; }

/* ---------- About + Skills ---------- */
.about-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; align-items: start; }
.about-text h2 { font-size: clamp(28px, 4vw, 40px); margin-top: 10px; margin-bottom: 20px; }
.about-text p { color: var(--text-2); font-size: 17px; }
.about-text p + p { margin-top: 14px; }
.about-text .btn { margin-top: 28px; }
.skills { display: grid; gap: 16px; }
.logo-row { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; }
.logo-tile {
  display: grid; justify-items: center; gap: 8px; padding: 14px 6px 10px; border-radius: 14px;
  background: #fff; border: 1px solid var(--border); color: #4d4b5e;
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}
.logo-tile:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--muted); }
.logo-tile img { width: 30px; height: 30px; }
.logo-tile span { font-size: 11.5px; font-weight: 600; text-align: center; line-height: 1.2; }
.skill-group { padding: 20px 22px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); }
.skill-group h3 { font-size: 13px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-bottom: 12px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 7px 13px; border-radius: 999px; font-size: 14px; font-weight: 500; background: var(--surface-2); border: 1px solid var(--border); color: var(--text); }
.chip.primary { background: var(--accent-soft); border-color: transparent; color: var(--accent-text); font-weight: 600; }

/* ---------- Contact ---------- */
.contact-wrap {
  display: grid; grid-template-columns: .9fr 1.1fr; gap: 48px;
  padding: 48px; border-radius: 28px;
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-md);
  position: relative; overflow: hidden;
}
.contact-wrap::before { content: ""; position: absolute; width: 400px; height: 400px; right: -160px; top: -200px; border-radius: 50%; background: var(--glow-1); filter: blur(70px); pointer-events: none; }
.contact-wrap.single { grid-template-columns: 1fr; text-align: center; padding: 48px 32px; }
.contact-wrap.single .contact-info { max-width: 560px; margin: 0 auto; }
.contact-wrap.single .eyebrow { justify-content: center; }
.contact-info, .form { position: relative; }
.contact-info h2 { font-size: clamp(28px, 4vw, 38px); margin-top: 10px; }
.contact-info > p { color: var(--text-2); margin-top: 14px; font-size: 16.5px; }
.contact-cta { display: flex; justify-content: center; gap: 12px; flex-wrap: wrap; margin-top: 24px; }
.contact-list { display: grid; gap: 12px; margin-top: 28px; }
.contact-list a, .contact-list li { display: flex; align-items: center; gap: 12px; font-weight: 500; }
.contact-list .ic { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-text); flex: none; }
.contact-list .ic svg { width: 18px; height: 18px; }
.contact-list a:hover { color: var(--accent-text); }
.form { display: grid; gap: 14px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field { display: grid; gap: 6px; }
.field label { font-size: 13.5px; font-weight: 600; color: var(--text-2); }
.field input, .field textarea { width: 100%; padding: 12px 14px; border-radius: var(--radius-sm); background: var(--bg); border: 1px solid var(--border); color: var(--text); font: inherit; font-size: 15px; transition: border-color .2s ease, box-shadow .2s ease; }
.field textarea { min-height: 140px; resize: vertical; }
.field input:focus, .field textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--ring); }
.form-actions { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.form-status { font-size: 14px; }
.form-status.ok { color: #16a34a; }
.form-status.err { color: #dc2626; }
.honeypot { position: absolute; left: -9999px; }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--border); padding: 40px 0 32px; }
.footer-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 20px; }
.footer-row .nav a { font-size: 14px; }
.footer-social { display: flex; gap: 4px; }
.footer-social a { width: 36px; height: 36px; border-radius: 999px; display: grid; place-items: center; color: var(--text-2); transition: all .2s; }
.footer-social a:hover { color: var(--accent-text); background: var(--surface-2); }
.footer-social svg { width: 18px; height: 18px; }
.copyright { margin-top: 24px; font-size: 13.5px; color: var(--muted); display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; }

/* ---------- Projects page ---------- */
.page-hero { padding: 72px 0 40px; position: relative; overflow: hidden; }
.page-hero::before { content: ""; position: absolute; width: 520px; height: 520px; right: -160px; top: -240px; border-radius: 50%; background: var(--glow-1); filter: blur(80px); pointer-events: none; }
.page-hero .container { position: relative; }
.page-hero h1 { font-size: clamp(36px, 5vw, 56px); font-weight: 800; margin-top: 12px; }
.page-hero p { color: var(--text-2); font-size: 17px; max-width: 600px; margin-top: 16px; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin: 36px 0 0; }
.filter-btn { display: inline-flex; align-items: center; padding: 9px 16px; border-radius: 999px; font-size: 14px; font-weight: 600; color: var(--text-2); background: var(--surface); border: 1px solid var(--border); transition: all .2s ease; }
.filter-btn:hover { color: var(--text); border-color: var(--muted); }
.filter-btn .count { margin-left: 6px; font-weight: 500; opacity: .6; }
.group-cards { scroll-margin-top: calc(var(--header-h) + 24px); }

/* ---------- Project detail page ---------- */
.project-hero { padding: 48px 0 8px; }
.back { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 600; color: var(--text-2); transition: color .2s ease; }
.back svg { width: 16px; height: 16px; }
.back:hover { color: var(--accent-text); }
.project-title-row { display: flex; align-items: center; gap: 20px; margin-top: 32px; }
.project-title-row img { width: 72px; height: 72px; border-radius: 18px; box-shadow: var(--shadow-md); border: 1px solid var(--border); flex: none; }
.project-hero h1 { font-size: clamp(34px, 5vw, 56px); font-weight: 800; margin-top: 10px; }
.project-meta { color: var(--muted); margin-top: 6px; font-size: 15px; }
.project-lead { font-family: var(--font-serif); font-style: italic; font-size: clamp(22px, 2.6vw, 30px); line-height: 1.3; color: var(--text); max-width: 760px; margin-top: 24px; }
.project-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }
.project-media { margin-top: 40px; }
.screens-row {
  display: flex; flex-wrap: wrap; justify-content: center; align-items: flex-start; gap: 28px;
  padding: 48px 24px; border-radius: 28px; border: 1px solid var(--border);
  background: linear-gradient(135deg, hsl(var(--h) 70% 94%), hsl(calc(var(--h) + 40) 60% 90%));
}
:root[data-theme="dark"] .screens-row { background: linear-gradient(135deg, hsl(var(--h) 40% 18%), hsl(calc(var(--h) + 40) 40% 12%)); }
.screens-row .phone { --phone-w: 230px; }
.project-image { width: 100%; border-radius: 24px; border: 1px solid var(--border); box-shadow: var(--shadow-md); margin-top: 24px; }
.project-placeholder { height: clamp(200px, 30vw, 340px); border-radius: 24px; overflow: hidden; }
.project-body { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(280px, .8fr); gap: 48px; margin-top: 56px; }
.project-text h2 { font-size: 26px; margin-bottom: 16px; }
.project-text p { color: var(--text-2); font-size: 17px; }
.project-text p + p { margin-top: 14px; }
.project-facts { padding: 24px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); align-self: start; position: sticky; top: calc(var(--header-h) + 24px); }
.project-facts dl { display: grid; gap: 18px; margin: 0; }
.project-facts dt { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.project-facts dd { margin: 6px 0 0; font-weight: 500; }
.project-facts .links { display: grid; gap: 10px; margin-top: 22px; padding-top: 22px; border-top: 1px solid var(--border); }
.project-facts .links a { display: flex; align-items: center; gap: 10px; font-weight: 600; color: var(--accent-text); }
.project-facts .links svg { width: 18px; height: 18px; flex: none; }
.project-facts .links svg:last-child { width: 14px; height: 14px; margin-left: auto; }
.project-next { margin-top: 96px; }
.not-found { padding: 96px 0; text-align: center; display: grid; justify-items: center; gap: 14px; }
.not-found h1 { font-size: clamp(32px, 5vw, 48px); }
.not-found p { color: var(--text-2); }

/* ---------- Page transitions (browsers that support cross-document view transitions) ---------- */
@view-transition { navigation: auto; }
::view-transition-old(root) { animation: 220ms ease-out both vt-out; }
::view-transition-new(root) { animation: 320ms ease-out both vt-in; }
@keyframes vt-out { to { opacity: 0; transform: translateY(-8px); } }
@keyframes vt-in { from { opacity: 0; transform: translateY(10px); } }
.not-found .contact-cta { margin-top: 12px; }

/* ---------- Resume page ---------- */
.resume { padding: 48px 24px 96px; }
.resume-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; flex-wrap: wrap; padding-bottom: 32px; border-bottom: 1px solid var(--border); }
.resume-head h1 { font-size: clamp(34px, 5vw, 52px); font-weight: 800; margin-top: 10px; }
.resume-title { color: var(--text-2); font-size: 17px; margin-top: 8px; }
.resume-title .sep { color: var(--muted); margin: 0 4px; }
.resume-contacts { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 14px; font-size: 14.5px; }
.resume-contacts a { color: var(--accent-text); font-weight: 500; }
.resume-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.resume-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(260px, .7fr); gap: 48px; margin-top: 40px; }
.resume-section + .resume-section { margin-top: 40px; }
.resume-section h2 { font-size: 13px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--accent-text); padding-bottom: 10px; border-bottom: 1px solid var(--border); margin-bottom: 18px; }
.resume-section > p { color: var(--text-2); font-size: 16px; }
.resume-item + .resume-item { margin-top: 22px; }
.resume-item-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px 16px; flex-wrap: wrap; }
.resume-item h3 { font-size: 17px; }
.resume-item h3 a:hover { color: var(--accent-text); }
.resume-item .org { display: block; color: var(--accent-text); font-weight: 600; font-size: 14.5px; margin-top: 2px; }
.resume-item .when { font-size: 13.5px; color: var(--muted); white-space: nowrap; }
.resume-item ul { list-style: disc; padding-left: 18px; margin-top: 8px; display: grid; gap: 6px; }
.resume-item li, .resume-item > p { color: var(--text-2); font-size: 15px; }
.resume-item > p { margin-top: 6px; }
.resume-item li a, .resume-item p a { color: var(--text); font-weight: 600; border-bottom: 1px solid var(--border); }
.resume-item .tech { font-size: 13.5px; color: var(--muted); }
.resume-more { margin-top: 18px; }
.resume-note h3 { font-size: 15px; color: var(--text-2); }
.resume-skills { display: grid; gap: 14px; margin: 0; }
.resume-skills dt { font-size: 13px; font-weight: 700; color: var(--text); }
.resume-skills dd { margin: 2px 0 0; color: var(--text-2); font-size: 14.5px; }
.resume-highlights { display: grid; gap: 10px; color: var(--text-2); font-size: 14.5px; }
.resume-highlights strong { display: inline-block; min-width: 64px; font-family: var(--font-display); font-size: 17px; color: var(--text); }
@media (max-width: 880px) { .resume-grid { grid-template-columns: 1fr; gap: 32px; } }

/* ---------- Print (resume) ---------- */
@media print {
  html, body { height: auto; overflow: visible; }
  :root, :root[data-theme="dark"] { --bg: #fff; --surface: #fff; --text: #111; --text-2: #333; --muted: #555; --border: #ddd; --accent-text: #4c1d95; }
  body { background: #fff; color: #111; font-size: 12.5px; }
  .site-header, .mobile-nav, .site-footer, .to-top, .no-print { display: none !important; }
  .container, .resume { max-width: none; padding: 0; }
  .resume-head { padding-bottom: 14px; }
  .resume-head h1 { font-size: 28px; }
  .resume-grid { grid-template-columns: 1.7fr .8fr; gap: 28px; margin-top: 18px; }
  .resume-section + .resume-section { margin-top: 18px; }
  .resume-item + .resume-item { margin-top: 10px; }
  .resume-item li, .resume-item > p, .resume-section > p { font-size: 12px; }
  .resume-item li a, .resume-item p a { border-bottom: 0; color: #111; }
  .reveal { opacity: 1 !important; transform: none !important; }
  a[href^="http"]::after { content: none; }
  @page { margin: 14mm; }
}

/* ---------- Reveal on scroll ---------- */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity .6s ease, transform .6s ease; }
.reveal.in { opacity: 1; transform: none; }
.reveal[data-delay="1"] { transition-delay: .08s; }
.reveal[data-delay="2"] { transition-delay: .16s; }
.reveal[data-delay="3"] { transition-delay: .24s; }

/* ---------- Back to top ---------- */
.to-top {
  position: fixed; right: 20px; bottom: 20px; z-index: 40;
  width: 44px; height: 44px; border-radius: 999px; display: grid; place-items: center;
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-md); color: var(--text-2);
  opacity: 0; transform: translateY(12px); pointer-events: none; transition: all .25s ease;
}
.to-top.show { opacity: 1; transform: none; pointer-events: auto; }
.to-top svg { width: 18px; height: 18px; }

/* ---------- Responsive ---------- */
/* ---------- Wide screens: full width, with the gutter doing the framing ---------- */
@media (min-width: 1280px) {
  :root { --gutter: 56px; }
  .hero .container { gap: 72px; }
  .hero-photo, .hero-glow { width: min(100%, 300px); }
  .hero-visual { width: min(100%, 470px); margin-inline: auto; }
  .hero-visual .ring { width: 410px; height: 410px; }
  /* Experience: heading beside the timeline instead of a stranded right margin. */
  #experience .container { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 64px; align-items: start; }
  #experience .section-head { margin-bottom: 0; position: sticky; top: calc(var(--header-h) + 40px); }
  /* Cards can span the screen, but their text should not run past a readable measure. */
  #experience .timeline { max-width: 1150px; }
  .contact-wrap { max-width: 1500px; margin-inline: auto; }
  .about-text p, .section-head p { max-width: 60ch; }
}
@media (min-width: 1800px) {
  :root { --gutter: 88px; }
  .hero-photo, .hero-glow { width: min(100%, 330px); }
  .showcase-stage { max-width: 1600px; margin-inline: auto; width: 100%; }
  .showcase-rail { max-width: 1600px; margin-inline: auto; }
}

@media (max-width: 1140px) {
  .scroll-hint { display: none; }
}
@media (max-width: 1080px) {
  .site-header .nav, .header-cta { display: none; }
  .menu-btn { display: flex; }
  /* Compact pills so the rail clears the floating back-to-top button.
     The active app is still named in the caption under the phone. */
  .rail-item .rail-name { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
}
@media (max-width: 1024px) {
  .hero .container { grid-template-columns: 1fr 1fr; gap: 40px; }
  .hero-visual .ring { display: none; }
  .showcase-stage { gap: 32px; }
}
@media (max-width: 880px) {
  /* A 72px bar is a lot of a phone screen, so it is shorter here. It stays
     put: nothing moves it in or out while the page scrolls. */
  :root { --header-h: 60px; }
  .nav, .header-cta { display: none; }
  .menu-btn { display: flex; }
  .hero { padding: 40px 0 72px; }
  .hero .container { grid-template-columns: 1fr; gap: 44px; }
  .hero-visual { order: 1; margin-top: 8px; }
  .hero-photo, .hero-glow { width: min(100%, 300px); }
  .hero-visual { display: flex; flex-direction: column; align-items: center; gap: 14px; }
  .hero-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; width: 100%; }
  .float-card { position: static; animation: none; padding: 10px 12px; gap: 10px; min-width: 0; }
  .float-card .ic { width: 32px; height: 32px; }
  .float-card .ic svg { width: 17px; height: 17px; }
  .float-card strong { font-size: 15px; }
  .float-card small { font-size: 11.5px; line-height: 1.35; }
  .hero-glow { display: none; }
  .about-grid { grid-template-columns: 1fr; }
  .logo-row { grid-template-columns: repeat(4, 1fr); }
  .contact-wrap { grid-template-columns: 1fr; padding: 32px 24px; gap: 32px; }
  .section { padding-block: 72px; }
  #open-source.section { padding-top: 72px; }
  .stats { padding-bottom: 72px; }
  .section-head { flex-direction: column; align-items: flex-start; margin-bottom: 28px; }

  /* How far you have to scroll for the next screen. Shorter on phones than it
     looks like it should be: iOS spends the first part of an upward gesture
     growing its URL bar rather than scrolling - measured at ~100px of viewport
     change across a flick - and the page then catches up in a lurch of up to
     160px. A smaller step means less of the gesture passes before the picture
     answers. */
  .showcase { --step: calc(var(--vh) * .2); }
  .showcase-pin { padding: 8px 0 12px; grid-template-rows: 1fr auto; }
  .showcase-stage { grid-template-columns: 1fr; gap: 12px; align-content: center; }
  .stage-phone { order: -1; gap: 8px; }
  .phone-lg { --phone-w: clamp(104px, calc((var(--vh) - var(--header-h) - 400px) / 2.4), 178px); }
  .stage-text { min-height: 250px; }

  .panel-desc { display: none; }
  .panel-highlights { display: none; }
  .stage-copy .chips { display: none; }
  .panel-title { margin-top: 8px; gap: 12px; }
  .panel-title h3 { font-size: 24px; }
  .panel-tagline { font-size: 19px; margin-top: 10px; }
  .panel-actions { margin-top: 16px; gap: 10px; }
  .btn-store { padding: 6px 12px 6px 10px; }
  .btn-store span { font-size: 14px; }
  .rail-item .rail-name { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .scroll-hint { display: none; }
  .to-top { display: none; }
  .shelf-card { flex-basis: 260px; }
  .project-body { grid-template-columns: 1fr; gap: 32px; }
  .project-facts { position: static; }
  .screens-row { gap: 16px; padding: 28px 12px; }
  .screens-row .phone { --phone-w: 150px; }
}
@media (max-width: 600px) {
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
  .stat { padding: 18px; }
  .stat strong { font-size: 30px; }
  .form-row { grid-template-columns: 1fr; }
  .hero-actions .btn { flex: 1 1 100%; }
  .footer-row .nav { display: none; }
  .tl-item { grid-template-columns: 32px 1fr; gap: 14px; }
  .tl-dot { width: 32px; height: 32px; }
  .tl-dot svg { width: 15px; height: 15px; }
  .tl-dot.logo img { width: 22px; height: 22px; }
  .timeline::before { left: 15px; }
  .float-card strong { font-size: 15px; }
  .panel-title img { width: 44px; height: 44px; }
  .project-title-row img { width: 56px; height: 56px; }
  .screens-row .phone { --phone-w: 130px; }
  .shelf-nav { display: none; }
  .shelf-card { flex-basis: 240px; }
  .logo-row { grid-template-columns: repeat(3, 1fr); }
  .shelf-wrap::before, .shelf-wrap::after { width: 28px; }
}

/* Short viewports: the pinned stage has a fixed height, so its content has to
   shrink or it collides with the rail underneath. */
@media (max-width: 880px) and (max-height: 720px) {
  .panel-tagline { display: none; }
  .stage-text { min-height: 168px; }
  .phone-lg { --phone-w: clamp(96px, calc((var(--vh) - var(--header-h) - 400px) / 2.4), 150px); }
  .panel-title { margin-top: 6px; gap: 10px; }
  .panel-title img { width: 38px; height: 38px; }
  .panel-title h3 { font-size: 20px; }
  .panel-client { font-size: 12.5px; }
  .panel-actions { margin-top: 12px; }
  .stage-phone { gap: 4px; }
  .showcase-rail { gap: 8px; margin-top: 4px; }
}

/* Below roughly 620px of height - a phone held sideways - there is no room for
   the mockup as well as the text and the rail. Drop the mockup rather than
   squash it into the buttons. */
@media (max-width: 880px) and (max-height: 620px) {
  .stage-phone { display: none; }
  .showcase-stage { align-content: center; }
}

/* ---------- Very small phones ---------- */
@media (max-width: 360px) {
  :root { --gutter: 16px; }
  .site-header .container { gap: 10px; }
  .brand { font-size: 15px; gap: 8px; }
  .brand-mark { width: 32px; height: 32px; }
  .brand-mark svg { width: 18px; height: 18px; }
  .hero-badge { font-size: 12px; }
  .float-card strong { font-size: 14px; }
  .float-card small { font-size: 11px; }
}

@media (prefers-reduced-motion: reduce) {
  body { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
  .float-card { animation: none; }
  .scroll-hint svg { animation: none; }
  ::view-transition-old(root), ::view-transition-new(root) { animation: none; }
  * { transition-duration: .01ms !important; }
}
