/* Design tokens and document defaults */

:root {
  color-scheme: light;
  --paper: #f6f4f1;
  --paper-soft: #fbf8f5;
  --mist: #e8eeee;
  --pool: #a7bdcb;
  --mint: #d3e0d9;
  --pink: #fbe7e7;
  --ink: #232322;
  --muted: #777b79;
  --faint: #a7aaa6;
  --line: rgba(35, 35, 34, 0.16);
  --line-strong: rgba(35, 35, 34, 0.28);
  --shadow: rgba(48, 59, 75, 0.14);
  --max: 1160px;
  --scene-image: url("assets/threshold-room.png");
  --scene-wash: rgba(211, 224, 217, 0.44);
  --scene-edge: rgba(216, 213, 208, 0.52);
}

:root[data-scene="corridor"] {
  --scene-image: url("assets/threshold-corridor.jpg");
  --paper: #edf2f4;
  --paper-soft: #f6f9fa;
  --scene-wash: rgba(180, 204, 219, 0.38);
  --scene-edge: rgba(201, 216, 225, 0.42);
}

:root[data-scene="atrium"] {
  --scene-image: url("assets/threshold-atrium.jpg");
  --paper: #f4efed;
  --paper-soft: #fcf7f5;
  --scene-wash: rgba(228, 204, 202, 0.32);
  --scene-edge: rgba(215, 221, 210, 0.42);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 96px;
}

body {
  margin: 0;
  min-width: 320px;
  background:
    linear-gradient(90deg, var(--scene-wash) 0 10%, transparent 10% 87%, var(--scene-edge) 87%),
    linear-gradient(180deg, var(--paper-soft), var(--paper));
  color: var(--ink);
  font-family:
    "Hiragino Mincho ProN", "Yu Mincho", "YuMincho", "Noto Serif JP", serif;
  font-synthesis: none;
  letter-spacing: 0;
  text-rendering: optimizeLegibility;
  transition:
    background 220ms ease,
    color 220ms ease,
    filter 220ms ease;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  content: "";
  background-image:
    linear-gradient(rgba(35, 35, 34, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(35, 35, 34, 0.05) 1px, transparent 1px);
  background-size: 86px 86px;
  mask-image: linear-gradient(90deg, #000 0 18%, transparent 18% 78%, #000 78%);
}

a {
  color: inherit;
  text-decoration: none;
}

/* Shared site shell */

.skip-link {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 100;
  padding: 10px 14px;
  background: var(--ink);
  color: var(--paper-soft);
  font-family: "Hiragino Sans", "Yu Gothic", "YuGothic", sans-serif;
  font-size: 0.9rem;
  transform: translateY(-160%);
  transition: transform 160ms ease;
}

.skip-link:focus {
  transform: translateY(0);
}

.site-header,
main,
.site-footer {
  width: min(100% - 48px, var(--max));
  margin: 0 auto;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 72px;
  border-bottom: 1px solid rgba(35, 35, 34, 0.08);
  background: rgba(251, 248, 245, 0.86);
  backdrop-filter: blur(18px);
}

.site-mark {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-family: Inter, "Helvetica Neue", Arial, sans-serif;
  font-size: 1rem;
  font-weight: 500;
}

.site-mark span {
  width: 1px;
  height: 24px;
  background: var(--ink);
}

.site-nav {
  display: flex;
  align-items: center;
  gap: clamp(18px, 4vw, 42px);
  font-family: Inter, "Helvetica Neue", Arial, sans-serif;
  font-size: 0.92rem;
}

/* A small day/night dial shared by all three pages. */
.theme-switch {
  display: grid;
  flex: none;
  place-items: center;
  width: 68px;
  height: 48px;
  margin-left: auto;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.theme-switch__track {
  position: relative;
  display: block;
  width: 58px;
  height: 30px;
  overflow: hidden;
  border: 1px solid rgba(73, 104, 113, 0.42);
  border-radius: 100px;
  background: linear-gradient(115deg, #dce8e5, #b7cdd4);
  box-shadow: inset 0 1px 3px rgba(35, 35, 34, 0.08);
  transition: background 240ms ease, border-color 240ms ease;
}

.theme-switch__track::after {
  position: absolute;
  top: 7px;
  right: 8px;
  width: 2px;
  height: 2px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: -7px 8px 0 rgba(255, 255, 255, 0.64), 3px 11px 0 rgba(255, 255, 255, 0.6);
  content: "";
  opacity: 0;
  transition: opacity 240ms ease;
}

.theme-switch__thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fffaf0;
  color: #5c7d82;
  box-shadow: 0 1px 5px rgba(24, 39, 44, 0.23);
  transition: transform 280ms cubic-bezier(0.2, 0.8, 0.2, 1), background 240ms ease, color 240ms ease;
}

.theme-switch__thumb svg {
  position: absolute;
  width: 15px;
  height: 15px;
  transition: opacity 160ms ease, transform 240ms ease;
}

.theme-switch__moon {
  opacity: 0;
  transform: rotate(-35deg) scale(0.6);
}

.theme-switch:hover .theme-switch__thumb {
  box-shadow: 0 1px 8px rgba(24, 39, 44, 0.32);
}

.theme-switch:focus-visible {
  border-radius: 100px;
}

.site-nav a,
.text-link,
.site-footer a {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 5px;
}

/* Home: hero */

.hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(300px, 0.8fr);
  align-items: stretch;
  min-height: min(780px, calc(100vh - 128px));
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--paper-soft);
  overflow: hidden;
}

.hero-image {
  position: relative;
  overflow: hidden;
  min-height: 520px;
  background:
    linear-gradient(90deg, rgba(246, 244, 241, 0.08), rgba(246, 244, 241, 0.32)),
    var(--scene-image) center / cover;
  animation: image-arrival 800ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.hero-image::before,
.hero-image::after {
  position: absolute;
  pointer-events: none;
  content: "";
}

.hero-copy {
  display: grid;
  align-content: center;
  justify-items: start;
  gap: 24px;
  min-width: 0;
  padding: clamp(34px, 6vw, 76px);
}

.hero-copy > * {
  animation: copy-arrival 620ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.hero-copy > :nth-child(2) {
  animation-delay: 70ms;
}

.hero-copy > :nth-child(3),
.hero-copy > :nth-child(4) {
  animation-delay: 130ms;
}

.hero-copy > :last-child {
  animation-delay: 190ms;
}

@keyframes image-arrival {
  from {
    opacity: 0;
    transform: scale(1.015);
  }
}

@keyframes copy-arrival {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
}

.handle,
.section-heading p,
.roman,
.record-list small,
.link-card small {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  letter-spacing: 0.26em;
  text-transform: uppercase;
}

.handle {
  margin: 0;
  color: #6d91a0;
  font-size: 0.9rem;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  max-width: max-content;
  font-size: clamp(3rem, 4.1vw, 4.35rem);
  font-weight: 500;
  line-height: 1.08;
}

h1 span {
  display: block;
  white-space: nowrap;
}

.lead {
  max-width: 480px;
  font-family: "Hiragino Sans", "Yu Gothic", "YuGothic", sans-serif;
  font-size: clamp(1rem, 1.45vw, 1.16rem);
  line-height: 1.9;
}

.lead span {
  display: block;
  overflow-wrap: anywhere;
}

.observation-note {
  display: none;
  max-width: 560px;
  border-top: 1px solid var(--line-strong);
  border-bottom: 1px solid var(--line-strong);
  padding: 18px 0;
  font-family: "Hiragino Sans", "Yu Gothic", "YuGothic", sans-serif;
  font-size: clamp(0.9rem, 1.2vw, 1rem);
  line-height: 1.9;
}

.observation-note p + p {
  margin-top: 12px;
}

.text-link {
  font-family: Inter, "Helvetica Neue", Arial, sans-serif;
  font-size: 0.94rem;
}

/* Home: profile and activity */

.profile-section {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(280px, 0.8fr);
  gap: clamp(28px, 6vw, 78px);
  align-items: stretch;
  padding: clamp(72px, 10vw, 132px) 0 54px;
}

.profile-card {
  padding: clamp(28px, 5vw, 56px) 0;
}

.profile-card h2 {
  width: min-content;
  border-top: 1px solid var(--line-strong);
  border-bottom: 1px solid var(--line-strong);
  padding: 40px 0 16px;
  font-size: clamp(4.8rem, 10vw, 8rem);
  font-weight: 500;
  line-height: 0.95;
}

.roman {
  margin: 18px 0 34px;
  color: #819da8;
  font-size: clamp(1rem, 2vw, 1.25rem);
}

.profile-list {
  display: grid;
  gap: 0;
  margin: 0;
  font-family: "Hiragino Sans", "Yu Gothic", "YuGothic", sans-serif;
}

.profile-list div {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 24px;
  padding: 16px 0;
  border-top: 1px solid var(--line);
}

.profile-list div:last-child {
  border-bottom: 1px solid var(--line);
}

.profile-list dt {
  color: var(--muted);
}

.profile-list dd {
  margin: 0;
}

.profile-more {
  margin-top: 28px;
  border-top: 1px solid var(--line-strong);
  border-bottom: 1px solid var(--line-strong);
  font-family: "Hiragino Sans", "Yu Gothic", "YuGothic", sans-serif;
}

.profile-more summary {
  cursor: pointer;
  padding: 16px 0;
  color: var(--ink);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  letter-spacing: 0.16em;
  list-style: none;
}

.profile-more summary::-webkit-details-marker {
  display: none;
}

.profile-more summary::after {
  content: "+";
  float: right;
  color: #6d91a0;
}

.profile-more[open] summary::after {
  content: "-";
}

.profile-more dl {
  display: grid;
  gap: 0;
  margin: 0;
  padding-bottom: 18px;
}

.profile-more div {
  display: grid;
  grid-template-columns: 140px minmax(0, 1fr);
  gap: 24px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}

.profile-more dt {
  color: var(--muted);
}

.profile-more dd {
  margin: 0;
}

.threshold-panel {
  isolation: isolate;
  overflow: hidden;
  position: relative;
  min-height: 560px;
  border-left: 1px solid var(--line);
  background:
    radial-gradient(circle at 62% 48%, rgba(251, 231, 231, 0.5), transparent 18%),
    linear-gradient(90deg, rgba(167, 189, 203, 0.82) 0 8%, transparent 8%),
    linear-gradient(rgba(35, 35, 34, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(35, 35, 34, 0.05) 1px, transparent 1px),
    rgba(216, 213, 208, 0.55);
  background-size: auto, auto, 120px 120px, 120px 120px, auto;
}

.threshold-panel::before {
  position: absolute;
  top: -0.14em;
  right: -0.12em;
  z-index: 0;
  color: rgba(35, 35, 34, 0.052);
  content: "間";
  font-family: "Hiragino Mincho ProN", "Yu Mincho", "YuMincho", "Noto Serif JP", serif;
  font-size: clamp(13rem, 24vw, 22rem);
  line-height: 0.8;
  pointer-events: none;
  writing-mode: vertical-rl;
}

.threshold-panel::after {
  position: absolute;
  top: 16%;
  right: 13%;
  z-index: 0;
  width: 38%;
  height: 54%;
  border: 1px solid rgba(35, 35, 34, 0.12);
  background:
    linear-gradient(180deg, rgba(251, 231, 231, 0.28), rgba(211, 224, 217, 0.14)),
    rgba(246, 244, 241, 0.2);
  box-shadow:
    -18px 22px 0 rgba(167, 189, 203, 0.14),
    26px -16px 0 rgba(251, 231, 231, 0.12);
  content: "";
  transform: translateY(10px);
}

.threshold-panel span {
  position: absolute;
  z-index: 1;
  width: 12px;
  height: 12px;
  background: rgba(35, 35, 34, 0.08);
}

.threshold-panel span:nth-child(1) {
  top: 24%;
  left: 33%;
}

.threshold-panel span:nth-child(2) {
  top: 47%;
  left: 58%;
  width: 8px;
  height: 8px;
  background: rgba(35, 35, 34, 0.16);
  transform: rotate(45deg);
}

.threshold-panel span:nth-child(3) {
  top: 72%;
  right: 18%;
}

.observation-trigger {
  position: absolute;
  top: 47%;
  left: 58%;
  z-index: 2;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 0;
  background: transparent;
  cursor: help;
  transform: translate(-12px, -12px);
}

.boundary-gate {
  position: absolute;
  top: 16%;
  right: 13%;
  z-index: 2;
  width: 38%;
  height: 54%;
  border: 1px solid rgba(142, 49, 45, 0);
  background:
    linear-gradient(90deg, transparent 0 48%, rgba(142, 49, 45, 0.12) 48% 49%, transparent 49%),
    linear-gradient(180deg, transparent 0 64%, rgba(35, 35, 34, 0.09) 64% 65%, transparent 65%);
  box-shadow: inset 0 0 0 0 rgba(142, 49, 45, 0);
  transform: translateY(10px);
  transition:
    border-color 180ms ease,
    box-shadow 180ms ease,
    background 180ms ease;
}

.boundary-gate::after {
  position: absolute;
  right: -1px;
  bottom: -27px;
  color: rgba(35, 35, 34, 0.32);
  content: "case / 00";
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.68rem;
  letter-spacing: 0.18em;
  white-space: nowrap;
}

.boundary-gate:hover,
.boundary-gate:focus-visible {
  border-color: rgba(142, 49, 45, 0.42);
  background:
    linear-gradient(90deg, transparent 0 48%, rgba(142, 49, 45, 0.26) 48% 49%, transparent 49%),
    linear-gradient(180deg, transparent 0 64%, rgba(35, 35, 34, 0.14) 64% 65%, transparent 65%),
    rgba(251, 248, 245, 0.18);
  box-shadow: inset 0 0 0 8px rgba(142, 49, 45, 0.035);
  outline: none;
}

.observation-trigger::before {
  position: absolute;
  inset: 12px;
  background: rgba(142, 49, 45, 0.5);
  content: "";
  transform: rotate(45deg);
  transition:
    background 160ms ease,
    transform 160ms ease;
}

.observation-trigger:hover::before,
.observation-trigger:focus-visible::before {
  background: rgba(142, 49, 45, 0.82);
  transform: rotate(45deg) scale(1.28);
}

.observation-trigger:focus-visible {
  outline: 1px solid rgba(35, 35, 34, 0.42);
  outline-offset: 4px;
}

.threshold-panel i {
  position: absolute;
  right: 18%;
  bottom: 20%;
  z-index: 1;
  width: 42%;
  height: 1px;
  background: var(--line);
  box-shadow: 0 -72px 0 rgba(35, 35, 34, 0.06);
}

.primary-links {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0;
  border-top: 1px solid var(--line-strong);
  border-bottom: 1px solid var(--line-strong);
}

.primary-links a {
  display: grid;
  grid-template-columns: auto 1fr;
  column-gap: 14px;
  row-gap: 4px;
  align-items: center;
  min-height: 110px;
  padding: 22px;
  border-right: 1px solid var(--line);
  background: rgba(251, 248, 245, 0.54);
  transition:
    background 160ms ease,
    transform 160ms ease;
}

.primary-links a:last-child {
  border-right: 0;
}

.primary-links span {
  grid-row: 1 / 3;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  color: #6d91a0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.primary-links strong,
.record-list strong,
.link-card strong {
  font-weight: 500;
}

.primary-links small,
.record-list span,
.link-card span {
  color: var(--muted);
}

.primary-links a:hover,
.primary-links a:focus-visible,
.record-list a:hover,
.record-list a:focus-visible,
.link-card:hover,
.link-card:focus-visible {
  background: rgba(211, 224, 217, 0.5);
  outline: none;
}

.split-sections {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(28px, 5vw, 62px);
  padding: clamp(72px, 10vw, 118px) 0 0;
}

.section-panel,
.music-section,
.likes-section,
.links-section,
.profile-section {
  scroll-margin-top: 90px;
}

.section-heading {
  margin-bottom: 22px;
}

.section-heading p {
  margin-bottom: 10px;
  color: #7798a5;
  font-size: 0.86rem;
}

.section-heading h2 {
  font-size: clamp(2.2rem, 4vw, 3.8rem);
  font-weight: 500;
  line-height: 1.1;
}

.record-list {
  border-top: 1px solid var(--line-strong);
}

.record-list a {
  position: relative;
  display: grid;
  grid-template-columns: 88px 1fr 32px;
  gap: 16px;
  align-items: baseline;
  min-height: 92px;
  padding: 20px 0;
  border-bottom: 1px solid var(--line);
  font-family: "Hiragino Sans", "Yu Gothic", "YuGothic", sans-serif;
}

.record-list a::after {
  content: "↗";
  grid-column: 3;
  grid-row: 1 / 3;
  align-self: center;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  transition: transform 160ms ease;
}

.record-list a:hover::after,
.record-list a:focus-visible::after {
  transform: translate(2px, -2px);
}

.record-list small {
  color: #8da9b2;
  font-size: 0.72rem;
}

.record-list span {
  grid-column: 2;
  line-height: 1.75;
}

.section-link {
  display: inline-block;
  margin-top: 18px;
  font-family: Inter, "Helvetica Neue", Arial, sans-serif;
  font-size: 0.92rem;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 5px;
}

.music-section {
  display: grid;
  grid-template-columns: minmax(240px, 0.7fr) minmax(0, 1.3fr);
  gap: clamp(36px, 7vw, 90px);
  align-items: end;
  padding-top: clamp(72px, 10vw, 118px);
}

.music-introduction .section-heading {
  margin-bottom: 14px;
}

.music-reading {
  margin-bottom: 22px;
  color: #819da8;
  font-family: "Hiragino Sans", "Yu Gothic", "YuGothic", sans-serif;
  font-size: 0.84rem;
  letter-spacing: 0.14em;
}

.music-description {
  max-width: 34em;
  color: var(--muted);
  font-family: "Hiragino Sans", "Yu Gothic", "YuGothic", sans-serif;
  line-height: 1.9;
  text-wrap: pretty;
}

.semantic-unit {
  white-space: nowrap;
}

.music-records {
  align-self: end;
}

.music-records small {
  line-height: 1.45;
  letter-spacing: 0.14em;
  white-space: nowrap;
}

.music-records a {
  min-height: 126px;
}

/* Home: likes, links, and footer */

.likes-section,
.links-section {
  padding-top: clamp(68px, 9vw, 110px);
}

.likes-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-top: 1px solid var(--line-strong);
  border-bottom: 1px solid var(--line-strong);
}

.likes-grid article {
  min-height: 190px;
  border-right: 1px solid var(--line);
  padding: 24px 26px 30px;
}

.likes-grid article:last-child {
  border-right: 0;
}

.likes-grid h3 {
  margin: 0 0 22px;
  color: #6d91a0;
  font-size: 1.05rem;
  font-weight: 500;
}

.likes-grid p {
  max-width: 20em;
  font-family: "Hiragino Sans", "Yu Gothic", "YuGothic", sans-serif;
  color: var(--muted);
  line-height: 1.9;
}

.link-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-top: 1px solid var(--line-strong);
  border-left: 1px solid var(--line);
}

.link-card {
  position: relative;
  display: grid;
  align-content: start;
  gap: 10px;
  min-height: 160px;
  padding: 22px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: rgba(251, 248, 245, 0.54);
}

.link-card[target="_blank"]::after {
  position: absolute;
  top: 22px;
  right: 22px;
  color: var(--muted);
  content: "↗";
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  transition: transform 160ms ease;
}

.link-card[target="_blank"]:hover::after,
.link-card[target="_blank"]:focus-visible::after {
  transform: translate(2px, -2px);
}

.link-card small {
  color: #8da9b2;
  font-size: 0.72rem;
}

.link-card span {
  font-family: "Hiragino Sans", "Yu Gothic", "YuGothic", sans-serif;
  font-size: 0.94rem;
  line-height: 1.75;
}

.site-footer {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 20px;
  margin-top: clamp(72px, 10vw, 120px);
  padding: 26px 0 42px;
  border-top: 1px solid var(--line-strong);
  color: var(--muted);
  font-family: Inter, "Helvetica Neue", Arial, sans-serif;
  font-size: 0.92rem;
}

.fictional-mode-label,
.observation-disclaimer,
.observation-exit {
  display: none;
}

.observation-disclaimer {
  position: fixed;
  left: 24px;
  bottom: 22px;
  z-index: 20;
  max-width: min(420px, calc(100vw - 190px));
  margin: 0;
  padding: 8px 12px;
  background: var(--paper-soft);
  color: rgba(35, 35, 34, 0.66);
  font-family: "Hiragino Sans", "Yu Gothic", "YuGothic", sans-serif;
  font-size: 0.78rem;
  line-height: 1.7;
}

.observation-exit {
  position: fixed;
  right: 24px;
  bottom: 22px;
  z-index: 20;
  border: 0;
  border-top: 1px solid var(--line-strong);
  border-radius: 0;
  min-height: 44px;
  padding: 10px 12px;
  background: var(--paper-soft);
  cursor: pointer;
  color: rgba(35, 35, 34, 0.74);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-decoration: none;
}

/* Home: fictional observation mode */

body.observation-mode {
  background:
    linear-gradient(90deg, rgba(215, 215, 211, 0.5) 0 10%, transparent 10% 87%, rgba(202, 202, 198, 0.52) 87%),
    linear-gradient(180deg, #f0efec, #e4e2dd);
  color: #2c2c29;
}

/* A filter on body would make fixed controls scroll with the document. */
body.observation-mode > main {
  filter: saturate(0.72);
}

body.observation-mode::before {
  background-size: 72px 72px;
  opacity: 0.78;
}

body.observation-mode .site-header {
  backdrop-filter: blur(10px) grayscale(0.5);
}

body.observation-mode .hero,
body.observation-mode .link-card,
body.observation-mode .primary-links a {
  background: rgba(240, 239, 236, 0.68);
}

body.observation-mode .hero-image {
  filter: grayscale(0.55) contrast(0.94) brightness(1.02);
}

body.observation-mode .hero-image::before {
  right: 17.2%;
  bottom: 28%;
  width: clamp(38px, 5.4vw, 68px);
  height: clamp(132px, 19vw, 220px);
  border-radius: 48% 48% 18% 18% / 20% 20% 80% 80%;
  background:
    radial-gradient(ellipse at 50% 9%, rgba(24, 24, 22, 0.58) 0 17%, transparent 18%),
    radial-gradient(ellipse at 48% 43%, rgba(24, 24, 22, 0.36) 0 38%, transparent 40%),
    linear-gradient(180deg, rgba(24, 24, 22, 0.34), rgba(24, 24, 22, 0.16) 72%, transparent);
  filter: blur(1px);
  opacity: 0.64;
  transform: skewX(-4deg);
}

body.observation-mode .hero-image::after {
  right: 15.8%;
  bottom: 26.5%;
  width: clamp(76px, 9vw, 118px);
  height: clamp(92px, 12vw, 150px);
  background: radial-gradient(ellipse at 50% 82%, rgba(24, 24, 22, 0.22), transparent 66%);
  filter: blur(6px);
  opacity: 0.72;
}

body.observation-mode .handle,
body.observation-mode .section-heading p,
body.observation-mode .roman,
body.observation-mode .record-list small,
body.observation-mode .link-card small,
body.observation-mode .likes-grid h3 {
  color: #6f797b;
}

body.observation-mode .lead {
  display: none;
}

body.observation-mode .observation-note {
  display: block;
}

body.observation-mode .profile-card h2 {
  color: #262623;
}

body.observation-mode .threshold-panel {
  background:
    radial-gradient(circle at 62% 48%, rgba(233, 230, 222, 0.72), transparent 18%),
    linear-gradient(90deg, rgba(145, 157, 161, 0.56) 0 8%, transparent 8%),
    linear-gradient(rgba(35, 35, 34, 0.075) 1px, transparent 1px),
    linear-gradient(90deg, rgba(35, 35, 34, 0.065) 1px, transparent 1px),
    rgba(212, 211, 206, 0.72);
  background-size: auto, auto, 120px 120px, 120px 120px, auto;
}

body.observation-mode .threshold-panel::before {
  color: rgba(35, 35, 34, 0.105);
}

body.observation-mode .threshold-panel::after {
  border-color: rgba(35, 35, 34, 0.18);
  background:
    linear-gradient(180deg, rgba(242, 240, 234, 0.48), rgba(218, 218, 211, 0.28)),
    rgba(240, 239, 236, 0.24);
}

body.observation-mode .observation-trigger::before {
  background: rgba(142, 49, 45, 0.9);
}

body.observation-mode .boundary-gate {
  border-color: rgba(142, 49, 45, 0.28);
  background:
    linear-gradient(90deg, transparent 0 48%, rgba(142, 49, 45, 0.24) 48% 49%, transparent 49%),
    linear-gradient(180deg, transparent 0 64%, rgba(35, 35, 34, 0.16) 64% 65%, transparent 65%),
    rgba(240, 239, 236, 0.18);
}

body.observation-mode .fictional-mode-label,
body.observation-mode .observation-disclaimer,
body.observation-mode .observation-exit {
  display: block;
}

body.observation-mode .site-nav a,
body.observation-mode .text-link,
body.observation-mode .site-footer a,
body.observation-mode .section-link {
  text-decoration-style: dotted;
}

/* Boundary essay */

.boundary-page {
  --boundary-red: #8e312d;
  --boundary-blue: #536f7a;
  min-height: 100vh;
  background:
    radial-gradient(ellipse at 64% 18%, rgba(142, 49, 45, 0.11), transparent 24%),
    linear-gradient(90deg, rgba(211, 224, 217, 0.36) 0 11%, transparent 11% 83%, rgba(167, 189, 203, 0.2) 83%),
    linear-gradient(180deg, #fbf8f5, #eeece7);
}

.boundary-page::before {
  background-image:
    linear-gradient(rgba(35, 35, 34, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(35, 35, 34, 0.04) 1px, transparent 1px);
  background-size: 72px 72px;
  mask-image: linear-gradient(90deg, #000 0 12%, transparent 12% 82%, #000 82%);
}

.boundary-page::after {
  position: fixed;
  inset: 7vh 8vw auto auto;
  z-index: -1;
  width: min(42vw, 560px);
  aspect-ratio: 1 / 1.14;
  border: 1px solid rgba(142, 49, 45, 0.18);
  border-radius: 48% 52% 44% 56% / 58% 43% 57% 42%;
  content: "";
  pointer-events: none;
  transform: rotate(-12deg);
}

.boundary-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
  width: min(100% - 48px, 1360px);
  min-height: 74px;
  margin: 0 auto;
  border-bottom: 1px solid rgba(35, 35, 34, 0.14);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.78rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.boundary-home {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 5px;
}

.boundary-header p {
  color: rgba(35, 35, 34, 0.54);
}

.boundary-main {
  position: relative;
  display: grid;
  grid-template-columns: minmax(120px, 0.22fr) minmax(0, 1fr);
  gap: clamp(26px, 5vw, 82px);
  width: min(100% - 48px, 1360px);
  margin: 0 auto;
  padding: clamp(44px, 7vw, 86px) 0 clamp(64px, 9vw, 112px);
}

.boundary-main::before,
.boundary-main::after {
  position: absolute;
  content: "";
  pointer-events: none;
}

.boundary-main::before {
  top: 128px;
  left: 13%;
  width: 1px;
  height: min(78vh, 720px);
  background: linear-gradient(180deg, transparent, rgba(142, 49, 45, 0.38), transparent);
}

.boundary-main::after {
  top: 26px;
  right: 3%;
  width: min(30vw, 380px);
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(83, 111, 122, 0.44), transparent);
}

.boundary-rail {
  position: sticky;
  top: 24px;
  align-self: start;
  display: grid;
  gap: 34px;
  min-height: calc(100vh - 124px);
  border-left: 1px solid rgba(35, 35, 34, 0.16);
  padding-left: 18px;
}

.boundary-rail > p {
  color: rgba(35, 35, 34, 0.72);
  font-size: clamp(2rem, 4vw, 4.4rem);
  font-weight: 500;
  line-height: 1;
  writing-mode: vertical-rl;
}

.boundary-rail dl {
  display: grid;
  gap: 16px;
  align-self: end;
  margin: 0 0 8px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.boundary-rail div {
  border-top: 1px solid rgba(35, 35, 34, 0.14);
  padding-top: 10px;
}

.boundary-rail dt {
  color: var(--boundary-blue);
}

.boundary-rail dd {
  margin: 4px 0 0;
  color: rgba(35, 35, 34, 0.48);
}

.boundary-article {
  position: relative;
  max-width: 980px;
  border-left: 1px solid rgba(35, 35, 34, 0.14);
  padding-left: clamp(24px, 5vw, 76px);
}

.boundary-article::before {
  position: absolute;
  top: 14px;
  left: clamp(12px, 3vw, 38px);
  width: clamp(120px, 17vw, 240px);
  height: clamp(210px, 30vw, 380px);
  border: 1px solid rgba(142, 49, 45, 0.2);
  background:
    linear-gradient(180deg, rgba(251, 231, 231, 0.18), transparent),
    rgba(251, 248, 245, 0.22);
  content: "";
  pointer-events: none;
  transform: translateX(-50%) skewY(-2deg);
}

.boundary-title-block {
  position: relative;
  display: grid;
  gap: 20px;
  min-height: min(680px, calc(100vh - 118px));
  align-content: center;
  border-bottom: 1px solid rgba(35, 35, 34, 0.18);
  padding: 28px 0 clamp(44px, 8vw, 86px);
}

.boundary-kana {
  color: var(--boundary-blue);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.78rem;
  letter-spacing: 0.2em;
  line-height: 1.7;
  text-transform: uppercase;
}

.boundary-title-block h1 {
  max-width: 820px;
  color: #24231f;
  font-size: clamp(3.1rem, 8vw, 7.8rem);
  line-height: 1.02;
  text-wrap: balance;
}

.boundary-pull {
  max-width: 690px;
  border-top: 1px solid rgba(142, 49, 45, 0.36);
  padding-top: 18px;
  color: rgba(35, 35, 34, 0.72);
  font-family: "Hiragino Sans", "Yu Gothic", "YuGothic", sans-serif;
  font-size: clamp(1rem, 1.7vw, 1.28rem);
  line-height: 1.95;
}

.boundary-text {
  position: relative;
  max-width: 760px;
  padding: clamp(42px, 7vw, 76px) 0 0;
  counter-reset: boundary-paragraph;
}

.boundary-text::before {
  position: absolute;
  top: clamp(42px, 7vw, 76px);
  bottom: 0;
  left: -26px;
  width: 1px;
  background: linear-gradient(180deg, rgba(142, 49, 45, 0.32), rgba(83, 111, 122, 0.18), transparent);
  content: "";
}

.boundary-text p {
  position: relative;
  max-width: 39em;
  font-family: "Hiragino Sans", "Yu Gothic", "YuGothic", sans-serif;
  font-size: clamp(1rem, 1.28vw, 1.08rem);
  line-height: 2.28;
  counter-increment: boundary-paragraph;
}

.boundary-text p + p {
  margin-top: 1.4em;
}

.boundary-text p::before {
  position: absolute;
  top: 0.62em;
  left: -4.7em;
  color: rgba(83, 111, 122, 0.5);
  content: counter(boundary-paragraph, decimal-leading-zero);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.62rem;
  letter-spacing: 0.1em;
}

.boundary-text p:nth-child(4),
.boundary-text p:nth-child(15),
.boundary-text p:nth-child(19) {
  margin: 2.1em 0;
  border-top: 1px solid rgba(142, 49, 45, 0.28);
  border-bottom: 1px solid rgba(142, 49, 45, 0.2);
  padding: 1.2em 0;
  color: #25231f;
  font-family: "Hiragino Mincho ProN", "Yu Mincho", "YuMincho", "Noto Serif JP", serif;
  font-size: clamp(1.35rem, 2.2vw, 1.85rem);
  line-height: 1.78;
}

.boundary-text p:last-child {
  color: #25231f;
}

.boundary-footer {
  max-width: 760px;
  margin-top: clamp(42px, 7vw, 76px);
  border-top: 1px solid rgba(35, 35, 34, 0.18);
  padding-top: 24px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.82rem;
  letter-spacing: 0.14em;
}

.boundary-footer a {
  color: rgba(35, 35, 34, 0.74);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 6px;
}

/* Toybox */

.toybox-page {
  --toybox-blue: #6f99aa;
  --toybox-mint: #c7d8d2;
  --toybox-pink: #fae5df;
  --toybox-yellow: #efe3b5;
  min-height: 100vh;
  background:
    linear-gradient(90deg, rgba(167, 189, 203, 0.32) 0 8%, transparent 8% 84%, rgba(251, 231, 231, 0.48) 84%),
    linear-gradient(180deg, #fbf8f5, #f1efea 62%, #f6f4f1);
}

.toybox-page::before {
  background-image:
    linear-gradient(rgba(35, 35, 34, 0.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(35, 35, 34, 0.045) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: linear-gradient(90deg, #000 0 18%, transparent 18% 78%, #000 78%);
}

.toybox-main {
  display: grid;
  gap: clamp(28px, 4vw, 42px);
  padding-bottom: 12px;
}

.toybox-hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(280px, 0.5fr);
  gap: clamp(28px, 6vw, 78px);
  align-items: end;
  min-height: min(520px, calc(100vh - 160px));
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line-strong);
  padding: clamp(42px, 7vw, 82px) 0 clamp(32px, 5vw, 54px);
}

.toybox-hero::before {
  position: absolute;
  right: min(5vw, 56px);
  bottom: clamp(120px, 18vw, 190px);
  width: min(38vw, 420px);
  height: clamp(140px, 23vw, 260px);
  border: 1px solid rgba(35, 35, 34, 0.14);
  background:
    linear-gradient(90deg, transparent 0 31%, rgba(35, 35, 34, 0.09) 31% 32%, transparent 32% 65%, rgba(35, 35, 34, 0.09) 65% 66%, transparent 66%),
    linear-gradient(180deg, transparent 0 48%, rgba(35, 35, 34, 0.1) 48% 49%, transparent 49%),
    linear-gradient(135deg, rgba(250, 229, 223, 0.44), rgba(199, 216, 210, 0.3));
  content: "";
  pointer-events: none;
}

.toybox-hero h1 {
  position: relative;
  z-index: 1;
  grid-column: 1;
  max-width: max-content;
  border-top: 1px solid var(--line-strong);
  padding-top: 24px;
  font-size: clamp(4.2rem, 10vw, 8rem);
  font-weight: 500;
  line-height: 0.96;
}

.toybox-hero > .handle {
  position: relative;
  z-index: 1;
}

.toybox-lead {
  position: relative;
  z-index: 1;
  grid-column: 1;
  max-width: 34em;
  font-family: "Hiragino Sans", "Yu Gothic", "YuGothic", sans-serif;
  font-size: clamp(1rem, 1.4vw, 1.12rem);
  line-height: 1.95;
}

.toybox-index {
  z-index: 1;
  grid-column: 2;
  grid-row: 2 / span 2;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-self: stretch;
  border-top: 1px solid var(--line-strong);
  border-left: 1px solid var(--line);
  background: rgba(251, 248, 245, 0.62);
  font-family: "Hiragino Sans", "Yu Gothic", "YuGothic", sans-serif;
}

.toybox-index a {
  min-height: 48px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 14px 18px;
  transition:
    background 160ms ease,
    color 160ms ease;
}

.toybox-index a:hover,
.toybox-index a:focus-visible {
  background: rgba(239, 227, 181, 0.34);
  color: #536f7a;
  outline: none;
}

.toybox-shelves {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(28px, 4vw, 52px);
  align-items: start;
}

.toybox-category {
  scroll-margin-top: 96px;
  border-top: 1px solid var(--line-strong);
  background: rgba(251, 248, 245, 0.42);
}

.wide-category {
  grid-column: 1 / -1;
}

.small-category {
  min-height: 100%;
}

.toybox-heading {
  display: grid;
  grid-template-columns: 62px 1fr;
  gap: 18px;
  align-items: baseline;
  border-bottom: 1px solid var(--line);
  padding: 18px 0;
}

.toybox-heading small {
  color: var(--toybox-blue);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.76rem;
  letter-spacing: 0.2em;
}

.toybox-heading h2 {
  font-size: clamp(1.55rem, 3vw, 2.6rem);
  font-weight: 500;
  line-height: 1.2;
}

.toybox-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0;
  margin: 0;
  padding: 0;
  font-family: "Hiragino Sans", "Yu Gothic", "YuGothic", sans-serif;
  list-style: none;
}

.toybox-list li {
  min-height: 54px;
  border-bottom: 1px solid var(--line);
  padding: 15px 20px;
  color: rgba(35, 35, 34, 0.82);
  line-height: 1.65;
}

.toybox-list li:nth-child(2n + 1) {
  border-right: 1px solid var(--line);
}

.toybox-list a {
  color: #536f7a;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 5px;
}

.toybox-list a::after {
  content: " ↗";
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.86em;
}

.toybox-list a:hover,
.toybox-list a:focus-visible {
  color: #2f5868;
}

.compact-list {
  grid-template-columns: 1fr;
}

.compact-list li,
.compact-list li:nth-child(2n + 1) {
  border-right: 0;
}

/* Responsive layout */

@media (max-width: 920px) {
  .site-header {
    align-items: flex-start;
    flex-direction: column;
    padding: 18px 0;
  }

  .site-header .theme-switch {
    position: absolute;
    top: 7px;
    right: 0;
  }

  .site-nav {
    width: 100%;
    flex-wrap: wrap;
    gap: 10px 24px;
  }

  .hero,
  .profile-section,
  .split-sections,
  .music-section {
    grid-template-columns: minmax(0, 1fr);
  }

  .music-section {
    gap: 30px;
  }

  .hero {
    min-height: auto;
  }

  .hero-image {
    min-height: 430px;
  }

  .hero-copy {
    padding: 34px 0 50px;
  }

  .threshold-panel {
    min-height: 300px;
  }

  .boundary-header,
  .boundary-main {
    width: min(100% - 36px, 1360px);
  }

  .boundary-main {
    grid-template-columns: 1fr;
    gap: 28px;
  }

  .boundary-rail {
    position: relative;
    top: auto;
    min-height: auto;
    border-left: 0;
    border-bottom: 1px solid rgba(35, 35, 34, 0.16);
    padding: 0 0 18px;
  }

  .boundary-rail > p {
    color: var(--boundary-blue);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.82rem;
    letter-spacing: 0.18em;
    line-height: 1.8;
    text-transform: uppercase;
    writing-mode: horizontal-tb;
  }

  .boundary-rail dl {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .boundary-article {
    border-left: 0;
    padding-left: 0;
  }

  .boundary-article::before {
    left: 54%;
    opacity: 0.65;
  }

  .boundary-title-block {
    min-height: auto;
    padding-top: 44px;
  }

  .primary-links,
  .link-grid,
  .likes-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .toybox-hero,
  .toybox-shelves {
    grid-template-columns: 1fr;
  }

  .toybox-hero {
    min-height: auto;
  }

  .toybox-index {
    grid-column: 1;
    grid-row: auto;
  }

  .toybox-hero::before {
    top: 92px;
    right: 0;
    bottom: auto;
    width: min(58vw, 360px);
    opacity: 0.68;
  }

  .primary-links a:nth-child(2n),
  .link-card:nth-child(2n),
  .likes-grid article:nth-child(2n) {
    border-right: 0;
  }
}

@media (max-width: 620px) {
  .site-header,
  main,
  .site-footer {
    width: min(100% - 32px, var(--max));
  }

  .site-header {
    position: static;
    gap: 12px;
  }

  .site-nav {
    flex-wrap: wrap;
    gap: 4px 20px;
    padding: 4px 0;
  }

  .site-nav a {
    display: inline-flex;
    align-items: center;
    min-height: 36px;
  }

  .hero-image {
    min-height: 310px;
  }

  h1 {
    font-size: clamp(2.55rem, 13vw, 3.8rem);
  }

  .profile-card h2 {
    font-size: clamp(4.2rem, 22vw, 6rem);
  }

  .profile-list div {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .profile-more div {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .primary-links,
  .link-grid,
  .likes-grid {
    grid-template-columns: 1fr;
  }

  .toybox-hero h1 {
    font-size: clamp(3.15rem, 15vw, 4.15rem);
  }

  .toybox-list {
    grid-template-columns: 1fr;
  }

  .toybox-index {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .toybox-index a {
    padding: 12px 14px;
  }

  .toybox-list li,
  .toybox-list li:nth-child(2n + 1) {
    border-right: 0;
    padding-inline: 16px;
  }

  .primary-links a,
  .primary-links a:nth-child(2n) {
    border-right: 0;
    padding-left: 0;
  }

  .link-card,
  .link-card:nth-child(2n) {
    border-right: 0;
    padding-inline: 18px;
  }

  .likes-grid article {
    min-height: auto;
    border-right: 0;
    padding: 22px 18px 28px;
  }

  .likes-grid article + article {
    border-top: 1px solid var(--line);
  }

  .record-list a {
    grid-template-columns: minmax(0, 1fr) 26px;
    gap: 8px 12px;
  }

  .record-list small,
  .record-list strong,
  .record-list span {
    grid-column: 1;
  }

  .record-list a::after {
    grid-column: 2;
    grid-row: 1 / 4;
  }

  .site-footer {
    flex-direction: column;
  }

  .observation-exit {
    right: 16px;
    bottom: 16px;
  }

  .observation-disclaimer {
    left: 16px;
    bottom: 68px;
    max-width: calc(100vw - 32px);
    padding-right: 14px;
  }

  .boundary-header {
    position: relative;
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
    padding: 18px 0;
  }

  .boundary-header .theme-switch {
    position: absolute;
    top: 7px;
    right: 0;
  }

  .boundary-main {
    padding-top: 38px;
  }

  .boundary-header p {
    font-size: 0.7rem;
    letter-spacing: 0.12em;
    line-height: 1.65;
  }

  .boundary-rail {
    gap: 18px;
  }

  .boundary-rail dl {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
  }

  .boundary-title-block h1 {
    font-size: clamp(2.6rem, 14vw, 4.5rem);
  }

  .boundary-text {
    padding-left: 28px;
  }

  .boundary-text::before {
    left: 0;
  }

  .boundary-text p::before {
    left: -3.6em;
  }
}

/* Keyboard and motion accessibility */

*:focus-visible {
  outline: 2px solid #536f7a !important;
  outline-offset: 4px;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition: none !important;
    animation: none !important;
  }
}

/* Night palette: deep blue-gray surfaces retain the site's quiet, airy structure. */
:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #161e25;
  --paper-soft: #1d2932;
  --mist: #263a43;
  --pool: #7fabb9;
  --mint: #45635f;
  --pink: #674e57;
  --ink: #edf0ec;
  --muted: #b8c5c7;
  --faint: #94a8ac;
  --line: rgba(210, 229, 230, 0.19);
  --line-strong: rgba(210, 229, 230, 0.36);
  --shadow: rgba(0, 8, 14, 0.3);
  --scene-wash: rgba(50, 83, 95, 0.31);
  --scene-edge: rgba(64, 75, 83, 0.36);
}

:root[data-theme="dark"][data-scene="corridor"] {
  --scene-wash: rgba(49, 76, 96, 0.38);
  --scene-edge: rgba(49, 66, 78, 0.4);
}

:root[data-theme="dark"][data-scene="atrium"] {
  --scene-wash: rgba(81, 65, 75, 0.31);
  --scene-edge: rgba(61, 77, 72, 0.37);
}

:root[data-theme="dark"] body::before {
  background-image:
    linear-gradient(rgba(216, 235, 235, 0.065) 1px, transparent 1px),
    linear-gradient(90deg, rgba(216, 235, 235, 0.055) 1px, transparent 1px);
}

:root[data-theme="dark"] .site-header {
  border-bottom-color: var(--line);
  background: rgba(25, 36, 44, 0.89);
}

:root[data-theme="dark"] .theme-switch__track {
  border-color: rgba(174, 206, 216, 0.58);
  background: linear-gradient(115deg, #263747, #40576a);
}

:root[data-theme="dark"] .theme-switch__track::after {
  opacity: 1;
}

:root[data-theme="dark"] .theme-switch__thumb {
  background: #e9ece4;
  color: #435b6c;
  transform: translateX(28px);
}

:root[data-theme="dark"] .theme-switch__sun {
  opacity: 0;
  transform: rotate(35deg) scale(0.6);
}

:root[data-theme="dark"] .theme-switch__moon {
  opacity: 1;
  transform: rotate(0) scale(1);
}

:root[data-theme="dark"] .hero-image {
  background:
    linear-gradient(90deg, rgba(12, 26, 33, 0.25), rgba(12, 26, 33, 0.48)),
    var(--scene-image) center / cover;
}

:root[data-theme="dark"] .handle,
:root[data-theme="dark"] .roman,
:root[data-theme="dark"] .music-reading,
:root[data-theme="dark"] .section-heading p,
:root[data-theme="dark"] .record-list small,
:root[data-theme="dark"] .link-card small,
:root[data-theme="dark"] .likes-grid h3,
:root[data-theme="dark"] .primary-links span,
:root[data-theme="dark"] .profile-more summary::after {
  color: #a9cbd3;
}

:root[data-theme="dark"] .threshold-panel {
  background:
    radial-gradient(circle at 62% 48%, rgba(151, 115, 123, 0.24), transparent 18%),
    linear-gradient(90deg, rgba(103, 145, 161, 0.35) 0 8%, transparent 8%),
    linear-gradient(rgba(210, 229, 230, 0.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(210, 229, 230, 0.055) 1px, transparent 1px),
    #28343d;
}

:root[data-theme="dark"] .threshold-panel::before {
  color: rgba(210, 229, 230, 0.07);
}

:root[data-theme="dark"] .threshold-panel::after {
  border-color: rgba(210, 229, 230, 0.2);
  background: linear-gradient(180deg, rgba(119, 112, 125, 0.17), rgba(72, 111, 115, 0.12));
  box-shadow: -18px 22px 0 rgba(100, 155, 170, 0.1), 26px -16px 0 rgba(164, 124, 130, 0.09);
}

:root[data-theme="dark"] .threshold-panel span {
  background: rgba(210, 229, 230, 0.13);
}

:root[data-theme="dark"] .threshold-panel span:nth-child(2) {
  background: rgba(210, 229, 230, 0.23);
}

:root[data-theme="dark"] .boundary-gate::after {
  color: var(--muted);
}

:root[data-theme="dark"] .boundary-gate {
  background:
    linear-gradient(90deg, transparent 0 48%, rgba(179, 112, 108, 0.26) 48% 49%, transparent 49%),
    linear-gradient(180deg, transparent 0 64%, rgba(215, 229, 230, 0.14) 64% 65%, transparent 65%);
}

:root[data-theme="dark"] .boundary-gate:hover,
:root[data-theme="dark"] .boundary-gate:focus-visible {
  border-color: rgba(208, 145, 135, 0.66);
  background-color: rgba(232, 240, 237, 0.06);
}

:root[data-theme="dark"] .observation-trigger::before {
  background: rgba(208, 145, 135, 0.76);
}

:root[data-theme="dark"] .primary-links a,
:root[data-theme="dark"] .link-card {
  background: rgba(37, 53, 62, 0.72);
}

:root[data-theme="dark"] .primary-links a:hover,
:root[data-theme="dark"] .primary-links a:focus-visible,
:root[data-theme="dark"] .record-list a:hover,
:root[data-theme="dark"] .record-list a:focus-visible,
:root[data-theme="dark"] .link-card:hover,
:root[data-theme="dark"] .link-card:focus-visible {
  background: rgba(92, 137, 145, 0.24);
}

:root[data-theme="dark"] .observation-disclaimer,
:root[data-theme="dark"] .observation-exit {
  color: var(--ink);
}

:root[data-theme="dark"] body.observation-mode {
  background:
    linear-gradient(90deg, rgba(62, 68, 72, 0.34) 0 10%, transparent 10% 87%, rgba(62, 68, 72, 0.34) 87%),
    linear-gradient(180deg, #20272b, #151b20);
  color: var(--ink);
}

:root[data-theme="dark"] body.observation-mode .hero,
:root[data-theme="dark"] body.observation-mode .link-card,
:root[data-theme="dark"] body.observation-mode .primary-links a {
  background: rgba(39, 46, 50, 0.8);
}

:root[data-theme="dark"] body.observation-mode .handle,
:root[data-theme="dark"] body.observation-mode .section-heading p,
:root[data-theme="dark"] body.observation-mode .roman,
:root[data-theme="dark"] body.observation-mode .record-list small,
:root[data-theme="dark"] body.observation-mode .link-card small,
:root[data-theme="dark"] body.observation-mode .likes-grid h3 {
  color: #aec5c7;
}

:root[data-theme="dark"] body.observation-mode .profile-card h2 {
  color: var(--ink);
}

:root[data-theme="dark"] body.observation-mode .threshold-panel {
  background:
    radial-gradient(circle at 62% 48%, rgba(141, 126, 112, 0.23), transparent 18%),
    linear-gradient(90deg, rgba(110, 132, 139, 0.3) 0 8%, transparent 8%),
    linear-gradient(rgba(210, 229, 230, 0.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(210, 229, 230, 0.055) 1px, transparent 1px),
    #2c3437;
}

:root[data-theme="dark"] body.observation-mode .threshold-panel::before {
  color: rgba(210, 229, 230, 0.11);
}

:root[data-theme="dark"] body.observation-mode .threshold-panel::after {
  border-color: var(--line-strong);
  background: linear-gradient(180deg, rgba(176, 169, 155, 0.12), rgba(104, 122, 124, 0.13));
}

:root[data-theme="dark"] body.observation-mode .boundary-gate {
  border-color: rgba(208, 145, 135, 0.48);
  background-color: rgba(232, 240, 237, 0.035);
}

:root[data-theme="dark"] .boundary-page {
  --boundary-red: #cf938d;
  --boundary-blue: #a7c6cf;
  background:
    radial-gradient(ellipse at 64% 18%, rgba(169, 96, 92, 0.13), transparent 24%),
    linear-gradient(90deg, rgba(65, 91, 90, 0.28) 0 11%, transparent 11% 83%, rgba(62, 88, 102, 0.23) 83%),
    linear-gradient(180deg, #1d2932, #151d25);
}

:root[data-theme="dark"] .boundary-page::before {
  background-image:
    linear-gradient(rgba(210, 229, 230, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(210, 229, 230, 0.05) 1px, transparent 1px);
}

:root[data-theme="dark"] .boundary-page::after,
:root[data-theme="dark"] .boundary-article::before {
  border-color: rgba(207, 147, 141, 0.28);
}

:root[data-theme="dark"] .boundary-header,
:root[data-theme="dark"] .boundary-rail,
:root[data-theme="dark"] .boundary-article,
:root[data-theme="dark"] .boundary-title-block,
:root[data-theme="dark"] .boundary-footer,
:root[data-theme="dark"] .boundary-rail div {
  border-color: var(--line);
}

:root[data-theme="dark"] .boundary-header p,
:root[data-theme="dark"] .boundary-rail > p,
:root[data-theme="dark"] .boundary-rail dd,
:root[data-theme="dark"] .boundary-pull,
:root[data-theme="dark"] .boundary-footer a {
  color: var(--muted);
}

:root[data-theme="dark"] .boundary-title-block h1,
:root[data-theme="dark"] .boundary-text p:nth-child(4),
:root[data-theme="dark"] .boundary-text p:nth-child(15),
:root[data-theme="dark"] .boundary-text p:nth-child(19),
:root[data-theme="dark"] .boundary-text p:last-child {
  color: var(--ink);
}

:root[data-theme="dark"] .boundary-text p::before {
  color: #adc4ca;
}

:root[data-theme="dark"] .boundary-article::before {
  background: linear-gradient(180deg, rgba(121, 84, 96, 0.16), transparent), rgba(214, 227, 227, 0.025);
}

:root[data-theme="dark"] .toybox-page {
  --toybox-blue: #a9cbd3;
  --toybox-mint: #55716d;
  --toybox-pink: #805d64;
  --toybox-yellow: #9d8e60;
  background:
    linear-gradient(90deg, rgba(55, 85, 101, 0.3) 0 8%, transparent 8% 84%, rgba(96, 66, 75, 0.25) 84%),
    linear-gradient(180deg, #1b2933, #162129 62%, #1b252c);
}

:root[data-theme="dark"] .toybox-page::before {
  background-image:
    linear-gradient(rgba(210, 229, 230, 0.065) 1px, transparent 1px),
    linear-gradient(90deg, rgba(210, 229, 230, 0.05) 1px, transparent 1px);
}

:root[data-theme="dark"] .toybox-hero::before {
  border-color: var(--line);
  background:
    linear-gradient(90deg, transparent 0 31%, rgba(213, 230, 231, 0.11) 31% 32%, transparent 32% 65%, rgba(213, 230, 231, 0.11) 65% 66%, transparent 66%),
    linear-gradient(180deg, transparent 0 48%, rgba(213, 230, 231, 0.12) 48% 49%, transparent 49%),
    linear-gradient(135deg, rgba(120, 84, 92, 0.21), rgba(79, 111, 106, 0.22));
}

:root[data-theme="dark"] .toybox-index,
:root[data-theme="dark"] .toybox-category {
  background: rgba(37, 53, 62, 0.52);
}

:root[data-theme="dark"] .toybox-index a:hover,
:root[data-theme="dark"] .toybox-index a:focus-visible {
  background: rgba(157, 142, 96, 0.22);
  color: var(--ink);
}

:root[data-theme="dark"] .toybox-list li {
  color: var(--ink);
}

:root[data-theme="dark"] .toybox-list a {
  color: #b1d5df;
}

:root[data-theme="dark"] .toybox-list a:hover,
:root[data-theme="dark"] .toybox-list a:focus-visible {
  color: #d7eef0;
}

:root[data-theme="dark"] *:focus-visible {
  outline-color: #b6d8dc !important;
}
