/* Full-viewport scene: black stone-and-sea art under the site's hairline type, like the tide pool. */
body:has(.basin) { margin: 0; background: #000; }
.page-container:has(.basin) { max-width: none; padding: 0; }
body:has(.basin) .theme-toggle, body:has(.basin) .theme-preferences { display: none; }

.basin { --ink: #ece9e4; --muted: #9b968f; --line: #3b3935; --panel: #0b0a09e6; --accent: #d4b9df;
  position: relative; height: 100svh; min-height: 480px; overflow: hidden; color: var(--ink); font-size: 14px;
  --gutter: clamp(16px, 3.4vw, 56px); }
.basin a { color: #d8d2cb; text-underline-offset: .3em; text-decoration-color: #8f8a82; }
.basin :is(button, a, summary, canvas):focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Difference blending keeps the heading legible wherever it lands: dark over the white stone and the ring, light over the sky. */
.basin-heading { position: absolute; z-index: 2; top: max(20px, env(safe-area-inset-top)); left: var(--gutter); right: var(--gutter); pointer-events: none;
  mix-blend-mode: difference; color: #fff; }
.basin-heading .basin-exit { color: #fff; text-decoration-color: currentColor; }
.basin-exit { pointer-events: auto; display: inline-flex; min-height: 44px; align-items: center; font-size: .8rem; }
.basin-heading h1 { margin: .2rem 0 .45rem; font: 400 clamp(2.4rem, 5vw, 5.2rem)/1 var(--site-font-display); letter-spacing: .02em; text-transform: uppercase; }
.basin-heading p { margin: 0; max-width: 26rem; color: #fff; font-size: .82rem; }

.basin-figure { position: absolute; inset: 0; margin: 0; }
.basin-figure canvas { display: block; position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; cursor: grab; }
.basin-figure canvas:active { cursor: grabbing; }
.basin-figure canvas:focus-visible { outline-offset: -6px; }

/* While the splats download, a ring (the scene's own) draws itself closed. */
.basin-veil { position: absolute; inset: 0; z-index: 1; display: grid; place-content: center; justify-items: center; gap: 1.4rem;
  background: #000; transition: opacity .9s ease, visibility 0s .9s; }
.basin[data-state="ready"] .basin-veil { opacity: 0; visibility: hidden; pointer-events: none; }
.basin-veil-ring { width: clamp(96px, 14vmin, 140px); height: auto; transform: rotate(-90deg); }
.basin-veil-ring circle { fill: none; stroke-width: 5; }
.basin-veil-track { stroke: #2a2826; }
.basin-veil-fill { stroke: var(--ink); stroke-dasharray: 100; stroke-dashoffset: calc(100 - var(--progress, 0) * 100); transition: stroke-dashoffset .4s ease; }
.basin-veil-note { margin: 0; font-size: .64rem; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }

/* Controls along the bottom: Walk on its own, then the viewpoints as a hairline row of square buttons. */
.basin-controls { position: absolute; z-index: 2; left: var(--gutter); bottom: max(18px, env(safe-area-inset-bottom));
  display: flex; gap: 10px; align-items: stretch; max-width: calc(100% - 2 * var(--gutter)); transition: opacity .8s ease .3s; }
.basin-views { display: flex; flex-wrap: wrap; border: 1px solid var(--line); background: var(--panel); }
.basin-controls button { min-height: 44px; padding: 0 1rem; border: 0; border-radius: 0; background: none; color: #cfcac3; font: inherit; font-size: .8rem; cursor: pointer; }
.basin-views button + button { border-left: 1px solid var(--line); }
.basin-controls button:hover:not(:disabled) { color: #fff; }
.basin-controls button[aria-pressed="true"] { background: var(--ink); color: #000; }
.basin-controls button:disabled { opacity: .45; cursor: default; }
.basin-walk { border: 1px solid var(--line) !important; background: var(--panel) !important; letter-spacing: .04em; }
.basin-walk[aria-pressed="true"] { background: var(--ink) !important; color: #000 !important; border-color: var(--ink) !important; }
.basin[data-state="loading"] .basin-controls { opacity: 0; }
/* A failed load leaves nothing to steer, and an unfinished ring would read as still loading. */
.basin[data-state="failed"] .basin-controls, .basin[data-state="failed"] .basin-veil-fill { display: none; }

/* Walking: the key hint above the controls, a dot at the centre to aim by, and the touch stick. */
.basin-hint { position: absolute; z-index: 2; left: var(--gutter); bottom: calc(max(18px, env(safe-area-inset-bottom)) + 58px); margin: 0;
  font-size: .64rem; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: #fff; mix-blend-mode: difference; pointer-events: none; }
.basin-aim { position: absolute; z-index: 2; left: 50%; top: 50%; width: 4px; height: 4px; margin: -2px 0 0 -2px; border-radius: 50%;
  background: #fff; mix-blend-mode: difference; opacity: .7; pointer-events: none; }
.basin:not([data-mode="walk"]) :is(.basin-hint, .basin-aim, .basin-stick) { display: none; }
.basin[data-mode="walk"] .basin-figure canvas { cursor: crosshair; }
.basin-stick { display: none; position: absolute; z-index: 3; left: var(--gutter); width: 112px; height: 112px; border-radius: 50%;
  bottom: calc(max(18px, env(safe-area-inset-bottom)) + 44px * 3 + 34px); border: 1px solid #ffffff55; background: #00000059; touch-action: none; }
.basin-stick span { position: absolute; left: 50%; top: 50%; width: 44px; height: 44px; margin: -22px 0 0 -22px; border-radius: 50%; background: #ece9e4cc; }
@media (pointer: coarse) { .basin[data-mode="walk"] .basin-stick { display: block; } .basin[data-mode="walk"] .basin-aim { display: none; } }

.basin-notes { position: absolute; z-index: 3; right: var(--gutter); top: max(20px, env(safe-area-inset-top)); width: min(22rem, calc(100% - 2 * var(--gutter)));
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.basin-notes summary { display: flex; justify-content: flex-end; align-items: center; gap: .6rem; min-height: 44px; cursor: pointer; list-style: none;
  font-size: .64rem; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.basin-notes summary::-webkit-details-marker { display: none; }
.basin-notes summary::after { content: '+'; font-size: .8rem; letter-spacing: 0; }
.basin-notes[open] summary::after { content: '−'; }
.basin-notes[open] { background: var(--panel); padding: 0 1rem .4rem; }
.basin-notes[open] summary { justify-content: space-between; }
.basin-notes p { margin: 0 0 .8rem; color: #cfcac3; font-size: .8rem; line-height: 1.55; }

.basin-status { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

@media (max-width: 640px) {
  /* Walk takes a full row above the viewpoints' two rows of three. */
  .basin-notes { top: auto; bottom: calc(max(18px, env(safe-area-inset-bottom)) + 44px * 3 + 24px); }
  .basin-controls { right: var(--gutter); flex-direction: column; gap: 8px; }
  .basin-views { width: auto; }
  .basin-views button { flex: 1 0 33.333%; padding: 0 .5rem; }
  .basin-hint { bottom: calc(max(18px, env(safe-area-inset-bottom)) + 44px * 3 + 24px); }
  .basin-views button:nth-child(3n + 1) { border-left: 0; }
  .basin-views button:nth-child(n + 4) { border-top: 1px solid var(--line); }
}
@media (prefers-reduced-motion: reduce) {
  .basin-veil, .basin-controls, .basin-veil-fill { transition: none; }
}
@media (max-width: 640px) {
  .basin[data-mode="walk"] .basin-notes { display: none; }
}
