/* ==========================================================================
   shanky.dev — tokens
   ========================================================================== */

:root {
  --bg: #0c0b0a;
  --surface: #151311;
  --surface-2: #1c1a17;
  --ink: #ede6d8;
  --muted: #8a8378;
  --line: rgba(237, 230, 216, 0.12);
  --accent: #ff5a1f;
  --accent-ink: #0c0b0a;
  --glow: rgba(255, 90, 31, 0.16);

  --sans: "Geist", ui-sans-serif, system-ui, sans-serif;
  --serif: "Instrument Serif", "Times New Roman", serif;
  --mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --gutter: clamp(16px, 4vw, 56px);
  --radius: 18px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);

  color-scheme: dark;
}

:root[data-theme="light"] {
  --bg: #ece6d9;
  --surface: #e4ddcf;
  --surface-2: #dbd3c3;
  --ink: #141210;
  --muted: #6b645a;
  --line: rgba(20, 18, 16, 0.14);
  --accent: #e2460e;
  --accent-ink: #f5f0e6;
  --glow: rgba(226, 70, 14, 0.14);
  color-scheme: light;
}

/* ==========================================================================
   Base
   ========================================================================== */

*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  transition: background-color 0.5s var(--ease), color 0.5s var(--ease);
}

a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }
img, canvas { display: block; max-width: 100%; }
::selection { background: var(--accent); color: var(--accent-ink); }

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

.mono {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.serif {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 400;
  letter-spacing: -0.01em;
}

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

.eyebrow {
  margin: 0 0 24px;
  color: var(--muted);
}

@media (max-width: 640px) {
  .hide-sm { display: none !important; }
}

/* Film grain over everything — subtle texture, zero cost. */
.grain {
  position: fixed;
  inset: -50%;
  z-index: 100;
  pointer-events: none;
  opacity: 0.06;
  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='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grain 1.2s steps(6) infinite;
}
:root[data-theme="light"] .grain { opacity: 0.09; }

@keyframes grain {
  0% { transform: translate(0, 0); }
  20% { transform: translate(-3%, 2%); }
  40% { transform: translate(2%, -4%); }
  60% { transform: translate(-4%, -1%); }
  80% { transform: translate(3%, 3%); }
  100% { transform: translate(0, 0); }
}

/* Custom cursor (fine pointers only). */
.cursor { display: none; }
@media (hover: hover) and (pointer: fine) {
  .cursor {
    display: block;
    position: fixed;
    top: 0; left: 0;
    z-index: 101;
    pointer-events: none;
    mix-blend-mode: difference;
  }
  .cursor span {
    display: block;
    width: 10px; height: 10px;
    margin: -5px 0 0 -5px;
    border-radius: 50%;
    background: #fff;
    transition: transform 0.35s var(--ease);
  }
  .cursor.is-hover span { transform: scale(4.2); }
}

/* ==========================================================================
   Nav
   ========================================================================== */

.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 18px var(--gutter);
  mix-blend-mode: normal;
  transition: transform 0.5s var(--ease), background-color 0.4s;
}
.nav.is-hidden { transform: translateY(-110%); }
.nav.is-solid {
  background: color-mix(in srgb, var(--bg) 72%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}

.nav__mark {
  font-family: var(--sans);
  font-weight: 600;
  font-size: 22px;
  letter-spacing: -0.04em;
}
.nav__mark em {
  font-family: var(--serif);
  font-weight: 400;
  color: var(--accent);
}

.nav__links {
  display: flex;
  gap: 28px;
  font-size: 14px;
}
.nav__links a {
  position: relative;
  display: inline-flex;
  gap: 6px;
  align-items: baseline;
}
.nav__links a .mono { font-size: 10px; color: var(--muted); }
.nav__links a::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -4px;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 0.45s var(--ease);
}
.nav__links a:hover::after { transform: scaleX(1); transform-origin: left; }

@media (max-width: 820px) {
  .nav__links { display: none; }
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px 8px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  transition: border-color 0.3s;
}
.theme-toggle:hover { border-color: var(--accent); }
.theme-toggle__dot {
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--ink);
  box-shadow: inset -5px -2px 0 0 var(--bg);
  transition: box-shadow 0.5s var(--ease), background 0.5s;
}
:root[data-theme="light"] .theme-toggle__dot {
  background: var(--accent);
  box-shadow: inset 0 0 0 0 var(--bg);
}
.theme-toggle__label { font-size: 11px; }

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

.hero {
  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  padding: 96px var(--gutter) 32px;
  overflow: hidden;
  isolation: isolate;
}

.hero__canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
}
/* Fallback when WebGL is unavailable. */
.hero:not(.has-gl) {
  background:
    radial-gradient(60% 50% at 70% 30%, var(--glow), transparent 70%),
    repeating-radial-gradient(circle at 70% 30%, transparent 0 22px, var(--line) 22px 23px);
}

.hero__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 28px;
  color: var(--muted);
}
.hero__meta--top { justify-content: space-between; }
.hero__meta a:hover { color: var(--accent); }

.pulse {
  display: inline-block;
  width: 7px; height: 7px;
  margin-right: 8px;
  border-radius: 50%;
  background: var(--accent);
  vertical-align: 1px;
  box-shadow: 0 0 0 0 var(--accent);
  animation: pulse 2.2s infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 60%, transparent); }
  70% { box-shadow: 0 0 0 10px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}

.hero__title {
  align-self: center;
  margin: 0;
  font-weight: 600;
  font-size: clamp(64px, 17vw, 300px);
  line-height: 0.86;
  letter-spacing: -0.065em;
  pointer-events: none;
}
.hero__line { display: block; overflow: hidden; padding-bottom: 0.04em; }
.hero__line--indent { padding-left: 0.9em; }
.hero__word { display: inline-block; }
.hero__word.serif { font-weight: 400; letter-spacing: -0.03em; }

@media (max-width: 640px) {
  .hero__line--indent { padding-left: 0.35em; }
}

.hero__bottom {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px 48px;
}
.hero__lede {
  max-width: 34ch;
  margin: 0;
  font-size: clamp(18px, 1.7vw, 24px);
  text-wrap: balance;
  line-height: 1.3;
  letter-spacing: -0.01em;
}
.hero__lede .serif { color: var(--accent); font-size: 1.08em; }
.hero__bottom .hero__meta { flex-direction: column; align-items: flex-end; gap: 6px; text-align: right; }
@media (max-width: 640px) {
  .hero__bottom .hero__meta { align-items: flex-start; text-align: left; }
}
.clock { color: var(--ink); margin-left: 6px; }

/* JS-on: hide pieces that GSAP brings in, to avoid a flash. */
.js .hero__word,
.js .hero__meta,
.js .hero__lede { visibility: hidden; }

/* ==========================================================================
   Marquee
   ========================================================================== */

.marquee {
  overflow: hidden;
  border-block: 1px solid var(--line);
  padding: 22px 0;
  white-space: nowrap;
}
.marquee__track {
  display: inline-flex;
  align-items: center;
  gap: 36px;
  padding-right: 36px;
  font-size: clamp(28px, 4.2vw, 60px);
  letter-spacing: -0.03em;
  will-change: transform;
}
.marquee__track i {
  font-style: normal;
  font-size: 0.5em;
  color: var(--accent);
}

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

section:not(.hero) { padding: clamp(96px, 14vw, 180px) var(--gutter) 0; }

.section-head { margin-bottom: clamp(40px, 6vw, 72px); }
.section-head--split {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
}
.section-title {
  max-width: 18ch;
  margin: 0;
  font-weight: 500;
  font-size: clamp(40px, 6.4vw, 96px);
  line-height: 0.95;
  letter-spacing: -0.05em;
}
.section-title .serif { color: var(--muted); }

/* About ------------------------------------------------------------------ */

.about__statement {
  max-width: 26ch;
  margin: 0;
  font-size: clamp(28px, 4.4vw, 64px);
  line-height: 1.08;
  letter-spacing: -0.035em;
  font-weight: 450;
}
.about__statement em {
  font-family: var(--serif);
  font-weight: 400;
  color: var(--accent);
}
.about__statement .word { display: inline-block; }

.about__stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px;
  max-width: 900px;
  margin: clamp(56px, 8vw, 96px) 0 0;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}
.about__stats div { margin: 0; }
.about__stats dt { color: var(--muted); margin-bottom: 8px; }
.about__stats dd {
  margin: 0;
  font-size: clamp(32px, 5vw, 64px);
  letter-spacing: -0.04em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

/* Bento ------------------------------------------------------------------ */

.bento {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-auto-rows: minmax(260px, auto);
  gap: 14px;
}
.card--xl { grid-column: span 2; grid-row: span 2; }
.card--tall { grid-column: span 2; grid-row: span 2; }
.card--wide { grid-column: span 2; }

@media (min-width: 1100px) {
  .card--tall { grid-column: span 1; }
  .card--wide { grid-column: span 3; }
}
@media (max-width: 900px) {
  .bento { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .card--xl, .card--tall, .card--wide { grid-column: span 2; grid-row: auto; }
}
@media (max-width: 560px) {
  .bento { grid-template-columns: minmax(0, 1fr); }
  .bento > * { grid-column: auto !important; }
}

/* Featured project + side card. */
.bento--duo { grid-template-columns: minmax(0, 2.2fr) minmax(0, 1fr); grid-auto-rows: auto; }
.bento--duo .card--xl { grid-column: auto; grid-row: auto; min-height: 520px; }
.bento--duo .card--xl .card__art--radar {
  flex: none;
  align-self: center;
  width: min(100%, 360px);
  min-height: 0;
  aspect-ratio: 1;
}
@media (max-width: 900px) {
  .bento--duo { grid-template-columns: minmax(0, 1fr); }
  .bento--duo .card--xl { min-height: 0; }
  .bento--duo .card--side { min-height: 320px; }
}

.card {
  --mx: 50%;
  --my: 50%;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 24px;
  min-height: 260px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
  isolation: isolate;
  transition: border-color 0.4s, transform 0.6s var(--ease);
}
/* Spotlight that follows the pointer. */
.card::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: radial-gradient(420px circle at var(--mx) var(--my), var(--glow), transparent 60%);
  opacity: 0;
  transition: opacity 0.4s;
}
.card:hover::before { opacity: 1; }
.card:hover { border-color: color-mix(in srgb, var(--accent) 50%, transparent); }

.card__top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
}
.card__body h3 {
  margin: 0 0 8px;
  font-weight: 500;
  font-size: clamp(26px, 2.6vw, 38px);
  letter-spacing: -0.04em;
  line-height: 1;
}
.card--xl .card__body h3 { font-size: clamp(36px, 4.4vw, 68px); }
.card__body p { margin: 0; max-width: 42ch; color: var(--muted); }

.card__arrow {
  position: absolute;
  top: 18px; right: 20px;
  font-size: 20px;
  opacity: 0;
  transform: translate(-6px, 6px);
  transition: opacity 0.35s, transform 0.5s var(--ease);
}
.card:hover .card__arrow { opacity: 1; transform: none; color: var(--accent); }
.card:hover .card__top span:last-child { opacity: 0; }

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
}
.tags li {
  padding: 4px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 10.5px;
  color: var(--muted);
}

/* Radar art for Spider-Sense */
.card__art--radar {
  position: relative;
  flex: 1;
  min-height: 220px;
  display: grid;
  place-items: center;
}
.card__art--radar span {
  position: absolute;
  aspect-ratio: 1;
  border: 1px solid var(--line);
  border-radius: 50%;
}
.card__art--radar span:nth-child(1) { width: 34%; }
.card__art--radar span:nth-child(2) { width: 58%; }
.card__art--radar span:nth-child(3) { width: 82%; border-style: dashed; }
.card__art--radar i {
  position: absolute;
  width: 82%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: conic-gradient(from 0deg, transparent 0 300deg, color-mix(in srgb, var(--accent) 55%, transparent) 360deg);
  -webkit-mask: radial-gradient(circle, #000 69%, transparent 70%);
          mask: radial-gradient(circle, #000 69%, transparent 70%);
  animation: sweep 4s linear infinite;
}
.card__art--radar::after {
  content: "";
  position: absolute;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 16px var(--accent);
  transform: translate(64px, -38px);
  animation: blip 4s linear infinite;
}
@keyframes sweep { to { transform: rotate(360deg); } }
@keyframes blip { 0%, 6% { opacity: 0.15; } 10% { opacity: 1; } 60%, 100% { opacity: 0.15; } }

.card--accent { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.card--accent .card__top,
.card--accent .card__body p { color: color-mix(in srgb, var(--accent-ink) 72%, transparent); }
.card--accent::before { display: none; }
.card--accent:hover .card__arrow { color: var(--accent-ink); }
.card__big {
  position: absolute;
  right: -0.06em;
  bottom: -0.22em;
  z-index: -1;
  font-size: clamp(110px, 15vw, 220px);
  line-height: 1;
  opacity: 0.2;
  transition: transform 0.8s var(--ease);
}
.card--side .card__big { top: 0.12em; bottom: auto; right: 0.04em; }
.card--accent:hover .card__big { transform: translateX(-12px) rotate(-3deg); }

/* Workbench --------------------------------------------------------------- */

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
}
.filters button {
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--muted);
  transition: background-color 0.3s, color 0.3s;
}
.filters button:hover { color: var(--ink); }
.filters button[aria-selected="true"] { background: var(--ink); color: var(--bg); }
.filters sup { font-size: 9px; margin-left: 2px; opacity: 0.7; }

.bench {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
  gap: 14px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.bench__item {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 280px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
  transition: transform 0.6s var(--ease), border-color 0.4s;
}
.bench__item:hover { transform: translateY(-4px) rotate(-0.4deg); border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.bench__item:nth-child(even):hover { transform: translateY(-4px) rotate(0.4deg); }
.bench__item[hidden] { display: none; }

.bench__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  color: var(--muted);
}
.bench__num { font-family: var(--serif); font-style: italic; font-size: 22px; text-transform: none; color: var(--ink); }

.status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 10px;
  border: 1px solid var(--line);
}
.status::before {
  content: "";
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.status--shipped { color: #3ec98a; }
.status--tinkering { color: var(--accent); }
.status--tinkering::before { animation: pulse 2.2s infinite; }
.status--idea { color: #a99cff; }
:root[data-theme="light"] .status--shipped { color: #13804f; }
:root[data-theme="light"] .status--idea { color: #5b4bd1; }

.bench__emoji { font-size: 40px; line-height: 1; margin: 28px 0 auto; }
.bench__title {
  margin: 28px 0 6px;
  font-weight: 500;
  font-size: 28px;
  letter-spacing: -0.04em;
  line-height: 1;
}
.bench__blurb { margin: 0; color: var(--muted); }
.bench__foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-end;
  gap: 12px;
  margin-top: 20px;
}
.bench__foot .tags { margin: 0; }
.bench__links { display: flex; gap: 14px; }
.bench__links a { font-size: 11px; border-bottom: 1px solid var(--line); padding-bottom: 2px; transition: color 0.3s, border-color 0.3s; }
.bench__links a:hover { color: var(--accent); border-color: var(--accent); }

/* The "next slot" card: an invitation, styled as a blueprint. */
.bench__item--slot {
  justify-content: center;
  align-items: flex-start;
  border-style: dashed;
  background:
    linear-gradient(var(--line) 1px, transparent 1px) 0 0 / 22px 22px,
    linear-gradient(90deg, var(--line) 1px, transparent 1px) 0 0 / 22px 22px,
    transparent;
}
.bench__item--slot .bench__title { margin-top: 0; }
.bench__item--slot .serif { color: var(--accent); }
.bench__item--slot code {
  display: inline-block;
  margin-top: 14px;
  padding: 4px 8px;
  border-radius: 6px;
  background: var(--surface-2);
  font-family: var(--mono);
  font-size: 11.5px;
}

/* Community --------------------------------------------------------------- */

.community__note {
  max-width: 34ch;
  margin: 0 0 0 auto;
  padding-top: 28px;
  border-top: 1px solid var(--line);
  font-size: clamp(22px, 2.6vw, 36px);
  line-height: 1.25;
  letter-spacing: -0.025em;
}
.community__note .serif { display: block; margin-top: 18px; color: var(--accent); }
@media (max-width: 720px) {
  .community__note { margin-left: 0; }
}

/* Contact ------------------------------------------------------------------ */

.contact { padding-bottom: clamp(72px, 10vw, 140px); }
.contact__big {
  display: block;
  font-weight: 600;
  font-size: clamp(54px, 11.5vw, 200px);
  line-height: 0.9;
  letter-spacing: -0.065em;
}
.contact__line { display: block; }
.contact__line.serif { font-weight: 400; letter-spacing: -0.03em; }
.contact__line .accent {
  display: inline-block;
  margin-left: 0.08em;
  font-family: var(--sans);
  font-style: normal;
  transition: transform 0.6s var(--ease);
}
.contact__big:hover .accent { transform: translateX(0.18em) rotate(-35deg); }

.contact__links {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 48px 0 0;
  padding: 0;
  list-style: none;
}
.contact__links a {
  display: inline-flex;
  gap: 10px;
  padding: 14px 20px;
  border: 1px solid var(--line);
  border-radius: 999px;
  transition: background-color 0.35s, color 0.35s, border-color 0.35s;
}
.contact__links a:hover { background: var(--ink); color: var(--bg); border-color: var(--ink); }

.footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 24px var(--gutter) 32px;
  border-top: 1px solid var(--line);
  color: var(--muted);
}
.footer a:hover { color: var(--accent); }

/* ==========================================================================
   Reduced motion
   ========================================================================== */

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