/* ============================================================
   fx.css — boot intro, options overlay, flashlight, work
   previews, journal, distressed textures, accessibility modes
   ============================================================ */

/* ───── Text scale (accessibility) ───── */
:root { --text-scale: 1; }
html { font-size: calc(16px * var(--text-scale)); }

/* ───── Reduce motion ───── */
body.reduce-motion *,
body.reduce-motion *::before,
body.reduce-motion *::after {
  animation-duration: 0.001s !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.001s !important;
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001s !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001s !important;
  }
}
body.reduce-motion .flashlight { display: none; }

/* ───── High contrast ───── */
body.high-contrast {
  --fg-1: #e8e5de;
  --fg-2: #c2bfb6;
  --fg-3: #9a978e;
  --line-soft: rgba(255,255,255,0.22);
  --line-faint: rgba(255,255,255,0.12);
  --line: #4a5257;
}
body.high-contrast .hero::before {
  background:
    radial-gradient(ellipse 120% 80% at 50% 50%, transparent 40%, rgba(0,0,0,0.75) 100%),
    linear-gradient(90deg, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0.5) 35%, transparent 60%);
}

/* ════════════════════════════════════════════════════════════
   BOOT INTRO
   ════════════════════════════════════════════════════════════ */
.boot {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: #050607;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 700ms ease;
}
.boot--exit { opacity: 0; pointer-events: none; }
/* Vanilla adaptation: skip the intro if this session already booted */
html.is-booted .boot { display: none; }
.boot__inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 22px;
}
.boot__glyph {
  width: 14px; height: 14px;
  border: 1px solid var(--fg-1);
  transform: rotate(45deg);
  opacity: 0;
  animation: bootFade 900ms ease 200ms forwards;
}
.boot__name {
  font-family: var(--display);
  font-size: clamp(28px, 4vw, 52px);
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--fg-0);
  opacity: 0;
  animation: bootFade 900ms ease 500ms forwards;
}
.boot__line {
  width: min(420px, 60vw);
  height: 1px;
  background: rgba(255,255,255,0.08);
  overflow: hidden;
}
.boot__line span {
  display: block;
  height: 100%;
  width: 100%;
  background: var(--fg-1);
  transform: scaleX(0);
  transform-origin: left;
  animation: bootLine 1400ms cubic-bezier(.2,.7,.2,1) 700ms forwards;
}
.boot__sub {
  font-family: var(--label);
  font-size: 11px;
  letter-spacing: 0.34em;
  color: var(--fg-2);
  opacity: 0;
  animation: bootFade 900ms ease 1100ms forwards;
}
.boot__skip {
  position: absolute;
  bottom: 36px;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--label);
  font-size: 10px;
  letter-spacing: 0.3em;
  color: var(--fg-3);
  opacity: 0;
  animation: bootFade 800ms ease 1400ms forwards;
}
@keyframes bootFade { to { opacity: 1; } }
@keyframes bootLine { to { transform: scaleX(1); } }

/* ════════════════════════════════════════════════════════════
   FLASHLIGHT
   ════════════════════════════════════════════════════════════ */
.flashlight {
  position: absolute;
  top: 0; left: 0;
  width: 1px; height: 1px;
  z-index: 2;
  pointer-events: none;
  will-change: transform;
}
.flashlight::after {
  content: "";
  position: absolute;
  left: -340px; top: -340px;
  width: 680px; height: 680px;
  border-radius: 50%;
  background: radial-gradient(circle,
    rgba(235, 240, 235, 0.10) 0%,
    rgba(235, 240, 235, 0.05) 30%,
    transparent 65%);
  mix-blend-mode: screen;
}
body.no-flashlight .flashlight { display: none; }

/* ════════════════════════════════════════════════════════════
   SOUND TOGGLE
   ════════════════════════════════════════════════════════════ */
.sound-toggle {
  font-family: var(--label);
  font-size: 11px;
  letter-spacing: 0.24em;
  color: var(--fg-3);
  padding: 6px 10px;
  border: 1px solid var(--line-faint);
  transition: color 200ms ease, border-color 200ms ease;
}
.sound-toggle:hover { color: var(--fg-1); border-color: var(--line-soft); }
.sound-toggle.is-on { color: var(--fg-0); border-color: var(--line); }

/* ════════════════════════════════════════════════════════════
   OPTIONS OVERLAY
   ════════════════════════════════════════════════════════════ */
.options {
  position: fixed;
  inset: 0;
  z-index: 150;
  display: none;               /* vanilla: hidden until opened */
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.options.is-open { display: flex; }
.options__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(4, 5, 6, 0.82);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  animation: optFade 300ms ease;
}
.options__panel {
  position: relative;
  width: min(680px, 100%);
  background: rgba(12, 15, 16, 0.9);
  border: 1px solid var(--line-soft);
  padding: 48px 52px 40px;
  animation: optRise 420ms cubic-bezier(.2,.7,.2,1);
}
@keyframes optFade { from { opacity: 0; } }
@keyframes optRise { from { opacity: 0; transform: translateY(24px); } }
.options__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 20px;
  padding-bottom: 24px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--line-soft);
}
.options__title {
  font-family: var(--display);
  font-size: 40px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.options__meta {
  font-family: var(--label);
  font-size: 10px;
  letter-spacing: 0.26em;
  color: var(--fg-3);
}
.opt-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 18px 12px 18px 22px;
  border-bottom: 1px solid var(--line-faint);
  position: relative;
  cursor: default;
}
.opt-row::before {
  content: "";
  position: absolute;
  left: 0; top: 50%;
  width: 2px; height: 0;
  background: var(--fg-0);
  transform: translateY(-50%);
  transition: height 200ms ease;
}
.opt-row.is-focused::before { height: 60%; }
.opt-row__label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-family: var(--label);
  font-size: 16px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--fg-3);
  transition: color 200ms ease;
}
.opt-row.is-focused .opt-row__label { color: var(--fg-0); }
.opt-row__hint {
  font-family: var(--body);
  font-size: 0.75rem;
  letter-spacing: 0.02em;
  text-transform: none;
  color: var(--fg-3);
}
.opt-row__value {
  display: flex;
  align-items: center;
  gap: 14px;
}
.opt-row__val {
  font-family: var(--label);
  font-size: 14px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--fg-1);
  min-width: 100px;
  text-align: center;
}
.opt-row.is-focused .opt-row__val { color: var(--fg-0); }
.opt-row__chev {
  font-size: 20px;
  color: var(--fg-3);
  padding: 2px 10px;
  transition: color 150ms ease;
}
.opt-row__chev:hover { color: var(--fg-0); }
.options__prompts {
  display: flex;
  gap: 28px;
  padding-top: 24px;
  font-family: var(--label);
  font-size: 10px;
  letter-spacing: 0.26em;
  color: var(--fg-2);
}
.options__close {
  position: absolute;
  top: 20px; right: 20px;
  font-size: 14px;
  color: var(--fg-3);
  padding: 8px;
  transition: color 150ms ease;
}
.options__close:hover { color: var(--fg-0); }

/* ════════════════════════════════════════════════════════════
   WORK ENTRIES / PREVIEW
   ════════════════════════════════════════════════════════════ */
.chapters {
  display: grid;
  grid-template-columns: minmax(380px, 44%) 1fr;
  gap: 64px;
  align-items: start;
}
.chapters__cat {
  padding: 26px 0 10px;
  font-family: var(--label);
  letter-spacing: 0.28em;
  font-size: 11px;
  color: var(--fg-2);
}
.chapters__list { border-top: 1px solid var(--line-soft); }
.chapter {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  text-align: left;
  padding: 18px 6px 18px 24px;
  border-bottom: 1px solid var(--line-soft);
  position: relative;
  cursor: pointer;
  transition: padding 240ms ease, background 240ms ease;
}
.chapter::before {
  content: "";
  position: absolute;
  left: 0; top: 50%;
  width: 2px; height: 0;
  background: var(--fg-0);
  transform: translateY(-50%);
  transition: height 240ms ease;
}
.chapter:hover, .chapter.is-active { padding-left: 34px; background: rgba(255,255,255,0.015); }
.chapter:hover::before, .chapter.is-active::before { height: 68%; }
.chapter__top {
  display: flex;
  justify-content: space-between;
  font-family: var(--label);
  font-size: 10px;
  letter-spacing: 0.3em;
  color: var(--fg-3);
}
.chapter.is-active .chapter__top { color: var(--fg-2); }
.chapter__name {
  font-family: var(--label);
  font-size: 19px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--fg-3);
  transition: color 240ms ease;
}
.chapter:hover .chapter__name, .chapter.is-active .chapter__name { color: var(--fg-0); }
.chapter__bar {
  height: 2px;
  background: rgba(255,255,255,0.07);
  margin-top: 4px;
  overflow: hidden;
}
.chapter__bar-fill {
  display: block;
  height: 100%;
  background: var(--accent-dim);
  transform-origin: left;
  transition: background 240ms ease;
}
.chapter.is-active .chapter__bar-fill { background: var(--accent); }
.chapter__foot {
  display: flex;
  justify-content: space-between;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--fg-3);
  letter-spacing: 0.06em;
}

/* Preview */
.chapters__preview { position: sticky; top: 120px; }
.chapters__frame {
  width: 100%;
  aspect-ratio: 16 / 9;
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line-soft);
  animation: chapterFade 500ms ease;
}
@keyframes chapterFade { from { opacity: 0; } }
.chapters__frame-bg {
  position: absolute;
  inset: 0;
  animation: chapterZoom 8s ease-out forwards;
}
@keyframes chapterZoom { from { transform: scale(1); } to { transform: scale(1.06); } }
.chapters__frame-grain {
  position: absolute;
  inset: 0;
  opacity: 0.05;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 0.6 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  mix-blend-mode: overlay;
}
.chapters__frame-content {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 8px;
  padding: 28px 32px;
  background: linear-gradient(180deg, transparent 40%, rgba(0,0,0,0.55) 100%);
}
.chapters__frame-ch {
  font-family: var(--label);
  font-size: 10px;
  letter-spacing: 0.32em;
  color: var(--fg-2);
}
.chapters__frame-name {
  font-family: var(--display);
  font-size: 26px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--fg-0);
}
.chapters__frame-note {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--fg-3);
  letter-spacing: 0.08em;
}

/* ════════════════════════════════════════════════════════════
   JOURNAL (about section)
   ════════════════════════════════════════════════════════════ */
.journal {
  display: grid;
  grid-template-columns: minmax(300px, 38%) 1fr;
  gap: 72px;
  align-items: start;
}
.journal__page--left {
  position: relative;
  background: #ddd6c6;
  padding: 44px 36px 52px;
  transform: rotate(-1.2deg);
  box-shadow: 0 24px 60px rgba(0,0,0,0.5);
  color: #2c2a24;
}
.journal__page--left::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.5;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='p'><feTurbulence type='fractalNoise' baseFrequency='0.04' numOctaves='4'/><feColorMatrix values='0 0 0 0 0.55  0 0 0 0 0.52  0 0 0 0 0.45  0 0 0 0.08 0'/></filter><rect width='100%' height='100%' filter='url(%23p)'/></svg>");
}
.journal__tape {
  position: absolute;
  top: -14px; left: 50%;
  transform: translateX(-50%) rotate(2deg);
  width: 110px; height: 30px;
  background: rgba(230, 224, 205, 0.55);
  border-left: 1px dashed rgba(0,0,0,0.08);
  border-right: 1px dashed rgba(0,0,0,0.08);
  z-index: 2;
}
.journal__photo {
  position: relative;
  transform: rotate(0.8deg);
  margin-bottom: 30px;
}
.journal__photo-inner {
  aspect-ratio: 4 / 5;
  background: #22262a;
  border: 6px solid #f2eee2;
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  color: #6a7076;
  overflow: hidden;
}
.journal__photo-inner img { width: 100%; height: 100%; object-fit: cover; }
.journal__caption {
  margin-top: 12px;
  font-family: var(--hand);
  font-size: 19px;
  color: #43403a;
  text-align: center;
  transform: rotate(-0.6deg);
}
.journal__note {
  font-family: var(--hand);
  font-size: 24px;
  line-height: 1.35;
  color: #35322b;
  transform: rotate(-1deg);
  margin-top: 8px;
}
.journal__scribble {
  margin-top: 14px;
  color: #6b665b;
  width: 120px;
}
.journal__page--right { padding-top: 8px; }
.journal__entry p {
  font-size: 1.0625rem;
  line-height: 1.75;
  color: var(--fg-1);
  margin-bottom: 1.2em;
  text-wrap: pretty;
  max-width: 640px;
}
.journal__entry p strong { color: var(--fg-0); font-weight: 600; }
.journal__entry p em { font-style: italic; color: var(--fg-0); }
.journal__margin {
  font-family: var(--hand);
  font-size: 20px;
  color: var(--fg-3);
  margin: 4px 0 36px;
  transform: rotate(-0.5deg);
}
.journal .about__stats { margin-bottom: 32px; }

/* ════════════════════════════════════════════════════════════
   DISTRESSED TEXTURE ACCENTS
   ════════════════════════════════════════════════════════════ */
body:not(.no-distress) section.page-section {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='400' height='400'><filter id='d'><feTurbulence type='fractalNoise' baseFrequency='0.012' numOctaves='5'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 0.015 0'/></filter><rect width='100%' height='100%' filter='url(%23d)'/></svg>");
}
body:not(.no-distress) .section-head {
  position: relative;
}
body:not(.no-distress) .section-head::after {
  content: "";
  position: absolute;
  bottom: -1px; left: 0;
  width: 72px; height: 1px;
  background: var(--fg-1);
  mask-image: linear-gradient(90deg, #000 0%, #000 30%, transparent 45%, #000 60%, #000 75%, transparent 90%, #000 100%);
  -webkit-mask-image: linear-gradient(90deg, #000 0%, #000 30%, transparent 45%, #000 60%, #000 75%, transparent 90%, #000 100%);
}

/* ════════════════════════════════════════════════════════════
   RESPONSIVE
   ════════════════════════════════════════════════════════════ */
@media (max-width: 960px) {
  .chapters { grid-template-columns: 1fr; }
  .chapters__preview { position: static; }
  .journal { grid-template-columns: 1fr; gap: 48px; }
  .journal__page--left { max-width: 380px; margin: 0 auto; }
  .options__panel { padding: 32px 24px 28px; }
  .options__title { font-size: 30px; }
}
