/* ==========================================================================
   Peter (Kuan-Yu) Huang — Coastal Depth-Field & Editorial Personal Page
   Hiroshi Yoshida / Kawase Hasui Indigo Pigments · Asymmetric 1120px Grid ·
   Tactile Micro-Interactions · Zero SaaS Cliché · Zero AI Feel
   ========================================================================== */

:root,
[data-theme="light"] {
  --bg: #f4f1ea;
  --surface: rgba(20, 56, 82, 0.042);
  --fg: #131820;
  --body: #323c48;
  --muted: #586372;
  --accent: #1b4a68;
  --border: #dfd9cc;
  --border-strong: #c5beb0;
  --header-scrolled: rgba(244, 241, 234, 0.84);
  --contour: rgba(24, 62, 88, 0.065);
}

[data-theme="dark"] {
  --bg: #0b1017;
  --surface: rgba(152, 194, 224, 0.055);
  --fg: #eef1f5;
  --body: #b5c0cd;
  --muted: #8290a2;
  --accent: #8cc0e0;
  --border: #1b2430;
  --border-strong: #2c3849;
  --header-scrolled: rgba(11, 16, 23, 0.84);
  --contour: rgba(154, 196, 226, 0.065);
}

/* Origin-aware circular ink-wash View Transition for theme switch */
::view-transition-old(root),
::view-transition-new(root) {
  animation: none;
  mix-blend-mode: normal;
}

::view-transition-new(root) {
  animation: ink-reveal 520ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes ink-reveal {
  from {
    clip-path: circle(0px at var(--vt-x, 92%) var(--vt-y, 28px));
  }
  to {
    clip-path: circle(var(--vt-r, 150vmax) at var(--vt-x, 92%) var(--vt-y, 28px));
  }
}

/* ==========================================================================
   RESET & BASE
   ========================================================================== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
  background-color: var(--bg);
}

body {
  position: relative;
  background-color: var(--bg);
  color: var(--body);
  font-family: "DM Sans", "Noto Sans TC", -apple-system, BlinkMacSystemFont, "PingFang TC", "Segoe UI", sans-serif;
  line-height: 1.72;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  transition: background-color 0.28s ease, color 0.28s ease;
}

::selection {
  background: rgba(27, 74, 104, 0.16);
  color: var(--fg);
}

[data-theme="dark"] ::selection {
  background: rgba(140, 192, 224, 0.22);
}

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

button {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;
}

a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.skip-link {
  position: fixed;
  top: -60px;
  left: 1rem;
  z-index: 100;
  padding: 0.5rem 0.9rem;
  background: var(--fg);
  color: var(--bg);
  font-size: 0.85rem;
}

.skip-link:focus {
  top: 0.75rem;
}

.font-mono {
  font-family: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.shell {
  width: 100%;
  max-width: 1120px;
  margin-left: auto;
  margin-right: auto;
  padding-left: 1.35rem;
  padding-right: 1.35rem;
}

@media (min-width: 640px) {
  .shell {
    padding-left: 2.25rem;
    padding-right: 2.25rem;
  }
}

/* ==========================================================================
   FULL-SCENE PAPER GRAIN & BATHYMETRIC DEPTH CONTOURS
   ========================================================================== */
.paper-grain {
  position: fixed;
  inset: 0;
  z-index: 50;
  pointer-events: none;
  opacity: 0.55;
}

.depth-contours {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 112vh;
  z-index: 0;
  pointer-events: none;
  color: var(--contour);
  will-change: transform;
  display: none;
}

@media (min-width: 1140px) {
  .depth-contours {
    display: block;
  }
}

/* Subtle settle animation on language switch */
.i18n-swap {
  transition: opacity 150ms cubic-bezier(0.22, 1, 0.36, 1), transform 150ms cubic-bezier(0.22, 1, 0.36, 1);
}

.i18n-swap.is-swapping {
  opacity: 0.32;
  transform: translateY(3px);
}

/* ==========================================================================
   HEADER (Seamless at scroll=0, frosted hairline reveals on scroll)
   ========================================================================== */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 40;
  background-color: transparent;
  border-bottom: 1px solid transparent;
  transition: background-color 0.28s ease, border-color 0.28s ease, backdrop-filter 0.28s ease;
}

.site-header.is-scrolled {
  background-color: var(--header-scrolled);
  border-bottom-color: var(--border);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.header-inner {
  height: 54px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

@media (min-width: 640px) {
  .header-inner {
    height: 60px;
  }
}

.brand-name {
  font-family: "Newsreader", "Noto Serif TC", Georgia, serif;
  font-size: 1.06rem;
  font-weight: 500;
  color: var(--fg);
  letter-spacing: -0.01em;
  white-space: nowrap;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

html[lang="zh-Hant"] .brand-name {
  letter-spacing: 0.04em;
}

.nav-links {
  display: none;
  align-items: center;
  gap: 1.85rem;
  font-size: 0.86rem;
  color: var(--muted);
}

.nav-links a {
  position: relative;
  padding: 4px 0;
  transition: color 0.18s ease;
}

.nav-links a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 240ms cubic-bezier(0.22, 1, 0.36, 1);
}

.nav-links a:hover,
.nav-links a.is-active {
  color: var(--fg);
}

.nav-links a.is-active::after {
  transform: scaleX(1);
}

@media (min-width: 640px) and (max-width: 1023px) {
  .nav-links {
    display: flex;
  }
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.lang-switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.8rem;
  color: var(--muted);
  padding-bottom: 3px;
}

.ctrl-btn {
  min-height: 36px;
  padding: 4px 5px;
  color: var(--muted);
  transition: color 0.18s ease;
}

.ctrl-btn:hover {
  color: var(--fg);
}

.ctrl-btn.is-active {
  color: var(--fg);
  font-weight: 600;
}

.ctrl-sep {
  opacity: 0.38;
  user-select: none;
}

.lang-indicator {
  position: absolute;
  bottom: 4px;
  left: 0;
  height: 1.5px;
  background-color: var(--accent);
  transform-origin: left;
  transition: transform 260ms cubic-bezier(0.22, 1, 0.36, 1), width 260ms cubic-bezier(0.22, 1, 0.36, 1);
  pointer-events: none;
}

.theme-btn {
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  transition: color 0.18s ease, transform 0.22s cubic-bezier(0.22, 1, 0.36, 1);
}

.theme-btn:hover {
  color: var(--fg);
}

.theme-btn:active {
  transform: scale(0.92);
}

[data-theme="light"] .icon-sun { display: none; }
[data-theme="light"] .icon-moon { display: block; }
[data-theme="dark"] .icon-sun { display: block; }
[data-theme="dark"] .icon-moon { display: none; }

/* Mobile scroll tide progress bar along bottom of sticky header */
.mobile-tide-bar {
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 1.5px;
  background-color: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  pointer-events: none;
  opacity: 0.85;
}

@media (min-width: 1024px) {
  .mobile-tide-bar {
    display: none;
  }
}

/* ==========================================================================
   FULL-BLEED TAIWAN EAST COAST HERO STAGE
   ========================================================================== */
.hero-stage {
  position: relative;
  width: 100%;
  min-height: 66svh;
  overflow: hidden;
  padding-top: 6.25rem;
  padding-bottom: 11.5rem;
  display: flex;
  align-items: flex-start;
  touch-action: pan-y;
}

@media (min-width: 640px) {
  .hero-stage {
    min-height: clamp(560px, 76vh, 720px);
    padding-top: 7.75rem;
    padding-bottom: 16.5rem;
  }
}

.coast-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 0;
  pointer-events: none;
}

.hero-content {
  position: relative;
  z-index: 2;
}

.hero-name {
  font-family: "Newsreader", "Noto Serif TC", Georgia, serif;
  font-size: clamp(2.45rem, 5.4vw, 3.65rem);
  font-weight: 500;
  line-height: 1.1;
  letter-spacing: -0.026em;
  color: var(--fg);
}

html[lang="zh-Hant"] .hero-name {
  letter-spacing: 0.03em;
}

.hero-name-sub {
  display: inline-block;
  margin-left: 0.55rem;
  font-family: "DM Sans", "Noto Sans TC", sans-serif;
  font-size: 0.98rem;
  font-weight: 400;
  letter-spacing: 0;
  color: var(--muted);
}

@media (max-width: 520px) {
  .hero-name-sub {
    display: block;
    margin-left: 0;
    margin-top: 0.4rem;
  }
}

.hero-lead {
  margin-top: 1.25rem;
  font-size: clamp(1.08rem, 1.5vw, 1.24rem);
  font-weight: 500;
  line-height: 1.52;
  color: var(--fg);
  max-width: 38rem;
}

.hero-bio {
  margin-top: 0.85rem;
  font-size: 0.96rem;
  line-height: 1.82;
  color: var(--body);
  max-width: 39rem;
}

.hero-links {
  margin-top: 1.65rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1.55rem;
  font-size: 0.9rem;
}

/* ==========================================================================
   LINKS & INLINE COPY EMAIL MORPH
   ========================================================================== */
.text-link {
  color: var(--fg);
  text-decoration: underline;
  text-decoration-color: var(--border-strong);
  text-underline-offset: 4px;
  text-decoration-thickness: 1px;
  transition: color 0.18s ease, text-decoration-color 0.18s ease;
}

.text-link:hover {
  color: var(--accent);
  text-decoration-color: var(--accent);
}

.accent-link {
  color: var(--accent);
  font-weight: 500;
  text-decoration: underline;
  text-decoration-color: transparent;
  text-underline-offset: 4px;
  transition: text-decoration-color 0.18s ease;
}

.accent-link:hover {
  text-decoration-color: var(--accent);
}

.copy-email-btn {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
}

.copy-email-btn.is-copied {
  color: var(--accent);
  text-decoration-color: var(--accent);
}

/* ==========================================================================
   ASYMMETRIC EDITORIAL GRID (1120px: Sticky Left Rail + Reading Stream)
   ========================================================================== */
.editorial-grid {
  position: relative;
  z-index: 2;
  padding-top: 1.5rem;
  padding-bottom: 5.5rem;
}

@media (min-width: 1024px) {
  .editorial-grid {
    display: grid;
    grid-template-columns: 232px minmax(0, 1fr);
    gap: 5rem;
    align-items: start;
    padding-top: 2.5rem;
    padding-bottom: 6.5rem;
  }
}

/* Sticky Left Rail */
.side-rail {
  display: none;
}

@media (min-width: 1024px) {
  .side-rail {
    display: block;
    position: sticky;
    top: 96px;
  }
}

.side-rail-inner {
  display: flex;
  flex-direction: column;
  gap: 2.25rem;
}

.rail-index {
  position: relative;
  display: flex;
  gap: 1rem;
}

.tide-track {
  position: relative;
  width: 1.5px;
  background-color: var(--border);
  flex-shrink: 0;
}

.tide-fill {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: var(--accent);
  transform: scaleY(0.15);
  transform-origin: top;
  will-change: transform;
}

.rail-nav {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.rail-link {
  display: inline-flex;
  align-items: baseline;
  gap: 0.65rem;
  font-size: 0.875rem;
  color: var(--muted);
  transition: color 0.18s ease, transform 220ms cubic-bezier(0.22, 1, 0.36, 1);
}

.rail-link:hover {
  color: var(--fg);
  transform: translateX(3px);
}

.rail-link.is-active {
  color: var(--fg);
  font-weight: 500;
}

.rail-link.is-active .rail-num {
  color: var(--accent);
}

.rail-num {
  font-size: 0.72rem;
  color: var(--muted);
  transition: color 0.18s ease;
}

.rail-meta {
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.75rem;
  color: var(--muted);
}

.rail-loc {
  color: var(--fg);
  font-weight: 500;
}

.rail-clock {
  font-variant-numeric: tabular-nums;
}

.rail-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.45rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
  font-size: 0.82rem;
  color: var(--muted);
  opacity: 0;
  visibility: hidden;
  transform: translateY(6px);
  pointer-events: none;
  transition: opacity 280ms cubic-bezier(0.22, 1, 0.36, 1), transform 280ms cubic-bezier(0.22, 1, 0.36, 1), visibility 0s linear 280ms;
}

.rail-actions.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  pointer-events: auto;
  transition: opacity 280ms cubic-bezier(0.22, 1, 0.36, 1), transform 280ms cubic-bezier(0.22, 1, 0.36, 1), visibility 0s linear 0s;
}

.rail-action-link {
  transition: color 0.18s ease;
}

.rail-action-link:hover {
  color: var(--accent);
}

/* Reading Stream */
.reading-stream {
  min-width: 0;
  max-width: 760px;
}

.section {
  padding-top: 3.75rem;
  scroll-margin-top: 5.5rem;
}

.section:first-child {
  padding-top: 0.5rem;
}

.section-head {
  display: flex;
  align-items: baseline;
  gap: 0.85rem;
  margin-bottom: 1.75rem;
}

.section-num {
  font-size: 0.76rem;
  color: var(--accent);
}

.section-title {
  font-family: "Newsreader", "Noto Serif TC", Georgia, serif;
  font-size: 1.65rem;
  font-weight: 500;
  line-height: 1.22;
  letter-spacing: -0.018em;
  color: var(--fg);
}

html[lang="zh-Hant"] .section-title {
  letter-spacing: 0.03em;
}

.sub-label {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.9rem;
}

.item-desc {
  font-size: 0.92rem;
  line-height: 1.75;
  color: var(--body);
}

/* ==========================================================================
   01 · PROJECTS & SPOTLIGHT DEPTH-OF-FIELD LISTS
   ========================================================================== */
.editorial-plate {
  padding: 1.35rem 1.45rem;
  border: 1px solid var(--border-strong);
  border-left: 2.5px solid var(--accent);
  background-color: var(--surface);
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  margin-bottom: 2.75rem;
  transition: border-color 0.22s ease, background-color 0.22s ease;
}

.plate-top {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem 1rem;
}

.entry-title-group {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.6rem;
}

.entry-title {
  font-size: 1.12rem;
  font-weight: 600;
  color: var(--fg);
  letter-spacing: -0.012em;
}

.entry-tag {
  font-size: 0.76rem;
  font-weight: 500;
  color: var(--accent);
  letter-spacing: 0.02em;
}

.entry-tag::before {
  content: "·";
  margin-right: 0.5rem;
  color: var(--border-strong);
}

.inline-links {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
  font-size: 0.84rem;
}

.meta-line {
  font-size: 0.77rem;
  color: var(--muted);
}

.list-group {
  display: flex;
  flex-direction: column;
}

.list-row {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  padding: 1.15rem 0;
  border-top: 1px solid var(--border);
  transition: opacity 240ms cubic-bezier(0.22, 1, 0.36, 1), background-color 200ms ease;
}

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

.list-row::before {
  content: "";
  position: absolute;
  top: -1px;
  left: 0;
  right: 0;
  height: 1.5px;
  background-color: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 280ms cubic-bezier(0.22, 1, 0.36, 1);
  pointer-events: none;
}

@media (min-width: 640px) {
  .list-row {
    flex-direction: row;
    align-items: baseline;
    justify-content: space-between;
    gap: 1.75rem;
  }
}

.row-main {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.row-title {
  font-size: 0.98rem;
  font-weight: 600;
  color: var(--fg);
  transition: color 180ms ease, transform 240ms cubic-bezier(0.22, 1, 0.36, 1);
}

.row-meta {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 0.85rem;
  font-size: 0.78rem;
  color: var(--muted);
  white-space: nowrap;
}

.star-count {
  color: var(--accent);
  font-weight: 500;
}

.arrow {
  display: inline-block;
  transition: transform 240ms cubic-bezier(0.22, 1, 0.36, 1), color 180ms ease;
}

.list-footer {
  margin-top: 1rem;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  font-size: 0.85rem;
}

.muted-note {
  color: var(--muted);
}

/* Depth-of-Field Spotlight Hover (Fine pointers only — never traps touch users) */
@media (hover: hover) and (pointer: fine) {
  .spotlight-group:has(.spotlight-item:hover) .spotlight-item:not(:hover) {
    opacity: 0.42;
  }

  .list-row-link:hover::before {
    transform: scaleX(1);
  }

  .list-row-link:hover .row-title {
    color: var(--accent);
    transform: translateX(4px);
  }

  .list-row-link:hover .arrow {
    color: var(--accent);
    transform: translate(3px, -3px);
  }
}

/* ==========================================================================
   02 · EXPERIENCE SPINE & EDUCATION
   ========================================================================== */
.timeline-list {
  list-style: none;
  position: relative;
  display: flex;
  flex-direction: column;
  padding-left: 1.35rem;
  border-left: 1px solid var(--border);
}

.timeline-item {
  position: relative;
  padding: 0 0 1.85rem 0;
  display: flex;
  flex-direction: column;
  gap: 0.32rem;
  transition: opacity 240ms cubic-bezier(0.22, 1, 0.36, 1);
}

.timeline-item:last-child {
  padding-bottom: 0.25rem;
}

.timeline-dot {
  position: absolute;
  left: -1.35rem;
  top: 0.46rem;
  width: 7px;
  height: 7px;
  margin-left: -4px;
  border-radius: 50%;
  background-color: var(--bg);
  border: 1.5px solid var(--border-strong);
  transition: border-color 0.2s ease, background-color 0.2s ease;
}

.timeline-item.is-current .timeline-dot {
  background-color: var(--accent);
  border-color: var(--accent);
}

@media (hover: hover) and (pointer: fine) {
  .timeline-item:hover .timeline-dot {
    border-color: var(--accent);
  }
}

.timeline-head {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

@media (min-width: 640px) {
  .timeline-head {
    flex-direction: row;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
  }
}

.timeline-org-wrap {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.5rem;
}

.timeline-org {
  font-size: 1.02rem;
  font-weight: 600;
  color: var(--fg);
}

.timeline-period {
  font-size: 0.79rem;
  color: var(--muted);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.timeline-role {
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--muted);
}

.timeline-detail {
  margin-top: 0.15rem;
  font-size: 0.92rem;
  line-height: 1.75;
  color: var(--body);
}

.edu-block {
  margin-top: 2.75rem;
}

.edu-list {
  list-style: none;
  display: flex;
  flex-direction: column;
}

.edu-item {
  padding: 0.9rem 0;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.edu-item:last-child {
  border-bottom: 1px solid var(--border);
}

@media (min-width: 640px) {
  .edu-item {
    flex-direction: row;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
  }
}

.edu-main {
  font-size: 0.93rem;
  color: var(--fg);
}

.edu-degree {
  color: var(--muted);
  margin-left: 0.5rem;
}

@media (max-width: 520px) {
  .edu-degree {
    display: block;
    margin-left: 0;
    font-size: 0.86rem;
  }
}

/* ==========================================================================
   03 · RESEARCH
   ========================================================================== */
.research-item {
  position: relative;
  padding: 1.25rem 0;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  transition: opacity 240ms cubic-bezier(0.22, 1, 0.36, 1);
}

.research-item:last-child {
  padding-bottom: 0;
}

.research-top {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.4rem 1rem;
}

.research-venue {
  font-size: 0.8rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.research-title {
  font-size: 1.02rem;
  font-weight: 600;
  line-height: 1.45;
  color: var(--fg);
}

.research-authors {
  font-size: 0.84rem;
  color: var(--muted);
}

.research-authors strong {
  color: var(--fg);
  font-weight: 500;
}

/* ==========================================================================
   FOOTER WITH RICH RETURNING PACIFIC TIDE
   ========================================================================== */
.site-footer {
  position: relative;
  z-index: 2;
  border-top: 1px solid var(--border);
  padding-top: 2.25rem;
  overflow: hidden;
  background-color: var(--bg);
}

.footer-inner {
  position: relative;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1.5rem;
  font-size: 0.84rem;
  color: var(--muted);
  padding-bottom: 1.5rem;
}

.footer-links {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1.25rem;
}

.footer-links a,
.footer-btn {
  transition: color 0.18s ease;
}

.footer-links a:hover,
.footer-btn:hover {
  color: var(--fg);
}

.footer-tide {
  display: block;
  width: 100%;
  height: 108px;
  cursor: pointer;
}

/* ==========================================================================
   EASTER EGGS — BORDERLESS EDITORIAL HUD (display: none at rest)
   ========================================================================== */
@keyframes hud-in {
  from {
    opacity: 0;
    transform: translateY(3px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.coast-hud {
  position: absolute;
  top: calc(100% + 0.55rem);
  left: 1.25rem;
  right: 1.25rem;
  z-index: 6;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.12rem;
  pointer-events: none;
}

@media (min-width: 640px) {
  .coast-hud {
    left: 2.25rem;
    right: 2.25rem;
  }
}

@media (min-width: 900px) {
  .coast-hud {
    top: auto;
    bottom: -2px;
    left: auto;
    right: 2.25rem;
    gap: 0.2rem;
  }
}

.coast-hud-bar {
  display: none;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 0.15rem 0.65rem;
  max-width: 100%;
  padding: 0;
  border: none;
  background: transparent;
  font-family: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.72rem;
  letter-spacing: 0.03em;
  line-height: 1.3;
  color: var(--muted);
  pointer-events: none;
}

[data-theme="dark"] .coast-hud-bar {
  text-shadow: 0 1px 8px rgba(9, 14, 22, 0.55);
}

.coast-hud-bar.is-open {
  display: inline-flex;
  pointer-events: auto;
  animation: hud-in 180ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

@media (max-width: 639px) {
  .coast-hud-bar {
    font-size: 0.68rem;
    gap: 0.1rem 0.5rem;
  }
}

.coast-hud-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 2px 1px;
  color: var(--muted);
  font: inherit;
  letter-spacing: inherit;
  transition: color 160ms ease;
}

.coast-hud-icon {
  min-width: 26px;
  padding: 2px 4px;
}

@media (pointer: coarse) {
  .coast-hud-btn {
    min-height: 32px;
  }
  .coast-hud-icon {
    min-width: 30px;
  }
}

.coast-hud-btn:hover {
  color: var(--fg);
}

.coast-hud-btn.is-active {
  color: var(--fg);
  font-weight: 500;
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 1.5px;
  text-underline-offset: 4px;
}

.coast-hud-btn[aria-pressed="true"] .icon-sfx-on {
  display: none;
}

.coast-hud-btn[aria-pressed="false"] .icon-sfx-off {
  display: none;
}

.coast-hud-stat {
  color: var(--fg);
  font-variant-numeric: tabular-nums;
  padding-right: 0.15rem;
}

.coast-hud-accent {
  color: #b6452c;
}

[data-theme="dark"] .coast-hud-accent {
  color: #d8b97e;
}

/* ==========================================================================
   REDUCED MOTION
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *, *::before, *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}
