/* etoele — `ascii` style (Tokyo Night / Tokyo Night Day). « Cap sur le terminal ! »
 * Tokens derived from ~/Skills/video-demo/styles/ascii.css.
 * Zero external assets, local/system fonts, one accent color.
 */

:root {
  color-scheme: dark;
  --bg: #0f111a;
  --surface: #161926;
  --fg: #c0caf5;
  --body: #a9b1d6;
  --muted: #7b83ad;
  --accent: #7aa2f7;
  --border: #2b324b;
  --logo: #c0caf5;
  --field-ink: #7aa2f7;

  --font-mono: "JetBrainsMono Nerd Font", "JetBrains Mono", "Noto Sans Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --space-1: 0.5rem;
  --space-2: 1rem;
  --space-3: 1.5rem;
  --space-4: 2.5rem;
  --space-5: 3.5rem;
  --measure: 48rem;
}

/* Tokyo Night Day follows the OS light theme unless dark is pinned. */
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    color-scheme: light;
    --bg: #e1e2e7;
    --surface: #d5d6db;
    --fg: #3760bf;
    --body: #343b58;
    --muted: #525e8c;
    --accent: #235ec4;
    --border: #b4b8c8;
    --logo: #3760bf;
    --field-ink: #3760bf;
  }
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #e1e2e7;
  --surface: #d5d6db;
  --fg: #3760bf;
  --body: #343b58;
  --muted: #525e8c;
  --accent: #235ec4;
  --border: #b4b8c8;
  --logo: #3760bf;
  --field-ink: #3760bf;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0f111a;
  --surface: #161926;
  --fg: #c0caf5;
  --body: #a9b1d6;
  --muted: #7b83ad;
  --accent: #7aa2f7;
  --border: #2b324b;
  --logo: #c0caf5;
  --field-ink: #7aa2f7;
}

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

html {
  background: var(--bg);
  color: var(--body);
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--body);
  font-family: var(--font-mono);
  font-size: 0.9375rem;
  line-height: 1.75;
}

/* Background starfield / reticle grid — quiet, but the eye must catch it moving.
   Three motions, all compositor-only (opacity, transform, dash offset):
   - reticles breathe on prime periods (7 / 11 / 13 s) so they never pulse in step;
   - the middle group turns a quarter turn: a cross looks the same after 90°, the loop is seamless;
   - dashes flow along the constellation lines, two dash periods per cycle (2 + 7 = 9 → 18). */
.bg-field {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
  color: var(--field-ink);
  overflow: hidden;
}

.bg-field .field-dots {
  opacity: 0.11;
}

.bg-field .field-links {
  opacity: 0.18;
  animation: field-flow 5s linear infinite;
}

.bg-field .pulse-a {
  animation: field-breathe 7s ease-in-out infinite;
}

.bg-field .pulse-b {
  animation: field-breathe 11s ease-in-out -4s infinite;
}

.bg-field .pulse-b use {
  transform-box: fill-box;
  transform-origin: center;
  animation: field-turn 19s linear infinite;
}

.bg-field .pulse-c {
  animation: field-breathe 13s ease-in-out -9s infinite;
}

@keyframes field-breathe {
  0%,
  100% {
    opacity: 0.06;
  }
  50% {
    opacity: 0.55;
  }
}

@keyframes field-turn {
  to {
    transform: rotate(90deg);
  }
}

@keyframes field-flow {
  to {
    stroke-dashoffset: -18;
  }
}

.page {
  position: relative;
  z-index: 1;
  max-width: var(--measure);
  margin: 0 auto;
  padding: var(--space-3) var(--space-3) var(--space-5);
}

/* Top bar: real controls only. */
.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-1) var(--space-2);
  padding-bottom: var(--space-2);
  border-bottom: 1px solid var(--border);
  font-size: 0.8125rem;
  color: var(--muted);
}

.topbar-id {
  color: var(--fg);
  font-weight: 700;
  letter-spacing: 0.02em;
}

.topbar-id a {
  color: inherit;
}

.topbar-controls {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

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

button.theme-btn {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  color: var(--muted);
  cursor: pointer;
}

button.theme-btn:hover {
  color: var(--accent);
}

.lang-link {
  color: var(--muted);
}

.lang-link:hover {
  color: var(--accent);
}

/* Hero: ASCII wordmark + identity. */
.hero {
  padding: var(--space-4) 0 var(--space-3);
}

.logo-ascii {
  margin: 0 0 var(--space-4);
  color: var(--logo);
  font-family: var(--font-mono);
  font-weight: 400;
  line-height: 1.12;
  white-space: pre;
  /* 45 columns wide: sized to fit down to 390 px without horizontal scroll. */
  font-size: clamp(9px, calc((100vw - 2.5rem) / 28), 16px);
}

.hero h1 {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--fg);
  line-height: 1.4;
}

.hero-role {
  margin: 0.25rem 0 0;
  color: var(--body);
}

.hero-tags {
  margin: 0.35rem 0 0;
  color: var(--muted);
  font-size: 0.875rem;
  word-spacing: 0.25rem;
}

.hero-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.25rem;
  margin-top: var(--space-2);
  padding: 0;
  list-style: none;
  font-size: 0.875rem;
}

/* Numbered sections. */
.section {
  margin-top: var(--space-4);
  padding-top: var(--space-3);
  border-top: 1px solid var(--border);
}

.section h2 {
  margin: 0 0 var(--space-2);
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--fg);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.section h2 .num {
  color: var(--accent);
  margin-right: 0.6rem;
}

.section p {
  margin: 0 0 var(--space-2);
  max-width: 66ch;
}

.section p:last-child {
  margin-bottom: 0;
}

/* Man-page style key/value grid. */
.spec-list {
  margin: var(--space-3) 0 0;
  padding: var(--space-2) 0 0;
  border-top: 1px solid var(--border);
  display: grid;
  grid-template-columns: 11rem 1fr;
  gap: 0.65rem 1.5rem;
  font-size: 0.875rem;
}

.spec-list dt {
  color: var(--muted);
}

.spec-list dd {
  margin: 0;
  color: var(--body);
}

/* Lab entries. */
.entries {
  margin: var(--space-3) 0 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--border);
}

.entry {
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--border);
}

.entry-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.25rem 1rem;
  margin-bottom: 0.35rem;
}

.entry-title {
  margin: 0;
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--fg);
}

.entry-status {
  font-size: 0.8125rem;
  color: var(--muted);
}

.entry-desc {
  margin: 0;
  font-size: 0.875rem;
  color: var(--body);
  max-width: 66ch;
}

.entry-links {
  margin-top: 0.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1rem;
  font-size: 0.8125rem;
}

/* Contact links. */
.contact-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  margin: var(--space-2) 0 0;
  padding: 0;
  list-style: none;
  font-size: 0.9375rem;
}

/* Explicit placeholder marker for legal fields waiting on JB. */
.todo {
  display: inline-block;
  padding: 0.05rem 0.4rem;
  border: 1px dashed var(--accent);
  color: var(--fg);
  background: var(--surface);
}

.legal-note {
  margin-top: var(--space-2);
  font-size: 0.8125rem;
  color: var(--muted);
}

/* Footer. */
.site-footer {
  margin-top: var(--space-5);
  padding-top: var(--space-3);
  border-top: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
  font-size: 0.8125rem;
  color: var(--muted);
}

.site-footer p {
  margin: 0;
}

.footer-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.4rem 1.25rem;
}

.skip-link {
  position: absolute;
  left: -9999px;
}

.skip-link:focus {
  position: static;
  display: inline-block;
  margin-bottom: var(--space-2);
}

/* Reduced motion: freeze the starfield in place. */
@media (prefers-reduced-motion: reduce) {
  .bg-field .pulse-a,
  .bg-field .pulse-b,
  .bg-field .pulse-c,
  .bg-field .pulse-b use,
  .bg-field .field-links {
    animation: none;
  }
  .bg-field .pulse-a,
  .bg-field .pulse-b,
  .bg-field .pulse-c {
    opacity: 0.2;
  }
}

/* Narrow viewports (390 px and below). */
@media (max-width: 600px) {
  body {
    font-size: 0.875rem;
    line-height: 1.7;
  }

  .page {
    padding: var(--space-2) 1.125rem var(--space-4);
  }

  .hero {
    padding: var(--space-3) 0 var(--space-2);
  }

  .logo-ascii {
    margin-bottom: var(--space-3);
    font-size: clamp(8.5px, calc((100vw - 2.25rem) / 27.5), 14px);
  }

  .spec-list {
    grid-template-columns: 1fr;
    gap: 0.2rem;
  }

  .spec-list dd {
    margin-bottom: 0.65rem;
  }

  .spec-list dd:last-child {
    margin-bottom: 0;
  }
}
