/* console font - lucida console */
@font-face {
  font-family: 'console';
  src: url('/assets/fonts/console.woff2') format('woff2'),
       url('/assets/fonts/console.woff') format('woff');
  font-weight: normal;
  font-style: normal;
}

:root {
  color-scheme: dark;

  --bg: #000000;
  --fg: #00cc00;
  --fg-dim: #004400;
  --fg-bright: #00ff00;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* screen reader only - accessible but hidden */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

html, body {
  width: 100%;
  height: 100%;
  overflow-x: hidden;
  background: var(--bg);
  font-family: 'console', 'Lucida Console', monospace;
  color: var(--fg);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

/* background layer - matrix rain */
#background {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  opacity: 0.5;
  pointer-events: none;
  color: var(--fg);
  font-size: 14px;
  line-height: 1;
  white-space: pre;
  overflow: hidden;
}

/* boot overlay - on top during boot */
#boot-display {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 100;
  background: var(--bg);
  color: var(--fg);
  font-size: 14px;
  line-height: 1;
  white-space: pre;
  overflow: hidden;
  transition: opacity 0.5s ease-out;
}

#boot-display.hidden {
  opacity: 0;
  pointer-events: none;
}

/* transparent mode: logo stays visible, content shows through */
#boot-display.transparent {
  background: transparent;
  pointer-events: none;
}

/* content layer */
#content {
  position: relative;
  z-index: 10;
  min-height: 100vh;
  padding: 20px;
  transition: opacity 0.5s ease-out;
}

#content.hidden {
  opacity: 0;
  pointer-events: none;
}

/* header with logo - positioned to match play.core boot sequence */
#header {
  text-align: center;
  padding: 0;
  padding-bottom: 40px;
  /* escape #content padding so centering matches play.core's full viewport */
  /* mobile base: 15px padding */
  margin-left: -15px;
  margin-right: -15px;
  /* match play.core targetY = 2 rows (font-size varies on mobile) */
  /* for clamp(6px, 1.3vw, 12px): 2 rows ≈ 12-24px, minus 15px content padding */
  margin-top: calc(2 * clamp(6px, 1.3vw, 12px) - 15px);
}

#logo {
  display: inline-block;
  font-size: 14px;
  line-height: 1;
  color: var(--fg);
  white-space: pre;
}

/* sections */
main {
  max-width: 800px;
  margin: 0 auto;
}

section {
  margin-bottom: 60px;
  padding: 20px;
  border: 1px solid var(--fg-dim);
}

h2 {
  color: var(--fg-bright);
  margin-bottom: 15px;
  font-size: 1.2em;
}

p {
  line-height: 1.6;
}

/* =============================================================================
   responsive layout - mobile first
   ============================================================================= */

/* mobile base (< 900px) */
#background {
  font-size: 12px;
}

#boot-display {
  /* 72 char logo needs ~5px/char = 360px min
     use vw to scale: 100vw / 72 chars ≈ 1.39vw per char
     clamp between 6px (tiny) and 12px (tablet) */
  font-size: clamp(6px, 1.3vw, 12px);
}

#logo {
  /* match boot-display for seamless handoff */
  font-size: clamp(6px, 1.3vw, 12px);
}

#content {
  padding: 15px;
}

section {
  margin-bottom: 40px;
  padding: 15px;
}

/* desktop (>= 900px) */
@media (min-width: 900px) {
  #background {
    font-size: 14px;
  }

  #boot-display {
    font-size: 14px; /* fixed size, viewport is wide enough */
  }

  #logo {
    font-size: 14px; /* match boot-display for seamless handoff */
  }

  #content {
    padding: 20px;
  }

  #header {
    /* desktop: 20px content padding */
    margin-left: -20px;
    margin-right: -20px;
    /* match play.core targetY = 2 rows at 14px: (2 * 14) - 20 = 8px */
    margin-top: 8px;
  }

  section {
    margin-bottom: 60px;
    padding: 20px;
  }
}

/* layout mode data attribute hooks */
[data-layout="mobile"] #background {
  opacity: 0.8;
}

[data-layout="desktop"] #background {
  opacity: 0.8;
}

/* =============================================================================
   links
   ============================================================================= */

a {
  color: var(--fg-bright);
  text-decoration: none;
  touch-action: manipulation;
}

a:hover,
a:visited,
a:active {
  color: var(--fg-bright);
}

a:hover {
  text-decoration: underline;
}

/* =============================================================================
   NFO-style sections
   ============================================================================= */

.nfo-section {
  border: none;
  padding: 0;
  margin-bottom: 8px;
}

.section-header {
  display: flex;
  align-items: center;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  overflow: hidden;
  padding: 4px 0;
  touch-action: manipulation;
  /* fix iOS alignment */
  text-align: left;
  justify-content: flex-start;
}

.nfo-border-l {
  color: var(--fg-dim);
  flex-shrink: 0;
  flex-grow: 0;
}

.nfo-title {
  color: var(--fg-bright);
  font-weight: normal;
  flex-shrink: 0;
  flex-grow: 0;
}

.nfo-border-r {
  color: var(--fg-dim);
  overflow: hidden;
  flex-grow: 1;
  flex-shrink: 1;
  min-width: 20px;
  position: relative;
}

/* dynamic fill using ░ character */
.nfo-border-r::before {
  content: '░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░';
  position: absolute;
  left: 0;
  white-space: nowrap;
}

.nfo-cap {
  color: var(--fg-dim);
  flex-shrink: 0;
  flex-grow: 0;
}

.section-toggle {
  color: var(--fg);
  flex-shrink: 0;
  flex-grow: 0;
  margin-left: 4px;
}

section.collapsed .section-toggle {
  color: var(--fg-dim);
}

section.collapsed .section-toggle::after {
  content: '◄►';
}

section:not(.collapsed) .section-toggle::after {
  content: '▼▼';
}

/* hover effects */
.section-header:hover .nfo-title {
  text-shadow: 0 0 8px var(--fg-bright);
}

.section-header:hover .section-toggle::after {
  color: var(--fg-bright);
}

/* hide the inline text, use ::after */
.section-toggle {
  font-size: 0;
}
.section-toggle::after {
  font-size: 1rem;
}

/* section footer (bottom of box) */
.section-footer {
  color: var(--fg-dim);
  overflow: hidden;
  white-space: nowrap;
}

section.collapsed .section-content,
section.collapsed .section-footer {
  display: none;
}

.section-content {
  padding: 10px 12px 10px 12px;
  border-left: 1px solid var(--fg-dim);
  border-right: 1px solid var(--fg-dim);
  margin-left: 0;
}

.section-content p {
  padding-left: 0;
  margin-bottom: 10px;
}

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

/* NFO menu links */
.nfo-menu {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-left: 0;
}

.nfo-menu a {
  display: inline-block;
  padding: 4px 0;
}

.nfo-menu a:hover {
  text-decoration: none;
  background: var(--fg-dim);
  color: var(--bg);
}

/* NFO footer */
.nfo-footer {
  color: var(--fg-dim);
  padding: 8px 0;
  overflow: hidden;
}

/* responsive: simplify borders on mobile */
@media (max-width: 600px) {
  /* full width sections - escape content padding */
  main {
    max-width: none;
  }

  .nfo-section {
    margin-left: -15px;
    margin-right: -15px;
    padding-left: 15px;
    padding-right: 15px;
  }

  .section-header {
    justify-content: flex-start;  /* left-align everything */
  }

  /* hide fill element on mobile - too cluttered */
  .nfo-border-r {
    display: none;
  }

  /* simplify right cap */
  .nfo-cap {
    flex-grow: 1;
    text-align: right;
  }

  .nfo-footer {
    display: none;
  }
}

/* =============================================================================
   bio image
   ============================================================================= */

.bio-image-wrap {
  text-align: center;
  margin-top: 1.5em;
  margin-bottom: 20px;
}

.bio-image {
  max-width: 438px;
  width: 100%;
  height: auto;
  opacity: 0.7;
  border: 1px solid var(--fg-dim);
}

/* bio-4: increase clarity */
.bio-image[src*="bio-4"] {
  opacity: 0.91;
}

#bio .section-content p {
  text-align: center;
}

/* mobile: scale to container */
@media (max-width: 600px) {
  .bio-image {
    max-width: 70%;
  }
}
