/* 字海 Word Sea — one stylesheet for the three scenes.
   The canvas paints everything atmospheric; this file only places text and controls. */

/* ——— Tokens ——— */
:root {
  color-scheme: dark;
  --accent: #ffc59a;
  --ink: #f5eee6;
  --ink-soft: #dedbd6;
  --ink-faint: #bbbfc6;
  --line: rgb(255 255 255 / .13);
  --line-strong: rgb(255 255 255 / .24);
  --glass: transparent;
  --glass-strong: rgb(11 14 22 / .88);
  --text-shadow: 0 1px 2px rgb(2 5 10 / .95), 0 2px 8px rgb(2 5 10 / .9), 0 4px 20px rgb(2 5 10 / .6);
  --shadow: 0 18px 50px rgb(0 0 0 / .32);
  --serif: "Songti SC", "Noto Serif SC", "Source Han Serif SC", "Noto Serif CJK SC", "STSong", "Times New Roman", serif;
  --sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, "JetBrains Mono", Menlo, Consolas, monospace;
  --ease: cubic-bezier(.22, .8, .24, 1);
  --edge: clamp(20px, 3.4vw, 52px);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --harbor: 0;
  --selection: color-mix(in srgb, var(--accent) 38%, transparent);
}

/* ——— Base ——— */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; width: 100%; height: 100%; overflow: hidden; background: #0b0d16; }
body { height: 100dvh; height: var(--viewport-height, 100dvh); font: 15px/1.6 var(--sans); color: var(--ink); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; border-radius: 6px; }
::selection { background: var(--selection); color: #fffaf3; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
[hidden] { display: none !important; }

#wordsea-scene { position: relative; width: 100%; height: 100%; overflow: hidden; isolation: isolate; }
#scene-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: pan-y; cursor: crosshair; }
.scene-transition #scene-canvas { cursor: default; }
/* One continuous photographic grade across all three scenes. */
.scene-grade {
  position: absolute; inset: 0; pointer-events: none; z-index: 0;
  background:
    radial-gradient(120% 90% at 50% 42%, transparent 55%, rgb(4 5 10 / .38) 100%),
    linear-gradient(to top, rgb(4 6 12 / .55), transparent 26%);
}
/* Shadows belong to the letters, so the sea stays visible between them. */
:is(.masthead, .hero, .journal, .dock, .passage-nav, .passage-foot, .friends-view, .site-footer, .restore) { text-shadow: var(--text-shadow); }
:is(.weather-chip, .journal button, .journal input, .dock button, .passage-nav button) { text-shadow: inherit; }

/* Home interface leaves as the dive begins and returns as it ends. */
[data-home-ui] { transition: opacity .3s var(--ease), visibility .3s; }
.article-mode [data-home-ui], .friends-mode [data-home-ui]:not(.dock):not(.site-footer),
.immersive [data-home-ui] { opacity: 0; visibility: hidden; pointer-events: none; }
.friends-mode .dock { opacity: .0; visibility: hidden; }

/* ——— Masthead ——— */
.masthead {
  position: absolute; z-index: 3; top: calc(var(--safe-top) + clamp(22px, 4.2vh, 44px)); left: calc(var(--edge) + var(--safe-left)); right: calc(var(--edge) + var(--safe-right));
  display: flex; align-items: center; justify-content: space-between; gap: 20px; pointer-events: none;
}
.brand { display: flex; align-items: center; gap: 16px; text-decoration: none; pointer-events: auto; min-width: 0; }
.brand-seal {
  display: grid; place-items: center; width: 46px; height: 46px; flex-shrink: 0;
  font: 400 26px/1 var(--serif); color: var(--ink);
  border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent); border-radius: 12px;
  background: radial-gradient(circle at 30% 25%, color-mix(in srgb, var(--accent) 22%, transparent), transparent 70%);
  box-shadow: inset 0 0 0 4px rgb(255 255 255 / .03);
}
.brand-text { display: grid; gap: 3px; min-width: 0; }
.brand-name { font: 500 17px/1.3 var(--serif); letter-spacing: .32em; }
.brand-tagline { font-size: 12px; letter-spacing: .14em; color: var(--ink-faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.weather-chip {
  pointer-events: auto; display: inline-flex; align-items: center; gap: 10px; max-width: min(340px, 42vw);
  padding: 9px 16px 9px 12px; border: 1px solid var(--line); border-radius: 999px;
  background: var(--glass);
  font-size: 12.5px; letter-spacing: .04em; color: var(--ink-soft); transition: border-color .25s, color .25s, background .25s;
}
.weather-chip:hover { border-color: var(--line-strong); color: var(--ink); }
.weather-chip > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.weather-glyph { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; background: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent), 0 0 14px var(--accent); }

/* ——— Hero line ——— */
.hero {
  position: absolute; z-index: 2; left: calc(var(--edge) + var(--safe-left)); bottom: clamp(150px, 22vh, 230px);
  max-width: min(560px, 42vw); pointer-events: none;
}
.hero-kicker { margin: 0 0 18px; font-size: 11px; letter-spacing: .38em; color: var(--ink-faint); text-transform: uppercase; }
.hero-kicker::before { content: ''; display: inline-block; width: 28px; height: 1px; margin-right: 14px; vertical-align: middle; background: var(--accent); }
.hero-line {
  margin: 0; font: 400 clamp(28px, 2.9vw, 42px)/1.45 var(--serif); letter-spacing: .1em;
  text-wrap: balance;
}
.hero-hint { margin: 20px 0 0; font-size: 12px; letter-spacing: .12em; color: var(--ink-faint); }

/* ——— Journal ——— */
.journal {
  position: absolute; z-index: 2; top: clamp(130px, 19vh, 200px); bottom: clamp(118px, 15vh, 150px); right: calc(var(--edge) + var(--safe-right));
  width: min(400px, 35vw); display: flex; flex-direction: column; min-height: 0;
}
/* An uneven wash supports the text, with feathered edges instead of a panel. */
.journal::before, .hero::before {
  content: ''; position: absolute; z-index: -1; inset: -44px -52px -36px -48px; pointer-events: none;
  background: linear-gradient(155deg, rgb(7 18 28 / .34), rgb(5 12 21 / .42) 58%, rgb(7 18 28 / .3));
  mask-image:
    linear-gradient(90deg, transparent, #000 20%, #000 76%, transparent),
    linear-gradient(180deg, transparent, #000 12%, #000 84%, transparent);
  mask-composite: intersect;
}
.journal-label { margin: 0 0 10px; font-size: 12px; font-weight: 500; line-height: 1.7; letter-spacing: .12em; color: var(--ink-soft); text-transform: uppercase; }
.journal-label:focus { outline: 0; }
.journal-scroll {
  flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain;
  scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent;
  padding: 4px 6px 8px 4px;
  mask-image: linear-gradient(to bottom, #000 calc(100% - 20px), transparent);
}
.story-link {
  position: relative; display: grid; grid-template-columns: 30px 1fr auto; align-items: center; gap: 14px;
  padding: 16px 4px 16px 0; text-decoration: none; color: inherit;
}
.story-link::after {
  content: ''; position: absolute; left: 44px; right: 0; bottom: 0; height: 1px;
  background: linear-gradient(90deg, var(--line-strong), transparent);
}
.story-link::before {
  content: ''; position: absolute; left: 44px; right: 0; bottom: 0; height: 1px; z-index: 1;
  background: var(--accent); transform: scaleX(0); transform-origin: left; transition: transform .2s var(--ease);
}
.story-link:hover::before, .story-link:focus-visible::before { transform: scaleX(1); }
.story-number { font: 500 11px/1 var(--mono); color: color-mix(in srgb, var(--accent) 70%, var(--ink-faint)); letter-spacing: .05em; }
.story-copy { min-width: 0; }
.story-title {
  display: block; font: 500 20px/1.6 var(--serif); letter-spacing: .03em;
  transition: color .2s;
}
.story-meta { display: block; margin-top: 5px; font: 12px/1.5 var(--mono); letter-spacing: .04em; color: var(--ink-faint); }
.story-link svg { width: 16px; opacity: 0; transform: translateX(-8px); transition: opacity .3s, transform .45s var(--ease); color: var(--accent); }
.story-link:hover .story-title, .story-link:focus-visible .story-title { color: #fff; }
.story-link:hover svg, .story-link:focus-visible svg { opacity: 1; transform: none; }
.story-link.just-read { background: linear-gradient(90deg, color-mix(in srgb, var(--accent) var(--read-glow), transparent), transparent); animation: just-read 2.6s ease-out; }
.story-link.just-read .story-number { color: var(--accent); }
/* A registered percentage interpolates, so the gradient fades rather than switching off. */
@property --read-glow { syntax: '<percentage>'; inherits: false; initial-value: 0%; }
@keyframes just-read { 0%, 20% { --read-glow: 16%; } 100% { --read-glow: 0%; } }
.empty-note { font: 16px/2 var(--serif); color: var(--ink-soft); }
.journal-tools { display: grid; gap: 12px; padding-top: 16px; }
.journal-pagination:empty { display: none; }
.page-navigator { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; padding: 0; margin: 0; font: 12px/1 var(--mono); }
.page-navigator a { display: inline-grid; place-items: center; min-width: 32px; height: 32px; padding: 0 9px; border-radius: 999px; text-decoration: none; color: var(--ink-soft); border: 1px solid transparent; transition: border-color .2s, color .2s; }
.page-navigator a:hover { border-color: var(--line-strong); color: var(--ink); }
.page-navigator .current a { color: #11131b; background: var(--accent); text-shadow: none; }
.site-pages { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 13px; letter-spacing: .08em; }
.site-pages a { text-decoration: none; color: var(--ink-soft); transition: color .2s; }
.site-pages a::before { content: '◦ '; color: var(--accent); }
.site-pages a:hover { color: var(--ink); }
.site-search { display: flex; align-items: center; gap: 8px; border-bottom: 1px solid var(--line); transition: border-color .25s; }
.site-search:focus-within { border-color: var(--accent); }
.site-search input { flex: 1; min-width: 0; border: 0; background: transparent; padding: 10px 0; font-size: 13px; color: var(--ink); outline: none; }
.site-search input::placeholder { color: var(--ink-faint); }
.site-search button { display: grid; place-items: center; width: 34px; height: 34px; border: 0; background: none; color: var(--ink-soft); font-size: 16px; }
.is-loading .journal { opacity: .6; }
/* The sea keeps moving while the 404 and shore text exchange places. */
.journal-changing .journal, .journal-changing .hero { opacity: 0; pointer-events: none; }

/* ——— Not found: the way home, and one family's search ——— */
/* Follow the journal content so AJAX navigation restores the home layout too. */
#wordsea-scene:has(.lost-line) .hero { display: none; }
.journal:has(.lost-line) {
  --lost-top: 120px; --lost-bottom: 116px;
  top: calc(var(--safe-top) + var(--lost-top)); bottom: calc(var(--safe-bottom) + var(--lost-bottom));
  left: calc(var(--edge) + var(--safe-left)); right: calc(var(--edge) + var(--safe-right));
  width: min(560px, calc(100% - 2 * var(--edge) - var(--safe-left) - var(--safe-right)));
  height: max-content; max-height: calc(100% - var(--lost-top) - var(--lost-bottom) - var(--safe-top) - var(--safe-bottom));
  margin: auto; text-align: center;
}
.journal:has(.lost-line) .journal-label { flex-shrink: 0; margin-bottom: 16px; letter-spacing: .2em; }
.journal:has(.lost-line) .journal-scroll { flex: 0 1 auto; padding-inline: 8px; }
.journal:has(.lost-line) .journal-tools { width: min(400px, 100%); margin: 8px auto 0; grid-template-columns: minmax(0, 1fr); flex-shrink: 0; }
.journal:has(.lost-line) .site-pages { justify-content: center; }
.lost-line { margin: 4px 0 22px; font: 400 clamp(24px, 3vw, 32px)/1.6 var(--serif); letter-spacing: .08em; text-wrap: balance; }
.journal:has(.lost-line) .missing { width: min(460px, 100%); margin-inline: auto; text-align: left; }
.missing { position: relative; margin-top: 30px; padding-top: 20px; animation: fade-in .3s ease-out both; }
.missing::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 1px; background: linear-gradient(90deg, var(--line-strong), transparent); }
.missing-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.missing-head h3 { margin: 0; font-size: 11.5px; font-weight: 500; letter-spacing: .18em; color: var(--accent); }
.missing-next { border: 0; background: none; padding: 6px 0; font-size: 12px; letter-spacing: .12em; color: var(--ink-soft); transition: color .2s, opacity .2s; }
.missing-next:hover { color: var(--ink); }
.missing-next:focus-visible { outline: 1px solid color-mix(in srgb, var(--accent) 60%, transparent); outline-offset: 4px; border-radius: 4px; }
.missing-next[aria-disabled="true"] { opacity: .45; cursor: progress; }
.missing-lead { margin: 8px 0 18px; font: 15px/1.8 var(--serif); text-wrap: pretty; color: var(--ink-soft); }
.missing-person { display: grid; grid-template-columns: 84px minmax(0, 1fr); gap: 18px; align-items: start; transition: opacity .3s; }
.missing[aria-busy="true"] .missing-person { opacity: .55; }
.missing-person > * { animation: fade-in .25s ease-out both; }
.missing-frame { display: grid; place-items: center; aspect-ratio: 4 / 5; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.missing-frame::before { content: '寻'; grid-area: 1 / 1; font: 26px var(--serif); color: var(--ink-faint); }
.missing-frame img { grid-area: 1 / 1; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .6s; }
.missing-frame.has-photo img { opacity: 1; }
.missing-name { margin: 0 0 10px; font: 400 19px/1.4 var(--serif); letter-spacing: .08em; overflow-wrap: anywhere; }
.missing-name small { display: block; margin-top: 4px; font: 12px/1.5 var(--sans); letter-spacing: .1em; color: var(--ink-faint); }
.missing-facts { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 3px 12px; margin: 0; font-size: 12.5px; line-height: 1.65; }
.missing-facts dt { color: var(--ink-faint); letter-spacing: .1em; }
.missing-facts dd { margin: 0; color: var(--ink-soft); overflow-wrap: anywhere; }
.missing-note { margin: 18px 0 0; font-size: 12.5px; color: var(--ink-soft); }
.missing-note a { margin: 0 2px; color: var(--accent); text-decoration: none; border-bottom: 1px solid color-mix(in srgb, var(--accent) 40%, transparent); }
.missing-source { margin: 4px 0 0; font-size: 11px; letter-spacing: .06em; color: var(--ink-faint); }

/* ——— Dock ——— */
.dock {
  position: absolute; z-index: 3; left: 50%; bottom: calc(var(--safe-bottom) + clamp(18px, 3.2vh, 32px)); transform: translateX(-50%);
  display: flex; align-items: center; gap: 6px; padding: 6px; max-width: calc(100% - 2 * var(--edge));
  border: 1px solid var(--line); border-radius: 999px; background: var(--glass);
  box-shadow: var(--shadow), inset 0 1px 0 rgb(255 255 255 / .06);
}
.dock-icon {
  display: grid; place-items: center; width: 40px; height: 40px; flex-shrink: 0; padding: 0;
  border: 1px solid transparent; border-radius: 50%; background: rgb(255 255 255 / .05); color: var(--ink);
  transition: background .2s, border-color .2s, transform .2s;
}
.dock-icon:hover { background: rgb(255 255 255 / .1); border-color: var(--line); }
.dock-icon:active { transform: scale(.94); }
.dock-icon[aria-pressed="true"] { color: var(--accent); }
.themes { display: flex; gap: 2px; padding: 0 4px; }
.theme {
  border: 0; border-radius: 999px; padding: 9px 13px; background: transparent; font-size: 13px; letter-spacing: .06em; white-space: nowrap;
  color: var(--ink-faint); transition: color .2s, background .25s, box-shadow .25s;
}
.theme:hover { color: var(--ink); }
.theme[aria-pressed="true"] { color: #12131a; background: var(--accent); text-shadow: none; }
.range-group { display: flex; align-items: center; gap: 10px; padding: 0 12px; border-left: 1px solid var(--line); }
.range-group label { font-size: 12.5px; color: var(--ink-soft); white-space: nowrap; letter-spacing: .06em; }
.range-group output { min-width: 32px; font: 11px/1 var(--mono); color: var(--ink-faint); text-align: right; font-variant-numeric: tabular-nums; }
input[type="range"] { --fill: 50%; width: 96px; height: 24px; margin: 0; appearance: none; background: transparent; cursor: pointer; }
input[type="range"]::-webkit-slider-runnable-track { height: 3px; border-radius: 3px; background: linear-gradient(90deg, var(--accent) var(--fill), rgb(255 255 255 / .18) var(--fill)); }
input[type="range"]::-moz-range-track { height: 3px; border-radius: 3px; background: rgb(255 255 255 / .18); }
input[type="range"]::-moz-range-progress { height: 3px; border-radius: 3px; background: var(--accent); }
input[type="range"]::-webkit-slider-thumb { appearance: none; width: 14px; height: 14px; margin-top: -5.5px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 30%, transparent), 0 2px 8px rgb(0 0 0 / .4); transition: box-shadow .2s; }
input[type="range"]::-moz-range-thumb { width: 14px; height: 14px; border: 0; border-radius: 50%; background: #fff; box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 30%, transparent); }
input[type="range"]:hover::-webkit-slider-thumb { box-shadow: 0 0 0 6px color-mix(in srgb, var(--accent) 34%, transparent), 0 2px 8px rgb(0 0 0 / .4); }
.dock-toggle {
  display: flex; align-items: center; gap: 7px; height: 40px; padding: 0 14px; border: 0; border-left: 1px solid var(--line);
  border-radius: 0; background: none; font-size: 12.5px; color: var(--ink-soft); transition: color .2s, opacity .2s;
}
.dock-toggle[aria-pressed="false"] { opacity: .45; }
.dock-toggle:hover { color: var(--ink); }
.sea-settings-open { display: none; }
.restore { position: absolute; z-index: 5; right: calc(var(--edge) + var(--safe-right)); bottom: calc(var(--safe-bottom) + 28px); opacity: 0; visibility: hidden; background: var(--glass); border-color: var(--line); transition: opacity .4s, visibility .4s; }
.immersive .restore { opacity: .7; visibility: visible; }
.restore:hover { opacity: 1; }
.site-footer { position: absolute; z-index: 2; left: calc(var(--edge) + var(--safe-left)); bottom: calc(var(--safe-bottom) + 12px); font-size: 11px; color: var(--ink-faint); letter-spacing: .04em; }
.site-footer a { margin-left: 10px; text-decoration: none; }
.site-footer a:hover { color: var(--ink); }
#site-status { position: absolute; z-index: 6; top: calc(var(--safe-top) + 24px); left: 50%; transform: translateX(-50%); font-size: 12px; color: var(--ink-soft); pointer-events: none; }
.is-loading #site-status::before { content: '正在沿着文字前行…'; padding: 8px 14px; border-radius: 999px; background: var(--glass-strong); }
.scene-error { position: absolute; z-index: 6; top: 90px; right: var(--edge); padding: 10px 16px; border-radius: 12px; background: var(--glass-strong); border: 1px solid var(--line); font-size: 12px; }
.scene-error p { margin: 0; }

/* ——— Sheets and dialogs ——— */
dialog { color: var(--ink); }
.sea-settings-dialog, .weather-dialog {
  width: min(460px, calc(100% - 24px)); max-height: calc(var(--viewport-height, 100dvh) - 32px); padding: 26px;
  border: 1px solid var(--line); border-radius: 22px; background: linear-gradient(160deg, rgb(24 28 40 / .92), rgb(10 12 20 / .95));
  box-shadow: 0 30px 90px rgb(0 0 0 / .5), inset 0 1px 0 rgb(255 255 255 / .06); overflow: auto; overscroll-behavior: contain;
}
.sea-settings-dialog::backdrop, .weather-dialog::backdrop { background: rgb(3 5 10 / .45); }
.sea-settings-dialog[open], .weather-dialog[open] { animation: sheet-in .35s var(--ease); }
@keyframes sheet-in { from { opacity: 0; transform: translateY(14px) scale(.98); } }
.sheet-heading, .weather-heading { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.sheet-heading h2, .weather-heading h2 { margin: 0; font: 400 22px/1.4 var(--serif); letter-spacing: .1em; }
.sheet-close, .weather-close { display: grid; place-items: center; width: 36px; height: 36px; flex-shrink: 0; padding: 0; border: 1px solid var(--line); border-radius: 50%; background: rgb(255 255 255 / .04); font-size: 20px; line-height: 1; color: var(--ink-soft); }
.sheet-close:hover, .weather-close:hover { color: var(--ink); border-color: var(--line-strong); }
.sea-settings-body { display: grid; gap: 22px; margin-top: 22px; }
.sea-settings-body .themes { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; padding: 0; }
.sea-settings-body .theme { min-height: 44px; border: 1px solid var(--line); border-radius: 12px; }
.sea-settings-body .range-group { display: grid; grid-template-columns: 56px 1fr 40px; padding: 0; border: 0; }
.sea-settings-body input[type="range"] { width: 100%; height: 44px; }
.sea-settings-body .dock-toggle { justify-content: center; height: 46px; border: 1px solid var(--line); border-radius: 12px; }
.weather-description { margin: 12px 0 22px; font-size: 13px; line-height: 1.8; color: var(--ink-soft); }
.weather-toggle { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; font-size: 14px; }
.weather-toggle input { width: 18px; height: 18px; accent-color: var(--accent); }
.weather-search { display: flex; gap: 8px; align-items: end; }
.weather-search label { flex: 1; min-width: 0; font-size: 12px; color: var(--ink-faint); }
.weather-search input, .weather-preview select {
  display: block; width: 100%; margin-top: 8px; padding: 11px 14px; border: 1px solid var(--line); border-radius: 12px;
  background: rgb(0 0 0 / .25); color: var(--ink); font-size: 14px; outline: none; transition: border-color .2s;
}
.weather-search input:focus, .weather-preview select:focus { border-color: var(--accent); }
.weather-dialog button:not(.weather-close) { padding: 11px 15px; border: 1px solid var(--line); border-radius: 12px; background: rgb(255 255 255 / .05); font-size: 13px; transition: background .2s, border-color .2s; }
.weather-dialog button:not(.weather-close):hover { background: rgb(255 255 255 / .1); border-color: var(--line-strong); }
.weather-dialog button:disabled { opacity: .45; cursor: wait; }
.weather-results { display: grid; gap: 6px; margin: 12px 0; padding: 0; list-style: none; }
.weather-results:empty { display: none; }
.weather-results button { width: 100%; text-align: left; }
.weather-location-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0 10px; }
.weather-location-note, .weather-preview-note { margin: 0 0 14px; font-size: 11.5px; line-height: 1.8; color: var(--ink-faint); }
.weather-status { min-height: 22px; font-size: 13px; line-height: 1.8; color: var(--ink-soft); overflow-wrap: anywhere; }
.weather-preview { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--line); font-size: 13px; }
.weather-preview select { width: auto; max-width: 60%; margin: 0; }
.weather-attribution { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); font-size: 11px; line-height: 1.9; color: var(--ink-faint); }
.weather-attribution a { color: var(--ink-soft); text-underline-offset: 3px; }
.weather-attribution small { display: block; font-size: 11px; }

/* ——— Shared navigation for the corridor and the harbour ——— */
.passage-nav {
  position: absolute; z-index: 4; top: calc(var(--safe-top) + 24px); left: calc(var(--edge) + var(--safe-left)); right: calc(var(--edge) + var(--safe-right));
  display: flex; align-items: center; justify-content: space-between; gap: 16px; pointer-events: auto;
}
.pill-link {
  display: inline-flex; align-items: center; gap: 10px; height: 42px; padding: 0 18px 0 14px; border: 1px solid var(--line); border-radius: 999px;
  background: var(--glass);
  text-decoration: none; font-size: 13px; letter-spacing: .1em; color: var(--ink-soft); transition: color .2s, border-color .2s, gap .3s var(--ease);
}
.pill-link:hover { color: var(--ink); border-color: var(--line-strong); gap: 14px; }
.passage-name { font-size: 10.5px; letter-spacing: .4em; color: var(--ink-faint); white-space: nowrap; }
.passage-tools { display: flex; align-items: center; gap: 8px; }
.passage-tools .dock-icon { background: var(--glass); border-color: var(--line); }
.pick-entry {
  height: 42px; padding: 0 18px; border: 1px solid color-mix(in srgb, #ffd28a 45%, transparent); border-radius: 999px;
  background: var(--glass); color: var(--ink-soft); font-size: 13px; letter-spacing: .14em;
  transition: background .2s, box-shadow .3s;
}
.pick-entry:hover { background: color-mix(in srgb, #ffd28a 18%, rgb(10 12 20 / .4)); box-shadow: 0 0 24px rgb(255 210 138 / .25); }

/* ——— The corridor and the article ——— */
.article-view { position: absolute; inset: 0; z-index: 2; opacity: 0; pointer-events: none; --reading: min(700px, 100%); }
/* A stationary wash follows the reading view's fade, leaving the walls visible. */
.article-view::before {
  content: ''; position: absolute; z-index: -1; pointer-events: none;
  inset: calc(var(--safe-top) + 70px) max(0px, calc((100% - var(--reading)) / 2 - 124px)) calc(var(--safe-bottom) + 14px);
  background: linear-gradient(155deg, rgb(7 14 23 / .4), rgb(5 11 19 / .56) 56%, rgb(8 16 25 / .44));
  mask-image:
    linear-gradient(90deg, transparent, #000 var(--reading-feather, 72px), #000 calc(100% - var(--reading-feather, 72px)), transparent),
    linear-gradient(180deg, transparent, #000 48px, #000 calc(100% - 48px), transparent);
  mask-composite: intersect;
}
.article-view > * { pointer-events: auto; }
.article-scroll {
  position: absolute; inset: calc(var(--safe-top) + 92px) 0 calc(var(--safe-bottom) + 34px); overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; outline: none;
  padding: 28px max(24px, calc((100% - var(--reading)) / 2)) 64px;
  scrollbar-width: thin; scrollbar-color: rgb(255 255 255 / .16) transparent;
  mask-image: linear-gradient(to bottom, transparent, #000 16px, #000 calc(100% - 28px), transparent);
}
.article-text { position: relative; max-width: var(--reading); margin: 0 auto; font: 17.5px/1.95 var(--sans); letter-spacing: .02em; color: #dce3ea; overflow-wrap: anywhere; text-shadow: 0 1px 2px #02050a, 0 2px 8px rgb(2 5 10 / .9); }
.article-text :is(pre, .code-window, button, input, textarea) { text-shadow: none; }
.article-meta { margin-bottom: 18px; font: 12px/1.6 var(--mono); letter-spacing: .12em; color: color-mix(in srgb, var(--accent) 55%, #8e9aa8); }
.article-meta a { text-decoration: none; }
.article-meta a:hover { color: var(--ink); }
.article-text h1 { margin: 0 0 22px; font: 400 clamp(30px, 3.4vw, 42px)/1.4 var(--serif); letter-spacing: .1em; color: #f5f2ee; text-wrap: balance; }
.article-text h1:focus { outline: 0; }
.article-reading-info { display: flex; flex-wrap: wrap; gap: 6px 22px; margin: 0 0 34px; padding-bottom: 26px; border-bottom: 1px solid var(--line); font-size: 12.5px; color: #8f9cab; }
.article-reading-info span::before { content: ''; display: inline-block; width: 5px; height: 5px; margin-right: 9px; border-radius: 50%; vertical-align: middle; background: var(--accent); opacity: .8; }
.article-reading-info time { color: #c3ccd6; }
.article-freshness { margin: -10px 0 30px; padding: 14px 18px; border: 1px solid rgb(232 196 132 / .22); border-radius: 14px; background: rgb(232 196 132 / .06); font-size: 13.5px; line-height: 1.85; color: #c9c4b8; }
.article-freshness-label { display: block; margin-bottom: 2px; font-size: 11px; letter-spacing: .14em; color: #e8c484; }

.post-content { text-autospace: normal; }
.post-content p { margin: 0 0 1.25em; }
.post-content :is(p, li, blockquote, figcaption) { text-wrap: pretty; }
.post-content :is(h1, h2, h3, h4) { text-wrap: balance; }
.post-content :is(h1, h2, h3, h4) { scroll-margin-top: 24px; color: #f1f3f4; font-family: var(--serif); font-weight: 400; }
.post-content h1, .post-content h2 { margin: 2.3em 0 .8em; font-size: 26px; line-height: 1.5; letter-spacing: .08em; }
.post-content h2::before { content: ''; display: block; width: 26px; height: 2px; margin-bottom: 16px; background: var(--accent); box-shadow: 0 0 12px var(--accent); }
.post-content h3 { margin: 1.9em 0 .6em; font-size: 20.5px; line-height: 1.6; letter-spacing: .05em; }
.post-content h4 { margin: 1.6em 0 .5em; font-size: 17.5px; }
.post-content > :is(h1, h2, h3):first-child { margin-top: 0; }
.post-content :is(h1, h2, h3) + :is(h1, h2, h3) { margin-top: .9em; }
.post-content [tabindex]:focus { outline: none; }
.post-content [tabindex]:focus-visible { outline: 1px solid color-mix(in srgb, var(--accent) 60%, transparent); outline-offset: 8px; }
.post-content strong, .post-content b { font-weight: 650; color: #fbfcfd; }
.post-content a[href]:not([href=""]):not(:has(img, picture, svg)) {
  color: color-mix(in srgb, var(--accent) 70%, #dfefff); text-decoration: underline; text-decoration-thickness: 1px;
  text-decoration-color: color-mix(in srgb, var(--accent) 40%, transparent); text-underline-offset: .28em; transition: text-decoration-color .2s, color .2s;
}
.post-content a[href]:not([href=""]):not(:has(img, picture, svg)):hover { color: #fff; text-decoration-color: currentColor; }
.post-content blockquote {
  position: relative; margin: 2em 0; padding: 4px 0 4px 26px; border-left: 2px solid color-mix(in srgb, var(--accent) 60%, transparent);
  font: 18.5px/1.9 var(--serif); color: #c9d2db;
}
.post-content blockquote > :last-child { margin-bottom: 0; }
.post-content ul, .post-content ol { padding-left: 1.4em; margin: 0 0 1.25em; }
.post-content li { margin: .35em 0; }
.post-content li::marker { color: color-mix(in srgb, var(--accent) 70%, var(--ink-faint)); }
.post-content hr { height: 1px; margin: 3em auto; border: 0; width: 40%; background: linear-gradient(90deg, transparent, var(--line-strong), transparent); }
.post-content :where(p, blockquote, li, dt, dd, h1, h2, h3, h4, h5, h6, figcaption, span, a, strong, b, em, i, nobr):not(pre *, table *) { white-space: normal !important; }
.post-content img:not(.emoji):not(.smiley) { display: block; max-width: 100%; height: auto; margin: 2em auto; border-radius: 14px; box-shadow: 0 20px 50px rgb(0 0 0 / .45); }
.post-content img[data-wordsea-zoom] { cursor: zoom-in; transition: transform .4s var(--ease); }
.post-content img[data-wordsea-zoom]:hover { transform: scale(1.01); }
.post-content figure { margin: 2em 0; }
.post-content figcaption { margin-top: -1em; text-align: center; font-size: 12.5px; color: #8b97a4; }
.post-content video, .post-content iframe { max-width: 100%; border: 0; border-radius: 12px; }
.post-content table { display: block; max-width: 100%; overflow-x: auto; margin: 2em 0; border-collapse: collapse; font-size: 14px; }
.post-content th { text-align: left; font-weight: 600; color: #eef1f4; border-bottom: 1px solid var(--line-strong); }
.post-content th, .post-content td { padding: 10px 18px 10px 0; }
.post-content td { border-bottom: 1px solid var(--line); color: #c8d0d8; line-height: 1.7; vertical-align: top; }
.post-content code { padding: .12em .42em; border-radius: 6px; background: rgb(255 255 255 / .07); font: .88em/1.6 var(--mono); letter-spacing: 0; overflow-wrap: anywhere; }
.post-content pre code { padding: 0; background: none; overflow-wrap: normal; }
.post-content pre { margin: 0; padding: 18px 22px; overflow: auto; font: 13.5px/1.8 var(--mono); letter-spacing: 0; tab-size: 2; }

.code-window { margin: 2em 0; overflow: hidden; border: 1px solid rgb(255 255 255 / .09); border-radius: 14px; background: #0a0e15; box-shadow: 0 18px 44px rgb(0 0 0 / .35); }
.code-window-bar { display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 12px 0 16px; border-bottom: 1px solid rgb(255 255 255 / .06); background: rgb(255 255 255 / .025); }
.code-window-dot { width: 11px; height: 11px; border-radius: 50%; background: #ff5f57; }
.code-window-dot:nth-child(2) { background: #febc2e; }
.code-window-dot:nth-child(3) { background: #28c840; }
.code-window-label { margin-left: auto; font: 11px/1 var(--mono); letter-spacing: .06em; color: #7d8896; text-transform: lowercase; }
.code-copy { min-width: 56px; height: 28px; margin-left: 10px; padding: 0 10px; border: 1px solid rgb(255 255 255 / .1); border-radius: 8px; background: rgb(255 255 255 / .04); font-size: 12px; color: #a9b4c0; transition: background .2s, color .2s; }
.code-copy:last-child:nth-child(4) { margin-left: auto; }
.code-copy:hover { background: rgb(255 255 255 / .1); color: #fff; }
.code-copy[aria-busy="true"] { cursor: progress; }
.post-content pre code .token.comment, .post-content pre code .token.prolog, .post-content pre code .token.doctype, .post-content pre code .token.cdata { color: #9aa7b8; }
.post-content pre code .token.punctuation { color: #98a3b1; }
.post-content pre code .token.keyword, .post-content pre code .token.atrule { color: #c8a1ff; }
.post-content pre code .token.string, .post-content pre code .token.char, .post-content pre code .token.attr-value, .post-content pre code .token.inserted { color: #a8dba8; }
.post-content pre code .token.number, .post-content pre code .token.boolean, .post-content pre code .token.constant, .post-content pre code .token.regex, .post-content pre code .token.symbol { color: #f5bd85; }
.post-content pre code .token.function, .post-content pre code .token.function-variable { color: #82c4ff; }
.post-content pre code .token.operator, .post-content pre code .token.url, .post-content pre code .token.entity { color: #86d9e0; }
.post-content pre code .token.class-name, .post-content pre code .token.attr-name, .post-content pre code .token.builtin { color: #ead08f; }
.post-content pre code .token.property, .post-content pre code .token.tag, .post-content pre code .token.deleted, .post-content pre code .token.important { color: #f3a6a6; }

.post-tags { margin: 2.4em 0 0; font-size: 12.5px; color: var(--ink-faint); }
.post-tags a { display: inline-block; margin: 0 6px 6px 0; padding: 3px 12px; border: 1px solid var(--line); border-radius: 999px; text-decoration: none; color: var(--ink-soft); }
.post-tags a:hover { border-color: var(--accent); color: var(--ink); }
.reading-end { position: relative; margin: 72px 0 48px; padding-top: 48px; text-align: center; }
.reading-end::before { content: '◇'; position: absolute; top: -10px; left: 50%; transform: translateX(-50%); color: var(--accent); font-size: 14px; }
.reading-end::after { content: ''; position: absolute; top: 0; left: 18%; right: 18%; height: 1px; background: linear-gradient(90deg, transparent, var(--line-strong) 30%, transparent 46%, transparent 54%, var(--line-strong) 70%, transparent); }
.article-text .reading-end-note { margin: 0 0 30px; font: 400 23px/1.8 var(--serif); letter-spacing: .2em; color: #e3e8ec; }
.author-signature { display: inline-flex; align-items: center; gap: 14px; margin: 0 0 40px; text-align: left; }
.author-seal { display: grid; place-items: center; width: 36px; height: 40px; border: 1px solid rgb(214 104 86 / .55); border-radius: 4px; transform: rotate(-5deg); color: #e08a78; background: rgb(214 104 86 / .08); font: 22px/1 var(--serif); }
.author-name { font-size: 13px; letter-spacing: .18em; color: #d0d8df; }
.article-text .author-signature p { margin: 2px 0 0; font-size: 11.5px; letter-spacing: .12em; color: #7f8b98; }
.post-near { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin: 0 0 30px; text-align: left; }
.post-near > div { position: relative; min-width: 0; padding: 16px 18px; border: 1px solid var(--line); border-radius: 14px; background: rgb(255 255 255 / .025); transition: border-color .25s, background .25s; }
.post-near > div:has(a[href]):is(:hover, :focus-within) { border-color: var(--line-strong); background: rgb(255 255 255 / .05); }
.post-near > div:last-child { text-align: right; }
.reading-near-label { display: block; margin-bottom: 6px; font: 11px/1.4 var(--mono); letter-spacing: .1em; color: #7f8b98; }
.post-near a { display: block; font: 15px/1.7 var(--serif); text-decoration: none; color: #d6dde4; }
.post-near a::after { content: ''; position: absolute; inset: 0; border-radius: 14px; }
.post-near a:focus-visible { outline: 0; }
.post-near a:focus-visible::after { outline: 2px solid var(--accent); outline-offset: 3px; }
.post-near a:hover { color: #fff; }
.reading-return { display: inline-flex; align-items: center; gap: 8px; height: 42px; padding: 0 22px; border: 1px solid var(--line); border-radius: 999px; text-decoration: none; font-size: 13px; letter-spacing: .14em; color: var(--ink-soft); transition: border-color .2s, color .2s, box-shadow .3s; }
.reading-return:hover { border-color: var(--accent); color: var(--ink); box-shadow: 0 0 22px color-mix(in srgb, var(--accent) 25%, transparent); }
.reading-resume { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 0 0 30px; padding: 12px 14px 12px 18px; border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent); border-radius: 14px; background: color-mix(in srgb, var(--accent) 7%, transparent); font-size: 13.5px; color: var(--ink-soft); }
.reading-resume > span { flex: 1; min-width: 130px; }
.reading-resume button { height: 36px; padding: 0 14px; border: 1px solid var(--line); border-radius: 10px; background: rgb(255 255 255 / .05); }
.reading-resume button:first-of-type { border-color: transparent; background: var(--accent); color: #12131a; }
.reading-resume button:last-child { border-color: transparent; background: none; color: var(--ink-faint); }

/* Comments */
.comments { margin-top: 48px; padding-top: 30px; border-top: 1px solid var(--line); font-size: 14.5px; }
.comments h2 { margin: 0 0 18px; font: 400 20px/1.5 var(--serif); letter-spacing: .1em; color: #eef1f4; }
.comment-list, .comment-list ol { list-style: none; padding: 0; margin: 0; }
.comment-list .comment-children { padding-left: 22px; border-left: 1px solid var(--line); }
.comment-body { padding: 18px 0; border-bottom: 1px solid var(--line); line-height: 1.85; }
.comment-author { display: flex; align-items: center; gap: 10px; }
.comment-author .avatar { width: 30px; height: 30px; border-radius: 50%; }
.comment-author cite { font-style: normal; font-weight: 600; color: #e7ebef; }
.comment-meta, .comment-reply, .cancel-comment-reply { font-size: 12px; color: var(--ink-faint); }
.comment-meta a, .comment-reply a, .cancel-comment-reply a { text-decoration: none; }
.comment-content p { margin: 10px 0; }
.comment-form { font-size: 13px; }
.comment-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.comment-fields label:last-child { grid-column: 1 / -1; }
.comment-form label { display: block; color: var(--ink-faint); }
.comment-form input, .comment-form textarea, .protected input {
  display: block; width: 100%; margin: 7px 0 14px; padding: 11px 14px; border: 1px solid var(--line); border-radius: 12px;
  background: rgb(255 255 255 / .03); color: var(--ink); font-size: 14px; line-height: 1.6; outline: none; transition: border-color .2s, background .2s;
}
.comment-form input:focus, .comment-form textarea:focus, .protected input:focus { border-color: var(--accent); background: rgb(255 255 255 / .05); }
.comment-form textarea { resize: vertical; }
.submit, .protected button, .protected input[type="submit"] { width: auto; padding: 11px 22px; border: 0; border-radius: 12px; background: var(--accent); color: #12131a; font-weight: 600; letter-spacing: .08em; cursor: pointer; }
.comments .page-navigator { margin-top: 20px; }

/* Reading cues */
.reading-progress { position: absolute; z-index: 5; top: 0; left: 0; right: 0; height: 2px; background: rgb(255 255 255 / .04); pointer-events: none; }
.reading-progress-fill { display: block; height: 100%; transform: scaleX(0); transform-origin: left; background: linear-gradient(90deg, color-mix(in srgb, var(--accent) 40%, transparent), var(--accent)); box-shadow: 0 0 12px var(--accent); }
.reading-toc { position: absolute; z-index: 5; top: 50%; right: calc(var(--edge) + var(--safe-right)); transform: translateY(-50%); }
.reading-toc-toggle { display: flex; flex-direction: column; align-items: flex-end; justify-content: center; gap: 6px; width: 44px; height: 48px; padding: 10px; border: 0; border-radius: 12px; background: transparent; color: var(--ink-faint); }
.reading-toc-toggle span { width: 20px; height: 1.5px; border-radius: 2px; background: currentColor; transition: width .3s var(--ease); }
.reading-toc-toggle span:nth-child(2) { width: 12px; }
.reading-toc-toggle:hover, .reading-toc.is-open .reading-toc-toggle { color: var(--ink); background: var(--glass); }
.reading-toc.is-open .reading-toc-toggle span { width: 20px; }
.reading-toc-panel {
  position: absolute; top: 50%; right: 52px; width: 272px; max-width: calc(100vw - 80px); padding: 20px 14px 14px 18px;
  border: 1px solid var(--line); border-radius: 18px; background: var(--glass-strong);
  box-shadow: var(--shadow); opacity: 0; visibility: hidden; transform: translate(8px, -50%); transition: opacity .25s, transform .35s var(--ease), visibility .25s;
}
.reading-toc.is-open .reading-toc-panel { opacity: 1; visibility: visible; transform: translate(0, -50%); }
.reading-toc-label { margin: 0 0 10px; font-size: 10.5px; letter-spacing: .3em; color: var(--ink-faint); }
.reading-toc-list { max-height: min(56vh, 420px); margin: 0; padding: 0; list-style: none; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
.reading-toc-list li { display: flex; align-items: center; gap: 4px; min-width: 0; }
.reading-toc-list li > a { position: relative; flex: 1; min-width: 0; padding: 7px 4px 7px 14px; font-size: 13px; line-height: 1.6; text-decoration: none; color: var(--ink-faint); transition: color .2s; }
.reading-toc-list li > a::before { content: ''; position: absolute; left: 0; top: 50%; width: 5px; height: 5px; margin-top: -2.5px; border-radius: 50%; background: var(--line-strong); transition: background .2s, box-shadow .2s; }
.reading-toc-list .reading-toc-sub > a { padding-left: 26px; font-size: 12.5px; }
.reading-toc-list .reading-toc-sub > a::before { left: 12px; width: 3px; height: 3px; margin-top: -1.5px; }
.reading-toc-list [data-level="2"] > a { padding-left: 38px; }
.reading-toc-list li > a:hover, .reading-toc-list li > a[aria-current] { color: var(--ink); }
.reading-toc-list li > a[aria-current]::before { background: var(--accent); box-shadow: 0 0 8px var(--accent); }
.reading-section-copy { flex-shrink: 0; padding: 4px 8px; border: 0; border-radius: 8px; background: none; font-size: 11px; color: var(--ink-faint); opacity: 0; transition: opacity .2s, background .2s; }
.reading-toc-list li:hover .reading-section-copy, .reading-section-copy:focus-visible, .reading-section-copy[aria-busy] { opacity: 1; }
.reading-section-copy:hover { background: rgb(255 255 255 / .08); color: var(--ink); }
.passage-foot { position: absolute; z-index: 3; bottom: calc(var(--safe-bottom) + 16px); left: 0; right: 0; margin: 0; text-align: center; font-size: 11px; letter-spacing: .3em; color: rgb(255 226 180 / .4); pointer-events: none; }

/* The picked quotation */
.collection-card {
  position: fixed; z-index: 20; inset: auto auto calc(var(--safe-bottom) + 28px) calc(var(--edge) + var(--safe-left)); margin: 0;
  width: 360px; max-width: calc(100vw - 32px); max-height: calc(var(--viewport-height, 100dvh) - 120px); overflow: auto; overscroll-behavior: contain;
  padding: 26px 28px 20px; border: 1px solid rgb(255 214 150 / .26); border-radius: 22px;
  background: linear-gradient(165deg, rgb(36 30 26 / .94), rgb(12 13 20 / .96)); box-shadow: 0 30px 80px rgb(0 0 0 / .55), 0 0 60px rgb(255 200 120 / .08);
  font: 14px/1.85 var(--sans); color: #d5d3cd; scrollbar-width: thin;
}
.collection-card[open] { animation: sheet-in .35s var(--ease); }
.collection-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 11px; letter-spacing: .24em; color: #d8b98a; }
.collection-close { display: grid; place-items: center; width: 32px; height: 32px; padding: 0; border: 1px solid rgb(255 255 255 / .1); border-radius: 50%; background: none; font-size: 18px; color: #b7aea3; }
.collection-close:hover { color: #fff; }
.collection-language { margin: 18px 0 8px; font: 11px/1.4 var(--mono); letter-spacing: .1em; color: #a29a8e; }
.collection-card blockquote { margin: 0; font: 400 23px/1.6 var(--serif); letter-spacing: .02em; color: #fff5e4; overflow-wrap: anywhere; text-shadow: 0 0 30px rgb(255 210 140 / .25); }
.collection-author { margin: 12px 0 20px; font-size: 12.5px; color: #c4a679; overflow-wrap: anywhere; }
.collection-translation, .collection-explanation { padding-top: 14px; border-top: 1px solid rgb(255 255 255 / .08); }
.collection-translation > span, .collection-explanation > span { font-size: 11px; letter-spacing: .2em; color: #918a80; }
.collection-translation p, .collection-explanation p { margin: 6px 0 14px; }
.collection-source { display: block; padding-bottom: 14px; font-size: 12px; text-decoration: none; color: #d8b98a; overflow-wrap: anywhere; }
.collection-source:hover { text-decoration: underline; text-underline-offset: 4px; }
.collection-bottom { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 12px; border-top: 1px solid rgb(255 255 255 / .08); }
.collection-copy, .collection-next { height: 38px; padding: 0 14px; border: 1px solid rgb(255 255 255 / .12); border-radius: 12px; background: rgb(255 255 255 / .04); font-size: 12.5px; color: #ddd5c8; }
.collection-next { border-color: transparent; background: #f2cf95; color: #1a1610; font-weight: 600; }
.collection-copy:hover { background: rgb(255 255 255 / .08); }

/* Image lightbox */
.image-lightbox { position: fixed; inset: 0; width: 100%; height: 100%; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; background: rgb(4 6 10 / .96); overflow: hidden; }
.image-lightbox::backdrop { background: #04060a; }
.image-lightbox[open] { display: flex; flex-direction: column; animation: fade-in .2s ease-out; }
@keyframes fade-in { from { opacity: 0; } }
.lightbox-toolbar { position: relative; flex-shrink: 0; display: flex; align-items: center; justify-content: center; gap: 8px; padding: calc(var(--safe-top) + 16px) 20px 12px; }
.lightbox-toolbar button { display: grid; place-items: center; min-width: 40px; height: 40px; padding: 0 12px; border: 1px solid var(--line); border-radius: 12px; background: rgb(255 255 255 / .05); font-size: 18px; line-height: 1; }
.lightbox-toolbar button:hover:enabled { background: rgb(255 255 255 / .1); }
.lightbox-toolbar button:disabled { opacity: .35; cursor: default; }
.lightbox-toolbar [data-zoom="reset"] { font-size: 12.5px; }
.lightbox-toolbar [data-close] { position: absolute; right: calc(var(--safe-right) + 20px); font-size: 22px; }
.lightbox-zoom { min-width: 52px; text-align: center; font: 12px/1 var(--mono); color: var(--ink-faint); }
.lightbox-stage { position: relative; flex: 1; min-height: 0; overflow: hidden; touch-action: none; user-select: none; cursor: zoom-in; outline-offset: -4px; }
.lightbox-stage.is-zoomed { cursor: grab; }
.lightbox-stage.is-manipulating { cursor: grabbing; }
.lightbox-image { position: absolute; left: 50%; top: 50%; max-width: none; max-height: none; transform-origin: center; transition: transform .15s ease-out; user-select: none; -webkit-user-drag: none; border-radius: 6px; }
.is-manipulating .lightbox-image { transition: none; }
.lightbox-caption { flex-shrink: 0; max-height: min(25%, 180px); overflow-y: auto; padding: 12px 24px calc(var(--safe-bottom) + 18px); text-align: center; font-size: 13px; line-height: 1.7; color: var(--ink-soft); overflow-wrap: anywhere; }
.lightbox-caption span { display: block; margin-top: 4px; font-size: 11px; color: var(--ink-faint); }

/* ——— The harbour ——— */
.friends-view { position: absolute; inset: 0; z-index: 2; opacity: 0; pointer-events: none; }
.friends-view > * { pointer-events: auto; }
.friends-intro { position: absolute; top: calc(var(--safe-top) + 120px); left: calc(var(--edge) + var(--safe-left)); pointer-events: none; }
.friends-eyebrow { margin: 0 0 14px; font-size: 11px; letter-spacing: .36em; color: var(--ink-faint); }
.friends-eyebrow::before { content: ''; display: inline-block; width: 28px; height: 1px; margin-right: 14px; vertical-align: middle; background: var(--accent); }
.friends-intro h1 { margin: 0 0 14px; font: 400 clamp(30px, 3vw, 44px)/1.3 var(--serif); letter-spacing: .24em; }
.friends-intro h1:focus { outline: 0; }
.friends-intro > p:last-child { margin: 0; font-size: 13px; letter-spacing: .16em; color: var(--ink-soft); }
.friend-list { position: absolute; inset: 0; pointer-events: none; }
.friend-list > [role="listitem"] { display: contents; }
.friend-link {
  position: absolute; left: 0; top: 0; display: flex; align-items: center; gap: 14px; width: 222px; min-height: 64px; padding: 10px 14px 10px 10px;
  border: 1px solid color-mix(in srgb, var(--lamp) 26%, transparent); border-radius: 16px; text-decoration: none; color: var(--ink); pointer-events: auto; opacity: 0;
  background: transparent;
  transition: border-color .3s, box-shadow .3s, background .3s;
}
.friend-link:hover, .friend-link:focus-visible { border-color: color-mix(in srgb, var(--lamp) 65%, transparent); box-shadow: 0 0 24px color-mix(in srgb, var(--lamp) 16%, transparent); }
.friend-link:focus-visible { outline-color: var(--lamp); }
.friend-avatar { display: grid; place-items: center; width: 42px; height: 42px; flex-shrink: 0; overflow: hidden; border-radius: 50%; border: 1px solid color-mix(in srgb, var(--lamp) 50%, transparent); background: color-mix(in srgb, var(--lamp) 12%, #0d1320); color: var(--lamp); box-shadow: 0 0 20px color-mix(in srgb, var(--lamp) 30%, transparent); }
.friend-avatar img { width: 100%; height: 100%; object-fit: cover; }
.friend-avatar svg { width: 20px; height: 20px; }
.friend-copy { display: grid; gap: 2px; min-width: 0; }
.friend-name { font: 400 16.5px/1.35 var(--serif); letter-spacing: .06em; overflow-wrap: anywhere; }
.friend-note { font-size: 11.5px; line-height: 1.5; color: var(--ink-soft); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.friends-empty, .friends-locked { position: absolute; left: 50%; top: 38%; transform: translateX(-50%); width: min(380px, 80vw); text-align: center; font: 18px/2.1 var(--serif); letter-spacing: .12em; color: var(--ink-soft); pointer-events: auto; }
.friends-foot { position: absolute; left: calc(var(--edge) + var(--safe-left)); bottom: calc(var(--safe-bottom) + 30px); font-size: 12px; letter-spacing: .14em; color: var(--ink-faint); pointer-events: none; }
.friends-pagination { position: absolute; right: calc(var(--edge) + var(--safe-right)); bottom: calc(var(--safe-bottom) + 22px); display: flex; align-items: center; gap: 14px; font-size: 12.5px; color: var(--ink-soft); }
.friends-pagination a { padding: 8px 14px; border: 1px solid var(--line); border-radius: 999px; text-decoration: none; }
.friends-pagination a:hover { border-color: var(--line-strong); color: var(--ink); }

/* ——— Immersive and transitions ——— */
.immersive .article-view, .immersive .friends-view { opacity: 0 !important; visibility: hidden; }
.scene-transition .journal, .scene-transition .dock { pointer-events: none; }

/* ——— Without WebGL or JavaScript: readable, quiet pages ——— */
.no-effects #scene-canvas { display: none; }
.no-effects #wordsea-scene { background: radial-gradient(120% 80% at 50% 0%, #2a3350, #0d1220 60%, #070a12); }
.no-effects .dock, .no-effects .passage-tools .dock-icon, .no-effects .pick-entry, .no-effects .passage-foot { display: none; }
body:not(.effects-ready) .article-view, body:not(.effects-ready) .friends-view { opacity: 1; }
body:not(.effects-ready) .friend-list { inset: calc(var(--safe-top) + 260px) var(--edge) 90px; display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; align-content: start; overflow: auto; pointer-events: auto; }
body:not(.effects-ready) .friend-link { position: relative; width: auto; opacity: 1; }

/* ——— Medium screens ——— */
@media (max-width: 1150px) {
  .themes .theme { padding: 9px 10px; }
  input[type="range"] { width: 70px; }
  .dock-toggle span { display: none; }
  .hero { max-width: 44vw; }
}
@media (max-width: 1150px), (max-height: 650px) {
  .friend-list { inset: calc(var(--safe-top) + 250px) var(--edge) calc(var(--safe-bottom) + 90px); display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; align-content: start; overflow-y: auto; pointer-events: auto; overscroll-behavior: contain; }
  .friend-link { position: relative; width: auto; transform: none !important; opacity: calc(var(--harbor) * 1.4 - .4) !important; }
}
@media (max-width: 900px) and (min-width: 701px) { .hero { display: none; } .journal { left: auto; width: min(460px, calc(100vw - 2 * var(--edge))); } }

/* ——— Phones and short landscape screens ——— */
@media (max-width: 700px), (max-width: 1000px) and (max-height: 500px) {
  :root { --edge: 20px; }
  body { font-size: 14px; }
  .brand-seal { width: 40px; height: 40px; font-size: 22px; border-radius: 10px; }
  .brand-name { font-size: 16px; letter-spacing: .2em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .brand-tagline { font-size: 11px; }
  .masthead { flex-wrap: nowrap; align-items: flex-start; gap: 12px; }
  .brand { gap: 12px; }
  .weather-chip { flex-shrink: 0; max-width: min(140px, 42%); min-height: 44px; padding-inline: 12px; gap: 8px; font-size: 12px; }
  .hero { display: none; }
  .journal { top: calc(var(--safe-top) + 150px); bottom: calc(var(--safe-bottom) + 96px); left: var(--edge); right: var(--edge); width: auto; }
  .journal:has(.lost-line) { --lost-top: 150px; --lost-bottom: 96px; }
  .story-link { padding: 15px 0; min-height: 64px; }
  .story-title { font-size: 17px; }
  .story-link svg { display: none; }
  .story-link:hover .story-title { transform: none; }
  .site-search input { font-size: 16px; }
  .page-navigator a { min-width: 40px; height: 40px; }
  .site-pages a { display: inline-flex; align-items: center; min-height: 40px; }
  .missing-next { min-height: 40px; }
  .dock { left: var(--edge); right: var(--edge); transform: none; max-width: none; justify-content: space-between; }
  .dock .themes, .dock .range-group, .dock #clouds { display: none; }
  .dock-icon { width: 44px; height: 44px; }
  .sea-settings-open { display: flex; align-items: center; justify-content: center; gap: 8px; flex: 1; height: 44px; border: 0; border-radius: 999px; background: rgb(255 255 255 / .05); font-size: 13.5px; letter-spacing: .1em; }
  .sea-settings-open svg { width: 16px; height: 16px; }
  .sea-settings-dialog { margin: auto auto calc(var(--safe-bottom) + 10px); border-radius: 24px; }
  .site-footer { display: none; }
  .restore { right: var(--edge); bottom: calc(var(--safe-bottom) + 20px); }

  .passage-nav { top: calc(var(--safe-top) + 14px); gap: 8px; }
  .passage-name, #passage-play, .passage-foot { display: none; }
  .pill-link { height: 44px; padding: 0 14px 0 12px; font-size: 12.5px; letter-spacing: .04em; }
  .pick-entry { height: 44px; padding: 0 14px; letter-spacing: .06em; }
  .passage-tools .dock-icon { width: 44px; height: 44px; }
  .article-view { --reading: 100%; --reading-feather: 22px; }
  .article-view::before { top: calc(var(--safe-top) + 58px); bottom: 0; }
  .article-scroll { inset: calc(var(--safe-top) + 74px) 0 0; padding: 20px max(22px, var(--safe-right)) 80px max(22px, var(--safe-left)); }
  .article-text { font-size: 17px; line-height: 1.9; }
  .article-text h1 { font-size: 28px; letter-spacing: .05em; }
  .post-content h1, .post-content h2 { font-size: 23px; }
  .post-content h3 { font-size: 19.5px; }
  .post-content pre { padding: 16px; font-size: 13px; }
  .code-window-bar { height: 46px; }
  .code-copy { height: 36px; min-width: 60px; }
  .comment-fields { grid-template-columns: 1fr; }
  .comment-form input, .comment-form textarea, .protected input { font-size: 16px; }
  .post-near { grid-template-columns: 1fr; }
  .post-near > div:last-child { text-align: left; }
  .reading-toc { top: auto; bottom: calc(var(--safe-bottom) + 18px); right: var(--edge); transform: none; }
  .reading-toc-toggle { width: 44px; height: 44px; border: 1px solid var(--line); border-radius: 50%; background: var(--glass); align-items: center; }
  .reading-toc-panel, .reading-toc.is-open .reading-toc-panel { position: fixed; top: auto; bottom: calc(var(--safe-bottom) + 74px); right: var(--edge); left: var(--edge); width: auto; max-width: none; transform: none; }
  .reading-toc-list { max-height: calc(var(--viewport-height, 100dvh) - 200px); }
  .reading-toc-list li > a { min-height: 44px; display: flex; align-items: center; font-size: 14px; }
  .reading-section-copy { opacity: 1; min-height: 40px; }
  .collection-card { left: max(12px, var(--safe-left)); right: max(12px, var(--safe-right)); bottom: max(12px, var(--safe-bottom)); width: auto; max-width: none; padding: 22px; }
  .collection-card blockquote { font-size: 20px; }
  .weather-dialog { padding: 22px; }
  .weather-search input, .weather-preview select { font-size: 16px; }
  .weather-dialog button:not(.weather-close) { min-height: 44px; }

  .friends-intro { top: calc(var(--safe-top) + 84px); }
  .friends-intro h1 { font-size: 28px; letter-spacing: .14em; }
  .friend-list { inset: calc(var(--safe-top) + 200px) var(--edge) calc(var(--safe-bottom) + 110px); grid-template-columns: 1fr; gap: 10px; }
  .friend-link { min-height: 76px; padding: 14px 16px; }
  .friends-hint { display: none; }
  .friends-foot { bottom: calc(var(--safe-bottom) + 76px); }
  .friends-pagination { left: var(--edge); right: var(--edge); bottom: calc(var(--safe-bottom) + 20px); justify-content: flex-end; }
  .lightbox-toolbar { gap: 6px; padding: calc(var(--safe-top) + 12px) 60px 12px 8px; }
  .lightbox-toolbar button { min-width: 44px; height: 44px; }

  .keyboard-open .masthead, .keyboard-open .dock, .keyboard-open .passage-nav, .keyboard-open .reading-toc { visibility: hidden; }
  .keyboard-open .journal { top: calc(var(--safe-top) + 12px); bottom: 12px; }
  .keyboard-open .journal:has(.lost-line) { --lost-top: 12px; --lost-bottom: 12px; }
  .keyboard-open .article-scroll { inset: 0; padding-top: calc(var(--safe-top) + 20px); }
}
@media (max-width: 1000px) and (max-height: 500px) and (min-width: 701px) {
  .journal { top: calc(var(--safe-top) + 80px); left: 42%; }
  .journal:has(.lost-line) { --lost-top: 80px; }
  .article-view { --reading: min(720px, 100%); }
}
@media (max-width: 700px) and (max-height: 650px), (max-width: 1000px) and (max-height: 500px) {
  .journal-label { margin-bottom: 4px; font-size: 10.5px; }
  .story-link { min-height: 60px; padding: 10px 0; }
  .lost-line { margin: 0 0 6px; font-size: 20px; line-height: 1.5; }
  .journal-scroll:has(.lost-line) { mask-image: linear-gradient(to bottom, #000 calc(100% - 8px), transparent); }
  .journal:has(.lost-line) .journal-label { margin-bottom: 8px; }
  .journal:has(.lost-line) .journal-tools { grid-template-columns: auto minmax(0, 1fr); gap: 12px; }
  .journal:has(.lost-line) .site-search { grid-column: auto; }
  .journal-tools { grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 6px 12px; padding-top: 8px; }
  .journal-pagination { min-width: 0; }
  .site-pages { justify-content: flex-end; gap: 12px; }
  .site-search { grid-column: 1 / -1; }
}
@media (hover: none) and (pointer: coarse) {
  button, a, input[type="range"] { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
