/* ==========================================================================
   emreayalp.com — light, quiet, tactile.
   Colours, type and motion live in the variables below.
   ========================================================================== */

@font-face {
  font-family: "Geist";
  src: url("/assets/fonts/Geist-Variable.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: "Geist Mono";
  src: url("/assets/fonts/GeistMono-Variable.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --bg: #f6f5f1;
  --surface: #ffffff;
  --surface-2: #efede7;
  --ink: #121211;
  --ink-2: #5b5a55;
  --ink-3: #9b9992;
  --line: rgba(18, 18, 17, 0.09);
  --line-2: rgba(18, 18, 17, 0.16);
  --accent: #ff5a1f;
  --accent-soft: rgba(255, 90, 31, 0.12);

  --sans: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --wrap: 1120px;
  --gutter: clamp(16px, 5vw, 48px);
  --radius: 28px;
  --radius-sm: 16px;

  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --shadow: 0 1px 0 rgba(18, 18, 17, 0.04), 0 1px 2px rgba(18, 18, 17, 0.04),
    0 12px 32px -12px rgba(18, 18, 17, 0.1);
  --shadow-lift: 0 1px 0 rgba(18, 18, 17, 0.04), 0 2px 4px rgba(18, 18, 17, 0.04),
    0 32px 64px -24px rgba(18, 18, 17, 0.22);

  color-scheme: light;
}

/* ---------- Page entrance ---------- */
main { animation: page-in 0.2s var(--ease) both; }
@keyframes page-in { from { opacity: 0.88; } to { opacity: 1; } }

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html {
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scrollbar-gutter: stable;
}
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.55;
  letter-spacing: -0.011em;
  overflow-x: hidden;
}
::selection { background: var(--accent); color: #fff; }
a { color: inherit; text-decoration: none; }
img, svg, canvas { display: block; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 8px; }
.mono { font-family: var(--mono); font-size: 12.5px; letter-spacing: 0.02em; text-transform: uppercase; }
.wrap { width: 100%; max-width: calc(var(--wrap) + var(--gutter) * 2); margin: 0 auto; padding: 0 var(--gutter); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Fine paper grain over everything; very subtle. */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 100;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---------- Header ---------- */
.site-head {
  position: sticky;
  top: 0;
  z-index: 50;
}
.site-head::before {
  content: "";
  position: absolute;
  inset: 0;
  background: color-mix(in srgb, var(--bg) 72%, transparent);
  backdrop-filter: saturate(1.6) blur(14px);
  -webkit-backdrop-filter: saturate(1.6) blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s;
}
.site-head.scrolled::before { border-bottom-color: var(--line); }
.head-row {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  height: 64px;
}
.nav { display: flex; align-items: center; gap: 4px; }
.nav a {
  position: relative;
  padding: 8px 12px;
  border-radius: 999px;
  color: var(--ink-2);
  font-size: 15px;
  transition: color 0.2s, background-color 0.2s;
}
.nav a:hover { color: var(--ink); background: rgba(18, 18, 17, 0.05); }
.sound-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: 8px;
  padding: 8px 10px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--ink-2);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  transition: color 0.2s, background-color 0.2s;
}
.sound-toggle[hidden] { display: none; }
.sound-toggle:hover { color: var(--ink); background: rgba(18, 18, 17, 0.05); }
.sound-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sound-toggle .sound-state { color: var(--ink-3); }
.nav a[aria-current="page"] { color: var(--ink); }
.nav a[aria-current="page"]::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 2px;
  width: 4px;
  height: 4px;
  margin-left: -2px;
  border-radius: 50%;
  background: var(--accent);
}
@media (max-width: 560px) { .nav a { padding: 8px 10px; } }

/* ---------- Reveal on scroll ---------- */
.js .reveal {
  opacity: 0;
  transform: translateY(18px);
  filter: blur(6px);
  transition: opacity 0.5s var(--ease), transform 0.5s var(--ease), filter 0.5s var(--ease);
  transition-delay: calc(var(--d, 0) * 45ms);
}
.js .reveal.in { opacity: 1; transform: none; filter: none; }

/* ---------- Hero (home) ---------- */
.hero {
  position: relative;
  min-height: min(86vh, 820px);
  display: flex;
  align-items: flex-end;
  padding-bottom: clamp(40px, 8vh, 88px);
  isolation: isolate;
}
.hero-field {
  position: absolute;
  inset: -64px 0 0;
  width: 100%;
  height: calc(100% + 64px);
  z-index: -1;
  -webkit-mask-image: radial-gradient(ellipse 80% 75% at 50% 45%, #000 40%, transparent 100%);
  mask-image: radial-gradient(ellipse 80% 75% at 50% 45%, #000 40%, transparent 100%);
  touch-action: pan-y;
}
.hero-inner { width: 100%; pointer-events: none; }
.hero-inner a, .hero-inner button { pointer-events: auto; }
.name {
  margin: 0;
  font-weight: 560;
  font-size: clamp(64px, 14.5vw, 196px);
  line-height: 0.86;
  letter-spacing: -0.065em;
  display: flex;
  flex-wrap: wrap;
  column-gap: 0.22em;
}
.name .w { display: inline-flex; }
.name .ch {
  display: inline-block;
  transform-origin: 50% 100%;
  will-change: transform;
}
.js .name .ch { opacity: 0; transform: translateY(0.5em) rotate(6deg); filter: blur(10px); }
.js .name.go .ch {
  opacity: 1;
  transform: none;
  filter: none;
  transition: opacity 0.8s var(--ease), transform 1s var(--ease-spring), filter 0.8s var(--ease);
  transition-delay: calc(var(--i) * 45ms + 120ms);
}
.name .w + .w { color: var(--ink-3); }
@media (max-width: 560px) { .name { font-size: 25vw; line-height: 0.88; } }
.hero-intro {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-top: clamp(24px, 4vh, 40px);
}
.hero-portrait {
  width: 64px;
  height: 64px;
  flex: none;
  border-radius: 50%;
  object-fit: cover;
}
.tagline {
  margin: 0;
  max-width: 34ch;
  text-wrap: balance;
  font-size: clamp(19px, 2.2vw, 25px);
  line-height: 1.35;
  letter-spacing: -0.022em;
  color: var(--ink-2);
}
.tagline strong { color: var(--ink); font-weight: 500; }
@media (max-width: 560px) {
  .hero-intro { gap: 14px; }
  .hero-portrait { width: 52px; height: 52px; }
}
.hero-hint {
  position: absolute;
  right: 0;
  bottom: clamp(40px, 8vh, 88px);
  color: var(--ink-3);
  display: flex;
  align-items: center;
  gap: 10px;
}
.hero-hint i { position: relative; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.hero-hint i::after {
  content: ""; position: absolute; inset: -4px; border-radius: 50%; border: 1.5px solid var(--accent);
  animation: ping 2s var(--ease) infinite;
}
@keyframes ping { 0% { transform: scale(0.5); opacity: 0.9; } 80%, 100% { transform: scale(2.4); opacity: 0; } }
@media (max-width: 720px) { .hero-hint { display: none; } }

/* ---------- Sections ---------- */
.section { padding: clamp(64px, 11vh, 128px) 0; }
.section + .section { padding-top: 0; }
.label {
  color: var(--ink-3);
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 28px;
}
.label::before { content: ""; width: 18px; height: 1px; background: currentColor; }
.h2 {
  margin: 0 0 12px;
  font-size: clamp(32px, 4.6vw, 56px);
  font-weight: 540;
  letter-spacing: -0.045em;
  line-height: 1.02;
}
.lede { margin: 0; color: var(--ink-2); max-width: 52ch; font-size: clamp(17px, 1.6vw, 19px); }

/* Now */
.now {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: clamp(32px, 6vw, 96px);
  align-items: start;
}
.now-statement {
  margin: 0;
  font-size: clamp(26px, 3.3vw, 40px);
  line-height: 1.15;
  letter-spacing: -0.035em;
  font-weight: 500;
}
.now-statement em { font-style: normal; color: var(--accent); }
.now-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.now-list li {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 16px;
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
}
.now-list .k { color: var(--ink-3); padding-top: 3px; }
.now-list .v { color: var(--ink); }
.now-list .v small { display: block; color: var(--ink-2); font-size: 15px; margin-top: 2px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex;
  align-items: center;
  height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--line-2);
  font-size: 14px;
  color: var(--ink-2);
  background: var(--surface);
}
@media (max-width: 820px) {
  .now { grid-template-columns: 1fr; }
  .now-list li { grid-template-columns: 1fr; gap: 4px; }
}

/* ---------- Tiles (projects) ---------- */
/* Tiles sit inside .reveal wrappers so the scroll-in transform never fights the tilt. */
.tiles > *, .cards > * { display: flex; flex-direction: column; }
.tiles > * > .tile, .cards > * > .card { flex: 1; }
.tiles {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(14px, 2vw, 24px);
  margin-top: 40px;
}
@media (max-width: 760px) { .tiles { grid-template-columns: 1fr; } }
.tile {
  --rx: 0deg; --ry: 0deg; --s: 1; --mx: 50%; --my: 50%;
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: clamp(340px, 40vw, 460px);
  padding: clamp(24px, 3vw, 36px);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
  transform: perspective(1400px) rotateX(var(--rx)) rotateY(var(--ry)) scale(var(--s));
  will-change: transform;
  transition: box-shadow 0.5s var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.tile::before {
  /* Soft light that follows the pointer. */
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(520px circle at var(--mx) var(--my), rgba(255, 90, 31, 0.07), transparent 45%);
  opacity: 0;
  transition: opacity 0.4s;
  pointer-events: none;
}
.tile::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  border: 1px solid var(--line);
  pointer-events: none;
}
.tile:hover { box-shadow: var(--shadow-lift); }
.tile:hover::before { opacity: 1; }
.tile-top { display: flex; justify-content: space-between; align-items: center; color: var(--ink-3); }
.tile-count {
  display: inline-flex; align-items: center; gap: 8px;
}
.tile-count b {
  display: inline-grid; place-items: center; min-width: 24px; height: 24px; padding: 0 7px;
  border-radius: 999px; background: var(--ink); color: var(--bg); font-weight: 500; font-size: 12px;
}
.tile-art { flex: 1; display: grid; place-items: center; padding: 24px 0; }
.tile-title {
  margin: 0;
  font-size: clamp(28px, 3.2vw, 40px);
  font-weight: 540;
  letter-spacing: -0.04em;
  line-height: 1.05;
}
.tile-desc { margin: 8px 0 0; color: var(--ink-2); max-width: 36ch; }
.tile-foot { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; }
.arrow {
  flex: none;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--surface-2);
  color: var(--ink);
  overflow: hidden;
  position: relative;
  transition: background-color 0.4s var(--ease), color 0.4s var(--ease), transform 0.5s var(--ease-spring);
}
.arrow svg { transition: transform 0.5s var(--ease); }
.arrow svg + svg { position: absolute; transform: translateX(-240%); }
.tile:hover .arrow, a:hover > .arrow { background: var(--ink); color: var(--bg); transform: scale(1.06); }
.tile:hover .arrow svg:first-child, a:hover > .arrow svg:first-child { transform: translateX(240%); }
.tile:hover .arrow svg + svg, a:hover > .arrow svg + svg { transform: none; }

/* Tile art: a fanned stack of skill cards. */
.stack { position: relative; width: min(220px, 58%); aspect-ratio: 1.35; }
.stack > span {
  position: absolute;
  inset: 0;
  border-radius: 18px;
  background: var(--surface);
  border: 1px solid var(--line-2);
  box-shadow: 0 10px 30px -14px rgba(18, 18, 17, 0.25);
  transition: transform 0.8s var(--ease-spring);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 14px 16px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-3);
}
.stack > span:nth-child(1) { transform: translate(-14%, 8%) rotate(-10deg); background: var(--surface-2); }
.stack > span:nth-child(2) { transform: translate(12%, 4%) rotate(7deg); background: #fbfaf7; }
.stack > span:nth-child(3) { transform: none; }
.stack > span:nth-child(3) i { display: block; height: 6px; border-radius: 3px; background: var(--surface-2); margin-top: 7px; }
.stack > span:nth-child(3) i:nth-child(2) { width: 82%; }
.stack > span:nth-child(3) i:nth-child(3) { width: 64%; }
.stack > span:nth-child(3) i:nth-child(4) { width: 72%; }
.stack .md { color: var(--ink); font-size: 12px; display: flex; justify-content: space-between; }
.stack .md em { font-style: normal; color: var(--accent); }
.tile:hover .stack > span:nth-child(1) { transform: translate(-30%, 12%) rotate(-16deg); }
.tile:hover .stack > span:nth-child(2) { transform: translate(28%, 6%) rotate(13deg); }
.tile:hover .stack > span:nth-child(3) { transform: translateY(-8%) rotate(-1.5deg); }

/* Tile art: lines of text being written. */
.lines { width: min(300px, 78%); display: grid; gap: 12px; }
.lines b { display: block; border-radius: 6px; }
.lines .tag { width: 64px; height: 10px; background: var(--accent); opacity: 0.85; margin-bottom: 6px; transition: width 0.7s var(--ease-spring); }
.lines .hd { height: 13px; background: var(--ink); opacity: 0.62; transform-origin: left; transition: transform 0.8s var(--ease); }
.lines .hd.short { width: 62%; margin-bottom: 10px; transition-delay: 0.04s; }
.tile:not(:hover) .lines .hd { transform: scaleX(0.9); }
.tile:hover .lines .tag { width: 88px; }
.lines i { display: block; height: 7px; border-radius: 4px; background: var(--surface-2); transform-origin: left; transition: transform 0.9s var(--ease); }
.lines i:nth-of-type(2) { width: 92%; }
.lines i:nth-of-type(3) { width: 78%; }
.lines i:nth-of-type(4) { width: 58%; }
.tile:not(:hover) .lines i { transform: scaleX(0.82); }
.tile .lines i:nth-of-type(2) { transition-delay: 0.05s; }
.tile .lines i:nth-of-type(3) { transition-delay: 0.1s; }
.tile .lines i:nth-of-type(4) { transition-delay: 0.15s; }

/* ---------- Footer ---------- */
.site-foot { padding: clamp(72px, 12vh, 140px) 0 32px; }
.foot-title {
  margin: 0 0 32px;
  font-size: clamp(40px, 7vw, 92px);
  line-height: 0.95;
  letter-spacing: -0.06em;
  font-weight: 540;
}
.foot-title span { color: var(--ink-3); }
.links { border-top: 1px solid var(--line-2); }
.link-row {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 4px;
  border-bottom: 1px solid var(--line-2);
  font-size: clamp(22px, 2.6vw, 32px);
  letter-spacing: -0.035em;
  font-weight: 500;
  overflow: hidden;
  isolation: isolate;
}
.link-row::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 0.6s var(--ease);
}
.link-row:hover::after { transform: scaleX(1); transform-origin: left; }
.link-row .name-l { display: inline-flex; overflow: hidden; line-height: 1.2; padding: 0.04em 0; }
.link-row .name-l .c {
  display: inline-block;
  white-space: pre;
  text-shadow: 0 1.2em 0 var(--accent);
  transition: transform 0.6s cubic-bezier(0.7, 0, 0.2, 1);
  transition-delay: calc(var(--i) * 24ms);
}
.link-row:hover .name-l .c { transform: translateY(-1.2em); }
.link-row .meta { color: var(--ink-3); font-family: var(--mono); font-size: 13px; letter-spacing: 0.02em; text-transform: none; margin-left: auto; margin-right: 8px; transition: color 0.4s, transform 0.6s var(--ease); }
.link-row:hover .meta { color: var(--ink-2); transform: translateX(-10px); }
.link-row .arrow svg + svg { transform: translate(-240%, 240%); }
.link-row:hover .arrow { background: var(--accent); color: #fff; transform: scale(1.08) rotate(0deg); }
.link-row:hover .arrow svg:first-child { transform: translate(240%, -240%); }
.link-row:hover .arrow svg + svg { transform: none; }
@media (max-width: 560px) { .link-row .meta { display: none; } }
.foot-base { display: flex; justify-content: space-between; gap: 16px; margin-top: 56px; color: var(--ink-3); flex-wrap: wrap; }
.foot-base a { transition: color 0.2s; }
.foot-base a:hover { color: var(--ink); }

/* ---------- Buttons ---------- */
.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 52px;
  padding: 0 24px;
  border-radius: 999px;
  font-weight: 500;
  font-size: 16px;
  letter-spacing: -0.01em;
  white-space: nowrap;
  transition: transform 0.4s var(--ease-spring), background-color 0.3s, box-shadow 0.3s, color 0.3s;
  -webkit-tap-highlight-color: transparent;
  will-change: transform;
}
.btn:active { transform: scale(0.96) !important; transition-duration: 0.1s; }
.btn-primary { background: var(--ink); color: var(--bg); box-shadow: 0 10px 24px -12px rgba(18, 18, 17, 0.6); }
.btn-primary:hover { background: #000; }
.btn-ghost { background: var(--surface); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line-2); }
.btn-ghost:hover { box-shadow: inset 0 0 0 1px var(--ink); }
.btn .ico { width: 18px; height: 18px; }
.btn-row { display: flex; flex-wrap: wrap; gap: 12px; }

/* Download button: arrow drops, a progress ring closes, then a check. */
.btn-dl .ico-wrap { position: relative; width: 18px; height: 18px; overflow: hidden; }
.btn-dl .ico-wrap svg { position: absolute; inset: 0; transition: transform 0.45s var(--ease), opacity 0.3s; }
.btn-dl .ico-check { transform: scale(0.4); opacity: 0; }
.btn-dl.busy .ico-arrow { transform: translateY(120%); }
.btn-dl.done .ico-arrow { opacity: 0; }
.btn-dl.done .ico-check { transform: none; opacity: 1; }
.btn-dl.done { background: var(--accent); box-shadow: 0 10px 24px -10px rgba(255, 90, 31, 0.7); }
.btn-dl .bar {
  position: absolute; left: 24px; right: 24px; bottom: 9px; height: 2px; border-radius: 2px;
  background: rgba(246, 245, 241, 0.25); transform-origin: left; transform: scaleX(0); opacity: 0;
}
.btn-dl.busy .bar { opacity: 1; animation: fill 0.75s var(--ease) forwards; background: rgba(246, 245, 241, 0.75); }
@keyframes fill { to { transform: scaleX(1); } }

/* ---------- Page header (sub-pages) ---------- */
.crumbs { display: flex; align-items: center; gap: 8px; color: var(--ink-3); margin: 28px 0 0; }
.crumbs a { transition: color 0.2s; }
.crumbs a:hover { color: var(--ink); }
.page-hero {
  position: relative;
  margin-top: 20px;
  padding: clamp(28px, 5vw, 64px);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
  isolation: isolate;
}
.page-hero::after { content: ""; position: absolute; inset: 0; border-radius: inherit; border: 1px solid var(--line); pointer-events: none; }
.page-hero .tile-art { position: absolute; right: clamp(16px, 5vw, 64px); top: 50%; transform: translateY(-50%); width: 320px; padding: 0; z-index: -1; }
.page-title {
  margin: 0;
  font-size: clamp(44px, 7vw, 96px);
  line-height: 0.95;
  letter-spacing: -0.06em;
  font-weight: 550;
  max-width: 12ch;
}
.page-lede { margin: 20px 0 0; color: var(--ink-2); max-width: 46ch; font-size: clamp(17px, 1.7vw, 20px); }
.page-hero .btn-row { margin-top: 32px; }
@media (max-width: 900px) { .page-hero .tile-art { display: none; } }
@media (min-width: 901px) {
  .skills-hero .page-title {
    max-width: calc(100% - 360px);
    font-size: clamp(44px, 5.1vw, 76px);
    text-wrap: balance;
  }
  .skills-hero .page-lede { max-width: min(46ch, calc(100% - 360px)); }
}
.tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 24px; }
.versions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
  margin-top: 36px;
}
.version { min-width: 0; padding-top: 18px; border-top: 1px solid var(--line); }
.version-label { margin: 0; color: var(--ink-3); }
.versions .btn-row { margin-top: 16px; gap: 8px; }
.version .btn { transition: background-color 0.2s, box-shadow 0.2s, color 0.2s; }
.version .btn:active { transform: scale(0.985) !important; }
@media (max-width: 760px) { .versions { grid-template-columns: 1fr; gap: 24px; } }

/* ---------- Skill list (cards) ---------- */
.cards { display: grid; gap: 16px; margin-top: 32px; }
.card {
  --rx: 0deg; --ry: 0deg; --s: 1; --mx: 50%; --my: 50%;
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: clamp(16px, 3vw, 32px);
  padding: clamp(20px, 3vw, 32px);
  border-radius: 24px;
  background: var(--surface);
  box-shadow: var(--shadow);
  transform: perspective(1400px) rotateX(var(--rx)) rotateY(var(--ry)) scale(var(--s));
  transition: box-shadow 0.5s var(--ease);
  overflow: hidden;
}
.card::after { content: ""; position: absolute; inset: 0; border-radius: inherit; border: 1px solid var(--line); pointer-events: none; }
.card::before {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity 0.4s;
  background: radial-gradient(420px circle at var(--mx) var(--my), rgba(255, 90, 31, 0.07), transparent 45%);
}
.card:hover { box-shadow: var(--shadow-lift); }
.card:hover::before { opacity: 1; }
.card-icon {
  width: 64px; height: 64px; border-radius: 18px; background: var(--surface-2);
  display: grid; place-items: center; color: var(--ink);
  transition: transform 0.6s var(--ease-spring), background-color 0.4s, color 0.4s;
}
.card:hover .card-icon { transform: rotate(-8deg) scale(1.06); background: var(--accent); color: #fff; }
.card h3 { margin: 0; font-size: clamp(22px, 2.4vw, 28px); font-weight: 540; letter-spacing: -0.035em; line-height: 1.1; }
.card p { margin: 6px 0 0; color: var(--ink-2); }
.card .chips { margin-top: 14px; }
.card-more {
  border-radius: 24px; border: 1.5px dashed var(--line-2); padding: 24px 32px; color: var(--ink-3);
  display: flex; align-items: center; gap: 12px;
}
@media (max-width: 640px) {
  .card { grid-template-columns: 1fr auto; }
  .card-icon { grid-column: 1 / -1; width: 52px; height: 52px; border-radius: 15px; }
}

/* ---------- Skill detail ---------- */
.grid-2 { display: grid; grid-template-columns: minmax(0, 4fr) minmax(0, 8fr); gap: clamp(24px, 6vw, 96px); }
@media (max-width: 860px) { .grid-2 { grid-template-columns: 1fr; } }
.grid-2 > :first-child { align-self: start; }
@media (min-width: 861px) { .grid-2 > .sticky { position: sticky; top: 96px; } }

.panel {
  position: relative;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: clamp(20px, 3vw, 36px);
}
.panel::after { content: ""; position: absolute; inset: 0; border-radius: inherit; border: 1px solid var(--line); pointer-events: none; }

/* Tabs with a sliding pill */
.tabs {
  position: relative;
  display: inline-flex;
  padding: 4px;
  border-radius: 999px;
  background: var(--surface-2);
  margin-bottom: 28px;
}
.tabs button {
  position: relative;
  z-index: 1;
  height: 38px;
  padding: 0 18px;
  border-radius: 999px;
  font-size: 15px;
  color: var(--ink-2);
  transition: color 0.3s;
}
.tabs button[aria-selected="true"] { color: var(--ink); }
@media (max-width: 480px) { .tabs button { padding: 0 10px; font-size: 14px; } }
.tabs .pill {
  position: absolute;
  top: 4px;
  left: 0;
  height: 38px;
  border-radius: 999px;
  background: var(--surface);
  box-shadow: 0 1px 2px rgba(18, 18, 17, 0.08), 0 4px 12px -4px rgba(18, 18, 17, 0.12);
  transition: transform 0.55s var(--ease-spring), width 0.55s var(--ease-spring);
}
.tab-panel[hidden] { display: none; }
.tab-panel { animation: panel-in 0.5s var(--ease); }
.install-note { margin: 24px 0 0; color: var(--ink-3); font-size: 14px; line-height: 1.5; }
@keyframes panel-in { from { opacity: 0; transform: translateY(8px); } }

.steps { list-style: none; margin: 0; padding: 0; counter-reset: s; }
.steps li {
  counter-increment: s;
  position: relative;
  padding: 0 0 26px 52px;
}
.steps li:last-child { padding-bottom: 0; }
.steps li::before {
  content: counter(s);
  position: absolute;
  left: 0;
  top: -2px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-family: var(--mono);
  font-size: 13px;
  background: var(--surface-2);
  color: var(--ink);
  transition: background-color 0.4s, color 0.4s, transform 0.5s var(--ease-spring);
}
.steps li::after {
  content: "";
  position: absolute;
  left: 15.5px;
  top: 36px;
  bottom: 6px;
  width: 1px;
  background: var(--line-2);
}
.steps li:last-child::after { display: none; }
.steps li:hover::before { background: var(--ink); color: var(--bg); transform: scale(1.08); }
.steps b { display: block; font-weight: 540; letter-spacing: -0.02em; }
.steps span { color: var(--ink-2); }
.steps kbd {
  font-family: var(--mono); font-size: 13px; padding: 2px 7px; border-radius: 6px;
  background: var(--surface-2); border: 1px solid var(--line); white-space: nowrap;
}

/* Code with copy */
.code {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
  padding: 14px 14px 14px 18px;
  border-radius: 16px;
  background: var(--ink);
  color: #e9e7e1;
  font-family: var(--mono);
  font-size: 13.5px;
  line-height: 1.5;
}
.code code { flex: 1; min-width: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.code code::-webkit-scrollbar { display: none; }
.code code .p { color: #7d7b75; user-select: none; }
.copy {
  flex: none;
  position: relative;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.08);
  color: #e9e7e1;
  transition: background-color 0.2s, transform 0.4s var(--ease-spring);
}
.copy:hover { background: rgba(255, 255, 255, 0.16); }
.copy:active { transform: scale(0.88); }
.copy svg { position: absolute; transition: transform 0.45s var(--ease-spring), opacity 0.25s; }
.copy .c2 { transform: scale(0.3) rotate(-45deg); opacity: 0; color: #7ee2a8; }
.copy.ok .c1 { transform: scale(0.3) rotate(45deg); opacity: 0; }
.copy.ok .c2 { transform: none; opacity: 1; }
.code.light { background: var(--surface-2); color: var(--ink); }
.code.light .copy { background: var(--surface); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line); }
.code.light .copy .c2 { color: #16a34a; }
.code.light code { white-space: normal; font-family: var(--sans); font-size: 15.5px; letter-spacing: -0.01em; }

/* Rules grid */
.rules { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.rule {
  padding: 20px;
  border-radius: 20px;
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--line);
  transition: transform 0.5s var(--ease-spring), box-shadow 0.4s;
}
.rule:hover { transform: translateY(-4px); box-shadow: inset 0 0 0 1px var(--line-2), 0 18px 32px -20px rgba(18, 18, 17, 0.3); }
.rule .n { color: var(--accent); }
.rule b { display: block; margin-top: 10px; font-weight: 540; letter-spacing: -0.02em; }
.rule span { display: block; color: var(--ink-2); font-size: 15px; margin-top: 4px; }

/* File tree */
.tree { list-style: none; margin: 0; padding: 0; font-family: var(--mono); font-size: 14px; }
.tree li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr);
  gap: 16px;
  padding: 12px 14px;
  border-radius: 12px;
  transition: background-color 0.2s;
}
.tree li:hover { background: var(--surface-2); }
.tree .f { display: flex; align-items: center; gap: 10px; white-space: nowrap; }
.tree .f svg { flex: none; color: var(--ink-3); }
.tree .in { padding-left: 26px; }
.tree .in2 { padding-left: 52px; }
.tree .d { color: var(--ink-2); font-family: var(--sans); font-size: 15px; }
@media (max-width: 560px) { .tree li { grid-template-columns: 1fr; gap: 2px; } .tree .d { padding-left: 26px; } }

/* Writing list */
.rows { margin-top: 32px; border-top: 1px solid var(--line-2); }
.row {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 24px;
  padding: 28px 8px;
  border-bottom: 1px solid var(--line-2);
}
.row h3 { margin: 0; font-size: clamp(22px, 2.8vw, 34px); font-weight: 520; letter-spacing: -0.035em; line-height: 1.1; transition: transform 0.5s var(--ease); }
.row p { margin: 8px 0 0; color: var(--ink-2); }
.row .mono { color: var(--ink-3); display: block; margin-bottom: 10px; }
.row:hover h3 { transform: translateX(10px); }

/* ---------- Legal page ---------- */
.legal { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(32px, 6vw, 96px); padding: 48px 0 24px; }
@media (max-width: 860px) { .legal { grid-template-columns: 1fr; } }
.legal section { scroll-margin-top: 88px; }
.legal .h2 { margin-bottom: 28px; }
.legal h2:not(.h2) { margin: 28px 0 6px; font-size: 16px; font-weight: 560; letter-spacing: -0.01em; }
.legal p, .legal address { margin: 0 0 10px; color: var(--ink-2); font-style: normal; font-size: 16px; }
.legal a { color: var(--ink); text-decoration: underline; text-decoration-color: var(--line-2); text-underline-offset: 3px; }
.legal .todo { color: var(--accent); background: var(--accent-soft); border-radius: 4px; padding: 0 4px; }
.legal .stand { margin-top: 32px; color: var(--ink-3); }

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
  .js .reveal, .js .name .ch { opacity: 1; transform: none; filter: none; }
}
