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

:root {
  --bg:       #1B1B1B;
  --text:     #E8D5A3;
  --dim:      #7a6e54;
  --seam:     #2e2e2e;
  --green:    #00CC66;
  --mono:     'Courier New', Courier, monospace;
  --rht:      "Red Hat Text", sans-serif;

  /* About section (white background) */
  --about-bg:   #ffffff;
  --about-text: #1B1B1B;
  --about-dim:  #1B1B1B;
  --about-seam: #dddddd;
}

html { scroll-behavior: smooth; }

body {
  background: var(--about-bg);
  color: var(--about-text);
  font-family: var(--mono);
  overflow-x: hidden;
}

/* ── Hero / about section ────────────────────────────────────────────────────── */
#about {
  padding: 7rem 1.5rem 4rem;
  display: flex;
  justify-content: center;
}

#about-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2.2rem;
  max-width: 900px;
  width: 100%;
}

/* Headline */
#hero-text {
  text-align: center;
  opacity: 0;
  animation: heroFadeUp 0.55s ease 0.05s forwards;
}

#about-heading {
  font-family: var(--rht);
  font-size: clamp(2rem, 5.5vw, 4.2rem);
  letter-spacing: 0.01em;
  line-height: 1.1;
  margin-bottom: 0.25em;
  font-weight: 300;
  color: var(--about-text);
}

/* ── Animated word strip — renders like a mini board row ──────────────────────
 * .word-sizer: invisible, in normal flow — sizes the strip to the longest word.
 * .rotating-word: absolutely stacked on top of the sizer, animate in/out.       */
#word-strip {
  position: relative;
  display: inline-block;
  overflow: hidden;
  background: #1B1B1B;
  border-radius: 2px;
  box-shadow: 0 0 0 1px #2a2a2a, 0 4px 24px rgba(0,0,0,0.22);
  vertical-align: bottom;
}

/* Center seam — mimics the top/bottom flap split of the real tiles */
#word-strip::after {
  content: '';
  position: absolute;
  left: 0; right: 0;
  top: 50%;
  height: 2px;
  background: #000;
  margin-top: -1px;
  z-index: 10;
  pointer-events: none;
}

.word-sizer,
.rotating-word {
  font-family: "Doto", monospace;
  font-weight: 700;
  font-optical-sizing: auto;
  font-variation-settings: "ROND" 0;
  font-size: clamp(2rem, 5.5vw, 4.2rem);
  color: #E8D5A3;
  letter-spacing: 0.06em;
  line-height: 1.15;
  white-space: nowrap;
  padding: 0.08em 0.45em;
}

.word-sizer {
  display: block;
  visibility: hidden;
  pointer-events: none;
}

.rotating-word {
  display: block;
  position: absolute;
  top: 0; left: 0; right: 0;
  text-align: center;
  transform: translateY(-110%);
}

.rotating-word.active {
  transform: translateY(0);
  transition: transform 0.52s cubic-bezier(0.22, 1, 0.36, 1);
}

.rotating-word.exiting {
  transform: translateY(110%);
  transition: transform 0.38s cubic-bezier(0.55, 0, 1, 0.45);
}

/* Description */
#about-desc {
  font-family: var(--rht);
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.75;
  color: var(--about-dim);
  letter-spacing: 0;
  text-align: center;
  max-width: 58ch;
  opacity: 0;
  animation: heroFadeUp 0.55s ease 0.28s forwards;
}

/* CTA buttons */
#hero-ctas {
  display: flex;
  gap: 0.9rem;
  flex-wrap: wrap;
  justify-content: center;
  opacity: 0;
  animation: heroFadeUp 0.55s ease 0.38s forwards;
}

#cta-primary {
  display: inline-block;
  background: var(--about-text);
  color: var(--about-bg);
  font-family: var(--rht);
  font-size: 0.85rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  padding: 0.65rem 1.5rem;
  text-decoration: none;
  transition: background 0.15s;
}

#cta-primary:hover { background: #333333; }

#cta-secondary {
  display: inline-block;
  border: 1px solid #cccccc;
  color: var(--about-dim);
  font-family: var(--rht);
  font-size: 0.85rem;
  font-weight: 400;
  letter-spacing: 0.08em;
  padding: 0.65rem 1.5rem;
  text-decoration: none;
  transition: border-color 0.15s, color 0.15s;
}

#cta-secondary:hover {
  border-color: var(--about-text);
  color: var(--about-text);
}

/* How-it-works steps — horizontal 3-column */
#how-it-works {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2rem;
  width: 100%;
  padding-top: 2.5rem;
  border-top: 1px solid var(--about-seam);
  opacity: 0;
  animation: heroFadeUp 0.55s ease 0.48s forwards;
}

.step {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.step-num {
  font-family: var(--rht);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  color: #007700;
}

.step-text {
  font-family: var(--rht);
  font-size: 0.875rem;
  font-weight: 400;
  line-height: 1.75;
  color: var(--about-dim);
  letter-spacing: 0;
}

.step-text em {
  font-style: normal;
  font-weight: 500;
  color: var(--about-text);
}

/* Page-load staggered reveal */
@keyframes heroFadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Hero section — now second ───────────────────────────────────────────────── */
#hero {
  background: #ffffff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1rem 1rem 2rem;
  gap: 0;
  border-top: 1px solid var(--about-seam);
  margin-top: 3rem;
}

#hero-header {
  width: 100%;
  max-width: 1200px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 0.75rem;
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  color: var(--dim);
}

#wordmark {
  font-size: 0.7rem;
  letter-spacing: 0.3em;
  color: var(--dim);
}

#boards-live {
  font-family: var(--rht);
  font-size: 0.8rem;
  font-weight: 400;
  letter-spacing: 0.04em;
  color: var(--about-text);
  opacity: 0.85;
}

/* ── Board container ─────────────────────────────────────────────────────────── */
#board-container {
  width: 100%;
  max-width: 1200px;
  display: flex;
  align-items: center;
  justify-content: center;
}

#board-grid {
  display: grid;
  grid-template-columns: repeat(22, 1fr);
  grid-template-rows: repeat(6, auto);
  gap: 3px;
  background: #111;
  padding: 10px;
  border-radius: 3px;
  width: 100%;
  box-shadow:
    0 0 0 1px #2a2a2a,
    0 4px 40px #00000060;
}

/* Responsive tile sizing — tile fills column, height driven by aspect-ratio.
 * JS (home.js) measures actual tile height via ResizeObserver and sets
 * --tile-fs (font-size) and --tile-ty (translateY magnitude) on #board-grid. */
#board-grid .tile {
  width: 100%;
  aspect-ratio: 2.2 / 4.3;
  height: auto;
}

#board-grid .tile .tile-char        { font-size: var(--tile-fs, 3rem); }
#board-grid .tile-top .tile-char    { transform: translateY(var(--tile-ty, 0.75rem)); }
#board-grid .tile-bottom .tile-char { transform: translateY(calc(var(--tile-ty, 0.75rem) * -1)); }

/* ── Demo controls + Connect Board ──────────────────────────────────────────── */
#demo-controls {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 0 0;
}

#demo-controls button {
  background: transparent;
  border: 1px solid #3a3a3a;
  color: var(--dim);
  font-family: var(--rht);
  font-size: 0.8rem;
  font-weight: 400;
  letter-spacing: 0.06em;
  padding: 0.3rem 0.8rem;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}

#demo-controls button:hover {
  border-color: var(--about-text);
  color: var(--about-text);
}

#demo-controls button.audio-locked {
  opacity: 0.35;
  cursor: default;
  pointer-events: none;
}

#btn-connect {
  display: inline-block;
  border: 1px solid var(--about-text);
  color: var(--about-text);
  font-family: var(--rht);
  font-size: 0.8rem;
  font-weight: 400;
  letter-spacing: 0.06em;
  padding: 0.3rem 0.8rem;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}

#btn-connect:hover {
  background: var(--about-text);
  color: var(--about-bg);
}

/* ── Footer ──────────────────────────────────────────────────────────────────── */
#site-footer {
  display: flex;
  justify-content: space-between;
  font-family: var(--rht);
  font-size: 0.75rem;
  font-weight: 400;
  letter-spacing: 0.02em;
  color: #1B1B1B;
  border-top: 1px solid var(--about-seam);
  padding: 1.5rem 1.5rem;
  max-width: 100%;
}

/* ── Fullscreen — 100vw wide, centered with 2vh gap top and bottom ───────────── */
#hero:fullscreen,
#hero:-webkit-full-screen {
  background: #1B1B1B;
  border-top: none;
  margin-top: 0;
  height: 100vh;
  padding: 0;
}

/* Hide header in fullscreen — reclaims ~16% vertical space */
#hero:fullscreen #hero-header,
#hero:-webkit-full-screen #hero-header {
  display: none;
}

#hero:fullscreen #board-container,
#hero:-webkit-full-screen #board-container {
  max-width: none;
  flex: 1;
  min-height: 0;
  padding: 2vh 0;
  align-items: center;
}

#hero:fullscreen #board-grid,
#hero:-webkit-full-screen #board-grid {
  width: 100vw;
  max-width: 100vw;
}

/* Header text: was dark (for white bg), needs to be light in fullscreen */
#hero:fullscreen #boards-live,
#hero:-webkit-full-screen #boards-live {
  color: #E8D5A3;
  opacity: 0.85;
}

#hero:fullscreen #wordmark,
#hero:-webkit-full-screen #wordmark {
  color: #7a6e54;
}

/* Demo control buttons: invert for dark bg */
#hero:fullscreen #demo-controls button,
#hero:-webkit-full-screen #demo-controls button {
  border-color: #4a4a4a;
  color: #7a6e54;
}

#hero:fullscreen #demo-controls button:hover,
#hero:-webkit-full-screen #demo-controls button:hover {
  border-color: #E8D5A3;
  color: #E8D5A3;
}

/* Connect Board link */
#hero:fullscreen #btn-connect,
#hero:-webkit-full-screen #btn-connect {
  border-color: #5a5a5a;
  color: #7a6e54;
}

#hero:fullscreen #btn-connect:hover,
#hero:-webkit-full-screen #btn-connect:hover {
  background: #E8D5A3;
  color: #1B1B1B;
}

/* ── Responsive ──────────────────────────────────────────────────────────────── */
@media (max-width: 720px) {
  #about {
    padding: 4.5rem 1.25rem 3rem;
  }

  #about-inner {
    gap: 1.75rem;
  }

  #about-desc {
    text-align: left;
  }

  #hero-ctas {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
  }

  #cta-primary,
  #cta-secondary {
    text-align: center;
  }

  #how-it-works {
    grid-template-columns: 1fr;
    gap: 1.75rem;
  }

  #site-footer {
    flex-direction: column;
    gap: 0.4rem;
  }
}
