/* The web chart. The page around it uses /style.css; inside the chart the look follows the iPhone
   app in its day appearance (ios/Rhumb/UI, ios/Shared/UI, ios/Rhumb/Chart/Layers). */

/* ── /chart page: nav, phone bar, chart filling the rest ───── */
.chart-page {
  display: flex; flex-direction: column;
  height: 100vh; height: 100dvh; overflow: hidden;
}
.chart-page main { flex: 1; min-height: 0; }
.chart-bar {
  display: none; align-items: center; justify-content: space-between; gap: 10px;
  background: var(--ink); color: var(--paper);
  font-size: 13.5px; line-height: 1.35; padding: 8px 12px 8px 16px;
}
.chart-bar a {
  flex: none; background: var(--magenta); color: #fff;
  border-radius: 6px; padding: 7px 12px; font-weight: 600;
}
.chart-bar a:hover { text-decoration: none; }
@media (max-width: 760px) { .chart-bar { display: flex; } }

.chart-noscript { padding: 32px 24px; max-width: 520px; }
.chart-noscript p { color: var(--ink-75); }

/* ── The chart ──────────────────────────────────────────────── */
.rhumb-chart {
  --chart-font: -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, sans-serif;
  --accent: #0282F6;                 /* the active tool button in ref/app-dividers.jpg */
  --label: #000;                     /* UIColor.label */
  --secondary: rgba(60, 60, 67, .6); /* UIColor.secondaryLabel */
  --graphite: rgba(64, 64, 64, .92); /* RouteLayer, day */
  --pad: 16px;                       /* SwiftUI .padding() */
  --button: 52px;                    /* CircleChromeButton */
  --gap: 12px;                       /* button spacing in FloatingControls and ZoomControls */
  --attr-h: 28px;                    /* set from the attribution's real height by chart.js */
  --bottom: calc(var(--attr-h) + var(--pad)); /* the bottom controls stay clear of the attribution */
  position: relative; overflow: hidden;
  background: #F7FAFB; color: var(--label);
  font: 14px/1.3 var(--chart-font);
  font-variant-numeric: tabular-nums;
}
.rhumb-chart [hidden] { display: none !important; }
.rhumb-chart :focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.rhumb-chart a { color: inherit; }
.rhumb-chart .maplibregl-map { font: 13px/1.2 var(--chart-font); font-variant-numeric: tabular-nums; }
.chart-map { position: absolute; inset: 0; }

/* Glass: Liquid Glass on iOS 26, a blurred white here. Without backdrop-filter, a near solid white. */
.chart-glass, .chart-tool {
  background: rgba(255, 255, 255, .55);
  -webkit-backdrop-filter: blur(12px) saturate(1.8);
  backdrop-filter: blur(12px) saturate(1.8);
  box-shadow: 0 3px 12px rgba(0, 0, 0, .14), inset 0 0 0 .5px rgba(255, 255, 255, .8);
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .chart-glass, .chart-tool { background: rgba(250, 250, 250, .94); }
}

/* Buttons: 52 px glass circles. Plain buttons have accent icons; toggles have black icons and turn
   accent blue with a white icon when on (dividersToggleBackground). */
.chart-corner, .chart-row { display: flex; flex-direction: column; gap: var(--gap); pointer-events: none; }
.chart-corner { position: absolute; z-index: 3; }
.chart-row { flex-direction: row; }
.chart-tl { top: var(--pad); left: var(--pad); }
.chart-tr { top: var(--pad); right: var(--pad); }
.chart-bl { bottom: var(--bottom); left: var(--pad); }
.chart-br { bottom: var(--bottom); right: var(--pad); align-items: flex-end; }
.chart-tool {
  width: var(--button); height: var(--button); padding: 0; border: 0; border-radius: 50%;
  display: grid; place-items: center;
  color: var(--accent); font: inherit; cursor: pointer; touch-action: manipulation; pointer-events: auto;
}
.chart-tool[data-toggle] { color: var(--label); }
.chart-tool[aria-pressed="true"] { background: var(--accent); color: #fff; }
.chart-tool:disabled { color: rgba(60, 60, 67, .3); cursor: default; }
.chart-tool svg {
  width: 24px; height: 24px; fill: none; stroke: currentColor;
  stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round;
}
.chart-tool .solid { fill: currentColor; stroke-width: 1.2; }
.chart-tool [data-icon="done"], .chart-tool[aria-pressed="true"] [data-icon="route"] { display: none; }
.chart-tool[aria-pressed="true"] [data-icon="done"] { display: block; }

/* Top centre: COG / SOG (ReadoutPanel), and under it the one-line note, as the app's banners. */
.chart-top {
  position: absolute; z-index: 3; top: 8px; left: 50%; transform: translateX(-50%);
  width: max-content; max-width: calc(100% - 2 * (var(--pad) + var(--button) + 8px));
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  pointer-events: none;
}
.chart-readout { display: flex; gap: 20px; padding: 10px 16px; border-radius: 12px; }
.chart-readout p { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.chart-readout .chart-key { font-size: 11px; line-height: 13px; }
.chart-readout b { font-size: 20px; line-height: 24px; font-weight: 600; }
.chart-key { color: var(--secondary); font-weight: 600; }
.chart-note {
  padding: 6px 12px; border-radius: 16px; font-size: 13px; text-align: center; pointer-events: auto;
}
.chart-note:empty { display: none; }

/* AttributionView: two centred caption lines at the very bottom, plain text. */
.chart-attr {
  position: absolute; z-index: 2; left: 0; right: 0; bottom: 0;
  display: flex; flex-direction: column; align-items: center; text-align: center;
  padding: 0 8px 2px; font-size: 11px; line-height: 13px; color: var(--secondary);
  pointer-events: none;
}

/* Labels on the chart: DividerLayer and RouteLayer pills, white at 0.85, radius 4. */
.chart-pill {
  background: rgba(255, 255, 255, .85); border-radius: 4px; padding: 3px 6px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .2);
  font-size: 13px; line-height: 16px; font-weight: 600; color: var(--label);
  white-space: nowrap; pointer-events: none;
}

/* Dividers: a 44 px handle around a 24 px ring with its letter; the bearing above it. */
.divider-end {
  width: 44px; height: 44px; display: grid; place-items: center;
  cursor: grab; touch-action: none; z-index: 3;
}
.divider-dot {
  width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center;
  background: rgba(255, 255, 255, .9); border: 2px solid var(--label);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .35);
  font-size: 13px; line-height: 1; font-weight: 700;
}
.divider-bearing { position: absolute; left: 50%; bottom: calc(50% + 16px); transform: translateX(-50%); }
.divider-distance { font-weight: 700; z-index: 3; }

/* Vessel: VesselLayer.boatGlyph and the COG label. */
.vessel-boat { pointer-events: none; z-index: 2; }
.vessel-boat svg { display: block; }
.vessel-boat path { fill: #fff; stroke: rgba(0, 0, 0, .85); stroke-width: 2; }
.vessel-cog { z-index: 2; }

/* Route waypoints: a 32 px target around RouteLayer's 16 px ring with a dot, the number to its right,
   the leg's distance 12 px below its centre. Editable only while the tool is on. */
.route-on .maplibregl-canvas-container.maplibregl-interactive { cursor: crosshair; }
.route-wp { width: 32px; height: 32px; cursor: grab; touch-action: none; z-index: 1; }
.rhumb-chart:not(.route-on) .route-wp { pointer-events: none; }
.route-ring {
  position: absolute; left: 8px; top: 8px; width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid var(--graphite); background: rgba(255, 255, 255, .85);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .35);
}
.route-ring::after {
  content: ""; position: absolute; left: 50%; top: 50%; width: 3px; height: 3px; margin: -1.5px;
  border-radius: 50%; background: var(--graphite);
}
.route-number {
  position: absolute; left: calc(50% + 10px); top: 50%; transform: translateY(-50%);
  font-size: 11px; line-height: 13px; font-weight: 600; color: var(--graphite); pointer-events: none;
  text-shadow: 0 0 2px #fff, 0 0 2px #fff, 0 0 2px #fff; /* a white halo, as the chart's own labels have */
}
.route-distance, .route-no-route { font-size: 12px; line-height: 15px; }
.route-distance {
  position: absolute; left: 50%; top: calc(50% + 12px); transform: translateX(-50%);
  color: var(--graphite); text-align: center; white-space: pre;
}
.route-no-route { color: #FF3B30; z-index: 1; }

/* Menus on the chart: Remove on a waypoint, the route's actions. */
.chart-popup .maplibregl-popup-tip { display: none; }
.chart-popup .maplibregl-popup-content {
  padding: 4px; border-radius: 12px; font: 15px/1.2 var(--chart-font);
  background: rgba(255, 255, 255, .9); box-shadow: 0 6px 24px rgba(0, 0, 0, .2);
}
.chart-menu { display: flex; flex-direction: column; }
.chart-menu .route-button { justify-content: flex-start; padding: 0 12px; font-size: 15px; }

/* Route hint, bottom centre as the app's routeBottomSlot: a footnote on glass. A wide chart has room
   between the zoom buttons and the tool buttons; a narrow one puts it above the tool buttons. */
.route-hint {
  --hint-bottom: calc(var(--bottom) + 2 * var(--button) + 2 * var(--gap));
  position: absolute; z-index: 3; left: var(--pad); right: var(--pad); bottom: var(--hint-bottom); margin: 0 auto;
  width: fit-content; max-width: 420px; padding: 8px 12px; border-radius: 12px;
  font-size: 13px; line-height: 1.35; text-align: center;
}
.chart-wide .route-hint {
  --hint-bottom: var(--bottom);
  left: calc(var(--pad) + var(--button) + var(--gap)); right: calc(var(--pad) + 3 * var(--button) + 3 * var(--gap));
}
.route-button {
  display: inline-flex; align-items: center; justify-content: center; min-height: 44px; min-width: 44px;
  padding: 0 6px; border: 0; background: none; cursor: pointer;
  font: 600 14px/1.2 var(--chart-font); color: var(--accent);
}

/* "Get Rhumb" in the nav of a wide page opens the QR code; a phone has the bar with the store link. */
.chart-page .nav-links { align-items: center; }
.chart-page .nav-get { background: var(--magenta); color: #fff; border-radius: 6px; padding: 7px 12px; font-weight: 600; }
.chart-page .nav-get:hover { text-decoration: none; }
@media (max-width: 760px) { .chart-page .nav-get { display: none; } }
.get-dialog {
  margin: auto; border: 0; border-radius: 16px; padding: 28px 28px 20px; max-width: 380px;
  background: var(--paper); color: var(--ink); text-align: center; box-shadow: 0 12px 48px rgba(11, 34, 51, .35);
}
.get-dialog::backdrop { background: rgba(11, 34, 51, .45); }
.get-dialog h2 { font-size: 26px; margin-bottom: 6px; }
.get-dialog p { color: var(--ink-75); }
.get-dialog img { display: block; width: 220px; height: 220px; margin: 18px auto; }
.get-dialog .store-buttons { justify-content: center; }
.get-dialog form { margin-top: 12px; }
.get-dialog form button { background: none; border: 0; color: var(--ink-75); font: inherit; cursor: pointer; padding: 8px 16px; }
