/* ==========================================================================
   Dev Amin — Portfolio · v7 "Chess"
   Palette taken from a walnut & maple tournament board with a brass clock.
   ========================================================================== */

:root {
  /* --- Walnut (backgrounds) --- */
  --walnut-950: #120d0a;
  --walnut-900: #17110d;
  --walnut-850: #1d1611;
  --walnut-800: #241b15;
  --walnut-700: #31251c;

  /* --- Board squares --- */
  --maple:      #e8d4b0;   /* light square */
  --walnut-sq:  #8a5d3b;   /* dark square */

  /* --- Text --- */
  --parchment:  #f2e8d8;
  --muted:      #b6a68e;
  --faint:      #7f705d;

  /* --- Accents --- */
  --brass:      #d4a64a;   /* clock brass — primary accent */
  --brass-soft: rgba(212, 166, 74, 0.13);
  --brass-line: rgba(212, 166, 74, 0.32);
  --felt:       #4f7a5c;   /* tournament-table felt — secondary */
  --check:      #c8553f;   /* king-in-check red — used sparingly */

  --line:       rgba(242, 232, 216, 0.09);
  --line-hi:    rgba(242, 232, 216, 0.18);

  /* --- Type --- */
  --f-display: "Bricolage Grotesque", "Helvetica Neue", sans-serif;
  --f-body:    "Manrope", system-ui, -apple-system, sans-serif;
  --f-mono:    "JetBrains Mono", "SFMono-Regular", Menlo, monospace;
  --f-pieces:  "Apple Symbols", "Segoe UI Symbol", "Noto Sans Symbols 2", "DejaVu Sans", serif;

  --r: 14px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);

  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}

body {
  margin: 0;
  background: var(--walnut-900);
  color: var(--parchment);
  font-family: var(--f-body);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: none; }
ul, ol, dl, dd { margin: 0; padding: 0; }
li { list-style: none; }
p { margin: 0; }
h1, h2, h3 { margin: 0; font-family: var(--f-display); font-weight: 700; letter-spacing: -0.02em; }
button { font-family: inherit; }

.wrap { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 28px; }

::selection { background: var(--brass); color: var(--walnut-950); }
a:focus-visible, button:focus-visible { outline: 2px solid var(--brass); outline-offset: 3px; border-radius: 6px; }

.brass { color: var(--brass); }

/* ==========================================================================
   Reveal
   ========================================================================== */

.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity .7s var(--ease), transform .7s var(--ease);
  transition-delay: var(--delay, 0ms);
}
.reveal.is-visible { opacity: 1; transform: none; }

/* ==========================================================================
   Top bar
   ========================================================================== */

.progress {
  position: fixed; top: 0; left: 0; z-index: 100;
  height: 2px; width: 0%;
  background: var(--brass);
}

.topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 50;
  border-bottom: 1px solid transparent;
  transition: background-color .3s ease, border-color .3s ease;
}
.topbar.is-scrolled {
  background: rgba(23, 17, 13, 0.92);
  border-bottom-color: var(--line);
}
.topbar-inner { display: flex; align-items: center; justify-content: space-between; gap: 20px; height: 72px; }

.logo {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: var(--f-display); font-weight: 700; font-size: 1.12rem; letter-spacing: -0.02em;
}
.logo-piece {
  display: inline-grid; place-items: center;
  width: 34px; height: 34px; border-radius: 9px;
  background: var(--maple); color: var(--walnut-950);
  font-family: var(--f-pieces); font-size: 1.3rem; line-height: 1;
}

.nav { display: flex; gap: 4px; }
.nav a {
  font-size: 0.88rem; font-weight: 500; color: var(--muted);
  padding: 8px 14px; border-radius: 8px;
  transition: color .2s ease, background-color .2s ease;
}
.nav a:hover { color: var(--parchment); background: rgba(242, 232, 216, 0.05); }
.nav a.is-active { color: var(--brass); }

.topbar-end { display: flex; align-items: center; gap: 8px; }

.icon-btn {
  display: inline-grid; place-items: center;
  width: 38px; height: 38px; border-radius: 10px;
  color: var(--muted); border: 1px solid var(--line);
  transition: color .2s ease, border-color .2s ease, transform .2s var(--ease);
}
.icon-btn:hover { color: var(--brass); border-color: var(--brass-line); transform: translateY(-2px); }

.nav-toggle {
  display: none; width: 38px; height: 38px;
  background: none; border: 1px solid var(--line); border-radius: 10px; cursor: pointer;
  flex-direction: column; align-items: center; justify-content: center; gap: 4px;
}
.nav-toggle span { width: 16px; height: 1.5px; background: var(--parchment); transition: transform .25s ease, opacity .2s ease; }
.nav-toggle.is-open span:nth-child(1) { transform: translateY(5.5px) rotate(45deg); }
.nav-toggle.is-open span:nth-child(2) { opacity: 0; }
.nav-toggle.is-open span:nth-child(3) { transform: translateY(-5.5px) rotate(-45deg); }

/* ==========================================================================
   Buttons
   ========================================================================== */

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 13px 22px; border-radius: 10px;
  font-weight: 600; font-size: 0.94rem;
  border: 1px solid transparent; cursor: pointer; white-space: nowrap;
  transition: transform .2s var(--ease), background-color .2s ease, border-color .2s ease, color .2s ease;
}
.btn:active { transform: scale(0.97); }
.btn svg { transition: transform .2s var(--ease); }

.btn-brass { background: var(--brass); color: var(--walnut-950); }
.btn-brass:hover { background: #e2b65a; transform: translateY(-2px); }
.btn-brass:hover svg { transform: translateX(3px); }

.btn-ghost { color: var(--parchment); border-color: var(--line-hi); }
.btn-ghost:hover { border-color: var(--brass); color: var(--brass); transform: translateY(-2px); }

.btn-sm { padding: 9px 16px; font-size: 0.85rem; }

/* ==========================================================================
   Hero
   ========================================================================== */

.hero {
  position: relative;
  min-height: 100svh;
  display: flex; align-items: center;
  padding: 120px 0 80px;
  overflow: hidden;
}

/* faint full-bleed checkerboard, fading out */
.hero-checker {
  position: absolute; inset: 0;
  background-image: conic-gradient(rgba(242,232,216,0.028) 25%, transparent 0 50%, rgba(242,232,216,0.028) 0 75%, transparent 0);
  background-size: 96px 96px;
  mask-image: radial-gradient(ellipse 70% 70% at 70% 45%, #000 10%, transparent 72%);
  -webkit-mask-image: radial-gradient(ellipse 70% 70% at 70% 45%, #000 10%, transparent 72%);
  pointer-events: none;
}

.hero-inner {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.04fr);
  gap: 64px; align-items: center;
}

.eyebrow {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: var(--f-mono); font-size: 0.76rem; color: var(--muted);
  margin-bottom: 22px;
}
.eyebrow .dot { width: 8px; height: 8px; border-radius: 2px; background: var(--felt); }

.hero-name {
  font-size: clamp(3.2rem, 7.4vw, 6rem);
  font-weight: 800; line-height: 0.95; letter-spacing: -0.045em;
  margin-bottom: 18px;
  font-variation-settings: "opsz" 96;
}
.hero-tagline {
  font-family: var(--f-display);
  font-size: clamp(1.25rem, 2.2vw, 1.6rem);
  font-weight: 500; color: var(--maple); letter-spacing: -0.01em;
  margin-bottom: 26px; max-width: 26ch;
}
.hero-lede { color: var(--muted); font-size: 1.04rem; max-width: 50ch; margin-bottom: 32px; }
.hero-lede strong { color: var(--parchment); font-weight: 600; }

.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 40px; }

/* --- Chess-clock stats --- */
.clocks { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; max-width: 520px; }
.clock {
  display: flex; flex-direction: column; gap: 6px;
  padding: 14px 16px 13px;
  background: var(--walnut-850);
  border: 1px solid var(--line);
  border-top: 3px solid var(--brass);
  border-radius: 10px;
}
.clock-face {
  font-family: var(--f-mono); font-weight: 600; font-size: 1.32rem;
  color: var(--parchment); letter-spacing: -0.02em; line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.clock-label { font-size: 0.74rem; color: var(--faint); line-height: 1.35; }

/* ==========================================================================
   The board
   ========================================================================== */

.board-wrap {
  margin: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 168px;
  gap: 20px; align-items: stretch;
}

.board-frame {
  position: relative;
  padding: 22px 22px 22px 22px;
  background: var(--walnut-800);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 40px 80px -40px rgba(0,0,0,0.8), inset 0 1px 0 rgba(242,232,216,0.06);
}

.board {
  position: relative;
  aspect-ratio: 1;
  width: 100%;
  border-radius: 4px;
  overflow: hidden;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.5);
}

.squares { position: absolute; inset: 0; display: grid; grid-template-columns: repeat(8, 1fr); grid-template-rows: repeat(8, 1fr); }
.sq { background: var(--maple); position: relative; }
.sq.dark { background: var(--walnut-sq); }
.sq.hl::after { content: ""; position: absolute; inset: 0; background: rgba(212, 166, 74, 0.5); }
.sq.check::after { content: ""; position: absolute; inset: 0; background: radial-gradient(circle, rgba(200,85,63,0.95) 0%, rgba(200,85,63,0.45) 45%, transparent 75%); }

.pieces { position: absolute; inset: 0; }
.pc {
  position: absolute; top: 0; left: 0;
  width: 12.5%; height: 12.5%;
  display: grid; place-items: center;
  font-family: var(--f-pieces);
  font-size: clamp(1.4rem, 3.6vw, 2.55rem);
  line-height: 1;
  transform: translate(calc(var(--f) * 100%), calc(var(--r) * 100%));
  transition: transform .55s var(--ease), opacity .3s ease;
  user-select: none;
}
.pc.w { color: #fbf4e6; text-shadow: 0 0 1px #1a120c, 0 1px 0 #1a120c, 0 -1px 0 #1a120c, 1px 0 0 #1a120c, -1px 0 0 #1a120c, 0 3px 4px rgba(0,0,0,0.35); }
.pc.b { color: #1a120c; text-shadow: 0 0 1px rgba(251,244,230,0.4), 0 3px 4px rgba(0,0,0,0.3); }
.pc.gone { opacity: 0; }

.files, .ranks {
  position: absolute;
  font-family: var(--f-mono); font-size: 0.62rem; color: var(--faint);
  pointer-events: none;
}
.files { left: 22px; right: 22px; bottom: 4px; display: grid; grid-template-columns: repeat(8, 1fr); text-align: center; }
.ranks { top: 22px; bottom: 22px; left: 7px; display: grid; grid-template-rows: repeat(8, 1fr); align-items: center; }

.board-side {
  display: flex; flex-direction: column; gap: 14px;
  padding: 18px 16px;
  background: var(--walnut-850);
  border: 1px solid var(--line);
  border-radius: 16px;
  min-height: 0;
  contain: size; /* let the board, not the move list, set the row height */
}
.board-meta { display: flex; flex-direction: column; gap: 4px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.board-title { font-family: var(--f-display); font-weight: 700; font-size: 0.98rem; }
.board-sub { font-size: 0.7rem; color: var(--faint); line-height: 1.4; }

.movelist {
  flex: 1; min-height: 0;
  overflow-y: auto; scrollbar-width: none;
  font-family: var(--f-mono); font-size: 0.74rem;
  display: grid; grid-template-columns: 22px 1fr 1fr; align-content: start;
  row-gap: 3px; column-gap: 4px;
}
.movelist::-webkit-scrollbar { display: none; }
.movelist .no { color: var(--faint); }
.movelist .mv { color: var(--muted); padding: 1px 5px; border-radius: 4px; transition: background-color .2s ease, color .2s ease; }
.movelist .mv.played { color: var(--parchment); }
.movelist .mv.now { background: var(--brass); color: var(--walnut-950); font-weight: 600; }

.board-status { display: flex; flex-direction: column; gap: 10px; padding-top: 12px; border-top: 1px solid var(--line); }
.status-text { font-family: var(--f-mono); font-size: 0.72rem; color: var(--muted); }
.status-text.mate { color: var(--check); font-weight: 600; }
.replay {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 7px 10px; border-radius: 8px;
  background: transparent; color: var(--parchment);
  border: 1px solid var(--line-hi); cursor: pointer;
  font-family: var(--f-mono); font-size: 0.72rem;
  transition: border-color .2s ease, color .2s ease;
}
.replay:hover { border-color: var(--brass); color: var(--brass); }

/* ==========================================================================
   Ticker — lens kept
   ========================================================================== */

.marquee {
  position: relative; overflow: hidden;
  padding: 30px 0;
  border-block: 1px solid var(--line);
  background: var(--walnut-950);
  mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
}
.marquee-track {
  position: relative;
  display: flex; align-items: center; gap: 30px;
  width: max-content;
  font-family: var(--f-mono); font-size: 0.92rem; color: var(--muted);
  animation: marquee 64s linear infinite;
}
.marquee:hover .marquee-track { animation-play-state: paused; }
.marquee-track span {
  display: inline-block; white-space: nowrap;
  transform: scale(calc(1 + var(--boost, 0) * 0.45));
  opacity: calc(0.42 + var(--boost, 0) * 0.58);
  will-change: transform, opacity;
}
.marquee-track span.is-focus { color: var(--brass); }
.marquee-track i { font-style: normal; font-family: var(--f-pieces); font-size: 0.8rem; color: var(--walnut-sq); }
@keyframes marquee { to { transform: translateX(-50%); } }

@media (prefers-reduced-motion: reduce) {
  .marquee-track span { transform: none; opacity: .9; }
}

/* ==========================================================================
   Sections
   ========================================================================== */

.section { padding: 104px 0; position: relative; }
.section-alt { background: var(--walnut-850); border-block: 1px solid var(--line); }

.section-head { margin-bottom: 48px; }
.kicker {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--f-mono); font-size: 0.78rem; color: var(--brass);
  letter-spacing: 0.04em; margin-bottom: 12px;
}
.kicker-move {
  display: inline-grid; place-items: center;
  min-width: 26px; height: 22px; padding: 0 6px;
  background: var(--brass-soft); border: 1px solid var(--brass-line); border-radius: 5px;
}
.section-title { font-size: clamp(2.1rem, 4.4vw, 3.2rem); line-height: 1.04; letter-spacing: -0.035em; }
.section-sub { color: var(--muted); font-size: 1.04rem; margin-top: 14px; max-width: 58ch; }

/* ==========================================================================
   About
   ========================================================================== */

.about { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 64px; align-items: start; }
.about-text p { font-size: 1.12rem; line-height: 1.7; color: var(--muted); max-width: 58ch; margin-bottom: 18px; }
.about-text p:first-child { color: var(--parchment); }

.facts {
  margin-top: 34px;
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  border-top: 1px solid var(--line);
  max-width: 620px;
}
.facts > div { padding: 16px 0; border-bottom: 1px solid var(--line); }
.facts > div:nth-child(odd) { padding-right: 20px; }
.facts dt { font-family: var(--f-mono); font-size: 0.7rem; color: var(--faint); text-transform: uppercase; letter-spacing: 0.1em; margin-bottom: 4px; }
.facts dd { font-weight: 600; font-size: 0.98rem; }

.about-photo {
  margin: 0; position: relative;
  padding: 10px;
  background: var(--walnut-800);
  border: 1px solid var(--line);
  border-radius: 16px;
}
.about-photo img { border-radius: 10px; aspect-ratio: 954 / 1014; object-fit: cover; }

/* ==========================================================================
   Skills — the pieces
   ========================================================================== */

.pieces-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.piece-card {
  display: grid; grid-template-columns: 64px minmax(0, 1fr); column-gap: 18px; row-gap: 18px;
  padding: 26px;
  background: var(--walnut-900);
  border: 1px solid var(--line);
  border-radius: var(--r);
  transition: border-color .25s ease, transform .25s var(--ease);
}
.piece-card:hover { border-color: var(--brass-line); transform: translateY(-3px); }
.piece-glyph {
  grid-row: span 2;
  display: grid; place-items: center;
  width: 64px; height: 64px; border-radius: 12px;
  background: var(--maple); color: var(--walnut-950);
  font-family: var(--f-pieces); font-size: 2.3rem; line-height: 1;
  box-shadow: inset 0 -3px 0 rgba(0,0,0,0.12);
}
.piece-card h3 { font-size: 1.18rem; }
.piece-role { font-size: 0.82rem; color: var(--faint); font-style: italic; margin-top: 2px; }

.chips { display: flex; flex-wrap: wrap; gap: 7px; }
.chips span {
  font-family: var(--f-mono); font-size: 0.74rem;
  padding: 5px 11px; border-radius: 6px;
  background: var(--walnut-800); border: 1px solid var(--line);
  color: var(--muted);
  transition: color .2s ease, border-color .2s ease;
}
.chips span:hover { color: var(--brass); border-color: var(--brass-line); }

/* ==========================================================================
   Experience — game record
   ========================================================================== */

.record { display: flex; flex-direction: column; gap: 16px; }
.record-item { display: grid; grid-template-columns: 56px minmax(0, 1fr); gap: 18px; align-items: start; }
.record-no {
  font-family: var(--f-mono); font-weight: 600; font-size: 1.05rem;
  color: var(--brass);
  padding-top: 26px; text-align: right;
}
.record-card {
  padding: 26px 28px;
  background: var(--walnut-850);
  border: 1px solid var(--line);
  border-left: 3px solid var(--walnut-sq);
  border-radius: var(--r);
  transition: border-color .25s ease;
}
.record-item:hover .record-card { border-left-color: var(--brass); }
.record-head { display: flex; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; gap: 12px; margin-bottom: 16px; }
.record-head h3 { font-size: 1.28rem; }
.record-org { color: var(--muted); font-size: 0.92rem; margin-top: 2px; }
.record-date {
  font-family: var(--f-mono); font-size: 0.74rem; color: var(--parchment);
  padding: 6px 11px; border-radius: 6px;
  background: var(--walnut-800); border: 1px solid var(--line);
  white-space: nowrap;
}

.bullets li {
  position: relative; padding-left: 22px;
  color: var(--muted); font-size: 0.95rem; line-height: 1.6;
  margin-bottom: 9px;
}
.bullets li:last-child { margin-bottom: 0; }
.bullets li::before {
  content: ""; position: absolute; left: 3px; top: 0.62em;
  width: 7px; height: 7px;
  background: var(--walnut-sq);
  transform: rotate(45deg);
}
.bullets strong { color: var(--parchment); font-weight: 600; }

/* ==========================================================================
   Projects — best games
   ========================================================================== */

.games { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.game {
  display: flex; flex-direction: column; gap: 14px;
  padding: 26px;
  background: var(--walnut-900);
  border: 1px solid var(--line);
  border-radius: var(--r);
  transition: border-color .25s ease, transform .25s var(--ease);
}
.game:hover { border-color: var(--brass-line); transform: translateY(-4px); }

.game-top { display: flex; align-items: center; justify-content: space-between; }
.game-piece {
  display: grid; place-items: center;
  width: 44px; height: 44px; border-radius: 10px;
  background: var(--maple); color: var(--walnut-950);
  font-family: var(--f-pieces); font-size: 1.6rem; line-height: 1;
}
.tag {
  font-family: var(--f-mono); font-size: 0.68rem; letter-spacing: 0.04em;
  padding: 5px 10px; border-radius: 6px;
  color: var(--felt); background: rgba(79,122,92,0.14); border: 1px solid rgba(79,122,92,0.35);
}

.game h3 { font-size: 1.6rem; letter-spacing: -0.03em; }
.game-sub { color: var(--maple); font-weight: 600; font-size: 0.95rem; margin-top: -8px; }
.game-desc { color: var(--muted); font-size: 0.92rem; }

.game-result {
  display: flex; flex-direction: column; gap: 4px;
  padding: 13px 14px;
  background: var(--brass-soft);
  border: 1px solid var(--brass-line);
  border-radius: 10px;
}
.result-big { font-family: var(--f-mono); font-weight: 600; font-size: 0.8rem; color: var(--brass); }
.result-small { font-size: 0.8rem; color: var(--muted); line-height: 1.45; }

.game .bullets li { font-size: 0.87rem; }
.game .bullets { flex: 1; }

.stack {
  font-family: var(--f-mono); font-size: 0.7rem; color: var(--faint); line-height: 1.6;
  padding-top: 12px; border-top: 1px solid var(--line);
}
.game-link {
  display: inline-flex; align-items: center; gap: 6px; align-self: flex-start;
  font-weight: 600; font-size: 0.86rem; color: var(--parchment);
  border-bottom: 1px solid var(--brass-line); padding-bottom: 2px;
  transition: color .2s ease, border-color .2s ease;
}
.game-link:hover { color: var(--brass); border-bottom-color: var(--brass); }

/* ==========================================================================
   Contact
   ========================================================================== */

.contact-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.contact {
  display: flex; flex-direction: column; gap: 8px;
  padding: 20px 18px;
  background: var(--walnut-850);
  border: 1px solid var(--line);
  border-radius: 12px;
  transition: border-color .25s ease, transform .25s var(--ease);
}
.contact:hover { border-color: var(--brass); transform: translateY(-3px); }
.contact-label { font-family: var(--f-mono); font-size: 0.68rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--faint); }
.contact-value { font-weight: 600; font-size: 0.86rem; white-space: nowrap; }

/* ==========================================================================
   Footer
   ========================================================================== */

.footer { border-top: 1px solid var(--line); padding: 30px 0; }
.footer-inner { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px; font-size: 0.82rem; color: var(--faint); }
.footer-note { font-family: var(--f-mono); font-size: 0.72rem; }

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 1100px) {
  .hero-inner { grid-template-columns: 1fr; gap: 56px; }
  .board-wrap { max-width: 640px; }
  .games { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 860px) {
  .nav {
    position: fixed; top: 72px; left: 0; right: 0;
    flex-direction: column; gap: 0;
    background: var(--walnut-900);
    border-bottom: 1px solid var(--line);
    padding: 8px 28px 20px;
    display: none;
  }
  .nav.is-open { display: flex; }
  .nav a { padding: 13px 0; border-bottom: 1px solid var(--line); border-radius: 0; }
  .nav-toggle { display: flex; }
  .topbar-end .icon-btn { display: none; }
  .topbar { background: rgba(23, 17, 13, 0.92); }

  .about { grid-template-columns: 1fr; gap: 36px; }
  .about-photo { max-width: 280px; }
  .pieces-grid { grid-template-columns: 1fr; }
  .games { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
  .wrap { padding: 0 20px; }
  .section { padding: 72px 0; }
  .hero { padding-top: 104px; }

  .board-wrap { grid-template-columns: 1fr; }
  .board-side { contain: none; }
  .board-frame { padding: 16px 16px 20px 18px; }
  .files { left: 18px; right: 16px; bottom: 3px; }
  .ranks { top: 16px; bottom: 20px; left: 5px; }
  .movelist { max-height: 120px; grid-template-columns: 22px 1fr 1fr 22px 1fr 1fr; }

  .clocks { grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
  .clock { padding: 11px 10px; }
  .clock-face { font-size: 1.05rem; }

  .facts { grid-template-columns: 1fr; }
  .facts > div:nth-child(odd) { padding-right: 0; }

  .piece-card { grid-template-columns: 52px minmax(0, 1fr); padding: 20px; }
  .piece-glyph { width: 52px; height: 52px; font-size: 1.9rem; }
  .record-item { grid-template-columns: 1fr; gap: 6px; }
  .record-no { padding-top: 0; text-align: left; }
  .record-card { padding: 22px 20px; }
  .game { padding: 22px 20px; }
}

/* ==========================================================================
   v10 — interactivity
   ========================================================================== */

/* --- board: squares are buttons (puzzle mode) --- */
.sq { border: 0; padding: 0; margin: 0; font: inherit; display: block; cursor: default; }
.board.is-play .sq { cursor: pointer; }
.board.is-play .sq:focus-visible { outline: 2px solid var(--brass); outline-offset: -2px; z-index: 2; }
.sq.sel::after { content: ""; position: absolute; inset: 0; background: rgba(79, 122, 92, 0.65); }
.sq.dot::before {
  content: ""; position: absolute; z-index: 3; left: 50%; top: 50%;
  width: 28%; height: 28%; border-radius: 50%; transform: translate(-50%, -50%);
  background: rgba(23, 17, 13, 0.32);
}
.sq.dot.cap::before { width: 86%; height: 86%; background: transparent; border: 4px solid rgba(23, 17, 13, 0.32); }
.sq.hint::after { content: ""; position: absolute; inset: 0; box-shadow: inset 0 0 0 4px var(--brass); animation: hintPulse 1.1s ease-in-out infinite; }
@keyframes hintPulse { 50% { box-shadow: inset 0 0 0 2px rgba(212,166,74,0.3); } }

.pieces { pointer-events: none; z-index: 4; }
.pieces.instant .pc { transition: none !important; }
.board.shake { animation: shake .4s ease; }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }

.board-toast {
  position: absolute; left: 50%; top: 50%; z-index: 6;
  transform: translate(-50%, -50%) scale(0.9);
  padding: 14px 22px; border-radius: 12px;
  background: rgba(18, 13, 10, 0.94); border: 1px solid var(--brass);
  font-family: var(--f-display); font-weight: 700; font-size: 1.15rem; color: var(--brass);
  text-align: center; white-space: nowrap;
  opacity: 0; pointer-events: none;
  transition: opacity .3s ease, transform .3s var(--ease);
}
.board-toast small { display: block; font-family: var(--f-body); font-weight: 500; font-size: 0.78rem; color: var(--muted); margin-top: 4px; }
.board-toast.show { opacity: 1; transform: translate(-50%, -50%) scale(1); }

.board-wrap:focus-visible { outline: 2px solid var(--brass); outline-offset: 6px; border-radius: 18px; }

/* --- side panel: tabs, panes, controls --- */
.tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 3px; background: var(--walnut-900); border-radius: 9px; border: 1px solid var(--line); }
.tab {
  padding: 7px 4px; border: 0; border-radius: 7px; cursor: pointer;
  background: transparent; color: var(--muted);
  font-family: var(--f-mono); font-size: 0.7rem; font-weight: 600;
  transition: background-color .2s ease, color .2s ease;
}
.tab:hover { color: var(--parchment); }
.tab.is-active { background: var(--brass); color: var(--walnut-950); }

.pane { display: flex; flex-direction: column; gap: 12px; flex: 1; min-height: 0; }
.pane[hidden] { display: none; }

.movelist .mv { cursor: pointer; border: 0; background: none; font: inherit; text-align: left; }
.movelist .mv:hover { color: var(--brass); }

.controls { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; }
.ctl {
  height: 30px; border-radius: 7px; cursor: pointer;
  background: var(--walnut-800); color: var(--parchment);
  border: 1px solid var(--line);
  font-size: 0.95rem; line-height: 1;
  transition: border-color .2s ease, color .2s ease;
}
.ctl:hover { border-color: var(--brass); color: var(--brass); }
.ctl-play { font-size: 0.62rem; letter-spacing: -1px; }

.puzzle-msg { font-size: 0.82rem; line-height: 1.5; color: var(--parchment); flex: 1; }
.puzzle-msg.good { color: var(--brass); font-weight: 600; }
.puzzle-msg.bad { color: var(--check); }
.puzzle-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }

/* --- skills: piece movement mini-board --- */
.piece-visual { grid-row: span 2; position: relative; width: 64px; height: 64px; }
.piece-visual .piece-glyph { position: absolute; inset: 0; transition: opacity .25s ease, transform .3s var(--ease); }
.mini {
  position: absolute; inset: 0;
  display: grid; grid-template-columns: repeat(5, 1fr); grid-template-rows: repeat(5, 1fr);
  border-radius: 10px; overflow: hidden;
  opacity: 0; transform: scale(0.9);
  transition: opacity .25s ease, transform .3s var(--ease);
}
.mini i { background: var(--maple); position: relative; display: grid; place-items: center; font-style: normal; }
.mini i.d { background: var(--walnut-sq); }
.mini i.home { font-family: var(--f-pieces); font-size: 0.72rem; color: var(--walnut-950); line-height: 1; }
.mini i.reach::after {
  content: ""; position: absolute; inset: 0; background: var(--brass);
  opacity: 0; transform: scale(0.3);
  transition: opacity .2s ease, transform .25s var(--ease);
  transition-delay: calc(var(--k) * 45ms);
}
.piece-card:hover .mini, .piece-card:focus-visible .mini { opacity: 1; transform: none; }
.piece-card:hover .piece-glyph, .piece-card:focus-visible .piece-glyph { opacity: 0; transform: scale(0.8); }
.piece-card:hover .mini i.reach::after, .piece-card:focus-visible .mini i.reach::after { opacity: 0.85; transform: none; }
.piece-card:focus-visible { outline: 2px solid var(--brass); outline-offset: 3px; }
.piece-head { align-self: center; }

/* --- projects: aligned rows across cards (subgrid) --- */
.game-sub { margin-top: 0; }
.how {
  align-self: flex-start;
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 14px; border-radius: 9px; cursor: pointer;
  background: transparent; color: var(--parchment);
  border: 1px solid var(--line-hi);
  font-family: var(--f-body); font-weight: 600; font-size: 0.86rem;
  transition: border-color .2s ease, color .2s ease, background-color .2s ease;
}
.how span { transition: transform .2s var(--ease); }
.how:hover { border-color: var(--brass); color: var(--brass); background: var(--brass-soft); }
.how:hover span { transform: translateX(3px); }

@supports (grid-template-rows: subgrid) {
  @media (min-width: 1101px) {
    .games { grid-auto-rows: auto; row-gap: 0; }
    .game {
      display: grid;
      grid-row: span 8;
      grid-template-rows: subgrid;
      row-gap: 14px;
    }
    .game .bullets { align-self: start; }
    .game .stack { align-self: start; }
  }
}

/* --- architecture dialog --- */
.arch {
  width: min(880px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  padding: 0; border: 1px solid var(--brass-line); border-radius: 18px;
  background: var(--walnut-900); color: var(--parchment);
  box-shadow: 0 50px 120px -30px rgba(0,0,0,0.9);
}
.arch::backdrop { background: rgba(10, 7, 5, 0.72); }
.arch[open] { animation: archIn .35s var(--ease); }
@keyframes archIn { from { opacity: 0; transform: translateY(16px) scale(0.98); } }
.arch-inner { padding: 28px; display: flex; flex-direction: column; gap: 22px; }
.arch-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.arch-head .kicker { margin-bottom: 4px; }
.arch-head h2 { font-size: 1.9rem; letter-spacing: -0.03em; }
.arch-close {
  width: 36px; height: 36px; border-radius: 9px; cursor: pointer;
  background: transparent; color: var(--muted); border: 1px solid var(--line);
  font-size: 0.9rem;
}
.arch-close:hover { color: var(--brass); border-color: var(--brass); }

.arch-flow { display: flex; flex-wrap: wrap; align-items: center; gap: 0; row-gap: 12px; }
.arch-flow li { display: flex; align-items: center; }
.arch-node {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
  padding: 9px 12px; border-radius: 10px; cursor: pointer;
  background: var(--walnut-800); border: 1px solid var(--line);
  color: var(--muted); font: inherit; text-align: left;
  transition: border-color .25s ease, background-color .25s ease, color .25s ease, transform .25s var(--ease);
}
.arch-node b { font-family: var(--f-display); font-size: 0.9rem; color: var(--parchment); font-weight: 700; }
.arch-node small { font-family: var(--f-mono); font-size: 0.64rem; }
.arch-node.done { border-color: var(--brass-line); }
.arch-node.on { background: var(--brass); border-color: var(--brass); color: var(--walnut-950); transform: translateY(-2px); }
.arch-node.on b { color: var(--walnut-950); }
.arch-link { width: 26px; height: 2px; background: var(--line-hi); position: relative; overflow: hidden; }
.arch-link.done { background: var(--brass); }
.arch-link.on::after {
  content: ""; position: absolute; top: -2px; left: -8px; width: 8px; height: 6px; border-radius: 3px;
  background: var(--brass); animation: packet .6s linear forwards;
}
@keyframes packet { to { left: 100%; } }

.arch-detail {
  padding: 20px 22px; border-radius: 14px;
  background: var(--walnut-850); border: 1px solid var(--line); border-left: 3px solid var(--brass);
  min-height: 150px;
}
.arch-step { font-family: var(--f-mono); font-size: 0.7rem; color: var(--brass); letter-spacing: 0.06em; }
.arch-detail h3 { font-size: 1.3rem; margin: 4px 0 2px; }
.arch-tech { font-family: var(--f-mono); font-size: 0.74rem; color: var(--faint); margin-bottom: 10px; }
.arch-what { color: var(--muted); font-size: 0.95rem; line-height: 1.6; max-width: 70ch; }
.arch-controls { display: flex; align-items: center; gap: 6px; }
.arch-controls .ctl { width: 40px; }
.arch-hint { margin-left: auto; font-family: var(--f-mono); font-size: 0.7rem; color: var(--faint); }

@media (max-width: 600px) {
  .arch-inner { padding: 20px; }
  .arch-flow { flex-direction: column; align-items: stretch; }
  .arch-flow li { flex-direction: column; align-items: stretch; }
  .arch-node { width: 100%; }
  .arch-link { width: 2px; height: 14px; margin-left: 20px; }
  .arch-hint { display: none; }
  .piece-visual { width: 52px; height: 52px; }
  .movelist { max-height: 110px; }
  .board-toast { font-size: 1rem; white-space: normal; width: 80%; }
}

/* ==========================================================================
   v12 — carved-D logo, crowned "i"
   ========================================================================== */

.logo-mark { width: 34px; height: 34px; flex-shrink: 0; display: block; transition: transform .3s var(--ease); }
.logo:hover .logo-mark { transform: rotate(-6deg) scale(1.05); }

/* dotless ı with a queen sitting where the tittle would be */
.crowned { position: relative; display: inline-block; }
.crown {
  position: absolute;
  left: 50%;
  top: 0.34em;
  transform: translateX(-50%);
  font-family: var(--f-pieces);
  font-size: 0.22em;
  line-height: 1;
  letter-spacing: 0;
  color: var(--brass);
  transition: transform .35s var(--ease);
}
.hero-name:hover .crown { transform: translateX(-50%) translateY(-0.12em) rotate(-8deg); }

/* ==========================================================================
   v17 — 3D board in the hero background
   ========================================================================== */

.hero-inner { grid-template-columns: minmax(0, 640px); }
.hero-copy { position: relative; z-index: 2; }

.hero-3d {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  z-index: 0;
  opacity: 0;
  pointer-events: none;
  transition: opacity 1.2s ease;
}
.hero-3d.is-ready { opacity: 0.32; }
.hero-3d.is-ready.is-resetting { opacity: 0; transition-duration: .6s; }

/* keeps the text side calm and readable over the board */
.hero-scrim {
  position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background:
    linear-gradient(90deg, var(--walnut-900) 0%, rgba(23,17,13,0.92) 28%, rgba(23,17,13,0.35) 58%, rgba(23,17,13,0) 78%),
    linear-gradient(0deg, var(--walnut-900) 0%, rgba(23,17,13,0) 22%);
}

@media (max-width: 900px) {
  .hero-3d.is-ready { opacity: 0.18; }
  .hero-scrim { background: linear-gradient(0deg, var(--walnut-900) 0%, rgba(23,17,13,0.55) 45%, rgba(23,17,13,0.75) 100%); }
}
