/* Entry 032 — Here the map ends
   Series: The Unreliable Narrator.
   Scene art direction: a navigator's chart table at the edge of the world. A dark
   headland of charted rock meets a churning teal sea — the exact place a map runs
   out. One frosted-glass chart floats over the water; the machine draws its answer
   as a coastline: solid warm ink where it surveyed, dashed and fading into fog where
   it's guessing, honest blank sea where it knows nothing. One accent: sextant-brass
   amber, reserved for certainty. Display: Marcellus (the map's cartouche voice).
   Chart labels: DM Mono (soundings, coordinates). Sharp 8px chart-table radius. */

:root {
  --brass: #e0a24a;         /* the one accent — the ink of certainty */
  --brass-glow: #f3cd86;
  --chart-ink: #21201b;     /* dark ink on the pale chart */
  --chart-ghost: #8b8f8c;   /* guessed labels, ghosted */
  --sea-deep: #101817;
  --radius: 8px;
}

.chart-scene {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 800px;
  padding: 108px 32px;
  overflow: hidden;
  border-color: rgba(9, 16, 16, 0.7);
  /* background-first: a real photograph (teal sea meeting dark rock) carries the
     scene; a cool scrim keeps the chart and its ink legible. */
  background-image:
    linear-gradient(184deg, rgba(9, 18, 18, 0.62) 0%, rgba(11, 22, 22, 0.34) 42%, rgba(6, 13, 13, 0.72) 100%),
    url("../../public/media/backgrounds/dark-cool-01-angel.jpg");
  background-size: cover, cover;
  background-position: center, center 42%;
  background-repeat: no-repeat, no-repeat;
}

/* mid layer — the headland's own shadow, spilled and blurred into the deep water */
.headland {
  position: absolute;
  z-index: 0;
  right: -6%;
  top: 46%;
  width: min(720px, 82%);
  height: 520px;
  transform: translateY(-50%);
  background: radial-gradient(58% 58% at 62% 50%, rgba(10, 22, 22, 0.55), transparent 72%);
  filter: blur(60px);
  pointer-events: none;
}

/* ------------------------------------------------------------------ */
/* THE COMPONENT — one frosted-glass navigator's chart                 */
/* ------------------------------------------------------------------ */

.chart {
  position: relative;
  z-index: 2;
  width: min(760px, 100%);
  display: grid;
  gap: 22px;
  padding: 34px 34px 30px;
  border-radius: var(--radius);
  font-family: var(--ui-sans);
  /* frosted glass with a faint warm-parchment breath so ink reads on it */
  background:
    linear-gradient(168deg, rgba(238, 240, 234, 0.16), rgba(18, 30, 30, 0.30));
  border: 1px solid rgba(224, 162, 74, 0.28);
  box-shadow:
    0 1px 0 rgba(243, 205, 134, 0.22) inset,
    0 0 0 1px rgba(6, 12, 12, 0.22),
    0 60px 130px rgba(4, 12, 12, 0.62),
    0 16px 50px rgba(20, 60, 66, 0.30);
  backdrop-filter: blur(26px) saturate(1.18);
  -webkit-backdrop-filter: blur(26px) saturate(1.18);
  color: #eaf1ef;
}

/* --- chart header: the cartouche --- */
.chart-head { display: grid; gap: 6px; }

.chart-kicker {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0;
  font-family: "DM Mono", ui-monospace, monospace;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(217, 226, 223, 0.6);
}

.chart-kicker .dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--brass);
  box-shadow: 0 0 10px rgba(224, 162, 74, 0.9);
}

.chart-q {
  margin: 0;
  font-family: "Marcellus", "Newsreader", Georgia, serif;
  font-weight: 400;
  font-size: clamp(26px, 4vw, 40px);
  line-height: 1.04;
  letter-spacing: 0.006em;
  color: #f4efe6;
  text-wrap: balance;
}

/* --- the chart plate: pale ground the ink is drawn on --- */
.chart-plate {
  position: relative;
  border-radius: 6px;
  padding: 6px 8px 4px;
  background:
    radial-gradient(120% 140% at 20% 0%, rgba(245, 241, 231, 0.10), transparent 60%),
    linear-gradient(180deg, rgba(233, 237, 233, 0.09), rgba(14, 24, 24, 0.16));
  border: 1px solid rgba(224, 162, 74, 0.14);
}

.chart-svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

/* --- the coastline ink --- */
.coast {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* surveyed: solid, warm, sure — the brightest ink in the frame */
.coast-solid {
  stroke: var(--brass);
  stroke-width: 3.4;
  filter: drop-shadow(0 0 8px rgba(224, 162, 74, 0.45));
}

/* guessed: dashed, thin, pale — clearly a guess */
.coast-dashed {
  stroke: rgba(233, 224, 205, 0.72);
  stroke-width: 2.2;
  stroke-dasharray: 3 9;
  opacity: 0.9;
}

/* the fabricated stretch only the "normal" view draws — hidden by default */
.coast-fabricated {
  stroke: var(--brass);
  stroke-width: 3.4;
  opacity: 0;
  visibility: hidden;
}

/* soundings & labels */
.soundings text,
.tag, .place, .ends-mark, .ends-sub {
  font-family: "DM Mono", ui-monospace, monospace;
}

.soundings .s {
  font-size: 15px;
  fill: var(--chart-ink);
  font-weight: 500;
}

.soundings.ghost .s {
  fill: var(--chart-ghost);
  font-style: italic;
  font-size: 13px;
  opacity: 0.86;
}

.place {
  font-size: 12px;
  letter-spacing: 0.22em;
  fill: rgba(243, 231, 208, 0.82);
}

.tag {
  font-size: 12px;
  letter-spacing: 0.04em;
}
.tag-sure { fill: rgba(224, 162, 74, 0.9); }
.tag-guess { fill: rgba(210, 214, 210, 0.62); font-style: italic; }

.fog {
  transition: opacity 500ms ease;
  opacity: 0.7;
  filter: blur(6px);
}

/* here the map ends — the honest blank */
.map-ends .rose {
  stroke: rgba(224, 162, 74, 0.5);
  stroke-width: 1.4;
  stroke-dasharray: 2 7;
}
.ends-mark {
  font-size: 17px;
  fill: rgba(244, 233, 212, 0.92);
  letter-spacing: 0.04em;
}
.ends-sub {
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  fill: rgba(212, 217, 213, 0.55);
}

/* hoverable coast zones lift a touch */
.surveyed, .guessed, .map-ends { cursor: help; }
.surveyed:hover .coast-solid { filter: drop-shadow(0 0 12px rgba(224, 162, 74, 0.7)); }
.guessed:hover .coast-dashed { opacity: 1; }

/* --- readout under the plate --- */
.readout {
  margin: 8px 2px 0;
  min-height: 1.4em;
  font-family: "Newsreader", Georgia, serif;
  font-size: clamp(15px, 1.8vw, 18px);
  font-style: italic;
  line-height: 1.45;
  color: rgba(233, 240, 237, 0.86);
  transition: color 200ms ease;
}

/* --- controls --- */
.controls { display: grid; gap: 16px; }

.slider-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 14px;
}
.slider-row label {
  font-family: "DM Mono", ui-monospace, monospace;
  font-size: 12px;
  letter-spacing: 0.06em;
  color: rgba(220, 228, 225, 0.78);
}
.slider-row output {
  font-family: "DM Mono", ui-monospace, monospace;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  color: var(--brass-glow);
  min-width: 3.5ch;
  text-align: right;
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  height: 3px;
  border-radius: 3px;
  background: linear-gradient(90deg, rgba(224, 162, 74, 0.85) var(--fill, 42%), rgba(233, 224, 205, 0.22) var(--fill, 42%));
  cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px; height: 16px; border-radius: 50%;
  background: radial-gradient(circle at 34% 32%, #ffe6b8, var(--brass));
  border: 1px solid rgba(255, 240, 210, 0.7);
  box-shadow: 0 2px 8px rgba(224, 162, 74, 0.55);
}
input[type="range"]::-moz-range-thumb {
  width: 16px; height: 16px; border-radius: 50%; border: 1px solid rgba(255, 240, 210, 0.7);
  background: radial-gradient(circle at 34% 32%, #ffe6b8, var(--brass));
  box-shadow: 0 2px 8px rgba(224, 162, 74, 0.55);
}

.toggle-row { display: flex; flex-wrap: wrap; gap: 12px; }

.tgl {
  font-family: var(--ui-sans);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.005em;
  color: rgba(228, 235, 232, 0.86);
  padding: 11px 18px;
  border-radius: 999px;
  border: 1px solid rgba(224, 162, 74, 0.28);
  background: rgba(224, 162, 74, 0.05);
  cursor: pointer;
  transition: transform 160ms ease, background 200ms ease, border-color 200ms ease, color 200ms ease;
}
.tgl:hover { transform: translateY(-1px); border-color: rgba(224, 162, 74, 0.55); color: #f6efe2; }
.tgl[aria-pressed="true"] {
  background: linear-gradient(180deg, rgba(243, 205, 134, 0.95), rgba(224, 162, 74, 0.92));
  border-color: rgba(255, 240, 210, 0.7);
  color: #2a1e0c;
  box-shadow: 0 8px 24px rgba(224, 162, 74, 0.32);
}

.caption {
  margin: 0;
  font-family: "Newsreader", Georgia, serif;
  font-size: 15px;
  line-height: 1.5;
  color: rgba(226, 233, 230, 0.72);
  transition: color 220ms ease;
}
.caption.warn { color: var(--brass-glow); }

/* --- the honest seam --- */
.seam {
  margin: 4px 0 0;
  padding-top: 18px;
  border-top: 1px solid rgba(224, 162, 74, 0.16);
  font-family: "DM Mono", ui-monospace, monospace;
  font-size: 11.5px;
  line-height: 1.6;
  letter-spacing: 0.02em;
  color: rgba(206, 214, 211, 0.6);
}
.seam-mark { color: var(--brass); margin-right: 6px; }

/* ------------------------------------------------------------------ */
/* MODES                                                               */
/* ------------------------------------------------------------------ */

/* honest (default): everything as authored */

/* "only what you're sure of" — hide every guess and the fog; a small island in a big sea */
.chart[data-mode="sure"] .guessed,
.chart[data-mode="sure"] .fog,
.chart[data-mode="sure"] .map-ends { opacity: 0; visibility: hidden; }
.chart[data-mode="sure"] input[type="range"] { opacity: 0.4; pointer-events: none; }

/* "draw it the normal way" — the confident lie: every coast inked solid & even, fog gone */
.chart[data-mode="flat"] .fog,
.chart[data-mode="flat"] .map-ends { opacity: 0; visibility: hidden; }
.chart[data-mode="flat"] .guessed [clip-path] { clip-path: none !important; }
.chart[data-mode="flat"] .coast-dashed {
  stroke: var(--brass);
  stroke-width: 3.4;
  stroke-dasharray: none;
  opacity: 1;
  filter: drop-shadow(0 0 8px rgba(224, 162, 74, 0.45));
}
.chart[data-mode="flat"] .coast-fabricated { opacity: 1; visibility: visible; }
.chart[data-mode="flat"] .soundings.ghost .s {
  fill: var(--chart-ink);
  font-style: normal;
  opacity: 1;
}
.chart[data-mode="flat"] .tag-guess { fill: rgba(224, 162, 74, 0.9); font-style: normal; }
.chart[data-mode="flat"] input[type="range"] { opacity: 0.4; pointer-events: none; }

@media (prefers-reduced-motion: reduce) {
  .fog, .readout, .caption, .tgl { transition: none; }
}

/* ---- small screens ---- */
@media (max-width: 720px) {
  .chart-scene { padding: 64px 14px; min-height: 0; }
  .chart { padding: 24px 20px 22px; gap: 18px; }
  .slider-row { grid-template-columns: 1fr auto; }
  .slider-row label { grid-column: 1 / -1; }
  .ends-mark { font-size: 15px; }
}
