/* Enginelore: the Lichess dashboard's layout language (glass, glows, grid, Geist) in
   orange. No inline styles anywhere: the CSP allows stylesheets from 'self' only. */

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

:root {
  color-scheme: light dark;
  --radius: 1rem;

  --bg: oklch(0.985 0.006 70);
  --card: oklch(1 0 0 / 72%);
  --card-solid: oklch(1 0 0);
  --fg: oklch(0.2 0.02 50);
  --muted: oklch(0.47 0.025 55);
  --border: oklch(0.25 0.03 50 / 11%);
  --border-strong: oklch(0.25 0.03 50 / 18%);

  /* Brand: orange, amber, ember. Decoration only. */
  --brand-1: #f26a0f;
  --brand-2: #f0a000;
  --brand-3: #e8402c;
  --on-brand: #fff;
  --glow: color-mix(in oklch, var(--brand-1) 26%, transparent);
  --grid-line: oklch(0.2 0.02 50 / 6%);

  --sq-light: #f6e7d6;
  --sq-dark: #d99a63;
  --piece-w: #fffaf3;
  --piece-b: #2a1d14;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: oklch(0.145 0.012 50);
    --card: oklch(0.19 0.014 50 / 70%);
    --card-solid: oklch(0.19 0.014 50);
    --fg: oklch(0.97 0.006 70);
    --muted: oklch(0.75 0.02 60);
    --border: oklch(1 0 0 / 9%);
    --border-strong: oklch(1 0 0 / 16%);

    --brand-1: #ff7a1a;
    --brand-2: #ffb21f;
    --brand-3: #ff5038;
    --on-brand: #1a0f07;
    --glow: color-mix(in oklch, var(--brand-1) 30%, transparent);
    --grid-line: oklch(1 0 0 / 4.5%);

    --sq-light: #e9d3bb;
    --sq-dark: #b56f38;
    --piece-w: #fff8ef;
    --piece-b: #1b120c;
  }
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 88px;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--fg);
  font-family: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-feature-settings: "ss01", "cv11";
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

::selection {
  background: color-mix(in oklch, var(--brand-1) 35%, transparent);
}

a {
  color: inherit;
}

.mono {
  font-family: "Geist Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  font-feature-settings: normal;
}

:focus-visible {
  outline: 2px solid var(--brand-1);
  outline-offset: 3px;
  border-radius: 6px;
}

/* ---- Backdrop: grid lines and drifting embers ---- */

.backdrop {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}

.grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(70rem 40rem at 50% 0%, #000 30%, transparent 75%);
}

.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.55;
  animation: drift 22s ease-in-out infinite alternate;
}
.blob-1 {
  width: 42rem;
  height: 30rem;
  left: -10rem;
  top: -12rem;
  background: radial-gradient(closest-side, var(--brand-1), transparent);
}
.blob-2 {
  width: 34rem;
  height: 26rem;
  right: -8rem;
  top: -6rem;
  background: radial-gradient(closest-side, var(--brand-2), transparent);
  opacity: 0.35;
  animation-duration: 28s;
  animation-delay: -6s;
}
.blob-3 {
  width: 30rem;
  height: 24rem;
  left: 35%;
  top: 22rem;
  background: radial-gradient(closest-side, var(--brand-3), transparent);
  opacity: 0.22;
  animation-duration: 34s;
  animation-delay: -12s;
}

@keyframes drift {
  0% {
    transform: translate3d(0, 0, 0) scale(1);
  }
  50% {
    transform: translate3d(6rem, 3rem, 0) scale(1.12);
  }
  100% {
    transform: translate3d(-4rem, 5rem, 0) scale(0.94);
  }
}

/* ---- Top bar ---- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  /* Full-bleed bar, content aligned with main's 1200px column. */
  padding: 14px max(16px, calc((100% - 1200px) / 2 + 16px));
}
.topbar::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: color-mix(in oklch, var(--bg) 70%, transparent);
  backdrop-filter: blur(14px) saturate(1.4);
  mask-image: linear-gradient(#000 60%, transparent);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
  text-decoration: none;
}
.brand img {
  border-radius: 8px;
  box-shadow: 0 0 0 1px var(--border), 0 6px 18px -6px var(--glow);
}
.brand b {
  font-weight: 600;
  color: var(--muted);
}

.pillnav {
  display: flex;
  gap: 2px;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--card);
  backdrop-filter: blur(12px);
}
.pillnav a {
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 0.875rem;
  color: var(--muted);
  text-decoration: none;
  transition: background 0.2s, color 0.2s;
}
.pillnav a:hover {
  color: var(--fg);
  background: color-mix(in oklch, var(--fg) 7%, transparent);
}

.iconbtn {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--card);
  color: var(--muted);
  transition: color 0.2s, border-color 0.2s;
}
.iconbtn:hover {
  color: var(--fg);
  border-color: var(--border-strong);
}

/* ---- Layout ---- */

main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 16px;
}

section {
  padding: 56px 0;
}

.section-head {
  max-width: 640px;
  margin-bottom: 28px;
}
.eyebrow {
  margin: 0 0 8px;
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--brand-1);
}
h2 {
  margin: 0;
  font-size: clamp(1.75rem, 3.6vw, 2.5rem);
  line-height: 1.1;
  letter-spacing: -0.03em;
  font-weight: 600;
}
.section-lede {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 1.0625rem;
}

/* ---- Hero ---- */

.hero {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 48px;
  align-items: center;
  padding-top: 64px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 22px;
  padding: 5px 14px 5px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--card);
  backdrop-filter: blur(10px);
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--muted);
}
.pulse {
  position: relative;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--brand-1);
}
.pulse::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: var(--brand-1);
  animation: ping 1.8s cubic-bezier(0, 0, 0.2, 1) infinite;
}
@keyframes ping {
  75%,
  100% {
    transform: scale(2.4);
    opacity: 0;
  }
}

h1 {
  margin: 0;
  font-size: clamp(2.6rem, 6.4vw, 4.75rem);
  line-height: 1.02;
  letter-spacing: -0.045em;
  font-weight: 600;
}
.gradient {
  background: linear-gradient(100deg, var(--brand-2), var(--brand-1) 45%, var(--brand-3));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.lede {
  margin: 22px 0 0;
  max-width: 34rem;
  font-size: clamp(1.0625rem, 1.6vw, 1.1875rem);
  color: var(--muted);
}

.ctas {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 30px;
}
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 20px;
  border-radius: 999px;
  font-size: 0.9375rem;
  font-weight: 600;
  text-decoration: none;
  transition: transform 0.2s, box-shadow 0.2s, background 0.2s;
}
.btn-primary {
  background: linear-gradient(100deg, var(--brand-2), var(--brand-1) 55%, var(--brand-3));
  color: var(--on-brand);
  box-shadow: 0 10px 30px -10px var(--brand-1);
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 38px -12px var(--brand-1);
}
.btn-primary svg {
  transition: transform 0.2s;
}
.btn-primary:hover svg {
  transform: translateX(3px);
}
.btn-ghost {
  border: 1px solid var(--border-strong);
  background: var(--card);
  backdrop-filter: blur(10px);
}
.btn-ghost:hover {
  background: var(--card-solid);
}

.facts {
  display: grid;
  grid-template-columns: repeat(3, auto);
  justify-content: start;
  gap: 0 28px;
  margin: 40px 0 0;
}
.facts div {
  padding-left: 14px;
  border-left: 1px solid var(--border-strong);
}
.facts dt {
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.facts dd {
  margin: 2px 0 0;
  font-size: 1.375rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}
.facts span {
  font-size: 0.8125rem;
  color: var(--muted);
}

/* ---- Board card ---- */

.board-card {
  margin: 0;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 8px);
  background: var(--card);
  backdrop-filter: blur(16px);
  box-shadow: 0 30px 80px -40px var(--glow), 0 1px 0 0 var(--border) inset;
}
.board-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 14px;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.75rem;
  color: var(--muted);
}
.dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--brand-2);
}

.board-wrap {
  display: grid;
  grid-template-columns: 10px 1fr;
  gap: 10px;
}
.evalbar {
  position: relative;
  border-radius: 6px;
  overflow: hidden;
  background: color-mix(in oklch, var(--piece-b) 82%, var(--fg));
  box-shadow: 0 0 0 1px var(--border);
}
.evalfill {
  position: absolute;
  inset: 46% 0 0;
  background: var(--piece-w);
  animation: evalrise 1.6s 0.6s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
@keyframes evalrise {
  from {
    inset: 50% 0 0;
  }
}

.board {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 10px;
  box-shadow: 0 0 0 1px var(--border);
}
.sq-light {
  fill: var(--sq-light);
}
.sq-dark {
  fill: var(--sq-dark);
}
.pieces text {
  font-family: "Segoe UI Symbol", "Noto Sans Symbols 2", "DejaVu Sans", "Apple Symbols", serif;
  font-size: 32px;
  text-anchor: middle;
  stroke-width: 1.1px;
  paint-order: stroke;
}
.pieces .w {
  fill: var(--piece-w);
  stroke: #3a2717;
}
.pieces .b {
  fill: var(--piece-b);
  stroke: #f3dcc3;
  stroke-width: 0.6px;
}
.arrow {
  stroke: var(--brand-1);
  stroke-width: 7;
  stroke-linecap: round;
  opacity: 0.88;
  stroke-dasharray: 60;
  stroke-dashoffset: 60;
  animation: draw 0.9s 0.9s ease-out forwards;
}
.arrow-alt {
  stroke: var(--brand-2);
  opacity: 0.7;
  animation-delay: 1.5s;
}
.arrow-head {
  fill: context-stroke;
}
@keyframes draw {
  to {
    stroke-dashoffset: 0;
  }
}

.lines {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}
.line {
  display: grid;
  grid-template-columns: 7.5rem 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: color-mix(in oklch, var(--card-solid) 60%, transparent);
  font-size: 0.875rem;
}
.engine {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
}
.swatch {
  width: 10px;
  height: 10px;
  border-radius: 3px;
}
.s1 {
  background: var(--brand-1);
}
.s2 {
  background: var(--brand-2);
}
.tag {
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: color-mix(in oklch, var(--brand-1) 16%, transparent);
  color: var(--brand-1);
}
.tag-alt {
  background: color-mix(in oklch, var(--brand-2) 18%, transparent);
  color: color-mix(in oklch, var(--brand-2) 80%, var(--fg));
}

/* ---- Spotlight surfaces (site.js sets --mx / --my) ---- */

.spot {
  position: relative;
  isolation: isolate;
}
.spot::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  background: radial-gradient(22rem circle at var(--mx, 50%) var(--my, -30%), color-mix(in oklch, var(--brand-1) 14%, transparent), transparent 70%);
  opacity: 0;
  transition: opacity 0.3s;
}
.spot::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: radial-gradient(16rem circle at var(--mx, 50%) var(--my, -30%), var(--brand-1), transparent 70%);
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
}
.spot:hover::before,
.spot:hover::after,
.spot:focus-within::before,
.spot:focus-within::after {
  opacity: 1;
}

/* ---- Projects bento ---- */

.bento {
  display: grid;
  grid-template-columns: 1.25fr 1fr;
  grid-template-rows: auto auto;
  gap: 16px;
}
.card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 4px);
  background: var(--card);
  backdrop-filter: blur(14px);
  transition: transform 0.25s, border-color 0.25s;
}
.card:hover {
  transform: translateY(-2px);
}
.card-wide {
  grid-row: span 2;
}
.card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.icon {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  color: var(--brand-1);
  background: color-mix(in oklch, var(--brand-1) 13%, transparent);
  box-shadow: 0 0 0 1px color-mix(in oklch, var(--brand-1) 25%, transparent) inset;
}
.path {
  font-size: 0.8125rem;
  color: var(--muted);
}
.card h3 {
  margin: 4px 0 0;
  font-size: 1.375rem;
  letter-spacing: -0.02em;
  font-weight: 600;
}
.card p {
  margin: 0;
  color: var(--muted);
}
.feats {
  display: grid;
  gap: 6px;
  margin: 4px 0 0;
  padding: 0;
  list-style: none;
  font-size: 0.9375rem;
}
.feats li {
  display: flex;
  gap: 10px;
}
.feats li::before {
  content: "";
  flex: none;
  width: 6px;
  height: 6px;
  margin-top: 0.6em;
  border-radius: 2px;
  background: var(--brand-1);
  transform: rotate(45deg);
}

.spark {
  flex: 1;
  min-height: 90px;
  margin: 8px -24px 0;
  display: flex;
  align-items: flex-end;
}
.spark svg {
  width: 100%;
  height: 110px;
  display: block;
}
.spark-stop-a {
  stop-color: var(--brand-1);
  stop-opacity: 0.35;
}
.spark-stop-b {
  stop-color: var(--brand-1);
  stop-opacity: 0;
}
.spark-line {
  fill: none;
  stroke: var(--brand-1);
  stroke-width: 2.2;
  vector-effect: non-scaling-stroke;
}

.card-foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
.status {
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--brand-1);
  background: color-mix(in oklch, var(--brand-1) 12%, transparent);
}
.status-private {
  color: var(--muted);
  background: color-mix(in oklch, var(--fg) 7%, transparent);
}
.link {
  font-size: 0.875rem;
  font-weight: 600;
  text-decoration: none;
  color: var(--fg);
}
.link:hover {
  color: var(--brand-1);
}

/* ---- Built tiles ---- */

.tiles {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.tile {
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  backdrop-filter: blur(12px);
}
.tile h3 {
  margin: 0 0 6px;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.tile h3::before {
  content: "";
  display: block;
  width: 28px;
  height: 3px;
  margin-bottom: 14px;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--brand-2), var(--brand-1), var(--brand-3));
}
.tile p {
  margin: 0;
  font-size: 0.9375rem;
  color: var(--muted);
}

/* ---- Footer ---- */

.footer {
  display: flex;
  justify-content: center;
  gap: 10px;
  padding: 36px 16px 44px;
  font-size: 0.875rem;
  color: var(--muted);
}
.footer a {
  text-decoration: none;
}
.footer a:hover {
  color: var(--brand-1);
}

/* ---- Entrance ---- */

.rise {
  animation: rise 0.8s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
.d1 {
  animation-delay: 0.08s;
}
.d2 {
  animation-delay: 0.18s;
}
.d3 {
  animation-delay: 0.3s;
}
.d4 {
  animation-delay: 0.42s;
}
@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(14px);
    filter: blur(6px);
  }
}

/* ---- 404 ---- */

.notfound {
  max-width: 560px;
  padding: 120px 0 80px;
}
.notfound .code {
  margin: 0 0 12px;
}

/* ---- Responsive ---- */

@media (max-width: 960px) {
  .hero {
    grid-template-columns: 1fr;
    padding-top: 40px;
  }
  .board-card {
    max-width: 520px;
  }
  .tiles {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 720px) {
  .pillnav {
    display: none;
  }
  .bento {
    grid-template-columns: 1fr;
  }
  .card-wide {
    grid-row: auto;
  }
  .facts {
    grid-template-columns: 1fr 1fr;
    gap: 18px 20px;
  }
  .tiles {
    grid-template-columns: 1fr;
  }
  .line {
    grid-template-columns: 1fr auto;
  }
  .line .mono {
    grid-column: 1 / -1;
    grid-row: 2;
  }
  section {
    padding: 40px 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-delay: 0s !important;
    transition: none !important;
  }
  html {
    scroll-behavior: auto;
  }
}
