/* MyWave · Chart Room — private-cloud page layer
 * Loads after style.css; scoped to body.chartroom.
 * Hallmark · component: page-layer · genre: editorial · theme: chartroom (site tokens)
 */

body.chartroom {
  background: var(--bg-0);
}

/* the homepage's sea layers don't sail here */
body.chartroom #dawn,
body.chartroom #dawn-veil,
body.chartroom #sea { display: none; }

/* ---- fixed chart paper ---- */
#chart-bg {
  position: fixed; top: 0; left: 0; right: 0;
  height: 100vh;
  height: 100svh; /* stable reference: URL-bar hide/show can't re-scale the art */
  background: url("../assets/chart.svg") no-repeat;
  background-size: cover;
  /* right-anchored: on portrait screens the compass sits ~30% down,
     in frame but clear of the fixed topbar; no crop guessing on scroll */
  background-position: 100% 0;
  pointer-events: none;
}
/* grain over the paper, under the chrome */
body.chartroom::after {
  content: ""; position: fixed; inset: 0; z-index: 35;
  pointer-events: none; opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---- the headlamp (desktop) ---- */
#lamp {
  position: fixed; top: 0; left: 0; z-index: 1;
  width: 62vmax; height: 62vmax;
  margin: -31vmax 0 0 -31vmax;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 214, 170, 0.10) 0%, rgba(255, 214, 170, 0.04) 38%, transparent 68%);
  mix-blend-mode: screen;
  pointer-events: none;
  transform: translate(50vw, 30vh);
}
/* mobile: the lamp rides at the primary eye line, breathing softly */
@media (pointer: coarse) {
  #lamp {
    transform: translate(50vw, 24vh) !important;
    background: radial-gradient(circle, rgba(255, 214, 170, 0.16) 0%, rgba(255, 214, 170, 0.06) 38%, transparent 68%);
    animation: lamp-breathe 7s ease-in-out infinite alternate;
  }
}
@keyframes lamp-breathe {
  from { opacity: 0.7; }
  to   { opacity: 1; }
}

/* ---- the plotted route ---- */
#route {
  position: absolute; inset: 0; z-index: 1;
  width: 100%; height: 100%;
  pointer-events: none;
  overflow: visible;
}
#route .route-plan  { fill: none; stroke: rgba(255, 167, 129, 0.22); stroke-width: 1.5; stroke-dasharray: 2 12; stroke-linecap: round; }
#route .route-halo  { fill: none; stroke: rgba(10, 32, 48, 0.42); stroke-width: 8; stroke-linecap: round; }
#route .route-draw  { fill: none; stroke: rgba(255, 167, 129, 0.82); stroke-width: 2; stroke-linecap: round; }

/* ---- waypoints ---- */
.wp-head {
  display: flex; align-items: center; gap: 0.9rem;
  margin: 0 0 1.3rem;
}
.wp-head .eyebrow { margin: 0; }
.wp-marker {
  flex: none; width: 15px; height: 15px; border-radius: 50%;
  border: 2px solid var(--accent);
  background: transparent;
  transition: background-color 0.35s var(--ease-out), box-shadow 0.35s var(--ease-out);
}
.wp.is-reached .wp-marker {
  background: var(--accent);
  box-shadow: 0 0 14px rgba(255, 167, 129, 0.75);
}

/* ---- legend entries (why private) ---- */
.legend-entries { list-style: none; margin: 0; padding: 0; max-width: 46rem; }
.legend-entries li {
  display: grid; grid-template-columns: 2.2rem 1fr; gap: 0 1.1rem;
  padding: 1.05rem 0; border-top: 1px solid var(--line);
  min-width: 0;
}
.legend-entries .glyph { color: var(--accent); padding-top: 0.15rem; }
.legend-entries .glyph svg { display: block; }
.legend-entries strong { display: block; font-weight: 600; font-size: 1.02rem; margin: 0 0 0.25rem; }
.legend-entries span { color: var(--text-muted); font-size: 0.95rem; font-weight: 500; }

/* ---- the legend box (what your server provides) ---- */
.chart-legend {
  max-width: 46rem;
  background: rgba(238, 246, 248, 0.94);
  color: var(--ink);
  border-radius: 8px;
  padding: 2.2rem 2.4rem 1.8rem;
  box-shadow: 0 24px 60px -30px rgba(0, 0, 0, 0.55);
}
.chart-legend-title {
  font-family: var(--font-mono); font-size: 0.85rem; letter-spacing: 0.2em;
  text-transform: uppercase; color: var(--accent-deep);
  margin: 0 0 1.4rem; padding-bottom: 0.9rem;
  border-bottom: 1px solid rgba(29, 70, 83, 0.2);
}
.chart-legend dl { margin: 0; }
.chart-legend .lg-row {
  display: grid; grid-template-columns: 2.4rem 11rem 1fr; gap: 0 1rem;
  padding: 0.75rem 0; align-items: baseline; min-width: 0;
}
.chart-legend dt { font-weight: 600; }
.chart-legend .glyph { color: var(--accent-deep); }
.chart-legend dd { margin: 0; color: var(--ink-muted); font-size: 0.92rem; font-weight: 500; }
@media (max-width: 640px) {
  .chart-legend .lg-row { grid-template-columns: 2rem 1fr; }
  .chart-legend dd { grid-column: 2; }
}
.legend-caption { color: var(--text-muted); font-size: 0.95rem; font-weight: 500; max-width: 44rem; margin: 1.4rem 0 0; }

/* ---- tide table (charter rates) ---- */
.tide {
  border-collapse: collapse; width: 100%; max-width: 46rem;
  font-family: var(--font-mono); text-align: left;
}
.tide caption {
  caption-side: top; text-align: left;
  font-family: var(--font-mono); font-size: 0.85rem; letter-spacing: 0.2em;
  text-transform: uppercase; color: var(--accent);
  padding: 0 0 1rem;
}
.tide th {
  font-size: 0.72rem; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--text-muted); font-weight: 400;
  padding: 0.7rem 1.2rem 0.6rem; border-bottom: 1px solid var(--line);
}
.tide td { padding: 1.15rem 1.2rem; border-bottom: 1px solid var(--line); vertical-align: baseline; min-width: 0; }
.tide tbody td:first-child { font-family: var(--font-body); font-weight: 600; white-space: nowrap; }
.tide .rate { font-family: var(--font-display); font-size: 1.7rem; color: var(--accent); white-space: nowrap; }
.tide .fits { font-family: var(--font-body); font-weight: 500; color: var(--text-muted); font-size: 0.95rem; }
.tide tr.is-flagship td { background: rgba(255, 167, 129, 0.05); }
.tide tr.is-flagship td:first-child { border-top: 1px solid rgba(255, 167, 129, 0.35); }
.tide .tag {
  display: inline-block; vertical-align: 0.12em; margin-left: 0.55rem;
  font-family: var(--font-mono); font-size: 0.6rem; font-weight: 400;
  letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--accent); border: 1px solid rgba(255, 167, 129, 0.45);
  border-radius: 999px; padding: 0.18rem 0.5rem 0.14rem;
  white-space: nowrap;
}
.tide tfoot td {
  border-bottom: none; padding-top: 1.3rem;
  font-size: 0.78rem; letter-spacing: 0.06em; color: var(--text-muted);
  white-space: normal; /* footnote is a first-child td — opt out of the size-cell nowrap */
}
/* mobile: the chart paper recedes to a whisper behind the text */
@media (max-width: 700px) {
  body.chartroom #chart-bg { opacity: 0.55; }
}
/* mobile: charter rows become cards — size + rate share a line, fits text runs full-width */
@media (max-width: 640px) {
  .tide { display: block; }
  .tide caption { letter-spacing: 0.12em; padding-bottom: 0.6rem; }
  .tide thead { display: none; }
  .tide tbody { display: block; }
  .tide tr {
    display: grid; grid-template-columns: 9.25rem auto; column-gap: 0.75rem;
    row-gap: 0.4rem; align-items: baseline;
    padding: 1.05rem 0; border-bottom: 1px solid var(--line);
  }
  .tide td { display: block; padding: 0; border-bottom: none; }
  .tide td:first-child { grid-column: 1; grid-row: 1; }
  .tide .rate { grid-column: 2; grid-row: 1; font-size: 1.45rem; }
  .tide .tag { display: block; width: max-content; margin: 0.55rem 0 0; font-size: 0.55rem; padding: 0.16rem 0.45rem 0.12rem; letter-spacing: 0.1em; }
  .tide .fits { grid-column: 1 / -1; margin-top: 0.15rem; overflow-wrap: anywhere; }
  .tide tr.is-flagship { background: rgba(255, 167, 129, 0.05); border-top: 1px solid rgba(255, 167, 129, 0.35); }
  .tide tr.is-flagship td { background: none; }
  .tide tr.is-flagship td:first-child { border-top: none; }
  .tide tfoot { display: block; }
  .tide tfoot tr, .tide tfoot td { display: block; }
  .tide tfoot td { padding-top: 0.4rem; line-height: 1.55; }
  .tide tfoot td + td { margin-top: 0.35rem; }
}
.own-vessel { color: var(--text-muted); font-size: 0.95rem; font-weight: 500; max-width: 46rem; margin: 2.2rem 0 0; }
.own-vessel a { color: var(--accent); }

/* ---- destination ---- */
.destination {
  display: flex; align-items: center; gap: 1rem; margin: 0 0 1.3rem;
}
.destination .wp-marker { width: 22px; height: 22px; }
.wp.is-reached.destination-ring .wp-marker { animation: ring-pulse 2.6s var(--ease-out) infinite; }
@keyframes ring-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 167, 129, 0.55), 0 0 14px rgba(255, 167, 129, 0.75); }
  50% { box-shadow: 0 0 0 12px rgba(255, 167, 129, 0), 0 0 14px rgba(255, 167, 129, 0.75); }
}
@media (prefers-reduced-motion: reduce) {
  .wp.is-reached.destination-ring .wp-marker { animation: none; }
  #lamp { display: none; }
}

/* --- waypoint small print (register hint / terms link) ------------------ */
.wp-note {
  margin: 1.6rem 0 0; font-size: 0.78rem; letter-spacing: 0.08em;
  color: var(--text-muted); text-transform: none;
}
.wp-note a { color: var(--accent); text-decoration: underline; text-underline-offset: 0.2em; }
.wp-note a:hover { color: var(--text); }
