/* Lies — an interactive story. Cinematic full-bleed layout. */

:root {
  --bg: #0a0c0e;
  --bg-deep: #060708;
  --ink: #e9e2d3;
  --ink-dim: #a29b8d;
  --ink-faint: #6e6960;
  --line: rgba(214, 208, 196, 0.28);
  --accent: #8f3b3b;
  --accent-bright: #b0524f;
  --note: #a08480;
  --serif: 'Iowan Old Style', 'Palatino Linotype', Palatino, Georgia, 'Times New Roman', serif;
  --sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
}

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

html, body { height: 100%; }

html { background: var(--bg); }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 19px;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

button { font: inherit; }

[hidden] { display: none !important; }

/* ---------- UI label voice: spaced small-caps sans ---------- */

.subtitle,
.author,
.content-note,
.endings-counter,
.ending-label,
.ending-count,
.the-end,
.btn {
  font-family: var(--sans);
  text-transform: uppercase;
  letter-spacing: 0.16em;
}

/* ---------- Cinematic backdrop ---------- */

#scene {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  /* built-in fallback for missing images: dark gradient, never a broken icon */
  background:
    radial-gradient(120% 95% at 50% 30%, #15181c 0%, #0b0d10 55%, var(--bg-deep) 100%);
}

#scene-layers {
  position: absolute;
  inset: 0;
  transition: filter 1.2s ease;
}

body.on-title #scene-layers {
  filter: brightness(0.45) saturate(0.85);
}

.scene-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  opacity: 0;
  transition: opacity 0.8s ease;
  will-change: transform, opacity;
}

.scene-img.is-visible { opacity: 1; }

/* very slow Ken Burns drift, alternating direction per layer */
@keyframes kenburns {
  from { transform: scale(1); }
  to   { transform: scale(1.06); }
}

.scene-img.kb-a { animation: kenburns 35s linear infinite alternate; }
.scene-img.kb-b { animation: kenburns 35s linear infinite alternate-reverse; }

.scene-grain {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.05;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)'/%3E%3C/svg%3E");
}

.scene-vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse 95% 85% at 50% 40%, transparent 55%, rgba(0, 0, 0, 0.4) 100%);
}

.scene-scrim {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(
    to bottom,
    rgba(6, 8, 10, 0) 0%,
    rgba(6, 8, 10, 0) 40%,
    rgba(6, 8, 10, 0.45) 68%,
    rgba(6, 8, 10, 0.92) 100%
  );
}

/* ---------- Title screen ---------- */

#title-screen {
  position: fixed;
  inset: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2rem 1.25rem;
  overflow-y: auto;
}

.title-inner { max-width: 32rem; }

#title-word {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(3rem, 11vw, 5.5rem);
  color: var(--ink);
  line-height: 1;
  margin-bottom: 1.75rem;
  text-shadow: 0 2px 18px rgba(0, 0, 0, 0.8);
}

#title-word span {
  display: inline-block;
  letter-spacing: 0.55em;
  margin-right: -0.55em; /* optical centering: cancel trailing letter-space */
}

.subtitle {
  font-size: 0.8rem;
  color: var(--ink-dim);
  margin-bottom: 0.6rem;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.8);
}

.author {
  font-size: 0.7rem;
  color: var(--ink-faint);
  margin-bottom: 3rem;
}

.content-note {
  font-size: 0.65rem;
  color: var(--ink-faint);
  margin-bottom: 2.25rem;
}

.endings-counter {
  font-size: 0.65rem;
  color: var(--ink-faint);
  margin-top: 2.5rem;
}

/* ---------- Reader: lower-third overlay ---------- */

#story-screen {
  position: fixed;
  inset: 0;
  z-index: 2;
  cursor: default;
}

#reader {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  padding: 1rem 1.25rem 2.25rem;
}

#well-wrap {
  position: relative;
  width: min(100%, 65ch);
  min-height: 0;
  flex: 0 1 auto;
}

#text-well {
  max-height: 42vh;
  overflow-y: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  /* top edge dissolves upward into the image */
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 3em);
  mask-image: linear-gradient(to bottom, transparent 0, #000 3em);
  padding-top: 3em;
}

#text-well::-webkit-scrollbar { display: none; }

.para {
  margin: 0 0 1.1em;
  color: var(--ink);
  text-shadow:
    0 1px 2px rgba(0, 0, 0, 0.85),
    0 2px 14px rgba(0, 0, 0, 0.6);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.35s ease, transform 0.35s ease;
}

.para.is-shown {
  opacity: 1;
  transform: none;
}

#advance-hint {
  color: var(--ink-faint);
  font-size: 0.6rem;
  text-align: center;
  padding: 0.6rem 0 0;
  animation: hint-pulse 1.8s ease-in-out infinite;
  user-select: none;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.8);
}

@keyframes hint-pulse {
  0%, 100% { opacity: 0.2; }
  50% { opacity: 0.6; }
}

/* ---------- Reveal controls ---------- */

#reveal-controls {
  position: absolute;
  right: -4.25rem;
  bottom: 0.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  z-index: 3;
}

.ctrl {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: rgba(10, 12, 14, 0.3);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  color: var(--ink-dim);
  font-family: var(--sans);
  font-size: 0.65rem;
  line-height: 1;
  cursor: pointer;
  transition: border-color 0.2s ease, color 0.2s ease, opacity 0.2s ease;
}

.ctrl:hover:not(:disabled),
.ctrl:focus-visible {
  border-color: var(--accent);
  color: var(--accent-bright);
  outline: none;
}

.ctrl:disabled {
  opacity: 0.3;
  cursor: default;
}

/* ---------- Interaction: notes, choices, endings ---------- */

#interaction {
  width: min(100%, 34rem);
  min-height: 0;
  flex: 0 1 auto;
  overflow-y: auto;
  scrollbar-width: none;
  opacity: 0;
  transition: opacity 0.45s ease;
}

#interaction::-webkit-scrollbar { display: none; }

#interaction.is-shown { opacity: 1; }

.passage-note {
  font-style: italic;
  color: var(--note);
  font-size: 0.94rem;
  text-align: center;
  margin: 1.25rem 0 0.5rem;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.8);
}

.choices { margin-top: 0.75rem; }

.btn {
  display: block;
  width: 100%;
  margin: 0.65rem 0;
  padding: 1rem 2rem;
  background: rgba(10, 12, 14, 0.55);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(214, 208, 196, 0.42);
  box-shadow: inset 0 0 0 1px rgba(214, 208, 196, 0.1);
  color: #f2ecdd;
  font-size: 0.8rem;
  letter-spacing: 0.18em;
  line-height: 1.5;
  text-align: center;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.9);
  cursor: pointer;
  transition: border-color 0.2s ease, color 0.2s ease,
              box-shadow 0.2s ease, background-color 0.2s ease;
}

.btn:hover,
.btn:focus-visible {
  border-color: var(--accent);
  color: var(--accent-bright);
  background: rgba(6, 8, 10, 0.75);
  box-shadow:
    inset 0 0 0 1px rgba(143, 59, 59, 0.35),
    0 0 24px rgba(143, 59, 59, 0.35);
  outline: none;
}

.btn-inline {
  display: inline-block;
  width: auto;
  min-width: 11rem;
}

/* staggered rise-and-fade entrance (delay set per button in JS) */
@keyframes rise-in {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: none; }
}

#interaction .btn {
  animation: rise-in 0.45s ease both;
}

/* ---------- Ending card ---------- */

.ending-card {
  margin-top: 1.5rem;
  text-align: center;
}

.ending-label {
  font-size: 0.65rem;
  color: var(--accent-bright);
  letter-spacing: 0.35em;
  margin-bottom: 1rem;
}

.ending-title {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 1.8rem;
  line-height: 1.35;
  color: var(--ink);
  margin-bottom: 1.25rem;
  text-shadow:
    0 2px 10px rgba(0, 0, 0, 0.8),
    0 0 22px rgba(143, 59, 59, 0.3);
}

.ending-taunt {
  font-style: italic;
  color: var(--ink-dim);
  font-size: 0.95rem;
  max-width: 42ch;
  margin: 0 auto 1.5rem;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.8);
}

.the-end {
  font-size: 0.7rem;
  color: var(--ink-dim);
  margin-bottom: 1.5rem;
}

.ending-count {
  font-size: 0.65rem;
  color: var(--ink-faint);
  margin: 1.5rem 0 1rem;
}

.ending-actions .btn { margin: 0.65rem auto; }

/* ---------- Small screens ---------- */

@media (max-width: 860px) {
  body { font-size: 18px; }

  #reader { padding: 0.75rem 1rem 1.25rem; }

  #text-well { max-height: 50vh; }

  #reveal-controls {
    position: fixed;
    right: 0.8rem;
    bottom: 0.9rem;
  }

  /* keep the well's last line clear of the corner controls */
  #well-wrap { padding-right: 0; }

  #interaction { width: 100%; }

  .btn { padding: 0.9rem 1.25rem; }

  .ending-title { font-size: 1.45rem; }
}

/* ---------- Reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  .scene-img { animation: none !important; }
  *, *::before, *::after {
    animation-duration: 0.001s !important;
    transition-duration: 0.001s !important;
  }
}
