/* Fukuyama’s Children — immersive reader
   ───────────────────────────────────────────── */

@import url('https://fonts.googleapis.com/css2?family=Share+Tech+Mono&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Special+Elite&display=swap');

:root {
  --fc-amber: #ffb54d;
  --fc-amber-dim: #b97f2f;
  --fc-amber-faint: #6b4d1e;
  --fc-green: #32cd32;
  --fc-bg: #050403;
}

* { box-sizing: border-box; }
.fc-body [hidden] { display: none !important; }

.fc-body {
  background: var(--fc-bg);
  color: var(--fc-amber);
  font-family: 'Share Tech Mono', monospace;
  margin: 0;
  padding: 0;
  min-height: 100vh;
  overflow-x: hidden;
  text-shadow: 0 0 6px rgba(255, 181, 77, 0.35);
}

.fc-body a { color: var(--fc-amber); text-decoration: none; }

/* ── CRT overlays ── */
.fc-crt {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 90;
  background:
    repeating-linear-gradient(
      0deg,
      rgba(0, 0, 0, 0.22) 0px,
      rgba(0, 0, 0, 0.22) 1px,
      transparent 1px,
      transparent 3px
    );
  mix-blend-mode: multiply;
  animation: fc-crt-flicker 4s infinite;
}

.fc-vignette {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 91;
  background: radial-gradient(ellipse at center, transparent 55%, rgba(0, 0, 0, 0.75) 100%);
}

@keyframes fc-crt-flicker {
  0%, 100% { opacity: 0.9; }
  3% { opacity: 0.75; }
  6% { opacity: 0.9; }
  42% { opacity: 0.88; }
  44% { opacity: 0.7; }
  46% { opacity: 0.9; }
}

/* ── Title screen ── */
.fc-title-screen {
  max-width: 46rem;
  margin: 0 auto;
  padding: 8vh 1.4rem 4rem;
  position: relative;
  z-index: 10;
}

.fc-boot {
  color: var(--fc-amber-dim);
  font-size: 0.85rem;
  min-height: 4.5rem;
  white-space: pre-wrap;
  margin-bottom: 2rem;
}

.fc-title {
  font-size: clamp(1.7rem, 5.4vw, 3.1rem);
  letter-spacing: 0.12em;
  margin: 0 0 0.4rem;
  color: var(--fc-amber);
}

.fc-flicker { animation: fc-title-flicker 7s infinite; }

@keyframes fc-title-flicker {
  0%, 100% { opacity: 1; }
  91% { opacity: 1; }
  92% { opacity: 0.4; }
  93% { opacity: 1; }
  95% { opacity: 0.55; }
  96% { opacity: 1; }
}

.fc-subtitle {
  color: var(--fc-amber-dim);
  letter-spacing: 0.3em;
  text-transform: uppercase;
  font-size: 0.8rem;
  margin-bottom: 3rem;
}

.fc-epigraphs {
  min-height: 12rem;
  color: var(--fc-amber);
  font-size: 0.95rem;
  line-height: 1.75;
}

.fc-epigraphs .fc-epigraph {
  margin-bottom: 1.8rem;
  opacity: 0.92;
}

.fc-epigraphs .fc-epigraph .fc-attr {
  display: block;
  margin-top: 0.4rem;
  color: var(--fc-amber-dim);
}

.fc-dedication {
  min-height: 2rem;
  margin: 2.2rem 0;
  color: var(--fc-amber-dim);
  font-style: italic;
}

.fc-actions { display: flex; gap: 1rem; flex-wrap: wrap; margin: 2rem 0; }

.fc-btn {
  display: inline-block;
  border: 1px solid var(--fc-amber-dim);
  background: rgba(255, 181, 77, 0.05);
  color: var(--fc-amber);
  font-family: inherit;
  font-size: 0.95rem;
  letter-spacing: 0.15em;
  padding: 0.7rem 1.3rem;
  cursor: pointer;
  transition: background 0.2s, box-shadow 0.2s;
}

.fc-btn:hover {
  background: rgba(255, 181, 77, 0.16);
  box-shadow: 0 0 14px rgba(255, 181, 77, 0.25);
}

.fc-part-index {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(7.5rem, 1fr));
  gap: 0.6rem;
  margin-top: 2.5rem;
}

.fc-part-index a {
  border: 1px solid var(--fc-amber-faint);
  padding: 0.55rem 0.4rem;
  text-align: center;
  color: var(--fc-amber-dim);
  font-size: 0.8rem;
  letter-spacing: 0.2em;
  transition: all 0.2s;
}

.fc-part-index a:hover { color: var(--fc-amber); border-color: var(--fc-amber-dim); background: rgba(255,181,77,0.07); }

.fc-part-index a .fc-wc { display: block; font-size: 0.62rem; opacity: 0.6; letter-spacing: 0.05em; margin-top: 0.2rem; }

.fc-exit { margin-top: 3.5rem; font-size: 0.8rem; color: var(--fc-amber-faint); }

/* ── Reader chrome ── */
.fc-topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 95;
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.55rem 1rem;
  background: linear-gradient(to bottom, rgba(5,4,3,0.95), rgba(5,4,3,0));
}

.fc-part-marker {
  font-size: 0.72rem;
  letter-spacing: 0.3em;
  color: var(--fc-amber-dim);
  white-space: nowrap;
}

.fc-progress {
  flex: 1;
  height: 2px;
  background: rgba(255, 181, 77, 0.12);
}

.fc-progress-fill {
  height: 100%;
  width: 0%;
  background: var(--fc-amber);
  box-shadow: 0 0 8px rgba(255, 181, 77, 0.6);
  transition: width 0.25s linear;
}

.fc-toplinks { display: flex; gap: 0.9rem; font-size: 0.9rem; }
.fc-toplinks a { color: var(--fc-amber-dim); }
.fc-toplinks a:hover { color: var(--fc-amber); }

/* interference burst */
.fc-interference {
  position: fixed;
  inset: 0;
  z-index: 94;
  pointer-events: none;
  background: repeating-linear-gradient(0deg, rgba(255,181,77,0.08) 0 2px, transparent 2px 4px);
  opacity: 0;
}

.fc-interference.fc-on { animation: fc-interference-burst 0.28s steps(2) 1; }

@keyframes fc-interference-burst {
  0% { opacity: 0; }
  25% { opacity: 0.5; transform: translateX(2px); }
  50% { opacity: 0.15; transform: translateX(-3px); }
  75% { opacity: 0.4; transform: translateX(1px); }
  100% { opacity: 0; transform: none; }
}

/* ── Reader page ── */
.fc-page {
  max-width: 44rem;
  margin: 0 auto;
  padding: 5.5rem 1.3rem 9rem;
  position: relative;
  z-index: 10;
  outline: none;
  cursor: default;
  min-height: 100vh;
}

.fc-page p {
  font-size: 1.06rem;
  line-height: 1.85;
  margin: 0 0 1.6rem;
  letter-spacing: 0.015em;
}

.fc-page p.fc-stamp {
  color: var(--fc-green);
  font-size: 0.82rem;
  letter-spacing: 0.35em;
  text-transform: uppercase;
  text-shadow: 0 0 8px rgba(50, 205, 50, 0.45);
  border-left: 2px solid var(--fc-green);
  padding-left: 0.8rem;
  margin: 2.4rem 0 1.6rem;
}

.fc-page .fc-msg {
  display: block;
  border: 1px solid var(--fc-amber-faint);
  background: rgba(255, 181, 77, 0.045);
  padding: 0.85rem 1rem;
  margin: 0 0 1.6rem;
  font-size: 0.95rem;
  line-height: 1.7;
  color: var(--fc-amber);
  position: relative;
}

.fc-page .fc-msg::before {
  content: "✉ incoming";
  position: absolute;
  top: -0.65rem;
  left: 0.7rem;
  background: var(--fc-bg);
  padding: 0 0.4rem;
  font-size: 0.62rem;
  letter-spacing: 0.25em;
  color: var(--fc-amber-dim);
  text-transform: uppercase;
}

.fc-page .fc-scenebreak {
  text-align: center;
  color: var(--fc-amber-dim);
  font-size: 1.1rem;
  letter-spacing: 1.2em;
  padding: 1.2rem 0 1.2rem 1.2em;
  margin: 0.6rem 0 2rem;
  opacity: 0;
  transition: opacity 1.2s ease;
}

.fc-page .fc-scenebreak.fc-visible { opacity: 1; }

/* cursor */
.fc-cursor {
  display: inline-block;
  background: var(--fc-amber);
  color: var(--fc-bg);
  animation: fc-blink 0.85s steps(2, start) infinite;
  box-shadow: 0 0 10px rgba(255, 181, 77, 0.7);
}

@keyframes fc-blink { to { visibility: hidden; } }

/* glitch char */
.fc-glitchchar {
  color: var(--fc-green);
  text-shadow: 0 0 10px rgba(50, 205, 50, 0.8);
}

/* footnotes */
.fc-fn {
  color: var(--fc-green);
  cursor: pointer;
  font-size: 0.72em;
  vertical-align: super;
  padding: 0 0.15em;
  border-bottom: 1px dotted var(--fc-green);
}

.fc-fn-note {
  display: none;
  border-left: 2px solid var(--fc-green);
  background: rgba(50, 205, 50, 0.05);
  color: var(--fc-green);
  font-size: 0.82rem;
  line-height: 1.7;
  padding: 0.8rem 1rem;
  margin: -0.8rem 0 1.6rem 1rem;
  text-shadow: none;
}

.fc-fn-note.fc-open { display: block; }

/* controls */
.fc-controls {
  position: fixed;
  bottom: 1.1rem;
  right: 1.1rem;
  z-index: 95;
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 0.55rem;
  max-width: calc(100vw - 2.2rem);
}

.fc-reader-control {
  font-size: 0.72rem;
  padding: 0.45rem 0.8rem;
  opacity: 0.62;
}

.fc-reader-control:hover,
.fc-reader-control:focus { opacity: 1; }

.fc-speed-select {
  appearance: auto;
  background: var(--fc-bg);
  color: var(--fc-amber);
  color-scheme: dark;
}

.fc-speed-select option {
  background: var(--fc-bg);
  color: var(--fc-amber);
}

.fc-pause-toggle { opacity: 0.9; }

.fc-pause-toggle[aria-pressed="true"] {
  border-color: var(--fc-green);
  color: var(--fc-green);
  box-shadow: 0 0 12px rgba(50, 205, 50, 0.22);
  opacity: 1;
}

.fc-body.fc-paused .fc-cursor {
  animation-play-state: paused;
  opacity: 0.55;
}

.fc-partnav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 95;
  display: flex;
  justify-content: center;
  gap: 1.2rem;
  padding: 1rem;
  background: linear-gradient(to top, rgba(5,4,3,0.97) 55%, rgba(5,4,3,0));
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.8s ease, transform 0.8s ease;
}

.fc-partnav.fc-visible { opacity: 1; transform: none; }

/* part transition wipe */
.fc-wipe {
  position: fixed;
  inset: 0;
  z-index: 99;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--fc-amber-dim);
  letter-spacing: 0.4em;
  font-size: 0.8rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.45s ease;
}

.fc-wipe.fc-on { opacity: 1; pointer-events: all; }

@media (max-width: 640px) {
  .fc-page { padding: 4.5rem 1.1rem 8rem; }
  .fc-page p { font-size: 1rem; line-height: 1.8; }
  .fc-partnav { gap: 0.6rem; }
  .fc-btn { padding: 0.6rem 0.9rem; font-size: 0.85rem; }
  .fc-reader-control { padding: 0.45rem 0.65rem; font-size: 0.68rem; }
}

@media (prefers-reduced-motion: reduce) {
  .fc-crt,
  .fc-flicker,
  .fc-cursor,
  .fc-interference,
  .fc-partnav,
  .fc-wipe { animation: none !important; transition: none !important; }
  .fc-crt { opacity: 0.65; }
  .fc-page { scroll-behavior: auto; }
}
