/* =====================================================================
   STYLES. The ocean look is dark on purpose, so light and dark mode match.
   ===================================================================== */
:root {
  /* ---- EASY-TO-CHANGE: colours and fonts ---- */
  --bg: #010509;
  --ink: #eaf7fb;
  --ink-soft: #b4d3df;
  --panel: rgba(5, 24, 43, 0.96);
  --line: rgba(150, 215, 235, 0.3);
  --accent: #7fe6f2;
  --accent-ink: #03222b;
  --warm: #ffd27a;
  --serif: 'Fraunces', Georgia, 'Times New Roman', serif;
  --sans: 'Figtree', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  /* ---- end of the easy list ---- */
  box-sizing: border-box;
}
*, *::before, *::after { box-sizing: inherit; }
html, body { height: 100%; margin: 0; background: var(--bg); color: var(--ink); font-family: var(--sans); overflow: hidden; overscroll-behavior: none; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--warm); outline-offset: 2px; }
a { color: var(--accent); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

#gl { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; }
#gl.drag { cursor: grabbing; }
#mask, #hose { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; }
#hose { z-index: 1; }
#mask { z-index: 2; }
#fade { position: fixed; inset: 0; pointer-events: none; z-index: 3; background: #000; opacity: 0; }

#bar { position: fixed; z-index: 10; top: 0; left: 0; right: 0; display: flex; justify-content: space-between; align-items: center; gap: 8px;
  padding: calc(10px + env(safe-area-inset-top, 0px)) 14px 10px; background: linear-gradient(rgba(0, 8, 16, 0.55), rgba(0, 8, 16, 0)); }
.brand { font-family: var(--serif); font-weight: 600; font-size: 1.25rem; white-space: nowrap; text-shadow: 0 1px 8px rgba(0, 0, 0, 0.6);
  color: var(--ink); background: none; border: 0; padding: 4px 6px; margin: 0; cursor: pointer; border-radius: 8px; }   /* also the home button */
.brand:hover { background: rgba(20, 70, 100, 0.5); }

/* ---- the side panel on the left edge: Pause, Music, Zoom. Hidden until you hover over it (or tap its handle) ---- */
#dock { position: fixed; z-index: 12; left: 0; top: 50%; transform: translateY(-50%); display: flex; align-items: center; gap: 10px; padding: 24px 24px 24px 0; }
.dockTab { width: 16px; height: 72px; padding: 0; margin: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; cursor: pointer;
  background: rgba(6, 28, 48, 0.72); border: 1px solid var(--line); border-left: 0; border-radius: 0 10px 10px 0; }
.dockTab span { width: 4px; height: 4px; border-radius: 50%; background: var(--ink-soft); }
#dockBody { display: flex; flex-direction: column; align-items: stretch; gap: 8px; opacity: 0; visibility: hidden; transform: translateX(-14px);
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0s linear 0.2s; }
#dock:hover #dockBody, #dock:focus-within #dockBody, #dock.open #dockBody { opacity: 1; visibility: visible; transform: none; transition-delay: 0s; }
#dock:hover .dockTab, #dock.open .dockTab { background: rgba(20, 70, 100, 0.85); }
#dockBody .btn { min-width: 9.5rem; text-align: left; }
@media (prefers-reduced-motion: reduce) { #dockBody { transition: none; } }
#bar nav { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.btn { font: inherit; font-weight: 500; color: var(--ink); white-space: nowrap; background: rgba(6, 28, 48, 0.72); border: 1px solid var(--line); border-radius: 999px;
  padding: 0.4rem 1rem; min-height: 44px; cursor: pointer; display: inline-flex; align-items: center; text-decoration: none; }
.btn:hover { background: rgba(20, 70, 100, 0.85); }
.btn[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; font-size: 1.05rem; padding: 0.5rem 1.6rem; }

#meter { position: fixed; z-index: 5; left: 18px; right: 18px; bottom: calc(18px + env(safe-area-inset-bottom, 0px)); display: flex; align-items: flex-end; gap: 14px; pointer-events: none;
  text-shadow: 0 1px 3px rgba(0, 10, 25, 0.95), 0 2px 14px rgba(0, 10, 25, 0.9); }
#depth { font-family: var(--serif); font-size: clamp(2.2rem, 7vw, 3.4rem); line-height: 1; font-variant-numeric: tabular-nums; }
#depth small { font-size: 0.42em; margin-left: 0.25em; }
#meterText { font-size: 0.95rem; line-height: 1.3; }
#meterText b { display: block; font-size: 1.05rem; font-weight: 600; }
#caption { display: block; }
#fact { display: block; font-size: 0.86rem; color: var(--ink-soft); max-width: 30rem; margin-top: 2px; }

#intro { position: fixed; inset: 0; z-index: 20; display: flex; align-items: center; justify-content: center; text-align: center; padding: 24px;
  background: radial-gradient(ellipse at 50% 40%, rgba(2, 30, 55, 0.35), rgba(0, 6, 14, 0.82)); transition: opacity 0.8s ease; }
#intro.leaving { opacity: 0; pointer-events: none; }
/* the start screen: a small line, the title, one subtitle, three short hints, Begin with a slim progress bar */
.introCard { max-width: 40rem; display: flex; flex-direction: column; align-items: center; }
#intro .eyebrow { margin: 0 0 0.9rem; font-size: 0.78rem; font-weight: 600; letter-spacing: 0.32em; text-transform: uppercase; color: var(--accent); }
#intro h1 { font-family: var(--serif); font-weight: 600; font-size: clamp(3.2rem, 12vw, 6.6rem); line-height: 0.95; letter-spacing: -0.01em; margin: 0;
  text-shadow: 0 0 42px rgba(127, 230, 242, 0.28), 0 2px 24px rgba(0, 0, 0, 0.6); }
#intro .tagline { margin: 1rem 0 1.8rem; font-family: var(--serif); font-style: italic; font-size: clamp(1.05rem, 2.6vw, 1.35rem); color: var(--ink); opacity: 0.9; }
#intro .howto { list-style: none; margin: 0 0 2rem; padding: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; font-size: 0.88rem; color: var(--ink-soft); }
#intro .howto li { padding: 5px 12px; border: 1px solid var(--line); border-radius: 999px; background: rgba(6, 28, 48, 0.45); }
#intro .howto b { color: var(--ink); font-weight: 600; }
#intro .progress { width: 12rem; height: 3px; margin: 1rem 0 0.4rem; border-radius: 3px; background: rgba(150, 215, 235, 0.18); overflow: hidden; }
#intro .progress span { display: block; height: 100%; width: 0; background: var(--accent); transition: width 0.3s ease; }
#loadMsg { margin: 0; min-height: 1.4em; font-size: 0.82rem; color: var(--ink-soft); }
#intro.ready .progress, #intro.ready #loadMsg { display: none; }   /* loading finished: close the gap */
#intro .btn.primary:disabled { opacity: 0.45; cursor: progress; }   /* not ready yet */
/* on the start screen only the start screen shows: no top bar, depth meter or side panel behind it */
body.home #bar, body.home #meter, body.home #dock { visibility: hidden; }
#intro .links { margin: 1.4rem 0 0; font-size: 0.88rem; display: flex; gap: 10px; color: var(--ink-soft); }
#credits { backdrop-filter: blur(20px) saturate(1.3); -webkit-backdrop-filter: blur(20px) saturate(1.3); box-shadow: 0 10px 50px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.12); position: fixed; z-index: 25; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(92vw, 560px); max-height: 80vh; overflow: auto;
  background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 20px 22px; line-height: 1.55; font-size: 0.95rem; }
#credits h2 { font-family: var(--serif); margin: 0 0 0.5rem; }
#credits ul { padding-left: 1.2rem; }


/* ---- phones and tablets: one Menu button opens a sheet with all the controls ---- */
#sheetBackdrop { position: fixed; inset: 0; z-index: 29; background: rgba(0, 6, 14, 0.5); }
#sheet { position: fixed; z-index: 30; left: 0; right: 0; bottom: 0; max-width: 620px; margin: 0 auto; padding: 18px 16px calc(20px + env(safe-area-inset-bottom, 0px));
  background: var(--panel); backdrop-filter: blur(20px) saturate(1.3); -webkit-backdrop-filter: blur(20px) saturate(1.3); border: 1px solid var(--line); border-bottom: 0;
  border-radius: 22px 22px 0 0; box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.5); }
#sheet #controls { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
#sheet #controls .btn { justify-content: center; min-height: 54px; font-size: 1rem; white-space: normal; text-align: center; }

/* ---- the blog ---- */
#journal { position: fixed; inset: 0; z-index: 40; overflow-y: auto; background: rgba(3, 14, 26, 0.97); backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px);
  padding: calc(16px + env(safe-area-inset-top, 0px)) 16px calc(40px + env(safe-area-inset-bottom, 0px)); }
.jwrap { max-width: 1000px; margin: 0 auto; }
.jhead { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.jhead h2 { font-family: var(--serif); font-size: clamp(1.7rem, 5vw, 2.6rem); margin: 0; line-height: 1.15; }
.lead { color: var(--ink-soft); margin: 0.6rem 0 0; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin: 1.2rem 0; }
.cards { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); }
.card { background: rgba(10, 40, 66, 0.8); border: 1px solid var(--line); border-radius: 14px; padding: 18px; display: flex; flex-direction: column; gap: 0.6rem; }
.card h4 { font-family: var(--serif); font-size: 1.25rem; margin: 0; line-height: 1.25; }
.card p { margin: 0; line-height: 1.5; }
.tags { font-size: 0.85rem; color: var(--accent); }
.card .btn { align-self: flex-start; }
.card .body p + p { margin-top: 0.6rem; }
.source { font-size: 0.9rem; margin-top: auto; }

@media (max-width: 460px) {
  #bar { padding-left: 10px; padding-right: 10px; gap: 4px; }
  #bar nav { gap: 5px; }
  .brand { font-size: 1.05rem; }
  #bar .btn { padding: 0.3rem 0.7rem; font-size: 0.86rem; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
