/* ==========================================================================
   Rayan Benhabiles - Portfolio
   Direction artistique reprise du CV : fond blanc, cadre fin périwinkle,
   bandeau plein, nom en capitales légères, Inter.
   ========================================================================== */

:root {
  /* Primitives */
  --periwinkle-500: #7377b5;
  --periwinkle-600: #5d61a3;
  --periwinkle-700: #4a4e8f;   /* texte accent : 7.0:1 sur blanc */
  --periwinkle-100: #ecedf8;
  --periwinkle-50:  #f6f6fc;
  --ink-900: #17182b;
  --ink-700: #3a3c52;
  --ink-500: #5c5f75;          /* texte secondaire : 6.1:1 sur blanc */
  --line:    #e4e5f0;
  --white:   #ffffff;

  /* Semantic tokens */
  --bg: var(--white);
  --surface: var(--periwinkle-50);
  --fg: var(--ink-900);
  --fg-muted: var(--ink-500);
  --accent: var(--periwinkle-500);
  --accent-ink: var(--periwinkle-700);
  --accent-soft: var(--periwinkle-100);
  --border: var(--line);
  --ring: var(--periwinkle-600);

  /* Type */
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "Cascadia Code", Consolas, monospace;

  /* Spacing (8pt) */
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px; --s8: 64px; --s9: 96px; --s10: 128px;

  /* Motion */
  --ease-out: cubic-bezier(.16, 1, .3, 1);   /* expo.out */
  --ease-in-out: cubic-bezier(.65, 0, .35, 1);
  --t-fast: 180ms;
  --t-med: 320ms;
  --t-slow: 900ms;

  /* Layers */
  --z-nav: 40; --z-cursor: 60; --z-modal: 100; --z-loader: 1000;

  --radius: 14px;
  --container: 1200px;
  --frame: 3px;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  color: var(--fg);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
body.is-loading { overflow: hidden; }
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; }
button { font: inherit; color: inherit; cursor: pointer; }
svg { width: 1em; height: 1em; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.mono { font-family: var(--mono); font-size: .8125rem; }
::selection { background: var(--accent); color: var(--white); }

:focus-visible { outline: 3px solid var(--ring); outline-offset: 3px; border-radius: 4px; }

.skip {
  position: fixed; left: var(--s4); top: -60px; z-index: 2000;
  background: var(--fg); color: var(--white); padding: var(--s2) var(--s4); border-radius: 8px; text-decoration: none;
  transition: top var(--t-fast);
}
.skip:focus { top: var(--s4); }

/* ---------- Loader ---------------------------------------------------- */
.loader {
  position: fixed; inset: 0; z-index: var(--z-loader);
  display: grid; place-items: center;
  background: var(--bg);
  transition: opacity 500ms var(--ease-out), visibility 500ms;
}
.loader.is-done { opacity: 0; visibility: hidden; }
.loader-frame { position: absolute; width: min(48vw, 260px); height: min(62vw, 340px); overflow: visible; }
.loader-frame path {
  fill: none; stroke: var(--accent); stroke-width: 3; vector-effect: non-scaling-stroke;
  stroke-dasharray: 700; stroke-dashoffset: 700;
  animation: draw 1.1s var(--ease-in-out) forwards;
}
.loader-name { display: grid; font-weight: 300; font-size: clamp(1.6rem, 5vw, 2.6rem); letter-spacing: .08em; line-height: 1.2; }
.loader-name span { overflow: hidden; display: block; }
.loader-name span { animation: rise .8s var(--ease-out) both; }
.loader-name span:nth-child(2) { animation-delay: .12s; }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes rise { from { transform: translateY(110%); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- Cursor + progress ----------------------------------------- */
.cursor {
  position: fixed; left: 0; top: 0; z-index: var(--z-cursor);
  width: 28px; height: 28px; margin: -14px 0 0 -14px;
  border: 1.5px solid var(--accent); border-radius: 50%;
  pointer-events: none; opacity: 0;
  transition: width var(--t-fast) var(--ease-out), height var(--t-fast) var(--ease-out), margin var(--t-fast) var(--ease-out), background var(--t-fast), opacity var(--t-fast);
}
.cursor.is-visible { opacity: 1; }
.cursor.is-hover { width: 56px; height: 56px; margin: -28px 0 0 -28px; background: color-mix(in srgb, var(--accent) 14%, transparent); }
@media (hover: none), (pointer: coarse) { .cursor { display: none; } }

.progress {
  position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: calc(var(--z-nav) + 1);
  background: var(--accent); transform-origin: 0 50%; transform: scaleX(0);
}

/* ---------- Nav -------------------------------------------------------- */
.nav {
  position: fixed; inset: 0 0 auto 0; z-index: var(--z-nav);
  display: flex; align-items: center; justify-content: space-between; gap: var(--s5);
  padding: var(--s4) clamp(var(--s4), 4vw, var(--s7));
  transition: background var(--t-med), box-shadow var(--t-med), padding var(--t-med) var(--ease-out);
}
.nav.is-scrolled {
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  box-shadow: 0 1px 0 var(--border);
  padding-block: var(--s3);
}
.nav-logo { font-weight: 700; font-size: 1.25rem; text-decoration: none; letter-spacing: .02em; min-height: 44px; display: inline-flex; align-items: center; }
.nav-logo span { color: var(--accent); }
.nav-links { display: flex; gap: var(--s1); list-style: none; margin: 0; padding: 0; }
.nav-links a {
  position: relative; display: inline-flex; align-items: center; min-height: 44px; padding: 0 var(--s3);
  text-decoration: none; font-size: .9375rem; font-weight: 500; color: var(--ink-700);
  transition: color var(--t-fast);
}
.nav-links a::after {
  content: ""; position: absolute; left: var(--s3); right: var(--s3); bottom: 8px; height: 2px;
  background: var(--accent); transform: scaleX(0); transform-origin: right; transition: transform var(--t-med) var(--ease-out);
}
.nav-links a:hover, .nav-links a.is-active { color: var(--fg); }
.nav-links a:hover::after, .nav-links a.is-active::after { transform: scaleX(1); transform-origin: left; }
.nav-actions { display: flex; align-items: center; gap: var(--s3); }

.lang {
  position: relative; display: inline-flex; padding: 4px; border: 1px solid var(--border); border-radius: 999px; background: var(--bg);
}
.lang button {
  position: relative; z-index: 1; border: 0; background: none; min-width: 44px; min-height: 36px; padding: 0 var(--s2);
  font-size: .8125rem; font-weight: 600; letter-spacing: .04em; border-radius: 999px; color: var(--fg-muted);
  transition: color var(--t-med);
}
.lang button[aria-pressed="true"] { color: var(--white); }
.lang-pill {
  position: absolute; top: 4px; bottom: 4px; left: 4px; width: 44px; border-radius: 999px; background: var(--accent);
  transition: transform var(--t-med) var(--ease-out);
}
.lang[data-active="en"] .lang-pill { transform: translateX(100%); }

.burger { display: none; width: 44px; height: 44px; border: 1px solid var(--border); background: var(--bg); border-radius: 50%; position: relative; }
.burger span { position: absolute; left: 13px; right: 13px; height: 2px; background: var(--fg); transition: transform var(--t-med) var(--ease-out); }
.burger span:first-child { top: 17px; } .burger span:last-child { top: 25px; }
.burger[aria-expanded="true"] span:first-child { transform: translateY(4px) rotate(45deg); }
.burger[aria-expanded="true"] span:last-child { transform: translateY(-4px) rotate(-45deg); }

/* ---------- Buttons ---------------------------------------------------- */
.btn {
  --bg-btn: var(--accent);
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s2);
  min-height: 48px; padding: 0 var(--s5);
  border: 1.5px solid var(--bg-btn); border-radius: 999px;
  background: var(--bg-btn); color: var(--white);
  font-weight: 600; font-size: .9375rem; text-decoration: none;
  transition: transform var(--t-fast) var(--ease-out), background var(--t-fast), color var(--t-fast), box-shadow var(--t-med);
  touch-action: manipulation;
}
.btn svg { font-size: 1.1em; transition: transform var(--t-med) var(--ease-out); }
.btn:hover { background: var(--periwinkle-600); border-color: var(--periwinkle-600); box-shadow: 0 10px 30px -10px color-mix(in srgb, var(--accent) 70%, transparent); }
.btn:hover svg { transform: translateX(3px); }
.btn:active { transform: scale(.97); }
.btn-small { min-height: 40px; padding: 0 var(--s4); font-size: .875rem; }
.btn-ghost { background: transparent; color: var(--accent-ink); }
.btn-ghost:hover { background: var(--accent-soft); color: var(--accent-ink); box-shadow: none; }
.btn-light { --bg-btn: var(--white); color: var(--accent-ink); }
.btn-light:hover { background: var(--white); border-color: var(--white); color: var(--fg); }
.btn-outline-light { background: transparent; border-color: rgba(255,255,255,.6); color: var(--white); }
.btn-outline-light:hover { background: rgba(255,255,255,.12); border-color: var(--white); }

.link {
  display: inline-flex; align-items: center; min-height: 44px; font-weight: 600; color: var(--accent-ink);
  text-decoration: underline; text-decoration-thickness: 1.5px; text-underline-offset: 5px;
  text-decoration-color: color-mix(in srgb, var(--accent) 40%, transparent);
  transition: text-decoration-color var(--t-fast);
}
.link:hover { text-decoration-color: var(--accent); }

/* ---------- Hero ------------------------------------------------------- */
.hero {
  position: relative; min-height: 100svh;
  display: flex; flex-direction: column; justify-content: center;
  padding: var(--s10) clamp(var(--s4), 6vw, var(--s9)) var(--s9);
  max-width: 1440px; margin: 0 auto;
}
/* le cadre du CV : haut (partiel), gauche, bas */
.hero-frame { position: absolute; inset: 88px clamp(var(--s3), 3vw, var(--s6)) var(--s6); pointer-events: none; }
.hero-frame span { position: absolute; background: var(--accent); }
.f-top    { top: 0; left: 0; height: var(--frame); width: 38%; transform-origin: left; transform: scaleX(0); }
.f-left   { top: 0; left: 0; width: var(--frame); bottom: 0; transform-origin: top; transform: scaleY(0); }
.f-bottom { bottom: 0; left: 0; height: var(--frame); width: 38%; transform-origin: left; transform: scaleX(0); }
.is-ready .f-top { animation: growX 1s .1s var(--ease-out) forwards; }
.is-ready .f-left { animation: growY 1.1s .25s var(--ease-out) forwards; }
.is-ready .f-bottom { animation: growX 1s .9s var(--ease-out) forwards; }
.f-top::after { content: ""; position: absolute; right: 0; top: 0; width: var(--frame); height: 40px; background: var(--accent); }
@keyframes growX { to { transform: scaleX(1); } }
@keyframes growY { to { transform: scaleY(1); } }

.hero-grid { position: relative; display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: var(--s8); align-items: end; padding-left: clamp(var(--s5), 4vw, var(--s8)); }
.eyebrow {
  display: inline-flex; align-items: center; gap: var(--s2); margin: 0 0 var(--s5);
  padding: var(--s2) var(--s4); border: 1px solid var(--border); border-radius: 999px;
  font-size: .8125rem; font-weight: 500; color: var(--ink-700); background: var(--bg);
}
.eyebrow .dot { width: 8px; height: 8px; border-radius: 50%; background: #2fa36b; box-shadow: 0 0 0 0 rgba(47,163,107,.5); animation: pulse 2.4s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 10px rgba(47,163,107,0); } 100% { box-shadow: 0 0 0 0 rgba(47,163,107,0); } }

.hero-name {
  margin: 0; font-weight: 300; text-transform: uppercase; letter-spacing: .06em; line-height: 1.02;
  font-size: clamp(3rem, 6.1vw, 7.6rem);
  white-space: nowrap;
}
@media (max-width: 1100px) { .hero-name { font-size: min(10.4vw, 7rem); } }
.hero-name .line { display: block; overflow: hidden; padding-bottom: .04em; }
.hero-name .char { display: inline-block; transform: translateY(105%); }
.is-ready .hero-name .char { animation: charUp .9s var(--ease-out) forwards; animation-delay: calc(var(--i) * 35ms + 150ms); }
@keyframes charUp { to { transform: none; } }

.hero-band {
  position: relative; display: inline-block; margin: var(--s5) 0 var(--s5) calc(-1 * clamp(var(--s5), 4vw, var(--s8)) - clamp(var(--s3), 3vw, var(--s6)));
  padding: var(--s3) var(--s6) var(--s3) calc(clamp(var(--s5), 4vw, var(--s8)) + clamp(var(--s3), 3vw, var(--s6)));
  color: var(--white); font-weight: 700; font-size: clamp(1rem, 1.7vw, 1.3rem);
  clip-path: inset(0 100% 0 0);
}
.hero-band::before { content: ""; position: absolute; inset: 0; background: var(--accent); z-index: -1; }
.hero-band { isolation: isolate; }
.is-ready .hero-band { animation: wipe 1s .7s var(--ease-out) forwards; }
@keyframes wipe { to { clip-path: inset(0 0 0 0); } }

.hero-summary { max-width: 58ch; margin: 0 0 var(--s6); font-size: clamp(1rem, 1.25vw, 1.125rem); font-style: italic; color: var(--ink-700); }
.hero-summary strong { font-style: normal; color: var(--fg); }
.hero-ctas { display: flex; flex-wrap: wrap; gap: var(--s3); }

.hero-side { display: grid; gap: var(--s5); }
.meta { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s2); justify-items: end; text-align: right; font-size: .9375rem; color: var(--ink-700); }
.meta li { display: flex; align-items: center; gap: var(--s2); }
.meta svg { color: var(--accent); font-size: 1.1rem; }
.meta a { text-decoration: none; min-height: 32px; display: inline-flex; align-items: center; }
.meta a:hover { color: var(--accent-ink); text-decoration: underline; text-underline-offset: 4px; }
.meta li:last-child a { font-weight: 700; color: var(--accent-ink); }

.terminal { border-radius: var(--radius); background: #15162a; color: #d9dbf5; box-shadow: 0 30px 60px -30px rgba(23,24,43,.55); overflow: hidden; }
.terminal-bar { display: flex; align-items: center; gap: 6px; padding: 10px 14px; background: #1e2038; font-family: var(--mono); font-size: .75rem; color: #9da0c8; }
.terminal-bar i { width: 10px; height: 10px; border-radius: 50%; background: #3a3d63; }
.terminal-bar i:first-child { background: #ff6b81; } .terminal-bar i:nth-child(2) { background: #ffc66b; } .terminal-bar i:nth-child(3) { background: #6be3a0; }
.terminal-bar span { margin-left: var(--s2); }
.terminal pre { margin: 0; padding: var(--s4) var(--s4) var(--s5); min-height: 196px; font-family: var(--mono); font-size: .8125rem; line-height: 1.7; white-space: pre-wrap; }
.terminal .k { color: #a6aaf0; } .terminal .s { color: #6be3a0; } .terminal .c { color: #7d80a8; }
.caret { display: inline-block; width: 8px; height: 1.1em; vertical-align: -3px; background: #a6aaf0; animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

.scroll-hint { position: absolute; left: 50%; bottom: var(--s5); width: 26px; height: 42px; margin-left: -13px; border: 1.5px solid var(--ink-500); border-radius: 14px; }
.scroll-hint span { position: absolute; left: 50%; top: 8px; width: 3px; height: 8px; margin-left: -1.5px; border-radius: 2px; background: var(--accent); animation: wheel 1.8s var(--ease-in-out) infinite; }
@keyframes wheel { 0% { transform: none; opacity: 1; } 80% { transform: translateY(14px); opacity: 0; } 100% { opacity: 0; } }

/* ---------- Stats ------------------------------------------------------ */
.stats {
  display: grid; grid-template-columns: repeat(4, 1fr);
  max-width: var(--container); margin: 0 auto var(--s9); padding: 0 var(--s5);
}
.stat { padding: var(--s5) var(--s5) var(--s5) var(--s5); border-left: var(--frame) solid var(--accent-soft); transition: border-color var(--t-med); }
.stat:hover { border-left-color: var(--accent); }
.stat b { display: flex; align-items: baseline; gap: var(--s2); font-size: clamp(2.25rem, 4vw, 3.25rem); font-weight: 300; line-height: 1.1; font-variant-numeric: tabular-nums; color: var(--accent-ink); }
.stat b small { font-size: 1rem; font-weight: 500; }
.stat > span { display: block; margin-top: var(--s2); color: var(--fg-muted); font-size: .9375rem; line-height: 1.5; }

/* ---------- Sections --------------------------------------------------- */
.section { max-width: var(--container); margin: 0 auto; padding: var(--s9) var(--s5); scroll-margin-top: 40px; }
.section-head { position: relative; display: grid; grid-template-columns: auto 1fr; column-gap: var(--s5); align-items: baseline; margin-bottom: var(--s7); }
.section-index { font-family: var(--mono); font-size: .875rem; color: var(--accent-ink); padding-top: .6em; }
.section-head h2 { margin: 0; font-size: clamp(2.25rem, 5vw, 3.75rem); font-weight: 700; letter-spacing: -.02em; line-height: 1.1; }
.section-head h2::after { content: ""; display: block; width: 64px; height: var(--frame); margin-top: var(--s4); background: var(--accent); transform-origin: left; transform: scaleX(0); transition: transform var(--t-slow) var(--ease-out) .2s; }
.section-head h2.is-in::after { transform: scaleX(1); }
.section-lead { grid-column: 2; max-width: 60ch; margin: var(--s4) 0 0; color: var(--fg-muted); }

/* ---------- Filters ---------------------------------------------------- */
.filters { display: flex; flex-wrap: wrap; gap: var(--s2); margin-bottom: var(--s6); }
.chip {
  min-height: 40px; padding: 0 var(--s4); border: 1px solid var(--border); border-radius: 999px; background: var(--bg);
  font-size: .875rem; font-weight: 500; color: var(--ink-700);
  transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast), transform var(--t-fast) var(--ease-out);
}
.chip:hover { border-color: var(--accent); color: var(--accent-ink); }
.chip:active { transform: scale(.96); }
.chip.is-active { background: var(--fg); border-color: var(--fg); color: var(--white); }

/* ---------- Projects --------------------------------------------------- */
.projects { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s6); }
.project > * { min-width: 0; }
.project {
  position: relative; display: grid; grid-template-columns: 1fr 1.15fr; gap: var(--s7); align-items: center;
  padding: clamp(var(--s5), 4vw, var(--s7));
  border: 1px solid var(--border); border-radius: calc(var(--radius) + 6px); background: var(--bg);
  transition: opacity var(--t-med), transform var(--t-med) var(--ease-out), border-color var(--t-med), box-shadow var(--t-med), filter var(--t-med);
}
.project::before { content: ""; position: absolute; left: -1px; top: var(--s6); bottom: var(--s6); width: var(--frame); background: var(--accent); border-radius: 2px; transform: scaleY(0); transition: transform var(--t-slow) var(--ease-out); }
.project.is-in::before { transform: scaleY(1); }
.project:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); box-shadow: 0 30px 60px -40px rgba(74,78,143,.45); }
.project.is-dim { opacity: .28; filter: grayscale(.8); transform: scale(.985); }
.project.is-hidden { display: none; }
.project--featured { grid-template-columns: 1fr 1.3fr; align-items: start; background: linear-gradient(180deg, var(--surface), var(--bg) 60%); }
.project--reverse .project-media { order: 2; }
.project h3 { margin: 0; font-size: clamp(1.5rem, 2.4vw, 2rem); font-weight: 700; letter-spacing: -.01em; line-height: 1.2; }
.project-top { display: flex; align-items: center; gap: var(--s3); flex-wrap: wrap; margin-bottom: var(--s4); }
.project-top > div { flex: 1; min-width: 200px; }
.project-logo { width: 44px; height: 44px; border-radius: 12px; object-fit: contain; background: #0d1d3f; padding: 6px; }
.project-icon { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; background: var(--fg); color: var(--white); font-size: 22px; }
.project-kicker { margin: var(--s1) 0 var(--s4); font-size: .9375rem; color: var(--fg-muted); font-weight: 500; }
.project-top .project-kicker { margin-bottom: 0; }
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; font-size: .75rem; font-weight: 600; background: var(--accent-soft); color: var(--accent-ink); white-space: nowrap; }
.badge-live::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: #2fa36b; }
.bullets { margin: 0 0 var(--s5); padding: 0; list-style: none; display: grid; gap: var(--s2); }
.bullets li { position: relative; padding-left: var(--s5); color: var(--ink-700); font-size: .9688rem; line-height: 1.6; }
.bullets li::before { content: ""; position: absolute; left: 2px; top: .7em; width: 10px; height: 2px; background: var(--accent); }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: var(--s3); }
.tags span { padding: 4px 10px; border-radius: 6px; background: var(--surface); border: 1px solid var(--border); font-family: var(--mono); font-size: .75rem; color: var(--ink-700); }
.project-links { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s4); }

/* architecture strip */
.arch { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0 0 var(--s5); padding: var(--s4); border: 1px dashed var(--border); border-radius: var(--radius); }
.node { padding: 6px 10px; border-radius: 8px; background: var(--bg); border: 1px solid var(--border); font-family: var(--mono); font-size: .75rem; font-weight: 500; }
.node-accent { background: var(--accent); color: var(--white); border-color: var(--accent); }
.node-sub { opacity: .8; }
.wire { position: relative; width: 22px; height: 2px; background: var(--border); overflow: hidden; }
.wire::after { content: ""; position: absolute; inset: 0; width: 8px; background: var(--accent); animation: packet 1.6s linear infinite; }
@keyframes packet { from { transform: translateX(-8px); } to { transform: translateX(24px); } }

/* browser frame */
.browser { border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); background: var(--bg); box-shadow: 0 30px 60px -36px rgba(23,24,43,.45); }
.browser-bar { display: flex; align-items: center; gap: 6px; padding: 10px 12px; background: var(--surface); border-bottom: 1px solid var(--border); }
.browser-bar i { width: 9px; height: 9px; border-radius: 50%; background: #d7d8e6; }
.browser-bar span { margin-left: var(--s3); padding: 2px 10px; border-radius: 6px; background: var(--bg); font-family: var(--mono); font-size: .6875rem; color: var(--fg-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.browser-dark { background: #111; border-color: #222; }
.browser-dark .browser-bar { background: #1b1b1b; border-color: #262626; }
.browser-dark .browser-bar i { background: #3a3a3a; }
.browser-dark .browser-bar span { background: #262626; color: #aaa; }
.browser img { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; object-position: top; cursor: zoom-in; transition: transform 1.2s var(--ease-out); }
.project:hover .browser img { transform: scale(1.02); }

/* tabs */
.showcase { min-width: 0; }
.tabs { position: relative; display: inline-flex; gap: var(--s1); padding: 4px; margin-bottom: var(--s4); border-radius: 999px; background: var(--surface); border: 1px solid var(--border); }
.tabs button { position: relative; z-index: 1; min-height: 40px; padding: 0 var(--s4); border: 0; border-radius: 999px; background: none; font-size: .875rem; font-weight: 600; color: var(--fg-muted); transition: color var(--t-med); }
.tabs button[aria-selected="true"] { color: var(--white); }
.tab-ink { position: absolute; top: 4px; bottom: 4px; left: 0; border-radius: 999px; background: var(--fg); transition: transform var(--t-med) var(--ease-out), width var(--t-med) var(--ease-out); }
.panels { position: relative; }
.panel { animation: fadeUp var(--t-med) var(--ease-out); }
@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.demo-note { margin: var(--s3) 0 0; font-size: .8125rem; color: var(--fg-muted); }

/* phone */
.panel-phone { display: flex; align-items: center; gap: var(--s6); }
.panel-phone[hidden] { display: none; }
.phone { position: relative; flex-shrink: 0; width: 290px; aspect-ratio: 9 / 19.5; padding: 10px; border-radius: 42px; background: #0f1020; box-shadow: 0 40px 70px -30px rgba(23,24,43,.6), inset 0 0 0 2px #2a2c4a; }
.phone-notch { position: absolute; top: 18px; left: 50%; width: 80px; height: 22px; margin-left: -40px; border-radius: 12px; background: #0f1020; z-index: 2; }
.phone-screen { width: 100%; height: 100%; border-radius: 33px; overflow: hidden; background: #0d1d3f; }
.phone-screen iframe { width: 100%; height: 100%; border: 0; display: block; background: #fff; }
.phone-launch { display: grid; place-items: center; align-content: center; gap: var(--s3); width: 100%; height: 100%; border: 0; background: radial-gradient(circle at 50% 35%, #1b3570, #0d1d3f 70%); color: var(--white); font-weight: 600; text-align: center; padding: var(--s5); }
.phone-launch img { width: 72px; height: 72px; border-radius: 18px; transition: transform var(--t-med) var(--ease-out); }
.phone-launch:hover img { transform: scale(1.08) rotate(-4deg); }
.phone-launch small { font-weight: 400; opacity: .75; }
.phone-note { color: var(--fg-muted); font-size: .9375rem; max-width: 34ch; }

/* scheduler */
.project--os { background: #14152a; color: #e6e7fb; border-color: #262846; }
.project--os .project-kicker, .project--os .bullets li { color: #b4b7dc; }
.project--os .tags span { background: #1e2040; border-color: #2e3160; color: #cfd2f6; }
.project--os .badge { background: #262a55; color: #c6c9ff; }
.project--os .project-icon { background: var(--accent); }
.sched { padding: var(--s5); border-radius: var(--radius); background: #0d0e1f; border: 1px solid #262846; }
.sched-head { display: flex; justify-content: space-between; gap: var(--s3); flex-wrap: wrap; margin-bottom: var(--s3); color: #9da0c8; }
.sched-head b { color: #a6aaf0; font-weight: 500; }
.sched-head output { color: #6be3a0; }
.sched canvas { width: 100%; height: auto; display: block; margin-top: var(--s3); border-radius: 8px; }
.sched-help { margin: var(--s3) 0 0; font-size: .8125rem; color: #9da0c8; }
input[type="range"] { -webkit-appearance: none; appearance: none; width: 100%; height: 28px; background: transparent; cursor: pointer; }
input[type="range"]::-webkit-slider-runnable-track { height: 4px; border-radius: 4px; background: linear-gradient(90deg, var(--accent) var(--fill, 30%), #2e3160 var(--fill, 30%)); }
input[type="range"]::-moz-range-track { height: 4px; border-radius: 4px; background: #2e3160; }
input[type="range"]::-moz-range-progress { height: 4px; border-radius: 4px; background: var(--accent); }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 20px; height: 20px; margin-top: -8px; border-radius: 50%; background: #fff; border: 4px solid var(--accent); }
input[type="range"]::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: #fff; border: 4px solid var(--accent); }

/* flow (AREA) */
.flow { display: flex; align-items: center; justify-content: center; gap: var(--s2); margin-top: var(--s4); font-family: var(--mono); font-size: .75rem; }
.flow-node, .flow-core { padding: 6px 12px; border-radius: 8px; border: 1px solid var(--border); background: var(--bg); }
.flow-core { background: var(--fg); color: var(--white); border-color: var(--fg); }
.flow-line { position: relative; width: 56px; height: 2px; background: var(--border); }
.flow-line i { position: absolute; top: -3px; left: 0; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); animation: travel 2s var(--ease-in-out) infinite; }
.flow-line + .flow-core + .flow-line i { animation-delay: 1s; }
@keyframes travel { from { transform: translateX(0); opacity: 0; } 15% { opacity: 1; } 85% { opacity: 1; } to { transform: translateX(48px); opacity: 0; } }

/* game gallery */
.project--game { background: linear-gradient(180deg, #f4fbf6, var(--bg) 70%); }
.gallery { display: grid; gap: var(--s3); }
.gallery-main { border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); background: #2a1d40; box-shadow: 0 30px 60px -36px rgba(23,24,43,.45); }
.gallery-main { position: relative; }
.gallery-main img, .gallery-main video { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }
.gallery-main img { cursor: zoom-in; }
.gallery-main [hidden] { display: none; }
.video-toggle { position: absolute; right: var(--s3); bottom: var(--s3); display: grid; place-items: center; width: 44px; height: 44px; border: 0; border-radius: 50%; background: rgba(15,16,32,.7); color: #fff; font-size: 18px; backdrop-filter: blur(6px); transition: background var(--t-fast), transform var(--t-fast) var(--ease-out); }
.video-toggle:hover { background: rgba(15,16,32,.9); transform: scale(1.06); }
.video-toggle .i-play, .video-toggle.is-paused .i-pause { display: none; }
.video-toggle.is-paused .i-play { display: inline; }
.video-badge { position: absolute; left: var(--s3); top: var(--s3); display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; background: rgba(15,16,32,.7); color: #fff; font-size: .75rem; }
.video-badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #ff5d6c; animation: pulse 2s infinite; }
.gallery-main video[hidden] ~ .video-badge { display: none; }
.gallery-thumbs { display: grid; grid-template-columns: repeat(6, 1fr); gap: var(--s2); }
.gallery-thumbs button { position: relative; }
.thumb-play { position: absolute; inset: 0; display: grid; place-items: center; color: #fff; font-size: 18px; background: rgba(15,16,32,.35); }
.gallery-thumbs button { padding: 0; border: 2px solid transparent; border-radius: 10px; overflow: hidden; background: none; min-height: 44px; opacity: .6; transition: opacity var(--t-fast), border-color var(--t-fast), transform var(--t-fast) var(--ease-out); }
.gallery-thumbs button:hover { opacity: 1; transform: translateY(-2px); }
.gallery-thumbs button[aria-pressed="true"] { opacity: 1; border-color: var(--accent); }
.gallery-thumbs img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }

/* ---------- Timeline --------------------------------------------------- */
.timeline { position: relative; list-style: none; margin: 0; padding: 0 0 0 var(--s6); }
.timeline::before { content: ""; position: absolute; left: 0; top: 6px; bottom: 6px; width: var(--frame); background: var(--accent-soft); }
.timeline::after { content: ""; position: absolute; left: 0; top: 6px; width: var(--frame); height: calc(var(--tl, 0) * (100% - 12px)); background: var(--accent); }
.tl-item { position: relative; display: grid; grid-template-columns: 140px 1fr; gap: var(--s5); padding: var(--s5) 0 var(--s6); border-bottom: 1px solid var(--border); transition: opacity var(--t-med), filter var(--t-med); }
.tl-item:last-child { border-bottom: 0; }
.tl-item::before { content: ""; position: absolute; left: calc(-1 * var(--s6) - 6px); top: calc(var(--s5) + 6px); width: 15px; height: 15px; border-radius: 50%; background: var(--bg); border: 3px solid var(--accent); }
.tl-item.is-dim { opacity: .3; filter: grayscale(1); }
.tl-date { font-family: var(--mono); font-size: .875rem; color: var(--accent-ink); padding-top: 4px; }
.tl-item h3 { margin: 0 0 var(--s1); font-size: 1.25rem; font-weight: 700; line-height: 1.35; }
.tl-item p { margin: 0 0 var(--s2); color: var(--ink-700); max-width: 70ch; }
.tl-item .tl-stack { font-family: var(--mono); font-size: .8125rem; color: var(--fg-muted); margin-bottom: var(--s3); }
.vba { margin-top: var(--s4); max-width: 420px; }
.vba-row { display: flex; align-items: center; gap: var(--s3); color: var(--fg-muted); }
.vba-bar { flex: 1; height: 6px; border-radius: 6px; background: var(--accent-soft); overflow: hidden; }
.vba-bar i { display: block; height: 100%; width: 100%; background: var(--accent); transform-origin: left; transform: scaleX(0); }
.tl-item.is-in .vba-bar i { animation: fill 2.2s .4s var(--ease-in-out) forwards; }
@keyframes fill { to { transform: scaleX(1); } }

/* ---------- Skills ----------------------------------------------------- */
.skills { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--s5); }
.skill-group { padding: var(--s5); border: 1px solid var(--border); border-radius: var(--radius); border-left: var(--frame) solid var(--accent); }
.skill-group h3 { margin: 0 0 var(--s4); font-size: 1.125rem; font-weight: 700; }
.skill-chips { display: flex; flex-wrap: wrap; gap: var(--s2); }
.skill-chips button {
  min-height: 40px; padding: 0 var(--s4); border-radius: 10px; border: 1px solid var(--border); background: var(--surface);
  font-size: .9063rem; font-weight: 500; color: var(--ink-700);
  transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast), transform var(--t-fast) var(--ease-out);
}
.skill-chips button:hover { border-color: var(--accent); color: var(--accent-ink); transform: translateY(-2px); }
.skill-chips button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--white); }
.skill-result { min-height: 56px; margin-top: var(--s5); display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2); color: var(--fg-muted); font-size: .9375rem; }
.skill-result a { display: inline-flex; align-items: center; min-height: 36px; padding: 0 var(--s3); border-radius: 999px; background: var(--fg); color: var(--white); text-decoration: none; font-weight: 600; font-size: .875rem; animation: fadeUp var(--t-med) var(--ease-out) both; }
.skill-result a:hover { background: var(--accent-ink); }

/* ---------- About ------------------------------------------------------ */
.about { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: var(--s5); }
.about-card { padding: var(--s6) var(--s5); border: 1px solid var(--border); border-radius: var(--radius); }
.about-card h3 { margin: 0 0 var(--s5); font-size: 1.375rem; font-weight: 700; }
.edu { display: grid; gap: 2px; margin-bottom: var(--s5); }
.edu b { font-weight: 600; line-height: 1.4; }
.edu span { color: var(--fg-muted); font-size: .9375rem; }
.edu-bar { margin-top: var(--s3); height: 6px; border-radius: 6px; background: var(--accent-soft); overflow: hidden; }
.edu-bar i { display: block; height: 100%; width: calc(var(--p) * 100%); background: var(--accent); transform-origin: left; transform: scaleX(0); transition: transform 1.6s var(--ease-out) .3s; }
.about-card.is-in .edu-bar i { transform: scaleX(1); }
.langs, .interests { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s4); }
.langs li { display: grid; gap: 6px; }
.lvl { display: block; height: 4px; border-radius: 4px; background: var(--accent-soft); position: relative; overflow: hidden; }
.lvl::after { content: ""; position: absolute; inset: 0; width: calc(var(--l) * 100%); background: var(--accent); transform-origin: left; transform: scaleX(0); transition: transform 1.4s var(--ease-out) .3s; }
.about-card.is-in .lvl::after { transform: scaleX(1); }
.interests li { display: flex; align-items: center; gap: var(--s3); font-weight: 500; }
.interests svg { width: 40px; height: 40px; padding: 9px; border-radius: 10px; background: var(--accent-soft); color: var(--accent-ink); }

/* ---------- Contact ---------------------------------------------------- */
.contact { position: relative; margin: var(--s9) clamp(var(--s3), 3vw, var(--s6)) var(--s6); padding: clamp(var(--s7), 9vw, var(--s10)) var(--s5); border-radius: calc(var(--radius) * 2); background: var(--accent); color: var(--white); overflow: hidden; }
.contact::before { content: ""; position: absolute; inset: var(--s5); border: 1.5px solid rgba(255,255,255,.35); border-radius: calc(var(--radius) * 1.4); pointer-events: none; }
.contact-inner { position: relative; max-width: 860px; margin: 0 auto; text-align: center; }
.eyebrow-light { background: rgba(255,255,255,.14); border-color: rgba(255,255,255,.4); color: var(--white); }
.contact h2 { margin: 0 0 var(--s5); font-size: clamp(2.25rem, 6vw, 4.5rem); font-weight: 300; line-height: 1.08; letter-spacing: -.01em; }
.contact p { margin: 0 auto var(--s6); max-width: 52ch; font-size: 1.125rem; color: rgba(255,255,255,.92); }
.contact-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--s3); }
.contact-cv { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--s5); margin-top: var(--s6); }
.contact-cv a { display: inline-flex; align-items: center; min-height: 44px; color: var(--white); font-weight: 600; text-underline-offset: 5px; }

.footer { display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--s3); padding: var(--s5) clamp(var(--s4), 4vw, var(--s7)) var(--s6); color: var(--fg-muted); font-size: .875rem; }
.footer a { text-decoration: none; min-height: 32px; display: inline-flex; align-items: center; }
.footer a:hover { color: var(--accent-ink); }

/* ---------- Toast / modal / lightbox ----------------------------------- */
.toast { position: fixed; left: 50%; bottom: var(--s6); z-index: var(--z-modal); padding: var(--s3) var(--s5); border-radius: 999px; background: var(--fg); color: var(--white); font-weight: 500; font-size: .9375rem; transform: translate(-50%, 200%); visibility: hidden; transition: transform var(--t-med) var(--ease-out), visibility var(--t-med); }
.toast.is-on { transform: translate(-50%, 0); visibility: visible; }

dialog { border: 0; padding: 0; color: inherit; }
dialog::backdrop { background: rgba(15,16,32,.62); backdrop-filter: blur(4px); }
.modal { width: min(1040px, 94vw); border-radius: calc(var(--radius) + 4px); background: var(--bg); overflow: hidden; }
.modal[open] { animation: pop var(--t-med) var(--ease-out); }
@keyframes pop { from { opacity: 0; transform: translateY(16px) scale(.97); } }
.modal-head, .modal-foot { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); flex-wrap: wrap; padding: var(--s3) var(--s4) var(--s3) var(--s5); }
.modal-head h2 { margin: 0; font-size: 1.125rem; }
.modal-head small { color: var(--accent-ink); margin-left: var(--s2); }
.modal-foot { border-top: 1px solid var(--border); color: var(--fg-muted); }
.icon-btn { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--border); background: var(--bg); font-size: 20px; transition: background var(--t-fast); }
.icon-btn:hover { background: var(--surface); }

.lightbox { max-width: 96vw; max-height: 94vh; background: transparent; overflow: visible; }
.lightbox[open] { animation: pop var(--t-med) var(--ease-out); }
.lightbox img { max-width: 96vw; max-height: 90vh; border-radius: var(--radius); box-shadow: 0 40px 80px rgba(0,0,0,.4); }
.lightbox .icon-btn { position: absolute; top: -12px; right: -12px; z-index: 1; }

/* ---------- Reveal ----------------------------------------------------- */
.reveal { opacity: 0; transform: translateY(24px); transition: opacity .8s var(--ease-out), transform .8s var(--ease-out); transition-delay: var(--d, 0ms); }
.reveal.is-in { opacity: 1; transform: none; }
.project.reveal.is-in.is-dim { opacity: .28; transform: scale(.985); }

/* i18n crossfade */
[data-i18n], [data-i18n-html] { transition: opacity 160ms ease; }
.is-switching [data-i18n], .is-switching [data-i18n-html] { opacity: 0; }

/* ---------- Responsive ------------------------------------------------- */
@media (max-width: 1100px) {
  .hero-grid { grid-template-columns: 1fr; gap: var(--s6); }
  .meta { justify-items: start; text-align: left; }
  .project, .project--featured { grid-template-columns: 1fr; gap: var(--s5); }
  .project--reverse .project-media { order: 0; }
  .about { grid-template-columns: 1fr 1fr; }
  .about-card:first-child { grid-column: 1 / -1; }
}
@media (max-width: 860px) {
  .nav-links {
    position: fixed; inset: 72px var(--s3) auto var(--s3); flex-direction: column; gap: 0; padding: var(--s3);
    background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 30px 60px -30px rgba(23,24,43,.4);
    opacity: 0; visibility: hidden; transform: translateY(-8px); transition: opacity var(--t-med), transform var(--t-med) var(--ease-out), visibility var(--t-med);
  }
  .nav-links.is-open { opacity: 1; visibility: visible; transform: none; }
  .nav-links a { width: 100%; min-height: 48px; font-size: 1rem; }
  .burger { display: block; }
  #cvLink span { display: none; }
  .stats { grid-template-columns: repeat(2, 1fr); row-gap: var(--s4); }
  .skills { grid-template-columns: 1fr; }
  .tl-item { grid-template-columns: 1fr; gap: var(--s2); }
  .panel-phone { flex-direction: column; }
}
@media (max-width: 560px) {
  .hero { padding-top: 120px; }
  .hero-frame { inset: 80px 10px 16px; }
  .hero-grid { padding-left: var(--s5); }
  .hero-band { margin-left: calc(-1 * var(--s5) - 10px); padding-left: calc(var(--s5) + 10px); padding-right: var(--s4); }
  .stats { grid-template-columns: 1fr; }
  .section { padding-inline: var(--s4); }
  .section-head { grid-template-columns: 1fr; }
  .section-lead { grid-column: 1; }
  .about { grid-template-columns: 1fr; }
  .lang button { min-width: 40px; }
  .lang-pill { width: 40px; }
  .project-top > div { min-width: 0; flex: 1 1 calc(100% - 60px); }
  .phone { width: min(280px, 78vw); }
  .nav { gap: var(--s2); }
  .nav-actions { gap: var(--s2); }
  .project { padding: var(--s5) var(--s4); }
  .tabs button { padding: 0 var(--s3); }
  .arch .wire { width: 12px; }
  .scroll-hint { display: none; }
}

/* ---------- Reduced motion -------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
  .reveal { opacity: 1; transform: none; }
  .hero-name .char { transform: none; }
  .hero-band { clip-path: none; }
  .hero-frame span { transform: none; }
  .wire::after, .flow-line i { display: none; }
  .cursor { display: none; }
}
