/* ==========================================================================
   adrik.me — tokens
   ========================================================================== */
:root {
  --bg: #0b0c0f;
  --bg-alt: #111318;
  --surface: #161920;
  --line: #262a33;
  --text: #ecebe7;
  --muted: #9a9ca5;
  --accent: #ff6a2b;
  --accent-ink: #0b0c0f;
  --hero-overlay: linear-gradient(180deg, rgba(11, 12, 15, .80) 0%, rgba(11, 12, 15, .92) 70%, var(--bg) 100%);

  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-display: "Space Grotesk", "Inter", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "Cascadia Code", Consolas, monospace;
  --grid-line: rgba(255, 255, 255, .05);
  --dash-bg: #0f1116;
  --radius: 18px;
  --gutter: clamp(16px, 4vw, 40px);
  color-scheme: dark;
}

:root[data-theme="light"] {
  --bg: #f7f6f2;
  --bg-alt: #efede7;
  --surface: #ffffff;
  --line: #e0ddd5;
  --text: #16171b;
  --muted: #5e616b;
  --accent: #e2511a;
  --accent-ink: #ffffff;
  --grid-line: rgba(0, 0, 0, .06);
  --dash-bg: #14161c;
  --hero-overlay: linear-gradient(180deg, rgba(247, 246, 242, .80) 0%, rgba(247, 246, 242, .92) 70%, var(--bg) 100%);
  color-scheme: light;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f7f6f2;
    --bg-alt: #efede7;
    --surface: #ffffff;
    --line: #e0ddd5;
    --text: #16171b;
    --muted: #5e616b;
    --accent: #e2511a;
    --accent-ink: #ffffff;
    --hero-overlay: linear-gradient(180deg, rgba(247, 246, 242, .80) 0%, rgba(247, 246, 242, .92) 70%, var(--bg) 100%);
    color-scheme: light;
  }
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 17px/1.65 var(--font-body);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

h1, h2, h3 { font-family: var(--font-display); line-height: 1.1; margin: 0 0 .5em; letter-spacing: -.02em; }
h2 { font-size: clamp(2rem, 4.5vw, 3rem); max-width: 18ch; }
h3 { font-size: 1.2rem; letter-spacing: -.01em; }
p { margin: 0 0 1em; }
a { color: inherit; }
img { max-width: 100%; display: block; }
strong { font-weight: 600; }

.wrap { width: min(1120px, 100%); margin: 0 auto; padding: 0 var(--gutter); }

.skip {
  position: absolute; left: -999px; top: 8px; z-index: 100;
  background: var(--accent); color: var(--accent-ink); padding: 8px 14px; border-radius: 8px;
}
.skip:focus { left: 8px; }

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

main { counter-reset: section; }
.section { counter-increment: section; }
.eyebrow {
  font: 500 .8rem/1 var(--font-mono);
  letter-spacing: .04em;
  text-transform: lowercase;
  color: var(--accent);
  margin-bottom: 1.1rem;
}
.eyebrow::before { content: "0" counter(section) " // "; color: var(--muted); }

/* ==========================================================================
   Nav
   ========================================================================== */
.nav {
  position: fixed; inset: 0 0 auto; z-index: 50;
  transition: background .3s, border-color .3s, backdrop-filter .3s;
  border-bottom: 1px solid transparent;
}
.nav.is-scrolled {
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  border-color: var(--line);
}
.nav__inner { display: flex; align-items: center; gap: 24px; height: 68px; }

.brand { text-decoration: none; }
.brand__mark {
  display: inline-flex; align-items: center;
  height: 40px; padding: 0 12px; border-radius: 12px; white-space: nowrap;
  background: var(--text); color: var(--bg);
  font: 700 .95rem/1 var(--font-mono);
  letter-spacing: -.02em;
}
.brand__cursor { color: var(--accent); animation: blink 1s steps(1) infinite; }

.nav__inner > nav { margin-left: auto; }
.nav__links { display: flex; gap: 4px; list-style: none; margin: 0; padding: 0; }
.nav__links a {
  display: block; padding: 8px 14px; border-radius: 999px;
  text-decoration: none; font-size: .92rem; font-weight: 500; color: var(--muted);
  transition: color .2s, background .2s;
}
.nav__links a:hover, .nav__links a.is-active { color: var(--text); background: var(--surface); }

/* A side door to drive mode: findable, but quieter than the section links */
.drive-link {
  display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 14px 0 12px;
  border: 1px solid var(--line); border-radius: 999px;
  color: var(--muted); text-decoration: none; font: 500 .85rem/1 var(--font-mono);
  transition: color .2s, border-color .2s;
}
.drive-link:hover { color: var(--text); border-color: var(--accent); }
.drive-link svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.theme-toggle {
  display: grid; place-items: center;
  width: 40px; height: 40px; border-radius: 999px;
  border: 1px solid var(--line); background: transparent; color: var(--text); cursor: pointer;
}
.theme-toggle svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.theme-toggle .i-sun { display: none; }
:root[data-theme="light"] .theme-toggle .i-sun { display: block; }
:root[data-theme="light"] .theme-toggle .i-moon { display: none; }
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) .theme-toggle .i-sun { display: block; }
  :root:not([data-theme="dark"]) .theme-toggle .i-moon { display: none; }
}

@media (max-width: 640px) {
  .nav__links a { padding: 8px 9px; font-size: .85rem; }
  .nav__inner { gap: 8px; }
  .drive-link { width: 40px; padding: 0; justify-content: center; }
  .drive-link span { display: none; }
}
@media (max-width: 400px) {
  .brand { display: none; }
  .nav__inner > nav { margin-left: 0; }
  .drive-link { margin-left: auto; }
}

/* ==========================================================================
   Buttons
   ========================================================================== */
.btn {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 14px 22px; border-radius: 999px;
  font: 600 .95rem/1 var(--font-body); text-decoration: none;
  transition: transform .2s, background .2s, border-color .2s, box-shadow .2s;
}
.btn svg { width: 18px; height: 18px; fill: currentColor; }
.btn--primary { background: var(--accent); color: var(--accent-ink); }
.btn--primary:hover { transform: translateY(-2px); box-shadow: 0 10px 30px -10px var(--accent); }
.btn--ghost { border: 1px solid var(--line); color: var(--text); }
.btn--ghost:hover { border-color: var(--text); transform: translateY(-2px); }

/* ==========================================================================
   Hero
   ========================================================================== */
.hero {
  position: relative; isolation: isolate; overflow: hidden;
  min-height: 100vh; min-height: 100svh;
  display: flex; align-items: flex-end;
  padding: 96px 0 64px;
}
.hero__bg { position: absolute; inset: 0; z-index: -2; }
.hero__bg::after {
  content: ""; position: absolute; inset: 0;
  background:
    radial-gradient(50% 45% at 20% 25%, color-mix(in srgb, #7b61ff 16%, transparent), transparent 70%),
    radial-gradient(45% 40% at 85% 30%, color-mix(in srgb, var(--accent) 18%, transparent), transparent 70%),
    radial-gradient(50% 40% at 60% 85%, color-mix(in srgb, #2ec4b6 12%, transparent), transparent 70%);
}
.hero__bg::before {
  content: ""; 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: 48px 48px;
  mask-image: radial-gradient(ellipse 80% 70% at 50% 40%, #000 40%, transparent 100%);
  -webkit-mask-image: radial-gradient(ellipse 80% 70% at 50% 40%, #000 40%, transparent 100%);
}
.hero::before {
  content: ""; position: absolute; inset: 0; z-index: -2; pointer-events: none;
  background: radial-gradient(420px circle at var(--mx, 70%) var(--my, 30%), color-mix(in srgb, var(--accent) 10%, transparent), transparent 70%);
}

/* 3D scene fills the hero; overlay text sits on top but lets drags through */
.hero__canvas {
  position: absolute; inset: 0; z-index: -1;
  width: 100%; height: 100%; display: block;
  touch-action: pan-y; cursor: grab;
  opacity: 0; transition: opacity 1.2s ease;
  /* fade the scene behind the overlay text in the bottom-left */
  -webkit-mask-image: radial-gradient(ellipse 60% 50% at 0% 100%, transparent 35%, #000 100%);
  mask-image: radial-gradient(ellipse 60% 50% at 0% 100%, transparent 35%, #000 100%);
}
@media (max-aspect-ratio: 1/1) {
  .hero__canvas {
    -webkit-mask-image: linear-gradient(to bottom, #000 45%, transparent 75%);
    mask-image: linear-gradient(to bottom, #000 45%, transparent 75%);
  }
}
.hero.is-3d .hero__canvas { opacity: 1; }
.hero.no-3d .hero__canvas, .hero.no-3d .hero__hint { display: none; }
.hero__canvas:active { cursor: grabbing; }
.hero__overlay { pointer-events: none; }
.hero__overlay a, .hero__overlay .status { pointer-events: auto; }

.hero__hint {
  position: absolute; top: 88px; right: var(--gutter); margin: 0;
  font: 400 .74rem/1 var(--font-mono); color: var(--muted);
  pointer-events: none; opacity: 0; transition: opacity .6s .8s;
}
.hero.is-3d .hero__hint { opacity: .85; }
@media (pointer: coarse) { .hero__hint-drag { display: none; } }

.hero__toast {
  position: absolute; top: 120px; left: 50%; z-index: 5;
  max-width: calc(100% - 32px); padding: 10px 18px; border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 85%, transparent);
  border: 1px solid var(--line);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  font: 500 .86rem/1.4 var(--font-body); text-align: center;
  box-shadow: 0 12px 40px -16px rgba(0, 0, 0, .5);
  transform: translate(-50%, -12px); opacity: 0; pointer-events: none;
  transition: opacity .3s, transform .3s;
}
.hero__toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 960px) { .hero__scroll { display: none; } }

.status {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 6px 14px 6px 10px; margin-bottom: 1.6rem;
  border: 1px solid var(--line); border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 70%, transparent);
  font: 500 .78rem/1.2 var(--font-mono); color: var(--muted);
}
.status__dot {
  width: 8px; height: 8px; border-radius: 50%; background: #2ecc71;
  box-shadow: 0 0 0 0 rgba(46, 204, 113, .6); animation: pulse 2s infinite;
}
@keyframes pulse { 70% { box-shadow: 0 0 0 8px rgba(46, 204, 113, 0); } 100% { box-shadow: 0 0 0 0 rgba(46, 204, 113, 0); } }

.hero__title { font-size: clamp(1.9rem, 3.8vw, 3rem); font-weight: 700; margin-bottom: .4em; max-width: 22ch; }
.hero.no-3d .hero__title { font-size: clamp(2.4rem, 6vw, 4.6rem); }
.hero.no-3d { align-items: center; }
.hero__rotate { display: block; min-height: 1.1em; color: var(--muted); }
@media (max-width: 640px) { .hero__rotate { min-height: 2.2em; } }
.rotator { color: var(--text); }
.rotator::after {
  content: ""; display: inline-block; width: .06em; height: .9em; margin-left: .06em;
  background: var(--accent); vertical-align: -.08em;
  animation: blink 1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }
.hero__lede { font-size: clamp(1rem, 1.5vw, 1.1rem); max-width: 34rem; color: var(--muted); }
.hero__lede strong { color: var(--text); }
.hero__cta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 1.5rem; }

.hero__scroll {
  position: absolute; left: 50%; bottom: 28px; translate: -50% 0;
  width: 26px; height: 42px; border: 2px solid var(--line); border-radius: 999px;
}
.hero__scroll span {
  position: absolute; left: 50%; top: 8px; width: 4px; height: 8px; margin-left: -2px;
  background: var(--accent); border-radius: 4px; animation: scrollcue 1.8s ease-in-out infinite;
}
@keyframes scrollcue { 0% { opacity: 0; transform: translateY(0); } 30% { opacity: 1; } 100% { opacity: 0; transform: translateY(14px); } }

/* ==========================================================================
   Sections
   ========================================================================== */
.section { padding: clamp(80px, 12vw, 140px) 0; }
.section--alt { background: var(--bg-alt); }

/* About */
.about { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: clamp(32px, 6vw, 80px); align-items: center; }
.about__text > p { color: var(--muted); }
.about__text > p strong { color: var(--text); }
@media (max-width: 860px) {
  .about { grid-template-columns: 1fr; }
  .about__dash { order: 2; max-width: 460px; }
}

/* Work timeline */
.timeline { list-style: none; padding: 0; margin: 3rem 0 0; border-top: 1px solid var(--line); }
.timeline__item {
  display: grid; grid-template-columns: 240px 1fr; gap: 24px 48px;
  padding: 32px 0; border-bottom: 1px solid var(--line);
}
.timeline__meta { display: flex; flex-direction: column; gap: 4px; }
.timeline__when { font: 500 .95rem/1.3 var(--font-mono); }
.timeline__item:first-child .timeline__when { color: var(--accent); }
.timeline__where { font-size: .88rem; color: var(--muted); }
.timeline__body p, .timeline__body li { color: var(--muted); }
.timeline__body ul { margin: 0; padding-left: 1.1em; }
.timeline__body li { margin-bottom: .4em; }
.timeline__body li::marker { color: var(--accent); }
@media (max-width: 720px) {
  .timeline__item { grid-template-columns: 1fr; gap: 8px; }
}

.skills { margin-top: 3.5rem; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; padding: 0; margin: 1rem 0 1.5rem; }
.chips li:hover { border-color: var(--accent); color: var(--accent); }
.chips li {
  padding: 6px 12px; border-radius: 8px; font: 400 .82rem/1.4 var(--font-mono);
  background: var(--surface); border: 1px solid var(--line);
}
.edu { color: var(--muted); font-size: .92rem; }

/* Life cards */
.cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-top: 3rem; }
.card {
  position: relative; overflow: hidden;
  padding: 28px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--line);
  transition: transform .25s, border-color .25s;
}
.card:hover { transform: translateY(-4px); border-color: var(--accent); }
.card::before {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity .3s;
  background: radial-gradient(260px circle at var(--mx, 50%) var(--my, 50%), color-mix(in srgb, var(--accent) 16%, transparent), transparent 70%);
}
.card:hover::before { opacity: 1; }
.card::after {
  content: attr(data-path); position: absolute; top: 22px; right: 22px;
  font: 400 .72rem/1 var(--font-mono); color: var(--muted); opacity: .7;
}
.card > * { position: relative; }
.card p { color: var(--muted); margin: 0; font-size: .96rem; }
.card__icon {
  width: 44px; height: 44px; padding: 10px; margin-bottom: 18px; border-radius: 12px;
  fill: none; stroke: var(--accent); stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round;
  background: color-mix(in srgb, var(--accent) 14%, transparent);
}
.card--wide { grid-column: 1 / -1; display: flex; gap: 24px; align-items: flex-start; }
.card--wide .card__icon { flex: none; margin: 0; }
.card--wide p { max-width: 60ch; }
@media (max-width: 900px) { .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) {
  .cards { grid-template-columns: 1fr; }
  .card--wide { flex-direction: column; gap: 0; }
  .card--wide .card__icon { margin-bottom: 18px; }
}

/* Contact */
.contact__inner { text-align: center; display: flex; flex-direction: column; align-items: center; }
.contact__inner h2 { max-width: none; }
.contact__inner p { color: var(--muted); max-width: 36rem; }

/* Footer */
.footer { border-top: 1px solid var(--line); padding: 28px 0; font-size: .88rem; color: var(--muted); }
.footer__inner { display: flex; justify-content: space-between; align-items: center; gap: 12px 24px; flex-wrap: wrap; font-family: var(--font-mono); font-size: .78rem; }
.footer__meta { opacity: .75; }
/* No keyboard on touch; tapping the hero letters is their way in */
@media (pointer: coarse) { .footer__konami { display: none; } }
.footer a { text-decoration: none; }
.footer a:hover { color: var(--text); }

/* ==========================================================================
   Instrument cluster: quiet, flat, one accent (think Polestar / Rivian)
   ========================================================================== */
.dash {
  --dash-fg: var(--text);
  --dash-muted: var(--muted);
  --dash-line: color-mix(in srgb, var(--text) 10%, transparent);
  padding: 22px 28px 26px;
  border-radius: 28px;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--dash-fg);
  font-family: var(--font-body);
}
.dash__top {
  display: flex; justify-content: space-between; align-items: baseline;
  font: 500 .8rem/1 var(--font-body); color: var(--dash-muted);
  font-variant-numeric: tabular-nums;
}
.dash__gear {
  display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 6px;
  background: var(--dash-fg); color: var(--surface); font-weight: 600; font-size: .72rem;
}

.dash__gauge { position: relative; max-width: 280px; margin: 10px auto 0; }
.dash__gauge svg { width: 100%; height: auto; display: block; overflow: visible; }
.dash__track, .dash__value { fill: none; stroke-width: 3; stroke-linecap: round; }
.dash__track { stroke: var(--dash-line); }
.dash__value {
  stroke: var(--accent);
  stroke-dasharray: 100; stroke-dashoffset: 100;
}
.dash__dot {
  fill: var(--surface); stroke: var(--accent); stroke-width: 3;
}
.dash__readout {
  position: absolute; left: 0; right: 0; top: 34%;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
}
.dash__big {
  font: 300 clamp(3.2rem, 7vw, 4.2rem)/.9 var(--font-body);
  letter-spacing: -.04em; font-variant-numeric: tabular-nums;
}
.dash__unit { font-size: .72rem; color: var(--dash-muted); letter-spacing: .02em; }

.dash__odo {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  margin: 6px 0 26px;
}
.dash__digits { font: 400 1.15rem/1.2 var(--font-body); font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.dash__label { font-size: .72rem; color: var(--dash-muted); }

.dash__lights {
  display: flex; justify-content: space-between; gap: 4px;
  padding-top: 18px; border-top: 1px solid var(--dash-line);
}
.dash__lights button {
  position: relative; display: grid; place-items: center;
  width: 40px; height: 40px; padding: 0; border: 0; border-radius: 12px;
  background: transparent; color: var(--dash-muted); cursor: pointer;
  transition: color .3s, background .3s;
}
.dash__lights svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.dash__lights button:hover { color: var(--dash-fg); }
.dash__lights button::after {
  content: ""; position: absolute; bottom: 2px; left: 50%; width: 4px; height: 4px; margin-left: -2px;
  border-radius: 50%; background: var(--accent); transform: scale(0); transition: transform .3s;
}
.dash__lights button.is-on { color: var(--dash-fg); background: color-mix(in srgb, var(--text) 6%, transparent); }
.dash__lights button.is-on::after { transform: scale(1); }

.dash__lcd {
  margin: 14px 0 22px; min-height: 1.5em; text-align: center;
  font-size: .9rem; color: var(--dash-fg);
}
.dash__lcd.flash { animation: lcd .45s ease; }
@keyframes lcd { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.dash__trip {
  display: grid; grid-template-columns: repeat(3, 1fr); margin: 0;
  padding-top: 18px; border-top: 1px solid var(--dash-line);
}
.dash__trip > div { padding: 0 4px; text-align: center; }
.dash__trip > div + div { border-left: 1px solid var(--dash-line); }
.dash__trip dt { font-size: .72rem; color: var(--dash-muted); }
.dash__trip dd { margin: 4px 0 0; font: 300 1.7rem/1.1 var(--font-body); letter-spacing: -.02em; }
.dash__trip small { margin-left: 3px; font-size: .75rem; color: var(--dash-muted); letter-spacing: 0; }
@media (max-width: 400px) {
  .dash { padding: 18px 16px 22px; }
  .dash__lights button { width: 36px; }
}

/* Party mode */
.party { position: fixed; inset: 0; z-index: 200; pointer-events: none; overflow: hidden; }
.party span { position: absolute; top: -50px; animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(110vh) rotate(540deg); } }
.is-party .brand__mark { animation: spin 1s ease-in-out 2; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ==========================================================================
   Motion
   ========================================================================== */
.js .reveal { opacity: 0; transform: translateY(18px); transition: opacity .7s ease, transform .7s ease; }
.js .reveal.is-visible { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .js .reveal { opacity: 1; transform: none; transition: none; }
  .rotator::after, .hero__scroll span, .brand__cursor, .status__dot { animation: none; }
}
