/* Minimal shell — overlay + legibility scrim only (§5). The field is the only
   richness; the overlay must never compete with it. */

:root {
  --bg: #070809;          /* near-black void */
  --ink: #eef2fb;
  --ink-dim: #aab3c6;
  --accent: #a8c4ff;
  --field-max: 1600px;    /* cap the field width so a wide viewport doesn't stretch the buffer */
}

* { box-sizing: border-box; }

html, body { margin: 0; height: 100%; }

body {
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* the field is capped to a centered box; the page bg (= the field's void color)
   fills the rest seamlessly, so it reads as a centered focal element, not a bar */
.stage {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);          /* also makes .stage the containing block for the overlay */
  width: min(100vw, var(--field-max));
  overflow: hidden;
}

/* animated surface, created by the host; fills the capped stage */
#field {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 0;
}

/* The overlay carries its own radial scrim — a soft dark pool only behind the
   text — so contrast holds against the moving field by construction, not luck. */
.overlay {
  position: absolute;            /* relative to .stage so it aligns to the field, not the viewport */
  z-index: 1;
  left: max(1.6rem, 4%);
  bottom: max(1.8rem, 7%);
  max-width: min(42ch, 86%);
  padding: 1.1rem 1.35rem;
  background: radial-gradient(125% 135% at 0% 100%, rgba(4, 5, 7, 0.82), rgba(4, 5, 7, 0) 72%);
  border-radius: 14px;
}

.name {
  margin: 0 0 0.15rem;
  font-size: clamp(1.9rem, 5vw, 3rem);
  font-weight: 650;
  letter-spacing: -0.01em;
}

/* phonetic pronunciation — half the name size, lighter weight, same color as the name */
.name .ipa {
  font-size: 0.5em;
  font-weight: 400;
  letter-spacing: 0;
}

/* OTP-style countdown ring — depletes over the 4 s auto-refresh interval (driven
   in JS from the same genStart clock, so it's exact and resets on each re-seed) */
.name .otp {
  width: 0.62em;
  height: 0.62em;
  margin-left: 0.4em;
  vertical-align: middle;
  overflow: visible;
}
.otp-track { fill: none; stroke: rgba(168, 196, 255, 0.22); stroke-width: 3; }
.otp-bar {
  fill: none;
  stroke: var(--accent);
  stroke-width: 3;
  stroke-linecap: round;
  transform: rotate(-90deg);          /* start the arc at 12 o'clock */
  transform-origin: 50% 50%;
  stroke-dasharray: 97.39;            /* 2π·15.5 (the circumference) */
  stroke-dashoffset: 0;              /* full; JS raises offset → depletes */
}
@media (prefers-reduced-motion: reduce) { .name .otp { display: none; } } /* no refresh ⇒ no countdown */

.tagline {
  margin: 0 0 0.9rem;
  color: var(--ink-dim);
  font-size: clamp(0.95rem, 1.6vw, 1.05rem);
  /* 50% black plate for legibility over bright animation frames */
  display: inline-block;
  background: rgba(0, 0, 0, 0.5);
  padding: 0.3rem 0.55rem;
  border-radius: 6px;
}

/* expandable "what I do" disclosure */
.about {
  margin: 0 0 0.85rem;
  max-width: 44ch;
}
.about > summary {
  cursor: pointer;
  list-style: none;
  width: fit-content;
  display: inline-flex;
  align-items: baseline;
  gap: 0.45rem;
  color: var(--ink);
  font-size: 0.95rem;
  border-bottom: 1px solid rgba(168, 196, 255, 0.35);
  padding: 0.1rem 0;
}
.about > summary::-webkit-details-marker { display: none; }
.about > summary::after { content: "+"; color: var(--accent); font-weight: 600; }
.about[open] > summary::after { content: "\2212"; } /* minus */
.about[open] > summary { border-bottom-color: var(--accent); margin-bottom: 0.55rem; }
.about ul {
  margin: 0;
  padding: 0.7rem 0.95rem 0.7rem 1.7rem;
  list-style: disc;
  background: rgba(0, 0, 0, 0.78);   /* darker plate ⇒ higher contrast over bright frames */
  border-radius: 6px;
  color: var(--ink);                 /* full-brightness text (was dimmed) */
  font-size: 0.9rem;
  line-height: 1.55;
}
.about li { margin: 0.55rem 0; }   /* a bit more air between the two-line items */
.about li:first-child { margin-top: 0; }
.about li strong { color: var(--ink); font-weight: 600; }
.about li::marker { color: var(--accent); }
summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

.links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.1rem 1.1rem;
  margin: 0 0 0.7rem;
}

.links a {
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid rgba(168, 196, 255, 0.35);
  padding: 0.1rem 0;
}

.links a:hover { border-bottom-color: var(--accent); }

.contact { margin: 0; }
.contact a { color: var(--accent); text-decoration: none; }
.contact a:hover { text-decoration: underline; }

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

/* live caption + regenerate control, quiet in the corner */
.meta {
  position: absolute;            /* relative to .stage (aligns to the field's corner) */
  z-index: 1;
  right: max(1rem, 3%);
  bottom: max(1rem, 4%);
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--ink-dim);
}

.caption {
  font-size: 0.8rem;
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
  opacity: 0.7;
}

#regen {
  appearance: none;
  cursor: pointer;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 1rem;
  line-height: 1;
  color: var(--ink-dim);
  background: rgba(20, 24, 32, 0.6);
  border: 1px solid rgba(168, 196, 255, 0.22);
  transition: color 0.15s, border-color 0.15s;
  -webkit-tap-highlight-color: transparent;
}

#regen:hover {
  color: var(--ink);
  border-color: var(--accent);
}

/* no focus ring / tap highlight on the regenerate control (per request) */
#regen:focus,
#regen:focus-visible {
  outline: none;
  box-shadow: none;
  border-radius: 50%;
}

@media (max-width: 520px) {
  .overlay { left: 1rem; right: 1rem; bottom: 4.75rem; max-width: none; }
}
