/* dreamreactor.net: Music and Projects pages.
   Base palette from the Reactor Control planner; flair (chromatic split, cut corners) is the site's own.
   Design doc lives outside this repo (everything here is public). */

@font-face { font-family: "Quantico"; font-weight: 700; font-display: swap; src: url("/assets/fonts/quantico-700.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-weight: 400 500; font-display: swap; src: url("/assets/fonts/plex-sans.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-weight: 400; font-display: swap; src: url("/assets/fonts/plex-mono-400.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-weight: 500; font-display: swap; src: url("/assets/fonts/plex-mono-500.woff2") format("woff2"); }

:root {
  color-scheme: dark;
  --bg: #0a0b0e;
  --panel: #111318;
  --panel-2: #171a20;
  --line: #252932;
  --line-2: #343a45;
  --fg: #e8eaf0;
  --muted: #a2a9b7;
  --red: #c4261e;
  --cyan: #2ff3ff; /* Reactor Control planner cyan */
  --r: 6px;
  --cut: 14px;
  --font-brand: "Quantico", "Segoe UI", system-ui, sans-serif;
  --font-body: "IBM Plex Sans", system-ui, -apple-system, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace;
}
@media (min-width: 901px) { :root { --line: #2f343e; --line-2: #444b58; } }

* { box-sizing: border-box; }
html { scrollbar-gutter: stable; background: var(--bg); }
body {
  margin: 0;
  background: transparent; /* html paints --bg; a body background would hide the rings layer */
  color: var(--fg);
  font: 15px/1.55 var(--font-body);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
:focus-visible { outline: 2px solid var(--cyan); outline-offset: 3px; }

.page {
  /* Centred in the viewport like the old site; when the content is taller it simply starts at the top */
  min-height: 100vh;
  min-height: 100svh;
  justify-content: center;
  max-width: 500px;
  margin: 0 auto;
  padding: max(40px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(56px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

/* Background rings: full-viewport canvas behind everything; the script centres the rings on the logo */
.magic-rings { position: fixed; inset: 0; z-index: -1; pointer-events: none; overflow: hidden; }
.magic-rings__canvas { position: absolute; inset: 0; display: block; width: 100%; height: 100%; pointer-events: none; }

/* Shared header: identical on both pages */
.site-head { display: flex; flex-direction: column; align-items: center; width: 100%; }

.logo { position: relative; width: 200px; height: 200px; }
.logo img, .logo video {
  position: absolute; inset: 0; width: 100%; height: 100%;
  display: block; mix-blend-mode: screen; transition: opacity 0.3s;
}
.logo video { opacity: 0; }
.logo.playing video { opacity: 1; }
.logo.playing img { opacity: 0; }

h1 {
  margin: 4px 0 24px;
  font: 700 clamp(26px, 8vw, 48px)/1 var(--font-brand);
  letter-spacing: 0.12em;
  margin-right: -0.12em; /* trailing tracking would push the centred word left */
  text-transform: uppercase;
  white-space: nowrap;
  color: #fff;
  text-shadow: -2px 0 var(--red), 2px 0 var(--cyan);
}
/* Page switch: borrowed from the planner's segmented control */
.tabs { display: inline-flex; border: 1px solid var(--line-2); border-radius: var(--r); margin-bottom: 32px; }
.tabs a:first-of-type { border-radius: calc(var(--r) - 1px) 0 0 calc(var(--r) - 1px); }
.tabs a:last-of-type { border-radius: 0 calc(var(--r) - 1px) calc(var(--r) - 1px) 0; }
.tabs a {
  display: flex; align-items: center; justify-content: center;
  min-height: 44px; min-width: 120px; padding: 0 18px;
  font: 500 13px var(--font-mono); letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--muted);
}
.tabs a + a { border-left: 1px solid var(--line-2); }
.tabs a[aria-current="page"] { background: var(--panel-2); color: var(--cyan); box-shadow: inset 0 -2px 0 var(--cyan); }
.tabs a:focus-visible { outline-offset: -3px; }
@media (hover: hover) { .tabs a:not([aria-current]):hover { color: var(--fg); } }

/* Both pages reserve the Music page's content height, so centring puts the header in the same place on each */
main { width: 100%; min-height: 584px; }

/* Music */
.intro { margin: 0 auto 32px; color: var(--muted); max-width: 380px; }
.links { width: 100%; margin-bottom: 28px; }
h2 {
  margin: 0 0 12px;
  font: 500 12px var(--font-mono);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}
.links ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; align-items: center; gap: 10px; }
/* One fixed width for every link: the widest label (Amazon Music) plus about 36px either side */
.links li { width: min(240px, 100%); }

/* Click state: the lit spot on the border, and its outer glow, grow until the whole border is lit (350 ms), and shrinks back
   with the hover fade once the pointer leaves. @property makes the radius animatable; browsers without it
   simply snap to the filled border. */
@property --spot-r { syntax: "<length>"; inherits: true; initial-value: 120px; }

/* Cut-corner link: the <a> stays unclipped (focus ring, glow), ::before is the grey border, .face is the panel.
   Edge glow adapted from React Bits BorderGlow: assets/border-glow.js sets --edge (0-100, how close the
   pointer is to the edge) and --x/--y (pointer position); a spot there lights the border, a soft cyan
   glow outside it, and a faint inner glow. Cyan only. */
.btn {
  --edge: 0; --x: 50%; --y: 50%;
  /* BorderGlow aims a cone from the centre; on a wide, short button a cone lights a whole side,
     so the light is a spot centred on the pointer instead */
  --spot: radial-gradient(circle 120px at var(--x) var(--y), #000 35%, transparent 100%);
  /* Lit-border spot; its radius grows to fill the whole border on click */
  --ring-spot: radial-gradient(circle var(--spot-r) at var(--x) var(--y), #000 35%, transparent 100%);
  --shape: polygon(0 0, calc(100% - var(--cut)) 0, 100% var(--cut), 100% 100%, var(--cut) 100%, 0 calc(100% - var(--cut)));
  position: relative; display: block; height: 52px;
}
.btn::before, .btn::after {
  content: ""; position: absolute; inset: 0;
  clip-path: var(--shape);
}
.btn::before { background: var(--line-2); }
/* Lit border: cyan under the face, so only the 1px ring shows, masked to the spot */
.btn::after {
  z-index: 1;
  background: var(--cyan);
  -webkit-mask-image: var(--ring-spot); mask-image: var(--ring-spot);
  opacity: calc(0.55 + var(--edge) / 100 * 0.45);
}
/* Outer glow: a blurred cyan copy of the shape behind the button, masked to the spot */
.btn .glow {
  position: absolute; inset: -16px; pointer-events: none;
  filter: blur(9px);
  --spot: radial-gradient(circle var(--spot-r) at calc(var(--x) + 16px) calc(var(--y) + 16px), #000 35%, transparent 100%);
  -webkit-mask-image: var(--spot); mask-image: var(--spot);
  opacity: calc((0.35 + var(--edge) / 100 * 0.65) * 0.7);
}
.btn .glow::before { content: ""; position: absolute; inset: 16px; background: var(--cyan); clip-path: var(--shape); }
.btn .face {
  position: absolute; inset: 1px; z-index: 2;
  display: flex; align-items: center; justify-content: center; gap: 12px;
  background: var(--panel-2);
  clip-path: polygon(0 0, calc(100% - var(--cut) + 0.4px) 0, 100% calc(var(--cut) - 0.4px), 100% 100%, calc(var(--cut) - 0.4px) 100%, 0 calc(100% - var(--cut) + 0.4px));
  font: 700 16px var(--font-brand);
  letter-spacing: 0.06em;
  color: #fff;
}
/* Faint inner glow along the lit edge */
.btn .face::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  box-shadow: inset 0 0 14px rgba(47, 243, 255, 0.35);
  -webkit-mask-image: var(--spot); mask-image: var(--spot);
  opacity: calc(0.4 + var(--edge) / 100 * 0.6);
}
.btn::after, .btn .glow, .btn .face::before { transition: opacity 0.25s ease-out; }
.btn:not(:hover)::after, .btn:not(:hover) .glow, .btn:not(:hover) .face::before { opacity: 0; transition: opacity 0.75s ease-in-out; }
.icon {
  position: relative;
  width: 24px; height: 24px; flex: none;
  background: currentColor;
  -webkit-mask: var(--icon) center / contain no-repeat;
  mask: var(--icon) center / contain no-repeat;
}
.btn:focus-visible { outline-offset: 2px; }
.btn, .tabs a, .card { --spot-r: 120px; }
.btn { transition: --spot-r 0.75s ease-in-out; }

/* Projects */
.projects { list-style: none; margin: 0; padding: 0; width: 100%; display: flex; flex-direction: column; gap: 12px; }
.card {
  display: flex; align-items: center; gap: 18px; text-align: left;
  padding: 18px 20px;
  background: var(--panel);
  border: 1px solid var(--line-2);
  border-radius: var(--r);
}
.card-art { width: clamp(96px, 28vw, 132px); height: auto; flex: none; display: block; }
.card-text { min-width: 0; }
@media (max-width: 359px) { .card { flex-direction: column; align-items: flex-start; } }
.card h2 { margin: 0 0 6px; white-space: nowrap; font: 700 clamp(15px, 4.4vw, 20px)/1.2 var(--font-brand); letter-spacing: 0.08em; color: #fff; }
.card p { margin: 0; color: var(--muted); }

/* Edge glow on rounded boxes (each tab on its own, project cards): same effect as the buttons. A lit 1px border on ::after,
   and a blurred cyan ring (.glow, added by border-glow.js) that glows both outside and just inside. */
.tabs a, .card { --edge: 0; --x: 50%; --y: 50%; position: relative; isolation: isolate; }
.tabs a::after, .card::after {
  content: ""; position: absolute; inset: -1px; pointer-events: none;
  border: 1px solid var(--cyan); border-radius: var(--r);
  --spot: radial-gradient(circle var(--spot-r) at calc(var(--x) + 1px) calc(var(--y) + 1px), #000 35%, transparent 100%);
  -webkit-mask-image: var(--spot); mask-image: var(--spot);
  opacity: calc(0.55 + var(--edge) / 100 * 0.45);
}
.tabs a .glow, .card .glow {
  position: absolute; inset: -17px; z-index: -1; pointer-events: none;
  filter: blur(8px);
  --spot: radial-gradient(circle var(--spot-r) at calc(var(--x) + 17px) calc(var(--y) + 17px), #000 35%, transparent 100%);
  -webkit-mask-image: var(--spot); mask-image: var(--spot);
  opacity: calc((0.35 + var(--edge) / 100 * 0.65) * 0.7);
}
.tabs a .glow::before, .card .glow::before {
  content: ""; position: absolute; inset: 16px;
  border: 2px solid var(--cyan); border-radius: var(--r);
}
.tabs a::after, .card::after, .tabs a .glow, .card .glow { transition: opacity 0.25s ease-out; }
/* Each tab's ring follows its own corners: rounded on the outside, square where the tabs meet */
.tabs a:first-of-type::after, .tabs a:first-of-type .glow::before { border-radius: var(--r) 0 0 var(--r); }
.tabs a:last-of-type::after, .tabs a:last-of-type .glow::before { border-radius: 0 var(--r) var(--r) 0; }
.tabs a:not(:hover)::after, .card:not(:hover)::after, .tabs a:not(:hover) .glow, .card:not(:hover) .glow { opacity: 0; transition: opacity 0.75s ease-in-out; }

/* Hover: background brightens slightly, with the same fade as the edge glow (in 0.25 s, out 0.75 s) */
.btn .face { transition: background-color 0.75s ease-in-out; }
.tabs a, .card { transition: --spot-r 0.75s ease-in-out, background-color 0.75s ease-in-out; }
@media (hover: hover) {
  .btn:hover .face { transition: background-color 0.25s ease-out; }
  .tabs a:hover, .card:hover { transition: --spot-r 0.75s ease-in-out, background-color 0.25s ease-out; }
  .btn:hover .face { background-color: #1d2028; }
  .tabs a:hover { background-color: rgba(255, 255, 255, 0.035); }
  .tabs a[aria-current="page"]:hover { background-color: #1d2028; }
  .card:hover { background-color: #161920; }
}

/* Click state (kept after the hover rules so it wins over their :not(:hover) fades) */
.btn.pressed, .tabs a.pressed, .card.pressed { --spot-r: 720px; transition: --spot-r 0.35s ease-out, background-color 0.25s ease-out; }
.btn.pressed::after, .tabs a.pressed::after, .card.pressed::after { opacity: 1; transition: opacity 0.35s ease-out; }
.btn.pressed .glow, .tabs a.pressed .glow, .card.pressed .glow { opacity: 0.7; transition: opacity 0.35s ease-out; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
