/* ============================================================
   Jia-heng Zhang · Refined Modern Academic Bento Stylesheet
   Low-saturation, cohesive scholarly aesthetic
   ============================================================ */

:root,
[data-theme="light"] {
  color-scheme: light;
  --bg-canvas: #fff;
  --card-bg: #fffdfa;
  --card-subtle: #f5f1eb;
  --card-muted: #eae4df;
  --border-color: #ddd5cc;
  --border-hover: #b1a398;
  --text-primary: #24263b;
  --text-secondary: #494959;
  --text-muted: #665f62;
  --accent: #933e29;
  --accent-hover: #73301f;
  --accent-soft: #f7e7dc;
  --accent-text: #893b29;
  --copper: #ad4f32;
  --wash: #eee4db;
  --shadow-sm: 0 3px 12px rgb(46 35 41 / 3%);
  --shadow-hover: 0 5px 16px rgb(46 35 41 / 8%);
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg-canvas: #151622;
  --card-bg: #202232;
  --card-subtle: #272939;
  --card-muted: #303245;
  --border-color: #414154;
  --border-hover: #646275;
  --text-primary: #f6f0e8;
  --text-secondary: #d4ced2;
  --text-muted: #b6aeb9;
  --accent: #f2b08c;
  --accent-hover: #ffd1ae;
  --accent-soft: #49342f;
  --accent-text: #f4b99a;
  --copper: #f0a27c;
  --wash: #302938;
  --shadow-sm: 0 3px 12px rgb(0 0 0 / 12%);
  --shadow-hover: 0 5px 16px rgb(0 0 0 / 20%);
}

:root {
  --serif: "STIX Two Text", Georgia, "Songti SC", "Noto Serif CJK SC", serif;
  --sans: "Source Sans 3", -apple-system, BlinkMacSystemFont, "PingFang SC", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

html,
body {
  min-height: 100%;
  background-color: var(--bg-canvas);
  color: var(--text-primary);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.25s ease, color 0.25s ease;
}

[data-theme="dark"] body {
  background-image: radial-gradient(ellipse at 88% 0, var(--wash), transparent 48rem);
}

:focus-visible {
  outline: 2px solid var(--copper);
  outline-offset: 3px;
}

.page-shell {
  max-width: 1216px;
  margin: 0 auto;
  padding: 24px clamp(16px, 3vw, 40px) 44px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* ============================================================
   Top Header
   ============================================================ */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 0 13px;
  border-bottom: 1px solid var(--border-hover);
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.brand-monogram {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 5px 10px;
  border-radius: 9px;
  background: var(--accent);
  color: #ffffff;
  font-family: var(--mono);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.03em;
}

[data-theme="dark"] .brand-monogram {
  color: #0b1018;
}

.brand-text {
  font-family: var(--sans);
  font-weight: 700;
  font-size: 0.98rem;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.topbar-controls {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  gap: 8px;
}

.control-btn {
  display: inline-flex;
  white-space: nowrap;
  align-items: center;
  gap: 6px;
  padding: 6px 13px;
  border-radius: 999px;
  background: var(--card-bg);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.18s ease, color 0.18s ease, background-color 0.18s ease;
}

.control-btn:hover {
  border-color: var(--border-hover);
  color: var(--text-primary);
  background: var(--card-subtle);
}

/* ============================================================
   Bento Grid System
   ============================================================ */
.bento-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.bento-card {
  position: relative;
  border-radius: 14px;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  padding: 24px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: border-color 0.2s ease, box-shadow 0.22s ease, transform 0.22s ease,
    background-color 0.25s ease;
}

.card-link {
  text-decoration: none;
  color: inherit;
}

.card-link:hover,
.zoomable:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow-hover);
  transform: translateY(-2px);
}

.zoomable {
  cursor: zoom-in;
}

.section-eyebrow {
  display: inline-block;
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--accent-text);
}

/* ============================================================
   Personal introduction and illustrated landscape
   ============================================================ */
.profile {
  grid-column: 1 / -1;
  overflow: hidden;
  border: 1px solid var(--border-color);
  border-radius: 16px;
  background: var(--card-bg);
  box-shadow: var(--shadow-sm);
}

.profile-landscape {
  position: relative;
  isolation: isolate;
  padding: clamp(26px, 4.4vw, 54px);
  color: #fffaf0;
  background-color: #132d3d;
}

.observatory-stage {
  position: absolute;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  container-type: size;
  pointer-events: none;
}

/* Keep the projection in the landscape's coordinates as the hero crops. */
.observatory-scene {
  position: absolute;
  top: 50%;
  right: 0;
  width: max(100cqw, 300cqh);
  aspect-ratio: 3;
  transform: translateY(-50%);
  background: url("./assets/carry-hefeng-array.webp") center / cover;
}

.observatory-stage::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgb(11 33 49 / 78%), rgb(12 36 49 / 56%) 41%, transparent 70%);
}

.role-line {
  width: fit-content;
  display: flex;
  align-items: center;
  gap: 10px;
  color: #ffd0a7;
  font: 500 0.78rem/1.5 var(--mono);
  letter-spacing: 0.05em;
}

.role-line::before {
  content: "";
  width: 26px;
  height: 2px;
  background: #f2ac73;
}

.hero-names {
  margin: 16px 0 10px;
  width: fit-content;
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0 15px;
  min-width: 0;
}

.hero-names h1 {
  font: 500 clamp(2.6rem, 5vw, 4.4rem)/1.04 var(--serif);
  letter-spacing: -0.045em;
}

.hero-names span {
  color: #ece1da;
  font: 400 1.25rem/1.4 var(--serif);
}

.hero-tagline {
  max-width: min(54%, 53ch);
  font-size: 1.09rem;
  line-height: 1.55;
  color: #f8f2ea;
}

.interest-chips, .hero-actions {
  width: fit-content;
  max-width: 100%;
  display: flex;
  align-items: center;
  gap: 8px 12px;
  flex-wrap: wrap;
}

.interest-chips {
  margin: 12px 0 24px;
  color: #f1d1b7;
  font: 500 0.78rem/1.5 var(--mono);
}

.interest-chip + .interest-chip::before {
  content: "/";
  margin-right: 12px;
  color: #f3b489;
}

.hero-actions a {
  padding: 8px 15px;
  border-radius: 6px;
  font-weight: 600;
  font-size: 0.95rem;
  text-decoration: none;
}

.btn-primary { color: #322326; background: #ffd3a8; }
.btn-primary:hover { background: #ffe2c6; }
.btn-secondary { color: #f8f3ed; border: 1px solid #b9abb0; background: #343447; }
.btn-secondary:hover { background: #46445b; }
.hero-actions .text-action { color: #f5ece7; text-decoration: underline; text-underline-offset: 3px; }

.affiliation {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  padding: 12px clamp(20px, 4.4vw, 54px);
  border-top: 2px solid #be8a64;
}

.photo-link {
  margin-inline-start: auto;
  padding: 5px 0;
  border: 0;
  background: none;
  color: var(--accent-text);
  font: 600 .88rem var(--sans);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.affiliation p {
  max-width: 87ch;
  font-size: 0.94rem;
  line-height: 1.45;
  color: var(--text-secondary);
}

.portrait {
  position: absolute;
  left: 74.2%;
  top: 82.5%;
  transform: translate(-50%, -100%);
  width: 13%;
  aspect-ratio: .92;
  pointer-events: none;
}
.portrait.figure-ready {pointer-events: auto}
.portrait img {display:block; width:100%; height:100%; object-fit:contain}
.figure-ready > img {display:none}
.portrait::before {
  content: "";
  position: absolute;
  left: 25%; right: 25%; bottom: -1%; height: 8%;
  pointer-events: none;
  border-radius: 50%;
  background: radial-gradient(ellipse, #fff7e9 0%, #f6ccabaa 22%, #e9ab9059 50%, transparent 72%);
  box-shadow: inset 0 0 1px 1px #f9d2ad88, 0 0 9px #f0b59b66;
}
#figure-control {
  position: absolute;
  inset: 0;
  padding: 0;
  border: 0;
  border-radius: 12%;
  background: transparent;
  cursor: grab;
  touch-action: pan-y;
  user-select: none;
}
#figure-control:active { cursor: grabbing; }
#figure-control canvas { display: block; width: 100%; height: 100%; }
#figure-help {
  position: absolute;
  top: calc(100% + 5px);
  left: 50%;
  transform: translateX(-50%);
  padding: 2px 7px;
  border-radius: 4px;
  background: rgb(38 34 49 / 85%);
  color: #fbf3ea;
  font: 500 .74rem/1.4 var(--sans);
  white-space: nowrap;
  pointer-events: none;
}

/* ============================================================
   Row 2: Italy 2027 (1 col) + Astro Clock (1 col) + Contact (2 cols)
   ============================================================ */
.card-news {
  justify-content: flex-start;
  gap: 8px;
  border-top: 3px solid var(--copper);
}

.card-news, .card-clock, .card-contact {
  padding: 18px 20px;
}

#news-title a { color: inherit; text-decoration: none; }
#news-title a::after { content: ""; position: absolute; inset: 0; }
#news-title a:hover, #news-title a:focus-visible { text-decoration: underline; }
#news-title, #news-body { overflow-wrap: anywhere; }
#news-body { white-space: pre-line; }
:root:not([data-theme="dark"]) :is(.card-news, .card-work, .affiliation) { border-top-color: #000; }

.mini-card-title {
  font-family: var(--sans);
  font-size: 1.22rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.mini-card-desc {
  font-size: 0.94rem;
  line-height: 1.52;
  color: var(--text-secondary);
}

.card-clock {
  --text-primary: #fff7ec;
  --text-secondary: #e3dce0;
  --accent-text: #f4be97;
  background: linear-gradient(145deg, #36344d, #212237);
  border-color: #4a4155;
  justify-content: flex-start;
  gap: 12px;
}

.clock-readout .section-eyebrow { margin-bottom: 6px; }
.astro-history { border-top: 1px solid #ffffff35; padding-top: 10px; }
.astro-history h2 { display: block; margin-bottom: 5px; }
#history-source {
  display: block;
  color: var(--text-secondary);
  font-size: .91rem;
  line-height: 1.35;
  text-decoration: none;
}
#history-source time { color: var(--text-primary); font: 600 .77rem var(--mono); }
#history-source:hover time, #history-source:focus-visible time { text-decoration: underline; }
#history-event { display: block; margin-top: 3px; }

.mjd-value {
  font-family: var(--mono);
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
  font-variant-numeric: tabular-nums;
}

.clock-lines {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-family: var(--mono);
  font-size: 0.77rem;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}

.card-contact {
  grid-column: span 2;
  justify-content: flex-start;
  gap: 10px;
}

.contact-top {
  display: grid;
  gap: 6px;
}

.profile-links {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.profile-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 38px;
  padding: 6px 12px;
  border-radius: 8px;
  background: var(--card-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  font-size: 0.95rem;
  font-weight: 600;
  text-decoration: none;
  transition: border-color 0.16s ease, background-color 0.16s ease;
}

.profile-pill:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.profile-pill svg {
  width: 18px;
  height: 18px;
  fill: var(--accent-text);
  flex-shrink: 0;
}

.email-list {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 6px;
}

.email-row {
  font: inherit;
  text-align: left;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 11px;
  background: var(--card-subtle);
  border: 1px solid var(--border-color);
  cursor: pointer;
  transition: border-color 0.16s ease, background-color 0.16s ease;
}

.email-row:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.email-meta {
  display: grid;
  grid-template-columns: 3rem minmax(0, 1fr);
  align-items: baseline;
  gap: 8px;
  min-width: 0;
}

.email-tag {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.email-addr {
  font-family: var(--mono);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-primary);
  overflow-wrap: anywhere;
}

.email-copy-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--accent-text);
  flex-shrink: 0;
}

/* ============================================================
   Featured research poster
   ============================================================ */
.card-work {
  border-top: 3px solid var(--accent-text);
  grid-column: 1 / -1;
  gap: 16px;
  padding: clamp(14px, 2.5vw, 28px);
}

.work-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 16px;
}

.work-link {
  color: var(--accent-text);
  font-size: 0.875rem;
  font-weight: 600;
  text-underline-offset: 3px;
}

.work-link::after {
  content: "";
  position: absolute;
  inset: 0;
  cursor: zoom-in;
}

.work-citation a {
  position: relative;
  z-index: 1;
  color: var(--accent-text);
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.5;
  text-underline-offset: 3px;
}

.card-work:focus-within {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.work-poster {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--border-color);
  border-radius: 10px;
}

/* ============================================================
   Row 4 Full Width: Publications & Collaborations (4 cols)
   ============================================================ */
.card-pubs {
  grid-column: span 4;
  padding: 26px 28px;
  gap: 18px;
}

.pubs-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.pubs-title-wrap {
  display: flex;
  align-items: baseline;
  gap: 14px;
  flex-wrap: wrap;
}

.section-heading {
  font-family: var(--serif);
  font-size: clamp(1.55rem, 2.8vw, 2.2rem);
  line-height: 1.15;
  font-weight: 500;
  letter-spacing: -0.02em;
}

.orcid-inline-link {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent-text);
  text-decoration: none;
}

.orcid-inline-link:hover {
  text-decoration: underline;
}

.pubs-filters {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.filter-chip {
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--card-subtle);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
  font-family: inherit;
  font-size: 0.77rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.16s ease;
}

.filter-chip:hover {
  color: var(--text-primary);
  border-color: var(--border-hover);
}

.filter-chip.active {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
}

[data-theme="dark"] .filter-chip.active {
  color: #0b1018;
}

.pubs-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.pub-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 15px 18px;
  border-radius: 13px;
  background: var(--card-subtle);
  border: 1px solid var(--border-color);
  transition: border-color 0.16s ease;
}

.pub-item:hover {
  border-color: var(--border-hover);
}

.pub-main {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}

.pub-meta-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.pub-date {
  font-family: var(--mono);
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--text-muted);
}

.pub-journal-pill {
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--accent-soft);
  color: var(--accent-text);
  font-size: 0.72rem;
  font-weight: 600;
}

.pub-title {
  font-size: 1.06rem;
  font-weight: 600;
  line-height: 1.42;
  color: var(--text-primary);
}

.pub-authors {
  font-size: 0.8rem;
  line-height: 1.5;
  color: var(--text-secondary);
}

.pub-authors strong {
  color: var(--text-primary);
  font-weight: 700;
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-underline-offset: 3px;
}

.pub-doi-btn {
  display: inline-flex;
  align-items: center;
  padding: 6px 11px;
  border-radius: 8px;
  background: var(--card-bg);
  color: var(--accent-text);
  border: 1px solid var(--border-color);
  font-family: var(--mono);
  font-size: 0.74rem;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
  transition: border-color 0.16s ease, background-color 0.16s ease;
}

.pub-doi-btn:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

/* ============================================================
   Footer, Lightbox & Toast
   ============================================================ */
.footer {
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-muted);
  padding-top: 6px;
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(10, 14, 22, 0.86);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease;
  cursor: zoom-out;
}

.lightbox.open {
  opacity: 1;
  pointer-events: auto;
}

.lightbox-inner {
  max-width: 900px;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.lightbox-inner img {
  max-width: 100%;
  max-height: 82vh;
  object-fit: contain;
  border-radius: 14px;
  background: #ffffff;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
}

.lightbox-caption {
  color: #e2e8f0;
  font-size: 0.86rem;
  line-height: 1.5;
  text-align: center;
  max-width: 720px;
}

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(18px);
  background: var(--text-primary);
  color: var(--card-bg);
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 600;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 150;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ============================================================
   Responsive Layouts
   ============================================================ */
@media (max-width: 960px) {
  .bento-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .card-pubs {
    grid-column: span 2;
  }


}

@media (max-width: 640px) {
  .page-shell {
    padding: 18px 14px 32px;
  }

  .bento-grid {
    grid-template-columns: 1fr;
  }

  .card-contact,
  .card-pubs {
    grid-column: span 1;
  }

  .email-meta {
    grid-template-columns: minmax(0, 1fr);
    gap: 3px;
  }

  .pub-item {
    flex-direction: column;
    align-items: flex-start;
  }
}


@media (max-width: 760px) {
  .profile-landscape {
    padding-bottom: 24px;
    padding-top: 252px;
  }
  .observatory-stage { top: 44px; bottom: auto; height: min(205px, 54vw); }
  .observatory-scene {
    right: auto;
    left: 91%;
    transform: translate(-91%, -50%);
  }
  .observatory-stage::after {
    background: linear-gradient(0deg, #132d3d, transparent 33%);
  }

  .hero-tagline { max-width: 52ch; }
  .brand-text { font-size: 0.88rem; }
  .topbar-controls { gap: 4px; }
  .control-btn { padding: 6px 9px; }
}

@media (max-width: 480px) {
  .hero-names { display: grid; gap: 3px; }
  .hero-names h1 { font-size: clamp(1.8rem, 8vw, 2.35rem); }
  .hero-actions { gap: 6px; }
  .hero-actions a { padding: 8px 10px; font-size: 0.9rem; }
  .hero-actions .text-action { padding-inline: 5px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: 0s !important; }
}

.visitor-tools {position:absolute; top:clamp(12px,2vw,24px); right:clamp(12px,2vw,24px); display:grid; justify-items:end; gap:6px}
.visitor-tools button {display:inline-flex; align-items:center; justify-content:center; gap:7px; min-height:36px; padding:5px 12px; border-radius:22px; border:1px solid #e7d8d277; background:#252638dc; color:#f3f3e9; font:600 .86rem var(--sans); cursor:pointer}
.visitor-tools button:hover,.visitor-tools button:focus-visible {background:#433c51; border-color:#f7cb9e}
.visitor-tools svg {width:16px; height:16px; fill:none; stroke:currentColor; stroke-width:1.65; stroke-linejoin:round}
#like-button[aria-pressed=true] svg {fill:#ffc398; stroke:#ffc398}
#likes {font-variant-numeric:tabular-nums}
.album-card {grid-column:1 / -1; gap:18px}
.album-grid {display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:14px}
.album-tile {border:0; background:transparent; color:var(--text-secondary); text-align:start; font:500 .88rem var(--sans); cursor:pointer; overflow-wrap:anywhere}
.album-tile img {display:block; width:100%; aspect-ratio:4/3; object-fit:cover; border-radius:9px; margin-bottom:6px}
.site-dialog {margin:auto; width:min(38rem,calc(100% - 28px)); max-height:86vh; overflow:auto; overscroll-behavior:contain; padding:clamp(17px,3vw,30px); border:1px solid var(--border-hover); border-radius:15px; background:var(--card-bg); color:var(--text-primary); box-shadow:0 16px 70px #29203355}
.site-dialog::backdrop {background:#211f2ab8; backdrop-filter:blur(4px)}
.site-dialog header {display:flex; align-items:center; justify-content:space-between; gap:12px; margin-bottom:18px}
.dialog-close {width:40px; height:40px; font:1.6rem/1 var(--sans); background:var(--card-subtle); border:1px solid var(--border-color); color:var(--text-primary); border-radius:50%; cursor:pointer}
.site-dialog form {display:grid; gap:10px; margin-bottom:20px}
.site-dialog label {display:grid; gap:4px; font-weight:600}
.site-dialog input,.site-dialog textarea {width:100%; padding:9px; background:var(--card-subtle); border:1px solid var(--border-hover); border-radius:6px; color:inherit; font:inherit}
.site-dialog small,.form-status,.album-grid>p,#board-list>p {color:var(--text-secondary)}
.action {width:fit-content; border:0; border-radius:7px; padding:9px 16px; font:600 .95rem var(--sans); background:var(--accent); color:var(--card-bg); cursor:pointer}
button:disabled {cursor:default; opacity:.76}
.form-status:empty {display:none}
#board-list article,#board-list>p {padding:12px 0; border-top:1px solid var(--border-color); margin-top:8px; overflow-wrap:anywhere}
#board-list article p {white-space:pre-wrap; margin-top:3px}
.gallery-dialog {width:min(56rem,calc(100% - 28px))}
#gallery-view {margin-bottom:18px; text-align:center}
#gallery-view img {max-width:100%; max-height:54vh; object-fit:contain; border-radius:9px}
#gallery-caption {color:var(--text-secondary); overflow-wrap:anywhere}
.album-tile[aria-current=true] img {outline:2px solid var(--copper); outline-offset:2px}
@media(max-width:760px){.visitor-tools{display:flex}.album-grid{grid-template-columns:repeat(2,minmax(0,1fr))}}

.album-actions, .album-nav {display:flex; align-items:center; gap:8px}
.album-actions {gap:clamp(10px, 2vw, 22px)}
.album-nav[hidden] {display:none}
.album-nav button {
  display:grid; place-content:center; width:40px; height:40px; padding:0 0 3px;
  border:1px solid var(--border-hover); border-radius:50%; background:var(--card-subtle);
  font:1.65rem/1 var(--sans); color:var(--accent-text); cursor:pointer;
}
.album-nav button:enabled:hover {background:var(--accent-soft); border-color:var(--accent)}
.album-nav button:disabled {opacity:.35; cursor:default}
.album-track {
  display:flex; width:100%; min-width:0; overflow-x:auto; scroll-snap-type:x mandatory;
  overscroll-behavior-x:contain; scrollbar-width:thin; scrollbar-color:var(--border-hover) transparent;
}
.album-track .album-tile {flex:0 0 100%; min-width:0; scroll-snap-align:start; padding-bottom:5px}
.album-track .album-tile:focus-visible {outline-offset:-3px; border-radius:12px}
.slide-frame {
  position:relative; isolation:isolate; display:grid; place-items:center; width:100%;
  height:clamp(260px, 40vw, 430px); overflow:hidden; border-radius:11px; background:#232333;
}
.album-track .slide-frame img {width:100%; height:100%; max-height:100%; min-height:0; margin:0; border-radius:0; aspect-ratio:auto; object-fit:contain}
.album-track .slide-frame .slide-backdrop {position:absolute; inset:0; z-index:-1; object-fit:cover; filter:blur(20px); transform:scale(1.12); opacity:.42}
.slide-caption {display:block; margin:9px 4px 0; line-height:1.4}
@media(max-width:640px){
  .slide-frame {height:clamp(195px, 64vw, 325px)}
  .album-card {padding:16px; gap:12px}
  .album-actions {margin-inline-start:auto}
}

.hero-notes {
  position:absolute; top:108px; bottom:12px; right:1.1%; width:17.6%;
  display:grid; align-content:center; gap:8px; pointer-events:none;
}
.hero-notes[hidden], .site-dialog form[hidden] {display:none}
.note-bubble {
  display:block; container-type:inline-size; overflow:hidden; width:100%; min-width:0;
  padding:0; border:0; background:transparent; text-align:left; color:#fff9ee;
  cursor:pointer; pointer-events:auto;
}
.note-line {
  display:block; width:max-content; white-space:nowrap; border-radius:999px;
  padding:5px 12px; background:linear-gradient(90deg,#272436e6,#393043db);
  font:600 clamp(1rem,1.55vw,1.16rem)/1.45 var(--sans);
}
.note-author {color:#ffcfac; font-weight:500}
.note-bubble:focus-visible .note-line {transform:none !important}
.note-bubble:focus-visible .note-line {width:auto; white-space:normal; overflow-wrap:anywhere; border-radius:9px; max-height:4em; overflow:hidden}
@media(prefers-reduced-motion:reduce){
  .note-line {width:auto; white-space:normal; overflow-wrap:anywhere; border-radius:9px; display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden}
}
@media(max-width:760px){
  .hero-notes {position:static; width:100%; margin-top:18px; gap:6px}
}

#figure-speech {
  position:absolute; z-index:2; top:calc(100% + 5px); left:50%; transform:translateX(-50%);
  width:max-content; max-width:clamp(118px,15vw,175px); padding:6px 10px; border:1px solid #dbb99f;
  border-radius:7px; text-align:center; color:#302737; background:#fff3df; box-shadow:0 3px 9px #18172833;
  font:600 .79rem/1.3 var(--sans); pointer-events:none;
}
#figure-speech:empty {display:none}
#figure-speech:not(:empty)::before {content:""; position:absolute; bottom:100%; left:48%; border:5px solid transparent; border-bottom-color:#fff3df}
.portrait:has(#figure-speech:not(:empty)) #figure-help {visibility:hidden}
.portrait.figure-fallback {pointer-events:auto}
.figure-fallback canvas {visibility:hidden}
@media (max-width:760px) {
  #figure-speech {top:42%; left:5%; transform:translateX(-100%); max-width:min(32vw,155px)}
  #figure-speech:not(:empty)::before {left:100%; bottom:40%; border-color:transparent; border-left-color:#fff3df}
}
