/* Shared by every page: one night palette, one type system, one button language, one motion language. */

:root {
  --ink: #121417;           /* the backdrop for pages; scenes paint their own full-window ground */
  --ink-2: #191c20;         /* raised surfaces */
  --ink-3: #20242a;
  --glass: rgb(18 20 23 / 0.72);
  --line: #2b3037;
  --line-2: #3a4049;
  --fg: #ecebe6;
  --muted: #a1a6ad;
  --dim: #6c727b;
  --ball: #d9ec6a;
  --koi: #f08a5d;
  --warn: #f1b49a;
  --sans: "Instrument Sans", "Helvetica Neue", Arial, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, monospace;
  --gutter: clamp(16px, 3.4vw, 44px);
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --rainbow: conic-gradient(from var(--halo-angle, 0deg), #ff7a7a, #ffb86b, #ffe27a, #8be49a, #6cc8ff, #a993ff, #ff7a7a);
  color-scheme: dark;
}
@property --halo-angle { syntax: "<angle>"; inherits: true; initial-value: 0deg; }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--ink); color: var(--fg); font: 400 15px/1.55 var(--sans); -webkit-font-smoothing: antialiased; }
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-underline-offset: 4px; text-decoration-thickness: 1px; }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { font-weight: 500; letter-spacing: -0.02em; }
button, select, input { font: inherit; color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--fg); outline-offset: 3px; border-radius: 999px; }
.visually-hidden, .sr-only { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.no-js .js-only { display: none !important; }
.skip-link { position: absolute; left: 12px; top: -60px; z-index: 100; padding: 8px 14px; background: var(--fg); color: var(--ink); border-radius: 999px; }
.skip-link:focus { top: 12px; }

/* The shared backdrop canvas behind every page. */
#backdrop { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; pointer-events: none; }

/* ---------- Pills ---------- */
.pill {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 40px; padding: 0 16px; border: 1px solid var(--line); border-radius: 999px;
  background: var(--glass); color: var(--fg); text-decoration: none; white-space: nowrap; cursor: pointer;
  font: 400 13.5px/1 var(--sans);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  transition: transform 0.22s var(--spring), border-color 0.18s var(--ease), background-color 0.18s var(--ease), opacity 0.18s;
}
.pill:hover { border-color: var(--line-2); transform: translateY(-1px); }
.pill:active { transform: translateY(0) scale(0.96); transition-duration: 0.08s; }
.pill[aria-pressed="true"], .pill[aria-expanded="true"] { border-color: var(--muted); background: var(--ink-3); }
.pill[aria-disabled="true"] { opacity: 0.42; cursor: not-allowed; transform: none; }
.pill-primary { background: var(--fg); border-color: var(--fg); color: var(--ink); font-weight: 500; }
.pill-primary:hover { background: #fff; border-color: #fff; }
.pill.small { min-height: 36px; padding: 0 13px; font-size: 12.5px; }

/* ---------- Icon buttons: named, with tooltips, a little bounce and a sparkle ---------- */
.ico { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.icon-btn {
  position: relative; display: inline-grid; place-items: center; width: 44px; height: 44px; padding: 0;
  border: 1px solid var(--line); border-radius: 50%; background: var(--glass); color: var(--fg); cursor: pointer; text-decoration: none;
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  transition: transform 0.22s var(--spring), border-color 0.18s, background-color 0.18s;
}
.icon-btn:hover { border-color: var(--line-2); }
.icon-btn:active { transform: scale(0.93); transition-duration: 0.08s; }
.icon-btn:focus-visible { outline: 2px solid var(--fg); outline-offset: 3px; border-radius: 50%; }
.icon-btn[aria-pressed="true"], .icon-btn[aria-expanded="true"] { border-color: var(--muted); background: var(--ink-3); }
.icon-btn[aria-disabled="true"] { opacity: 0.45; cursor: not-allowed; }
.icon-btn.primary { background: var(--fg); border-color: var(--fg); color: var(--ink); }
.icon-btn.primary:hover { background: #fff; border-color: #fff; }
.icon-btn::before {
  /* one small sparkle, shown only for a moment on hover, focus or press */
  content: "✦"; position: absolute; top: -3px; right: -2px; font-size: 9px; line-height: 1; color: var(--ball); opacity: 0; pointer-events: none;
}
@keyframes icon-bounce { 0% { transform: none; } 30% { transform: translateY(-3px); } 55% { transform: translateY(1px); } 75% { transform: translateY(-0.5px); } 100% { transform: none; } }
@keyframes icon-sparkle { 0% { opacity: 0; transform: scale(0.4) rotate(0); } 35% { opacity: 1; transform: scale(1) rotate(25deg); } 100% { opacity: 0; transform: scale(0.6) rotate(60deg); } }
.icon-btn:hover .ico, .icon-btn:focus-visible .ico, .icon-btn:active .ico, .icon-btn.hello .ico { animation: icon-bounce 0.42s var(--ease); }
.icon-btn:hover::before, .icon-btn:focus-visible::before, .icon-btn.hello::before { animation: icon-sparkle 0.6s ease-out; }
.icon-row { display: flex; flex-wrap: wrap; gap: 10px; }
/* The same small bounce and sparkle on pills, the picker and the round action. */
.pill::before, .picker-btn::before {
  content: "✦"; position: absolute; top: -4px; right: 2px; font-size: 9px; line-height: 1; color: var(--ball); opacity: 0; pointer-events: none;
}
@keyframes pill-bounce { 0% { transform: none; } 30% { transform: translateY(-2.5px); } 55% { transform: translateY(0.8px); } 75% { transform: translateY(-0.4px); } 100% { transform: none; } }
.pill:hover, .pill:focus-visible { animation: pill-bounce 0.42s var(--ease); }
.pill:hover::before, .pill:focus-visible::before, .picker-btn:hover::before, .picker-btn:focus-visible::before { animation: icon-sparkle 0.6s ease-out; }
.fab:hover .ico, .fab:focus-visible .ico, .picker-btn:focus-visible > .ico:first-of-type { animation: icon-bounce 0.42s var(--ease); }

.tip::after {
  content: attr(data-tip); position: absolute; left: 50%; top: calc(100% + 8px); transform: translate(-50%, -3px); z-index: 40;
  padding: 5px 9px; border-radius: 8px; background: var(--ink-3); border: 1px solid var(--line-2); color: var(--fg);
  font: 400 12px/1.2 var(--sans); white-space: nowrap; pointer-events: none; opacity: 0; transition: opacity 0.15s, transform 0.2s var(--ease);
}
.tip:hover::after, .tip:focus-visible::after { opacity: 1; transform: translate(-50%, 0); }
.tip.tip-up::after { top: auto; bottom: calc(100% + 10px); transform: translate(-50%, 3px); }
.tip.tip-up:hover::after, .tip.tip-up:focus-visible::after { transform: translate(-50%, 0); }
.tip.tip-left::after { left: auto; right: 0; transform: translate(0, 3px); }
.tip.tip-left:hover::after, .tip.tip-left:focus-visible::after { transform: none; }
.tip.tip-end::after { left: auto; right: 0; transform: translate(0, -3px); }
.tip.tip-end:hover::after, .tip.tip-end:focus-visible::after { transform: none; }

/* Small mono read-outs: score, chips, food. */
.readout { font: 400 11.5px/1.4 var(--mono); color: var(--muted); font-variant-numeric: tabular-nums; }
.readout b { color: var(--fg); font-weight: 400; }

/* ---------- Menu: the same place on every screen ---------- */
.navlinks { display: flex; gap: 2px; }
.navlinks a { padding: 9px 12px; border-radius: 999px; color: var(--muted); text-decoration: none; font-size: 13.5px; transition: color 0.18s, background-color 0.18s; }
.navlinks a:hover { color: var(--fg); background: rgb(255 255 255 / 0.04); }
.navlinks a[aria-current="page"] { color: var(--fg); background: var(--ink-3); }
.menu-btn { display: none; }
@media (max-width: 1099px), (max-height: 560px) {
  .navlinks { display: none; }
  .menu-btn { display: inline-grid; }
  .navlinks.open { display: grid; position: absolute; top: calc(100% + 8px); right: 0; z-index: 40; padding: 8px; gap: 2px; min-width: 200px;
    background: var(--ink-2); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 20px 50px rgb(0 0 0 / 0.45); animation: rise 0.2s var(--ease); }
  .navlinks.open a { padding: 11px 14px; border-radius: 10px; }
}

/* ---------- Page chrome shared by Projects, About and Contact ---------- */
.page { position: relative; z-index: 1; min-height: 100vh; display: flex; flex-direction: column; }
.topnav { position: relative; display: flex; align-items: center; justify-content: space-between; padding: 14px var(--gutter); }
.topnav .nav-wrap { position: relative; }
.anchor { font-weight: 500; }
.page main { flex: 1; width: 100%; max-width: calc(1080px + 2 * var(--gutter)); margin: 0 auto; padding: clamp(36px, 8vh, 84px) var(--gutter) 0; }
.kicker { font: 400 11.5px/1.4 var(--mono); color: var(--muted); letter-spacing: 0.04em; }
.page h1 { margin-top: 10px; font-size: clamp(30px, 5vw, 48px); line-height: 1.06; letter-spacing: -0.035em; }
.page .sub { margin-top: 12px; color: var(--muted); font-size: 16px; max-width: 44ch; }

/* Footer: one quiet line, credits on demand. */
.footer { width: 100%; max-width: calc(1080px + 2 * var(--gutter)); margin: 72px auto 0; padding: 18px var(--gutter) 28px;
  display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px 20px; color: var(--dim); font-size: 12.5px; }
.footer details { max-width: 50ch; }
.footer summary { cursor: pointer; list-style: none; color: var(--muted); border-radius: 6px; }
.footer summary::-webkit-details-marker { display: none; }
.footer summary::after { content: " +"; }
.footer details[open] summary::after { content: " −"; }
.footer details p { margin-top: 8px; line-height: 1.6; }
.footer details a { color: var(--muted); }

/* ---------- Page changes: a soft crossfade; the top-left anchor and the menu stay put ---------- */
@view-transition { navigation: auto; }
.anchor, .picker-btn { view-transition-name: top-left; }
.navlinks:not(.open) { view-transition-name: site-nav; }
@media (max-width: 1099px), (max-height: 560px) { .navlinks:not(.open) { view-transition-name: none; } .menu-btn { view-transition-name: site-nav; } }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: 0.42s; animation-timing-function: cubic-bezier(0.2, 0.8, 0.2, 1); }
::view-transition-group(top-left), ::view-transition-group(site-nav) { animation-duration: 0.42s; }

/* ---------- Motion (full unless the visitor asks for less) ---------- */
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes halo-spin { to { --halo-angle: 360deg; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; }
  .pill:hover, .pill:active, .icon-btn:active { transform: none; }
}
