/* ==========================================================================
   Personal site — Nocturne
   Edit the variables in :root to restyle everything.
   ========================================================================== */

:root {
  --bg: #161826;
  --bg-deep: #121320;
  --bg-lift: #1d2035;
  --text: #e9e9ed;
  --accent: #9184d9;
  --accent-text: #d2cefd;
  --accent-soft: #2b2741;
  --n100: #f3f5fe;
  --n200: #e4e7f5;
  --n300: #cfd3e5;
  --n400: #b2b6ca;
  --n500: #9397ab;
  --n600: #75798c;
  --n700: #595d6c;
  --n800: #3f424d;

  --font-heading: "Inter", system-ui, sans-serif;
  --font-body: "Inter", system-ui, sans-serif;

  --radius: 8px;
  --gutter: 22px;
  --measure: 980px;
}

/* ---- base ---------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.55;
}
h1, h2 { font-family: var(--font-heading); font-weight: 500; margin: 0; line-height: 1.12; letter-spacing: -0.015em; }
p { margin: 0; text-wrap: pretty; }
a { color: var(--accent); text-underline-offset: 3px; }
a:hover { color: var(--accent-text); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
::selection { background: color-mix(in srgb, var(--accent) 30%, transparent); }

/* ---- hero --------------------------------------------------------------- */
.hero {
  padding-top: 62px;
  position: relative;
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  overflow: hidden;
}
.site-bg {
  position: fixed; inset: 0; z-index: 0;
  background: radial-gradient(120% 80% at 50% 15%, var(--bg-lift) 0%, var(--bg) 55%, var(--bg-deep) 100%);
}
.site-bg canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.site-scrim {
  position: fixed; inset: 0; z-index: 1; pointer-events: none;
  background:
    radial-gradient(90% 65% at 50% 45%, transparent 40%, rgba(18,19,32,0.55) 100%),
    linear-gradient(to bottom, rgba(22,24,38,0.55) 0%, transparent 30%, rgba(22,24,38,0.75) 100%);
}

/* nav */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 40;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  padding: 17px var(--gutter);
}
.nav-menu { justify-self: start; }
.nav .pill-accent { justify-self: end; }
.wordmark {
  justify-self: center;
  font-family: var(--font-heading); font-size: 15px;
  letter-spacing: 0.42em; text-transform: uppercase;
}
.burger { display: grid; gap: 3px; }
.burger span { display: block; width: 14px; height: 1.5px; background: currentColor; }

/* pills */
.pill {
  display: inline-flex; align-items: center; gap: 10px;
  border: 1px solid transparent; border-radius: 999px;
  padding: 10px 20px;
  font-family: var(--font-heading); font-weight: 500;
  font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase;
  text-decoration: none; cursor: pointer; color: var(--text);
  background: transparent;
}
.pill-outline { border-color: var(--n500); background: rgba(22,24,38,0.35); backdrop-filter: blur(6px); padding: 9px 16px; }
.pill-outline:hover { background: rgba(233,233,237,0.10); }
.pill-accent { color: var(--accent); border-color: var(--accent); }
.pill-accent:hover { background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent-text); }
.pill-light { background: var(--n100); color: var(--bg); padding: 12px 14px 12px 22px; font-size: 13px; letter-spacing: 0.1em; }
.pill-light:hover { background: var(--n300); color: var(--bg); }
.pill-dark { background: rgba(22,24,38,0.78); border-color: var(--n800); padding: 12px 14px 12px 22px; font-size: 13px; letter-spacing: 0.1em; }
.pill-dark:hover { background: rgba(22,24,38,0.95); color: var(--text); }
.dot { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 999px; font-size: 10px; }
.dot-dark { background: var(--bg); color: var(--n100); }
.dot-accent { background: var(--accent); color: var(--bg); }

/* headline */
.hero-main {
  position: relative; z-index: 2;
  display: grid; align-content: center; justify-items: center; gap: 22px;
  padding: 22px var(--gutter);
}
.hero-main h1 {
  text-align: center;
  font-size: clamp(40px, 7.4vw, 108px);
  line-height: 1.02; letter-spacing: -0.03em;
  max-width: 15ch; text-wrap: balance;
}
.hero-main h1 em { font-style: italic; font-weight: 400; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }

/* hero footer */
.hero-foot {
  position: relative; z-index: 2;
  display: grid; grid-template-columns: 1fr auto; align-items: end; gap: 22px;
  padding: 22px var(--gutter) 44px;
}
.hero-intro { max-width: 34ch; font-size: 17px; line-height: 1.55; color: var(--n200); }
.hero-intro a { color: var(--accent-text); }
.badge { display: grid; justify-items: center; gap: 8px; }
.badge-label { font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--n400);}
.badge-box {
  display: grid; place-items: center; min-width: 190px;
  padding: 17px 22px;
  border: 1px solid var(--n700); border-radius: var(--radius);
  font-family: var(--font-heading); font-size: 20px; letter-spacing: 0.16em;
}

/* ---- page sections ------------------------------------------------------ */
.page { position: relative; z-index: 2; max-width: var(--measure); padding: 120px var(--gutter) 140px; display: grid; gap: 110px; }
.section { display: grid; gap: 17px; }
.section h2 { font-size: 30px; }
.section-text { max-width: 48ch; font-size: 17px; color: var(--n300); }

/* a rule that fades out at both ends */
.rule {
  height: 1px; border: 0; margin: 0;
  background: linear-gradient(to right, transparent, var(--n800) 48px, var(--n800) calc(100% - 48px), transparent);
}

.list { display: grid; gap: 6px; }
.list-loose { gap: 17px; }
.row { display: grid; grid-template-columns: 120px 1fr; gap: 17px; align-items: baseline; }
.row-date { font-size: 13px; color: var(--n500); }
.row-text { font-size: 17px; color: var(--n300); }
.row-title { font-size: 19px; }
.row-link {
  padding: 11px 11px 11px 0; border-radius: var(--radius);
  text-decoration: none; color: var(--text);
}
.row-link:hover { background: var(--accent-soft); color: var(--text); }

/* buttons (outlined — never filled) */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--font-heading); font-weight: 500; font-size: 14px;
  padding: 11px 20px; border-radius: 999px;
  border: 1px solid transparent; background: transparent;
  color: var(--text); text-decoration: none; cursor: pointer;
}
.btn-primary { color: var(--accent); border-color: var(--accent); }
.btn-primary:hover { background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--accent); }
.btn-ghost { color: var(--accent); padding-inline: 6px; }
.btn-ghost:hover { background: color-mix(in srgb, var(--accent) 10%, transparent); color: var(--accent); }

.links { display: flex; flex-wrap: wrap; gap: 8px; }
footer { position: relative; z-index: 2; padding: 17px var(--gutter) 22px; font-size: 12px; color: var(--n600); }

/* ---- small screens ------------------------------------------------------ */
@media (max-width: 720px) {
  .hero-foot { grid-template-columns: 1fr; justify-items: start; }
  .badge { justify-items: start; }
  .row { grid-template-columns: 1fr; gap: 2px; }
  .page { padding-top: 72px; gap: 72px; }
  .wordmark { letter-spacing: 0.2em; font-size: 13px; }
}


/* ==========================================================================
   Interaction & motion — hover, press, scroll reveal, custom cursor.
   Everything here is disabled automatically under prefers-reduced-motion.
   ========================================================================== */

/* ---- shared easing / transitions ---------------------------------------- */
.pill, .btn, .row-link, .badge-box, .nav a, .hero-intro a {
  transition:
    background-color 220ms cubic-bezier(.2,.7,.3,1),
    border-color 220ms cubic-bezier(.2,.7,.3,1),
    color 220ms cubic-bezier(.2,.7,.3,1),
    box-shadow 260ms cubic-bezier(.2,.7,.3,1),
    transform 260ms cubic-bezier(.2,.7,.3,1);
  will-change: transform;
}

/* ---- pills: lift on hover, press in on click ---------------------------- */
.pill { position: relative; overflow: hidden; }
.pill:hover { transform: translateY(-2px); }
.pill:active { transform: translateY(0) scale(0.97); transition-duration: 90ms; }
.pill-accent:hover { box-shadow: 0 0 0 1px var(--accent), 0 8px 26px -10px var(--accent); }
.pill-light:hover { box-shadow: 0 10px 28px -14px rgba(243,245,254,0.7); }
.pill-dark:hover { box-shadow: 0 10px 28px -14px rgba(0,0,0,0.9); border-color: var(--n700); }
.pill-outline:hover { box-shadow: inset 0 0 0 1px rgba(233,233,237,0.25); }

/* the little play dot slides forward and spins up */
.dot { transition: transform 320ms cubic-bezier(.2,.7,.3,1), background-color 220ms ease; }
.pill:hover .dot { transform: translateX(3px) scale(1.12); }
.pill:active .dot { transform: translateX(0) scale(0.94); }

/* burger lines part on hover */
.burger span { transition: transform 240ms cubic-bezier(.2,.7,.3,1), width 240ms ease; }
.nav-menu:hover .burger span:first-child { transform: translateY(-1px); }
.nav-menu:hover .burger span:last-child { transform: translateY(1px); width: 10px; }

/* ripple, injected on click by interactions.js */
.ripple {
  position: absolute; border-radius: 999px; pointer-events: none;
  background: currentColor; opacity: 0.28;
  transform: translate(-50%, -50%) scale(0);
  animation: ripple 620ms cubic-bezier(.2,.7,.3,1) forwards;
}
@keyframes ripple {
  to { transform: translate(-50%, -50%) scale(1); opacity: 0; }
}

/* ---- outlined buttons --------------------------------------------------- */
.btn { position: relative; overflow: hidden; }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 8px 24px -12px var(--accent); }
.btn:active { transform: translateY(0) scale(0.97); transition-duration: 90ms; }
.btn-ghost:hover { transform: translateY(-1px); }

/* ---- list rows: slide in slightly, accent bar grows --------------------- */
.row-link { position: relative; }
.row-link::before {
  content: ""; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 2px;
  background: var(--accent); border-radius: 2px;
  transform: scaleY(0); transform-origin: top;
  transition: transform 260ms cubic-bezier(.2,.7,.3,1);
}
.row-link:hover { transform: translateX(6px); }
.row-link:hover::before { transform: scaleY(1); }
.row-link:active { transform: translateX(3px) scale(0.995); transition-duration: 90ms; }

/* ---- text links: underline wipes in ------------------------------------- */
.hero-intro a, .section-text a {
  position: relative; text-decoration: none;
  background-image: linear-gradient(currentColor, currentColor);
  background-size: 0% 1px; background-position: 0 100%; background-repeat: no-repeat;
  transition: background-size 280ms cubic-bezier(.2,.7,.3,1), color 200ms ease;
}
.hero-intro a:hover, .section-text a:hover { background-size: 100% 1px; }

/* nav wordmark + badge get a quiet breath on hover */
.badge-box:hover { border-color: var(--accent); transform: translateY(-2px); }

/* ---- scroll reveal ------------------------------------------------------ */
.reveal { opacity: 0; transform: translateY(18px); }
.reveal-in {
  opacity: 1; transform: none;
  transition: opacity 620ms cubic-bezier(.2,.7,.3,1), transform 620ms cubic-bezier(.2,.7,.3,1);
}

/* anchor targets stop clear of the top edge */
.section { scroll-margin-top: 72px; }

/* ---- custom cursor ------------------------------------------------------ */
.cursor-dot, .cursor-ring {
  position: fixed; top: 0; left: 0; z-index: 999;
  pointer-events: none; border-radius: 999px;
  opacity: 0; transition: opacity 200ms ease;
}
.cursor-dot { width: 6px; height: 6px; margin: -3px 0 0 -3px; background: var(--accent-text); }
.cursor-ring {
  width: 30px; height: 30px; margin: -15px 0 0 -15px;
  border: 1px solid color-mix(in srgb, var(--accent) 70%, transparent);
  transition: opacity 200ms ease, width 220ms cubic-bezier(.2,.7,.3,1),
              height 220ms cubic-bezier(.2,.7,.3,1), margin 220ms cubic-bezier(.2,.7,.3,1),
              background-color 220ms ease, border-color 220ms ease;
}
body.cursor-on .cursor-dot, body.cursor-on .cursor-ring { opacity: 1; }
body.cursor-on.cursor-hot .cursor-ring {
  width: 54px; height: 54px; margin: -27px 0 0 -27px;
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  border-color: var(--accent);
}
body.cursor-on.cursor-press .cursor-ring { width: 22px; height: 22px; margin: -11px 0 0 -11px; }
/* hide the native cursor only where the custom one is active */
body.cursor-on, body.cursor-on a, body.cursor-on button { cursor: none; }

@media (prefers-reduced-motion: reduce) {
  .pill, .btn, .row-link, .badge-box { transition: background-color 120ms linear, color 120ms linear; }
  .pill:hover, .btn:hover, .row-link:hover, .badge-box:hover, .pill:active, .btn:active { transform: none; }
  .reveal, .reveal-in { opacity: 1; transform: none; transition: none; }
  .ripple { display: none; }
  .cursor-dot, .cursor-ring { display: none; }
}


/* ==========================================================================
   Get in touch, moved into the bottom-left of the hero
   ========================================================================== */
.hero-contact { display: grid; gap: 11px; max-width: 44ch; }
.hero-contact .hero-intro { max-width: 40ch; }
.hero-contact .links { margin-top: 6px; }

/* ==========================================================================
   About page
   ========================================================================== */
.hero-short { min-height: 62vh; grid-template-rows: auto 1fr; }
.hero-main-left { justify-items: start; align-content: end; gap: 11px; padding-bottom: 44px; }
.hero-main-left h1 { text-align: left; }
.h1-sm { font-size: clamp(34px, 5.2vw, 68px); max-width: 20ch; }
.arrow-back { font-size: 9px; }
.nav-menu .arrow-back { transition: transform 240ms cubic-bezier(.2,.7,.3,1); }
.nav-menu:hover .arrow-back { transform: translateX(-3px); }
.section-text-wide { max-width: 62ch; }
.section-text + .section-text { margin-top: 6px; }


/* ==========================================================================
   Side navigation drawer (opened by the Menu button)
   ========================================================================== */
.drawer-backdrop {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(18,19,32,0.55);
  backdrop-filter: blur(2px);
  opacity: 0;
  transition: opacity 320ms cubic-bezier(.2,.7,.3,1);
}
.drawer-backdrop.is-open { opacity: 1; }

.drawer {
  position: fixed; top: 0; left: 0; bottom: 0; z-index: 51;
  width: min(340px, 84vw);
  display: grid; grid-template-rows: auto 1fr auto; gap: 22px;
  padding: 17px 22px 33px;
  background: color-mix(in srgb, var(--bg-deep) 92%, transparent);
  backdrop-filter: blur(14px);
  border-right: 1px solid var(--n800);
  box-shadow: 30px 0 60px -30px rgba(0,0,0,0.8);
  transform: translateX(-102%);
  visibility: hidden;
  transition: transform 420ms cubic-bezier(.2,.7,.3,1), visibility 420ms;
}
.drawer.is-open { transform: none; visibility: visible; }

.drawer-head { display: flex; align-items: center; justify-content: space-between; }
.drawer-close {
  border: 0; background: transparent; color: var(--n400);
  font-size: 15px; line-height: 1; padding: 6px; cursor: pointer;
  border-radius: 999px;
  transition: color 200ms ease, background-color 200ms ease, transform 220ms cubic-bezier(.2,.7,.3,1);
}
.drawer-close:hover { color: var(--text); background: rgba(233,233,237,0.08); transform: rotate(90deg); }

.drawer-links { display: grid; align-content: start; gap: 2px; }
.drawer-link {
  display: flex; align-items: baseline; gap: 14px;
  padding: 11px 11px 11px 6px; border-radius: var(--radius);
  font-family: var(--font-heading); font-size: 22px; letter-spacing: -0.01em;
  color: var(--text); text-decoration: none;
  /* staggered entrance, driven by --i set in interactions.js */
  opacity: 0; transform: translateX(-14px);
  transition: opacity 380ms cubic-bezier(.2,.7,.3,1), transform 380ms cubic-bezier(.2,.7,.3,1),
              background-color 200ms ease, color 200ms ease;
}
.drawer.is-open .drawer-link {
  opacity: 1; transform: none;
  transition-delay: calc(120ms + var(--i, 0) * 55ms);
}
.drawer-link:hover { background: var(--accent-soft); color: var(--text); }
.drawer-link[aria-current="page"] { color: var(--accent-text); }
.drawer-num {
  font-size: 11px; letter-spacing: 0.14em; color: var(--n600);
  transition: color 200ms ease;
}
.drawer-link:hover .drawer-num, .drawer-link[aria-current="page"] .drawer-num { color: var(--accent); }

.drawer-cta {
  justify-self: start;
  opacity: 0; transform: translateX(-14px);
  transition: opacity 380ms cubic-bezier(.2,.7,.3,1), transform 380ms cubic-bezier(.2,.7,.3,1);
}
.drawer.is-open .drawer-cta { opacity: 1; transform: none; transition-delay: 380ms; }

/* menu button turns into an X-ish state while open */
.nav-menu[aria-expanded="true"] .burger span:first-child { transform: translateY(2px) rotate(12deg); }
.nav-menu[aria-expanded="true"] .burger span:last-child { transform: translateY(-2px) rotate(-12deg); }

/* back pill arrow */
.nav-back .arrow-back { transition: transform 240ms cubic-bezier(.2,.7,.3,1); }
.nav-back:hover .arrow-back { transform: translateX(-3px); }

body.drawer-open { overflow: hidden; }

@media (prefers-reduced-motion: reduce) {
  .drawer, .drawer-backdrop, .drawer-link, .drawer-cta { transition: none; }
  .drawer-link, .drawer-cta { opacity: 1; transform: none; }
}


/* ==========================================================================
   Page entrance — everything fades and floats up on load
   ========================================================================== */
/* Hidden from the very first paint — the selector list matches what
   interactions.js animates, so nothing can flash before the class lands.
   Without JS (html has no .js class) everything simply stays visible. */
html.js .nav > *,
html.js .hero-main > *,
html.js .hero-foot > *,
html.js .page > .section,
html.js footer,
html.js .site-bg,
html.js .site-scrim {
  opacity: 0;
}
html.js .nav > *,
html.js .hero-main > *,
html.js .hero-foot > *,
html.js .page > .section,
html.js footer {
  transform: translateY(20px);
}

/* the background fades in on its own, slower and without the float */
html.js body.loaded .site-bg,
html.js body.loaded .site-scrim {
  opacity: 1;
  transition: opacity 1200ms cubic-bezier(.2,.7,.3,1);
}
body.loaded .enter {
  opacity: 1 !important; transform: none;
  transition: opacity 700ms cubic-bezier(.2,.7,.3,1), transform 700ms cubic-bezier(.2,.7,.3,1);
  transition-delay: calc(var(--e, 0) * 90ms);
}

/* fade the whole page out again while navigating away */
body.leaving { opacity: 0; transition: opacity 260ms ease; }
body.leaving .site-bg, body.leaving .site-scrim { opacity: 0; transition: opacity 260ms ease; }

/* the sticky bar keeps a soft edge once the page scrolls under it */
.nav {
  background: linear-gradient(to bottom, rgba(18,19,32,0.72), rgba(18,19,32,0));
  backdrop-filter: blur(3px);
}

@media (prefers-reduced-motion: reduce) {
  html.js .nav > *, html.js .hero-main > *, html.js .hero-foot > *,
  html.js .page > .section, html.js footer,
  html.js .site-bg, html.js .site-scrim,
  .enter, body.loaded .enter {
    opacity: 1 !important; transform: none; transition: none;
  }
  body.leaving { opacity: 1; transition: none; }
}


/* home hero: extra top spacing so the headline sits mid-screen on load */
.hero:not(.hero-short) { padding-top: calc(62px + min(190px, 17vh)); }

/* pages without a header block start below the fixed nav bar */
.page-top { padding-top: calc(62px + 44px); }
