/* Osminok Ocean Theme
   Scoped to pages with .osminok-ocean wrapper.
   Loaded globally via extra_css but inert without the wrapper class. */

/* Osminok fonts */
@font-face {
  font-family: "Capriola";
  src: url("../assets/fonts/Capriola-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Gabriela";
  src: url("../assets/fonts/Gabriela-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

/* Override Material palette to eliminate Mommyship color bleed */
body:has(.osminok-ocean) {
  --md-default-fg-color: #CCC3C1;
  --md-default-fg-color--light: rgba(204, 195, 193, 0.7);
  --md-default-fg-color--lighter: rgba(204, 195, 193, 0.5);
  --md-default-fg-color--lightest: rgba(204, 195, 193, 0.2);
  --md-primary-fg-color: #50A0FF;
  --md-accent-fg-color: #50A0FF;
  --md-typeset-a-color: #50A0FF;
}

/* Kill the space theme on ocean pages */
body:has(.osminok-ocean) #starfield,
body:has(.osminok-ocean) .galacticity-control {
  display: none !important;
}

/* Base: full-page ocean gradient on md-main */
body:has(.osminok-ocean) {
  background: #000;
}

body:has(.osminok-ocean) .md-main {
  background: linear-gradient(180deg,
    #04111a 0%,
    #030c14 8%,
    #020910 20%,
    #02060c 35%,
    #030410 50%,
    #04030c 65%,
    #020208 80%,
    #010104 92%,
    #000 100%
  ) !important;
}

body:has(.osminok-ocean) .md-main__inner,
body:has(.osminok-ocean) .md-content,
body:has(.osminok-ocean) .md-content__inner {
  background: transparent !important;
}

body:has(.osminok-ocean) .md-content__inner {
  padding-top: 0;
  margin-top: 0;
}

body:has(.osminok-ocean) .md-header {
  background: rgba(18, 25, 38, 0.92) !important;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(40, 55, 75, 0.25);
}

body:has(.osminok-ocean) .md-footer,
body:has(.osminok-ocean) .md-footer-meta,
body:has(.osminok-ocean) .md-footer-nav {
  background: transparent !important;
}

body:has(.osminok-ocean) .md-header__topic .md-ellipsis {
  font-family: "Gabriela", "Capriola", serif;
  -webkit-text-stroke: 0;
}

/* Reserve left nav space so content width matches the main site */
body:has(.osminok-ocean) .md-content {
  margin-left: 12.1rem;
}

/* Font swap: Capriola for body (slightly smaller), Gabriela for headings (slightly bigger) */
body:has(.osminok-ocean) .md-typeset,
body:has(.osminok-ocean) .md-nav,
body:has(.osminok-ocean) .md-sidebar {
  font-family: "Capriola", sans-serif;
  font-size: calc(0.7rem * var(--md-text-scale, 1));
}

body:has(.osminok-ocean) .md-typeset h1 {
  font-family: "Gabriela", "Capriola", serif;
  font-size: 3em;
  font-weight: 400;
  -webkit-text-stroke: 0;
  animation: osminok-glow-ripple 2.5s ease-in-out infinite;
}

@keyframes osminok-glow-ripple {
  0%, 100% {
    text-shadow:
      -8px 0 18px rgba(100, 210, 230, 0.5),
      8px 0 8px rgba(80, 160, 255, 0.15),
      -3px 2px 10px rgba(100, 210, 230, 0.25),
      3px -2px 6px rgba(80, 160, 255, 0.15),
      0 0 4px rgba(100, 210, 230, 0.3);
  }
  50% {
    text-shadow:
      8px 0 18px rgba(80, 160, 255, 0.5),
      -8px 0 8px rgba(100, 210, 230, 0.15),
      3px -2px 10px rgba(80, 160, 255, 0.25),
      -3px 2px 6px rgba(100, 210, 230, 0.15),
      0 0 4px rgba(80, 160, 255, 0.3);
  }
}

body:has(.osminok-ocean) .md-typeset h1 .headerlink {
  display: none;
}

body:has(.osminok-ocean) .md-typeset h2,
body:has(.osminok-ocean) .md-typeset h3,
body:has(.osminok-ocean) .md-typeset h4 {
  font-family: "Gabriela", "Capriola", serif;
  font-size: 115%;
}

/* Stacking context so waves (z-index: -1) sit behind text */
body:has(.osminok-ocean) .md-content__inner {
  position: relative;
  isolation: isolate;
  min-height: 100vh;
}

body:has(.osminok-ocean) .md-typeset {
  color: #CCC3C1;
}

/* Paragraph indentation for dense lore text */
body:has(.osminok-ocean) .md-typeset p {
  text-indent: 2em;
}

body:has(.osminok-ocean) .md-typeset h1,
body:has(.osminok-ocean) .md-typeset h2,
body:has(.osminok-ocean) .md-typeset h3,
body:has(.osminok-ocean) .md-typeset h4 {
  color: #64D2E6;
  font-weight: 500;
}

body:has(.osminok-ocean) .md-typeset h2 {
  font-size: 130%;
  animation: osminok-glow-ripple 2.5s ease-in-out infinite;
}

body:has(.osminok-ocean) .md-typeset h3,
body:has(.osminok-ocean) .md-typeset h4 {
  font-size: 130%;
  text-shadow:
    0 0 10px rgba(100, 210, 230, 0.35),
    0 0 3px rgba(80, 160, 255, 0.25);
}

body:has(.osminok-ocean) .md-typeset strong {
  color: #64D2E6;
}

body:has(.osminok-ocean) .md-typeset em {
  color: #EBE8E7;
}

body:has(.osminok-ocean) .md-typeset blockquote {
  background: rgba(80, 160, 255, 0.08);
  border-left-color: rgba(100, 210, 230, 0.3);
  color: #C0BAB8;
}

/* Text-size rocker — override Mommyship pink, inherit body font */
body:has(.osminok-ocean) .text-size-rocker__btn {
  font-family: "Capriola", sans-serif;
}

body:has(.osminok-ocean) .text-size-rocker__btn[data-text-size="decrease"],
body:has(.osminok-ocean) .text-size-rocker__btn[data-text-size="increase"] {
  background: #2a7ab5;
}

body:has(.osminok-ocean) .text-size-rocker__btn[data-text-size="decrease"]:hover,
body:has(.osminok-ocean) .text-size-rocker__btn[data-text-size="increase"]:hover {
  background: #3a8ec8;
}

body:has(.osminok-ocean) .text-size-rocker__btn[data-text-size="decrease"]:active,
body:has(.osminok-ocean) .text-size-rocker__btn[data-text-size="increase"]:active {
  background: #1e6a9e;
}

/* TOC active link — cyan to match headers */
body:has(.osminok-ocean) .md-nav__link--current {
  color: #64D2E6 !important;
}

/* Override Mommyship pink hover (extra.css sets these as direct colors) */
body:has(.osminok-ocean) .md-typeset a:hover,
body:has(.osminok-ocean) .md-nav__link:hover {
  color: #78E6C8;
}

/* Scrollbar — matches rocker button tones */
body:has(.osminok-ocean) ::-webkit-scrollbar {
  width: 8px;
}

body:has(.osminok-ocean) ::-webkit-scrollbar-track {
  background: rgba(18, 25, 38, 0.5);
}

body:has(.osminok-ocean) ::-webkit-scrollbar-thumb {
  background: #2a7ab5;
  border-radius: 4px;
}

body:has(.osminok-ocean) ::-webkit-scrollbar-thumb:hover {
  background: #3a8ec8;
}

body:has(.osminok-ocean) {
  scrollbar-color: #2a7ab5 rgba(18, 25, 38, 0.5);
}

/* Hero h1 overlaps the wave zone — position: relative keeps it
   above waves (z-index: -1). Top padding clears the header bar. */
body:has(.osminok-ocean) .md-typeset h1 {
  position: relative;
  padding-top: 2rem;
  margin-top: 0;
}

/* Surface Waves + Megastorm — SVG wave layers over a canvas cloud/lightning
   system. Container extends 2rem into the header so clouds blend seamlessly
   into the header bar. ::after overlay fades everything into the page
   gradient (more reliable than mask-image with GPU-promoted canvas). */
.ocean-surface {
  position: absolute;
  top: -2rem;
  left: 50%;
  transform: translateX(-50%);
  width: 100vw;
  height: calc(160px + 2rem);
  z-index: -1;
  pointer-events: none;
  overflow: hidden;
}

/* Gradient overlay replaces mask-image — canvas GPU layers break
   cross-boundary masking, but a painted overlay is always reliable */
.ocean-surface::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 65%;
  z-index: 10;
  background: linear-gradient(to bottom, transparent, #04111a);
}

.storm-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

.storm-blur {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 80px;
  z-index: 1;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.wave {
  position: absolute;
  width: 300vw;
  left: -100vw;
  z-index: 2;
  will-change: transform;
  background-repeat: repeat-x;
}

/* Deep background swell — broad, lazy peak shifted left to x=720 */
.wave-1 {
  height: 210px;
  bottom: -75px;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' width='1600' height='198'%3e%3cdefs%3e%3clinearGradient id='a' x1='50%25' x2='50%25' y1='-10.959%25' y2='100%25'%3e%3cstop stop-color='%231a3a50' stop-opacity='.15' offset='0%25'/%3e%3cstop stop-color='%231a3a50' offset='100%25'/%3e%3c/linearGradient%3e%3c/defs%3e%3cpath fill='url(%23a)' fill-rule='evenodd' d='M.005 121C280 121 370 2 720 2c380 2 520 119 880 119v77H0s.005-48 .005-77z'/%3e%3c/svg%3e");
  background-size: 1600px 100%;
  animation: wave-scroll-1 4.8s linear infinite;
}

/* Main swell — original prototype curve, peak at x=811 */
.wave-2 {
  height: 180px;
  bottom: -55px;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' width='1600' height='198'%3e%3cdefs%3e%3clinearGradient id='a' x1='50%25' x2='50%25' y1='-10.959%25' y2='100%25'%3e%3cstop stop-color='%232a5575' stop-opacity='.20' offset='0%25'/%3e%3cstop stop-color='%232a5575' offset='100%25'/%3e%3c/linearGradient%3e%3c/defs%3e%3cpath fill='url(%23a)' fill-rule='evenodd' d='M.005 121C311 121 409.898-.25 811 0c400 0 500 121 789 121v77H0s.005-48 .005-77z'/%3e%3c/svg%3e");
  background-size: 1400px 100%;
  animation: wave-scroll-2 3.2s linear infinite;
}

/* Cross-chop — tighter peak shifted right to x=880 */
.wave-3 {
  height: 140px;
  bottom: -25px;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' width='1600' height='198'%3e%3cdefs%3e%3clinearGradient id='a' x1='50%25' x2='50%25' y1='-10.959%25' y2='100%25'%3e%3cstop stop-color='%234a7595' stop-opacity='.18' offset='0%25'/%3e%3cstop stop-color='%234a7595' offset='100%25'/%3e%3c/linearGradient%3e%3c/defs%3e%3cpath fill='url(%23a)' fill-rule='evenodd' d='M.005 121C350 121 460-1 880 0c380 0 450 121 720 121v77H0s.005-48 .005-77z'/%3e%3c/svg%3e");
  background-size: 1200px 100%;
  animation: wave-scroll-3 2.2s linear infinite;
}

/* Surface chop — asymmetric, quick rise to x=620, long descent */
.wave-4 {
  height: 100px;
  bottom: 0;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' width='1600' height='198'%3e%3cdefs%3e%3clinearGradient id='a' x1='50%25' x2='50%25' y1='-10.959%25' y2='100%25'%3e%3cstop stop-color='%236a95b0' stop-opacity='.15' offset='0%25'/%3e%3cstop stop-color='%236a95b0' offset='100%25'/%3e%3c/linearGradient%3e%3c/defs%3e%3cpath fill='url(%23a)' fill-rule='evenodd' d='M.005 121C220 121 320 3 620 3c480 3 580 118 980 118v77H0s.005-48 .005-77z'/%3e%3c/svg%3e");
  background-size: 1000px 100%;
  animation: wave-scroll-4 1.4s linear infinite;
}

/* Each scrolls one tile width with vertical heave for cross-chop.
   Alternating left/right so overlapping crests interfere. */
@keyframes wave-scroll-1 {
  0%   { transform: translateX(0)       translateY(0); }
  25%  { transform: translateX(400px)   translateY(10px); }
  50%  { transform: translateX(800px)   translateY(-6px); }
  75%  { transform: translateX(1200px)  translateY(8px); }
  100% { transform: translateX(1600px)  translateY(0); }
}

@keyframes wave-scroll-2 {
  0%   { transform: translateX(0)       translateY(0); }
  25%  { transform: translateX(-350px)  translateY(-12px); }
  50%  { transform: translateX(-700px)  translateY(8px); }
  75%  { transform: translateX(-1050px) translateY(-10px); }
  100% { transform: translateX(-1400px) translateY(0); }
}

@keyframes wave-scroll-3 {
  0%   { transform: translateX(0)       translateY(0); }
  25%  { transform: translateX(300px)   translateY(14px); }
  50%  { transform: translateX(600px)   translateY(-8px); }
  75%  { transform: translateX(900px)   translateY(10px); }
  100% { transform: translateX(1200px)  translateY(0); }
}

@keyframes wave-scroll-4 {
  0%   { transform: translateX(0)       translateY(0); }
  20%  { transform: translateX(-200px)  translateY(-16px); }
  50%  { transform: translateX(-500px)  translateY(12px); }
  80%  { transform: translateX(-800px)  translateY(-10px); }
  100% { transform: translateX(-1000px) translateY(0); }
}

/* Mid-content undercurrent — rotating blob technique from waves2 prototype.
   Oversized rounded rectangles spin continuously; only their curved edges
   are visible, creating organic undulating motion. Good starting point for
   a subtle water-texture layer behind the content area.
   HTML would go in the content body:
   <div class="ocean-undercurrent">
     <div class="undercurrent undercurrent-1"></div>
     <div class="undercurrent undercurrent-2"></div>
     <div class="undercurrent undercurrent-3"></div>
     <div class="undercurrent undercurrent-4"></div>
   </div>

.ocean-undercurrent {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100vw;
  height: 100%;
  z-index: -1;
  pointer-events: none;
  overflow: hidden;
}

.undercurrent {
  position: absolute;
  left: 50%;
  border-radius: 43%;
  will-change: transform;
}

.undercurrent-1 {
  width: 3000px;
  height: 2600px;
  top: -2250px;
  margin-left: -1500px;
  opacity: 0.07;
  background: rgba(100, 160, 200, 1);
  animation: undercurrent-swell 5s linear infinite;
}

.undercurrent-2 {
  width: 2400px;
  height: 2100px;
  top: -1780px;
  margin-left: -1200px;
  opacity: 0.10;
  background: rgba(60, 120, 160, 1);
  animation: undercurrent-churn 3.5s linear infinite;
}

.undercurrent-3 {
  width: 1800px;
  height: 1500px;
  top: -1220px;
  margin-left: -900px;
  opacity: 0.06;
  background: rgba(160, 200, 225, 1);
  animation: undercurrent-swell 2.5s linear infinite;
}

.undercurrent-4 {
  width: 1400px;
  height: 1200px;
  top: -920px;
  margin-left: -700px;
  opacity: 0.05;
  background: rgba(200, 225, 245, 1);
  animation: undercurrent-churn 1.8s linear infinite;
}

@keyframes undercurrent-swell {
  from { transform: rotate(80deg); }
  to   { transform: rotate(440deg); }
}

@keyframes undercurrent-churn {
  from { transform: rotate(280deg); }
  to   { transform: rotate(-80deg); }
}
*/

@keyframes undercurrent-swell {
  from { transform: rotate(80deg); }
  to   { transform: rotate(440deg); }
}

@keyframes undercurrent-churn {
  from { transform: rotate(280deg); }
  to   { transform: rotate(-80deg); }
}

/* Bioluminescence layers — three depth zones appended by osminok.js.
   Each has independent opacity, parallax, and creature morphology. */
.osminok-bio {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 1;
  opacity: 0;
  will-change: transform, opacity;
  contain: layout paint style;
}

/* Abyss — JS reparents this outside .osminok-ocean so it layers
   above bio (z-index: 1). SVG waves crest upward into the content. */
.ocean-abyss {
  position: relative;
  z-index: 2;
  width: 100%;
  height: 200px;
  pointer-events: none;
  margin-top: 4rem;
  background: #000;
}

.abyss-waves {
  position: absolute;
  width: 100%;
  height: 15vh;
  min-height: 100px;
  max-height: 150px;
  top: 0;
  left: 0;
  transform: translateY(-100%);
}

.abyss-parallax > path {
  animation: abyss-wave-drift 25s cubic-bezier(0.55, 0.5, 0.45, 0.5) infinite;
}

.abyss-parallax > path:nth-child(1) { animation-delay: -2s; animation-duration: 7s; }
.abyss-parallax > path:nth-child(2) { animation-delay: -3s; animation-duration: 10s; }
.abyss-parallax > path:nth-child(3) { animation-delay: -4s; animation-duration: 13s; }
.abyss-parallax > path:nth-child(4) { animation-delay: -5s; animation-duration: 20s; }

@keyframes abyss-wave-drift {
  0%   { transform: translate3d(-90px, 0, 0); }
  100% { transform: translate3d(85px, 0, 0); }
}

/* Dive Page
   Full-depth ocean column at 10px per meter (~121,000px).
   h4s are invisible spacers, h3s are ghostly depth watermarks.
   All non-essential chrome hidden for full immersion. */

/* Kill all scrollbars — root (html for Firefox), body, and TOC sidebar */
html:has(.osminok-dive) {
  scrollbar-width: none;
}

html:has(.osminok-dive)::-webkit-scrollbar,
body:has(.osminok-dive)::-webkit-scrollbar {
  display: none;
}

body:has(.osminok-dive) .md-sidebar__scrollwrap {
  scrollbar-width: none;
}

body:has(.osminok-dive) .md-sidebar__scrollwrap::-webkit-scrollbar {
  display: none;
}

/* Keep header bar visible as the cloud ceiling — min-height prevents
   flex collapse when all children are hidden */
body:has(.osminok-dive) .md-header {
  min-height: 2.4rem;
}

body:has(.osminok-dive) .md-header__inner {
  min-height: 2.4rem;
}

/* Break controls out of md-grid's max-width so they pin to viewport edge */
body:has(.osminok-dive) .submarine-toggle {
  position: absolute;
  right: 3.2rem;
  top: 50%;
  transform: translateY(-50%);
  margin: 0;
}

body:has(.osminok-dive) .dive-volume-header {
  position: absolute;
  right: 0.8rem;
  top: 50%;
  transform: translateY(-50%);
}

/* Strip header contents down to bare cloud ceiling */
body:has(.osminok-dive) .md-header__button.md-logo,
body:has(.osminok-dive) .md-header__button[for="__drawer"],
body:has(.osminok-dive) .md-header__title,
body:has(.osminok-dive) .galacticity-control,
body:has(.osminok-dive) .text-size-rocker,
body:has(.osminok-dive) .md-header__option,
body:has(.osminok-dive) .md-header__button[for="__search"],
body:has(.osminok-dive) .md-search {
  display: none !important;
}

body:has(.osminok-dive) .md-footer {
  display: none !important;
}

/* No left nav on dive — zero the reserved margin.
   overflow: visible lets ocean-surface extend to full viewport width.
   TOC sidebar becomes a fixed overlay so it doesn't steal flex width. */
body:has(.osminok-dive) .md-content {
  margin-left: 0;
  max-width: 100%;
  overflow: visible !important;
}

body:has(.osminok-dive) .md-main__inner {
  overflow: visible !important;
}

body:has(.osminok-dive) .md-sidebar--secondary {
  position: fixed;
  right: 0.6rem;
  top: 3rem;
  bottom: 0;
  width: auto;
  max-width: 10rem;
  z-index: 3;
}

/* Heading spacing — 1000px per 100m interval (10px per meter, ~121,000px total) */
body:has(.osminok-dive) .md-typeset h3,
body:has(.osminok-dive) .md-typeset h4 {
  height: 1000px;
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  border-bottom: none;
}

/* h4s (100m markers) — invisible spacers preserving scroll distance */
body:has(.osminok-dive) .md-typeset h4 {
  visibility: hidden;
}

/* h3s (1,000m markers) — ghostly centered depth watermarks */
body:has(.osminok-dive) .md-typeset h3 {
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(192, 216, 240, 0.12);
  font-size: 2.5em;
  font-weight: 400;
  letter-spacing: 0.15em;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.08);
  text-shadow: 0 0 20px rgba(192, 216, 240, 0.06);
}

/* "??????" heading — ominous glow at the threshold of the unknown */
body:has(.osminok-dive) .md-typeset h3#_1 {
  color: rgba(110, 30, 160, 0.2);
  font-size: 3.5em;
  letter-spacing: 0.4em;
  text-shadow: 0 0 30px rgba(110, 30, 160, 0.15), 0 0 60px rgba(80, 20, 120, 0.08);
  border-bottom: none;
}

/* Hide permalink anchors on dive headings */
body:has(.osminok-dive) .md-typeset h3 .headerlink,
body:has(.osminok-dive) .md-typeset h4 .headerlink {
  display: none;
}

/* Abyss V-funnel — two overflow:hidden wall containers, each holding
   three spinning blobs (border-radius: 43%). Only the inner curved
   edges are visible. Walls rotated 14deg to form V-funnel. */
body:has(.osminok-dive) .ocean-abyss--dive {
  position: relative;
  height: 100vh;
  overflow: hidden;
  background: transparent;
  margin-top: 0;
}

/* Wall containers — full-height overflow:hidden zones rotated from bottom-center */
body:has(.osminok-dive) .abyss-wall {
  position: absolute;
  width: 120%;
  height: 100%;
  bottom: 0;
  overflow: hidden;
  pointer-events: none;
}

body:has(.osminok-dive) .abyss-wall--left {
  right: calc(50% - 2vw);
  transform-origin: right bottom;
  transform: rotate(14deg);
}

body:has(.osminok-dive) .abyss-wall--right {
  left: calc(50% - 2vw);
  transform-origin: left bottom;
  transform: rotate(-14deg);
}

/* Blob base — oversized rounded rectangles, offset so only inner curved edge visible */
body:has(.osminok-dive) .abyss-blob {
  position: absolute;
  border-radius: 43%;
  will-change: transform;
  top: 50%;
}

/* Left wall: 300px of blob visible at the right (inner) edge */
body:has(.osminok-dive) .abyss-wall--left .abyss-blob {
  left: calc(100% - 300px);
}

/* Right wall: 300px of blob visible at the left (inner) edge */
body:has(.osminok-dive) .abyss-wall--right .abyss-blob {
  right: calc(100% - 300px);
}

/* Individual blob sizes + colors (inner to outer, deep purple palette) */
body:has(.osminok-dive) .abyss-blob-1 {
  width: 2800px;
  height: 2400px;
  margin-top: -1200px;
  background: rgba(80, 20, 120, 0.18);
  animation: undercurrent-swell 8s linear infinite;
}

body:has(.osminok-dive) .abyss-blob-2 {
  width: 2200px;
  height: 1900px;
  margin-top: -950px;
  background: rgba(55, 14, 85, 0.25);
  animation: undercurrent-churn 6s linear infinite;
}

body:has(.osminok-dive) .abyss-blob-3 {
  width: 1600px;
  height: 1400px;
  margin-top: -700px;
  background: rgba(25, 6, 45, 0.55);
  animation: undercurrent-swell 4.5s linear infinite;
}

/* Inset glow pseudo-element — soft purple light along the wall edges */
body:has(.osminok-dive) .abyss-wall::after {
  content: '';
  position: absolute;
  inset: 0;
  box-shadow: inset 0 0 80px 30px rgba(80, 20, 120, 0.15);
  pointer-events: none;
  z-index: 1;
  animation: abyss-inner-glow 14s ease-in-out infinite;
}

@keyframes abyss-inner-glow {
  0%, 100% { box-shadow: inset 0 0 60px 20px rgba(80, 20, 120, 0.12); }
  50% { box-shadow: inset 0 0 120px 50px rgba(110, 30, 160, 0.25); }
}

/* Singularity — pulsing point at wall convergence */
body:has(.osminok-dive) .abyss-singularity {
  position: absolute;
  bottom: 5%;
  left: 50%;
  transform: translate(-50%, 50%);
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(130, 50, 172, 0.6);
  box-shadow:
    0 0 4px 2px rgba(130, 50, 172, 0.3),
    0 0 20px 8px rgba(110, 30, 160, 0.15);
  animation: abyss-singularity-pulse 5s ease-in-out infinite;
  z-index: 2;
  pointer-events: none;
}

@keyframes abyss-singularity-pulse {
  0%, 100% {
    opacity: 0.3;
    box-shadow:
      0 0 4px 2px rgba(130, 50, 172, 0.2),
      0 0 8px 4px rgba(110, 30, 160, 0.1);
  }
  50% {
    opacity: 0.8;
    box-shadow:
      0 0 12px 6px rgba(130, 50, 172, 0.5),
      0 0 40px 16px rgba(110, 30, 160, 0.3);
  }
}

/* Phase 2: Submarine toggle — replaces palette on osminok pages */
.submarine-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.4rem;
  margin: 0 0.2rem 0 auto;
  background: none;
  border: none;
  cursor: pointer;
  color: #b0c8e0;
  transition: color 0.2s, filter 0.2s;
}

.submarine-toggle:hover {
  color: #41ead4;
  filter: drop-shadow(0 0 6px rgba(65, 234, 212, 0.5));
}

.submarine-icon {
  display: block;
  width: 1.5rem;
  height: 1.5rem;
  mask-image: url('../assets/submarine.svg');
  mask-size: contain;
  mask-repeat: no-repeat;
  mask-position: center;
  -webkit-mask-image: url('../assets/submarine.svg');
  -webkit-mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-position: center;
  background-color: currentColor;
}

/* Phase 3: Expanded surface + alt-lightning canvas */
body:has(.osminok-dive) .ocean-surface {
  height: 66vh;
}

/* Must sit above storm-canvas (later in DOM but needs to be visible on top) */
.storm-light-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}

/* Rain canvas — above waves (z:2) but below ::after fade (z:10) */
.rain-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 5;
  pointer-events: none;
}

/* Phase 4: TOC depth meter */

/* Hide the "Table of Contents" title label */
body:has(.osminok-dive) .md-nav--secondary .md-nav__title {
  display: none;
}

/* h4 entries (100m ticks) — small, tight */
body:has(.osminok-dive) .md-nav--secondary .md-nav .md-nav__link {
  font-size: 0.65em;
  padding: 0 0.6em;
  line-height: 1.4;
}

/* h3 entries (1,000m markers) — bolder, use depth colors */
body:has(.osminok-dive) .md-nav--secondary > .md-nav__list > .md-nav__item > .md-nav__link {
  font-size: 0.85em;
  font-weight: 600;
}

/* TOC links — JS overrides opacity per-link via inline !important.
   CSS baseline keeps them dim until JS takes over. */
body:has(.osminok-dive) .md-nav--secondary .md-nav__link {
  opacity: 0.15;
  text-shadow: 0 0 4px currentColor;
  transition: opacity 0.3s, text-shadow 0.15s, transform 0.15s;
}

/* Current depth marker — bright glow + slight scale */
body:has(.osminok-dive) .md-nav--secondary .md-nav__link--current {
  text-shadow: 0 0 12px currentColor, 0 0 4px currentColor !important;
  transform: scale(1.12);
}

/* Depth colors for 1,000m markers — bright at surface, deep at bottom */
body:has(.osminok-dive) .md-nav--secondary a[href="#0m"] { color: #7dd3fc !important; }
body:has(.osminok-dive) .md-nav--secondary a[href="#1000m"] { color: #38bdf8 !important; }
body:has(.osminok-dive) .md-nav--secondary a[href="#2000m"] { color: #0ea5e9 !important; }
body:has(.osminok-dive) .md-nav--secondary a[href="#3000m"] { color: #0284c7 !important; }
body:has(.osminok-dive) .md-nav--secondary a[href="#4000m"] { color: #1e5a8a !important; }
body:has(.osminok-dive) .md-nav--secondary a[href="#5000m"] { color: #2e4570 !important; }
body:has(.osminok-dive) .md-nav--secondary a[href="#6000m"] { color: #3a3868 !important; }
body:has(.osminok-dive) .md-nav--secondary a[href="#7000m"] { color: #3d2e60 !important; }
body:has(.osminok-dive) .md-nav--secondary a[href="#8000m"] { color: #3a2558 !important; }
body:has(.osminok-dive) .md-nav--secondary a[href="#9000m"] { color: #331e50 !important; }
body:has(.osminok-dive) .md-nav--secondary a[href="#10000m"] { color: #2d1848 !important; }
body:has(.osminok-dive) .md-nav--secondary a[href="#11000m"] { color: #271340 !important; }
body:has(.osminok-dive) .md-nav--secondary a[href="#12000m"] { color: #220e38 !important; }
body:has(.osminok-dive) .md-nav--secondary a[href="#_1"] { color: #1a0a2e !important; }

/* "Surface" pill — all Osminok pages */
body:has(.osminok-ocean) .md-top {
  background: rgba(18, 25, 38, 0.4) !important;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border: 1px solid rgba(42, 122, 181, 0.3);
  color: rgba(100, 210, 230, 0.9);
  text-shadow: 0 0 8px rgba(80, 160, 255, 0.4);
  font-family: "Capriola", sans-serif;
}

/* 25% brightness boost on dive bio layers — GPU-composited, no per-particle changes */
body:has(.osminok-dive) .osminok-bio {
  filter: brightness(1.25);
}

/* Phase 6: Marine snow — fixed overlay for falling particles */
.marine-snow {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 1;
}

/* Landing page — swirly stars background + CSS wave ring */

.swirly-stars {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 0;
}

/* Hide storm surface on landing — stars replace it */
body:has(.osminok-landing) .ocean-surface {
  display: none;
}

.ring {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(80vw, 600px);
  aspect-ratio: 1;
  border: 4px solid transparent;
  border-radius: 50%;
  z-index: 1;
  transition: box-shadow 0.4s ease-out;
}

/* Radar sweep — conic gradient masked to a hollow ring */
.ring::after {
  content: "";
  position: absolute;
  inset: -14px;
  border-radius: 50%;
  z-index: -1;
  background: conic-gradient(
    from var(--glow-angle, 0deg),
    transparent 0%,
    transparent 55%,
    #64D2E6 75%,
    #64D2E6 90%,
    transparent 100%
  );
  padding: 14px;
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  filter: blur(10px);
  animation: radar-sweep 6s linear infinite;
  pointer-events: none;
}

.ringwave {
  position: relative;
  width: 100%;
  height: 100%;
  background: #2a5575;
  border-radius: 50%;
  overflow: hidden;
  box-shadow: inset 0 0 60px 0 rgba(0, 0, 0, 0.6);
}

/* Third wave — deep background swell, darker and slower */
.ringswell {
  position: absolute;
  top: 0;
  left: 50%;
  width: 200%;
  height: 200%;
  border-radius: 42%;
  background: rgba(4, 8, 14, 0.7);
  transform: translate(-50%, -75%);
  animation: ring-swell-spin 14s linear infinite;
}

/* Pseudo-elements are the rotating "sky" — dark, with rounded edges
   creating the wave boundary against the ocean background */
.ringwave::before,
.ringwave::after {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  width: 200%;
  height: 200%;
  transform: translate(-50%, -75%);
}

.ringwave::before {
  border-radius: 45%;
  background: rgba(4, 8, 14, 0.95);
  animation: ring-wave-spin 5s linear infinite;
}

.ringwave::after {
  border-radius: 40%;
  background: rgba(4, 8, 14, 0.5);
  animation: ring-wave-spin 10s linear infinite;
}

@keyframes ring-wave-spin {
  from { transform: translate(-50%, -75%) rotate(0deg); }
  to { transform: translate(-50%, -75%) rotate(360deg); }
}

@keyframes ring-swell-spin {
  from { transform: translate(-50%, -75%) rotate(0deg); }
  to { transform: translate(-50%, -75%) rotate(360deg); }
}

/* Content floats above the wave surface */
.ring-content {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 2;
  padding: 2rem;
  pointer-events: none;
}

.ring-content h1 {
  font-family: "Gabriela", "Capriola", serif;
  font-size: clamp(2rem, 6vw, 3.5rem);
  color: #64D2E6;
  margin: 0 0 1.5rem;
  animation: osminok-glow-ripple 2.5s ease-in-out infinite;
  pointer-events: auto;
}

.ring-nav {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  align-items: center;
  pointer-events: auto;
}

.ring-nav a {
  font-family: "Capriola", sans-serif;
  font-size: clamp(0.75rem, 2vw, 1rem);
  color: #CCC3C1;
  text-decoration: none;
  text-shadow: 0 0 6px rgba(100, 210, 230, 0.2);
  transition: color 0.2s, text-shadow 0.2s;
}

.ring-nav a:hover {
  color: #78E6C8;
  text-shadow: 0 0 12px rgba(100, 210, 230, 0.5);
}

/* Dive Overlay — intro screen with volume + Dive button */
.dive-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(2, 6, 12, 0.88);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  opacity: 1;
  transition: opacity 0.6s ease-out;
}

.dive-overlay--hidden {
  opacity: 0;
  pointer-events: none;
}

.dive-overlay__card {
  max-width: 420px;
  padding: 2.5rem 2rem;
  background: rgba(18, 25, 38, 0.92);
  border: 1px solid rgba(100, 210, 230, 0.2);
  border-radius: 12px;
  box-shadow: 0 0 40px rgba(100, 210, 230, 0.08);
  text-align: center;
}

.dive-overlay__card p {
  font-family: "Capriola", sans-serif;
  font-size: 0.9rem;
  color: #CCC3C1;
  line-height: 1.6;
  margin: 0 0 1rem;
  text-indent: 0 !important;
}

.dive-overlay__title {
  font-family: "Gabriela", "Capriola", serif;
  font-size: 1.8rem;
  color: #64D2E6;
  margin: 0 0 1.2rem;
  font-weight: 400;
  animation: osminok-glow-ripple 2.5s ease-in-out infinite;
}

.dive-overlay__hint {
  font-size: 0.78rem !important;
  color: rgba(204, 195, 193, 0.6) !important;
}

.dive-overlay__volume {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  margin: 1.2rem 0 1.5rem;
  padding: 0 0.5rem;
}

.dive-overlay__volume label {
  font-family: "Capriola", sans-serif;
  font-size: 0.75rem;
  color: rgba(204, 195, 193, 0.5);
  flex-shrink: 0;
}

.dive-overlay__volume input[type="range"] {
  flex: 1;
  height: 4px;
  -webkit-appearance: none;
  appearance: none;
  background: rgba(42, 122, 181, 0.3);
  border-radius: 2px;
  outline: none;
}

.dive-overlay__volume input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #64D2E6;
  cursor: pointer;
  box-shadow: 0 0 6px rgba(100, 210, 230, 0.4);
}

.dive-overlay__volume input[type="range"]::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #64D2E6;
  border: none;
  cursor: pointer;
  box-shadow: 0 0 6px rgba(100, 210, 230, 0.4);
}

.dive-overlay__btn {
  font-family: "Gabriela", "Capriola", serif;
  font-size: 1.1rem;
  color: #0a1520;
  background: #64D2E6;
  border: none;
  border-radius: 24px;
  padding: 0.6rem 2.4rem;
  cursor: pointer;
  transition: background 0.2s, box-shadow 0.2s;
  box-shadow: 0 0 12px rgba(100, 210, 230, 0.2);
}

.dive-overlay__btn:hover {
  background: #78E6C8;
  box-shadow: 0 0 20px rgba(100, 210, 230, 0.4);
}

.dive-overlay__btn:focus-visible {
  outline: 2px solid #64D2E6;
  outline-offset: 3px;
}

/* Lock scroll while overlay is visible */
body:has(.dive-overlay:not(.dive-overlay--hidden)) {
  overflow: hidden !important;
}

/* Header volume slider — ghostly, compact, next to submarine button */
.dive-volume-header {
  display: inline-flex;
  align-items: center;
  margin: 0 0.4rem 0 auto;
  opacity: 0.3;
  transition: opacity 0.25s;
}

.dive-volume-header:hover {
  opacity: 0.85;
}

.dive-volume-header input[type="range"] {
  width: 70px;
  height: 3px;
  -webkit-appearance: none;
  appearance: none;
  background: rgba(100, 210, 230, 0.25);
  border-radius: 2px;
  outline: none;
}

.dive-volume-header input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #64D2E6;
  cursor: pointer;
}

.dive-volume-header input[type="range"]::-moz-range-thumb {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #64D2E6;
  border: none;
  cursor: pointer;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .wave,
  .abyss-parallax > use {
    animation: none !important;
  }

  .abyss-blob {
    animation: none !important;
  }

  .abyss-singularity {
    animation: none !important;
    opacity: 0.5;
  }

  .osminok-bio,
  .marine-snow {
    display: none !important;
  }

  .ringwave::before,
  .ringwave::after,
  .ringswell {
    animation: none !important;
  }

  .dive-overlay__title {
    animation: none !important;
  }
}
