:root {
  --ink: #0b0e12;
  --steel-900: #11161d;
  --steel-700: #1b232e;
  --steel-500: #3a4a5c;
  --steel-300: #8b9bad;
  --steel-150: #c3cdd8;
  --paper: #eef1f5;
  --accent: oklch(0.72 0.13 235);
  --bg: var(--ink);
  --surface: var(--steel-900);
  --line: rgba(195, 205, 216, 0.14);
  --fg: var(--paper);
  --fg-dim: var(--steel-300);
  --display: "Bricolage Grotesque", sans-serif;
  --serif: "Newsreader", serif;
  --mono: "IBM Plex Mono", monospace;
}
[data-theme="light"] {
  --bg: #e9ecf1;
  --surface: #f4f6f9;
  --line: rgba(11, 14, 18, 0.12);
  --fg: #11161d;
  --fg-dim: #4a5a6c;
  --accent: oklch(0.55 0.14 235);
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--serif);
  line-height: 1.5;
  overflow-x: hidden;
  transition: background 0.6s cubic-bezier(0.65,0,0.35,1), color 0.6s cubic-bezier(0.65,0,0.35,1);
  -webkit-font-smoothing: antialiased;
}
::selection { background: var(--accent); color: var(--ink); }
a { color: inherit; text-decoration: none; }

/* Custom cursor (desktop, fine pointer) */
@media (pointer: fine) {
  body { cursor: none; }
  .cur, .cur-r { position: fixed; top: 0; left: 0; z-index: 9999; pointer-events: none; border-radius: 50%; mix-blend-mode: difference; }
  .cur { width: 9px; height: 9px; background: #fff; transform: translate(-50%,-50%); }
  .cur-r { width: 38px; height: 38px; border: 1px solid #fff; transform: translate(-50%,-50%); transition: width .28s ease, height .28s ease, opacity .28s ease; }
  .cur-r.big { width: 76px; height: 76px; opacity: 0.7; }
}
.cur, .cur-r { display: none; }
@media (pointer: fine) { .cur, .cur-r { display: block; } }

/* scroll progress */
.progress { position: fixed; top: 0; left: 0; height: 2px; width: 0; background: var(--accent); z-index: 9999; }

/* Grain + grid overlay */
body::before {
  content: "";
  position: fixed; inset: 0; z-index: 1; pointer-events: none;
  background-image: linear-gradient(var(--line) 1px, transparent 1px), linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 100% 100%, calc(100% / 12) 100%;
  opacity: 0.5;
}

.wrap { max-width: 1440px; margin: 0 auto; padding: 0 clamp(20px, 4vw, 64px); position: relative; z-index: 2; }

/* ---------- NAV ---------- */
nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px clamp(20px, 4vw, 64px);
  mix-blend-mode: difference; color: #fff;
}
nav .brand { font-family: var(--mono); font-size: 12px; letter-spacing: 0.18em; text-transform: uppercase; }
nav .navlinks { display: flex; gap: 26px; font-family: var(--mono); font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase; }
nav .navlinks a { position: relative; opacity: 0.85; }
nav .navlinks a::after { content: ""; position: absolute; left: 0; bottom: -4px; width: 0; height: 1px; background: #fff; transition: width 0.4s ease; }
nav .navlinks a:hover::after { width: 100%; }
.theme-btn {
  position: fixed; bottom: 24px; right: 24px; z-index: 120;
  width: 52px; height: 52px; border-radius: 50%;
  border: 1px solid var(--line); background: var(--surface); color: var(--fg);
  font-family: var(--mono); font-size: 16px; cursor: pointer;
  display: grid; place-items: center; transition: transform 0.4s, background 0.4s;
}
@media (pointer: fine) { .theme-btn { cursor: none; } }
.theme-btn:hover { transform: rotate(90deg) scale(1.08); }

/* ---------- HERO ---------- */
header { min-height: 100vh; display: flex; flex-direction: column; justify-content: center; padding-top: 80px; position: relative; }
.hero-portrait { position: absolute; top: 0; right: 0; height: 100%; width: clamp(320px, 46vw, 660px); z-index: 0; border: none; object-fit: cover; object-position: 50% 28%; filter: grayscale(1) contrast(1.05) brightness(0.92); transition: filter 0.5s ease; }
.hero-portrait:hover { filter: grayscale(0) contrast(1.02) brightness(1); }
.hero-overlay { position: absolute; inset: 0; z-index: 1; pointer-events: none; background: linear-gradient(90deg, var(--bg) 22%, rgba(0,0,0,0) 78%), linear-gradient(0deg, var(--bg) 3%, rgba(0,0,0,0) 34%), linear-gradient(180deg, var(--bg) 0%, rgba(0,0,0,0) 18%); }
.hero-content { position: relative; z-index: 2; pointer-events: none; }
.hero-meta { text-shadow: 0 1px 14px var(--bg); }
.eyebrow { font-family: var(--mono); font-size: 12px; letter-spacing: 0.22em; text-transform: uppercase; color: var(--fg-dim); display: flex; gap: 16px; align-items: center; margin-bottom: 28px; }
.eyebrow::before { content: ""; width: 56px; height: 1px; background: var(--accent); }
h1.name {
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(56px, 13vw, 220px);
  line-height: 0.84;
  letter-spacing: -0.03em;
  text-transform: uppercase;
  will-change: transform;
}
h1.name .ln { display: block; overflow: hidden; }
h1.name .ln > span { display: inline-block; }
h1.name .italic > span { font-family: var(--serif); font-style: italic; font-weight: 400; text-transform: none; letter-spacing: -0.01em; color: var(--accent); }
.roles {
  margin-top: 40px; display: flex; flex-wrap: wrap; gap: 0;
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
}
.roles .role {
  flex: 1 1 200px; padding: 22px 0; border-right: 1px solid var(--line);
  padding-right: 24px; padding-left: 4px;
}
.roles .role:last-child { border-right: none; }
.roles .role .n { font-family: var(--mono); font-size: 11px; color: var(--fg-dim); letter-spacing: 0.15em; }
.roles .role .t { font-family: var(--display); font-weight: 600; font-size: clamp(20px, 2.4vw, 30px); margin-top: 8px; letter-spacing: -0.01em; }
.hero-meta { position: absolute; right: clamp(20px,4vw,64px); top: 36%; text-align: right; font-family: var(--mono); font-size: 11px; letter-spacing: 0.12em; color: var(--fg-dim); line-height: 2; }

/* Scrolling marquee */
.marquee { overflow: hidden; border-bottom: 1px solid var(--line); padding: 18px 0; white-space: nowrap; position: relative; z-index: 2; }
.marquee .track { display: inline-block; will-change: transform; }
.marquee span { font-family: var(--display); font-weight: 800; font-size: clamp(28px,5vw,68px); text-transform: uppercase; letter-spacing: -0.02em; padding: 0 28px; }
.marquee span.out { color: transparent; -webkit-text-stroke: 1px var(--fg-dim); }

/* ---------- SECTION SHELL ---------- */
section { padding: clamp(80px, 12vh, 160px) 0; position: relative; }
.sec-head { display: flex; align-items: baseline; gap: 20px; margin-bottom: 64px; }
.sec-head .idx { font-family: var(--mono); font-size: 13px; color: var(--accent); letter-spacing: 0.1em; }
.sec-head h2 { font-family: var(--display); font-weight: 800; font-size: clamp(34px, 6vw, 92px); letter-spacing: -0.03em; text-transform: uppercase; line-height: 0.9; }

/* ---------- ABOUT ---------- */
.about-grid { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(30px,5vw,90px); align-items: start; }
.about-lead { font-family: var(--serif); font-size: clamp(24px, 3vw, 40px); line-height: 1.28; letter-spacing: -0.01em; }
.about-lead em { font-style: italic; color: var(--accent); }
.about-body { font-family: var(--serif); font-size: 18px; line-height: 1.7; color: var(--fg-dim); }
.about-body p + p { margin-top: 20px; }
.about-stats { margin-top: 36px; display: flex; gap: 40px; }
.about-stats .s .num { font-family: var(--display); font-weight: 800; font-size: 44px; letter-spacing: -0.02em; }
.about-stats .s .lab { font-family: var(--mono); font-size: 11px; color: var(--fg-dim); letter-spacing: 0.12em; text-transform: uppercase; }

/* ---------- EXPERIENCE ---------- */
.exp-item {
  display: grid; grid-template-columns: 90px 1fr auto; gap: clamp(16px,3vw,48px);
  padding: 38px 0; border-top: 1px solid var(--line); position: relative; cursor: default;
  transition: padding-left 0.5s cubic-bezier(0.65,0,0.35,1);
  overflow: hidden;
}
.exp-item:last-child { border-bottom: 1px solid var(--line); }
.exp-item:hover { padding-left: 18px; }
.exp-item::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: var(--accent); transition: width 0.5s cubic-bezier(0.65,0,0.35,1); }
.exp-item:hover::before { width: 4px; }
.exp-ghost { position: absolute; right: 2%; top: 50%; transform: translateY(-50%) translateX(40px); font-family: var(--display); font-weight: 800; font-size: clamp(80px, 14vw, 220px); color: var(--accent); opacity: 0; pointer-events: none; transition: opacity .5s ease, transform .6s cubic-bezier(0.16,1,0.3,1); line-height: 1; z-index: 0; }
.exp-item:hover .exp-ghost { opacity: 0.08; transform: translateY(-50%) translateX(0); }
.exp-num { font-family: var(--mono); font-size: 13px; color: var(--fg-dim); padding-top: 8px; position: relative; z-index: 1; }
.exp-main { position: relative; z-index: 1; }
.exp-main .role { font-family: var(--display); font-weight: 600; font-size: clamp(22px, 2.8vw, 38px); letter-spacing: -0.02em; line-height: 1.05; }
.exp-main .org { font-family: var(--mono); font-size: 13px; color: var(--accent); margin-top: 10px; letter-spacing: 0.06em; }
.exp-main .desc { font-family: var(--serif); font-size: 16px; line-height: 1.6; color: var(--fg-dim); margin-top: 16px; max-width: 60ch; }
.exp-main .desc ul { list-style: none; margin-top: 6px; }
.exp-main .desc li { padding-left: 18px; position: relative; }
.exp-main .desc li::before { content: "→"; position: absolute; left: 0; color: var(--accent); }
.exp-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 16px; }
.exp-tags span { font-family: var(--mono); font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; padding: 4px 9px; border: 1px solid var(--line); border-radius: 999px; color: var(--fg-dim); }
.exp-meta { text-align: right; font-family: var(--mono); font-size: 12px; color: var(--fg-dim); letter-spacing: 0.06em; line-height: 1.8; padding-top: 8px; white-space: nowrap; position: relative; z-index: 1; }
.exp-meta .now { color: var(--accent); }

/* ---------- SKILLS ---------- */
.skills-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px,1fr)); border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.skill-cell { border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 26px 22px; min-height: 130px; display: flex; flex-direction: column; justify-content: space-between; transition: background 0.4s, color 0.4s; }
.skill-cell:hover { background: var(--accent); color: var(--ink); }
.skill-cell .k { font-family: var(--mono); font-size: 11px; opacity: 0.6; }
.skill-cell .v { font-family: var(--display); font-weight: 600; font-size: clamp(18px, 1.8vw, 24px); letter-spacing: -0.01em; }

/* ---------- SERVICE ---------- */
.service-grid { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(30px,5vw,90px); align-items: start; }
.svc-label { font-family: var(--mono); font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--accent); margin-bottom: 24px; }
.svc-creds { margin-top: 30px; display: flex; gap: 36px; flex-wrap: wrap; }
.svc-creds .c .big-num { font-family: var(--display); font-weight: 800; font-size: clamp(30px,3vw,46px); letter-spacing: -0.02em; }
.svc-creds .c .lab { font-family: var(--mono); font-size: 11px; color: var(--fg-dim); letter-spacing: 0.1em; text-transform: uppercase; margin-top: 4px; max-width: 16ch; }
.svc-steps { display: flex; flex-direction: column; }
.svc-step { display: grid; grid-template-columns: auto 1fr; gap: 22px; padding: 24px 0; border-top: 1px solid var(--line); }
.svc-step:last-child { border-bottom: 1px solid var(--line); }
.svc-step .sn { font-family: var(--mono); font-size: 13px; color: var(--accent); padding-top: 6px; }
.svc-step .st { font-family: var(--display); font-weight: 600; font-size: clamp(18px,2vw,25px); letter-spacing: -0.01em; line-height: 1.1; }
.svc-step .sd { font-family: var(--serif); font-size: 16px; line-height: 1.6; color: var(--fg-dim); margin-top: 8px; max-width: 48ch; }

/* ---------- CONTACT ---------- */
.contact { border-top: 1px solid var(--line); }
.contact .cta { font-family: var(--display); font-weight: 800; font-size: clamp(20px, 5vw, 70px); line-height: 0.95; letter-spacing: -0.03em; text-transform: uppercase; overflow-wrap: anywhere; }
.contact .cta a { display: inline-block; transition: color 0.4s; will-change: transform; }
.contact .cta a:hover { color: var(--accent); }
.contact-links { margin-top: 60px; display: flex; flex-wrap: wrap; gap: 0; border-top: 1px solid var(--line); }
.contact-links a { flex: 1 1 200px; padding: 26px 0; border-right: 1px solid var(--line); font-family: var(--mono); font-size: 13px; letter-spacing: 0.1em; text-transform: uppercase; display: flex; justify-content: space-between; padding-right: 18px; transition: padding-left 0.4s, color 0.4s; }
.contact-links a:last-child { border-right: none; }
.contact-links a:hover { padding-left: 12px; color: var(--accent); }
.contact-links a .ar { transition: transform 0.4s; }
.contact-links a:hover .ar { transform: translate(4px,-4px); }
footer { padding: 40px 0 120px; font-family: var(--mono); font-size: 11px; color: var(--fg-dim); letter-spacing: 0.1em; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px; }

/* ---------- GALLERY IMAGES (duotone) ---------- */
.svc-gallery { display: grid; grid-template-columns: repeat(3, 1fr); gap: clamp(12px, 2vw, 20px); margin-top: clamp(40px, 6vh, 80px); }
.svc-gallery .g-img { display: block; width: 100%; height: auto; aspect-ratio: 3 / 4; object-fit: cover; border: 1px solid var(--line); filter: grayscale(1) contrast(1.04) brightness(0.96); transition: filter 0.5s ease; }
.svc-gallery .g-img:hover { filter: grayscale(0.55) contrast(1.04); }
.svc-gallery .g-cap { font-family: var(--mono); font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--fg-dim); margin-top: 10px; }
@media (max-width: 640px) { .svc-gallery { grid-template-columns: 1fr; } }

/* reveal */
.reveal { opacity: 0; transform: translateY(40px); transition: opacity 0.9s cubic-bezier(0.16,1,0.3,1), transform 0.9s cubic-bezier(0.16,1,0.3,1); }
.reveal.in { opacity: 1; transform: none; }

@media (max-width: 780px) {
  .about-grid { grid-template-columns: 1fr; }
  .exp-item { grid-template-columns: 1fr; }
  .exp-meta { text-align: left; }
  .hero-meta { display: none; }
  nav .navlinks { display: none; }
  body::before { background-size: 100% 100%, calc(100% / 4) 100%; }
}
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; }
  h1.name .ln > span { transform: none !important; }
}
