/* ---------- Design tokens ---------- */
:root {
  --bg: #ffffff;
  --bg-alt: #f4f9fd;
  --surface: #eaf3fb;
  --surface-border: #d3e6f5;
  --text: #0a2a43;
  --text-dim: #4a6178;
  --accent: #0a2a43;
  --accent-2: #2f6fad;
  --gradient: linear-gradient(135deg, var(--accent), var(--accent-2));
  --radius: 14px;
  --max-width: 760px;
  --header-h: 60px;
  color-scheme: light;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
  font-family: Georgia, "Noto Serif TC", serif;
  line-height: 1.25;
  margin: 0 0 .5em;
}

a {
  color: var(--accent-2);
  text-decoration: none;
}
a:hover { text-decoration: underline; }

p { margin: 0 0 1em; color: var(--text-dim); }

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 20px;
}

/* ---------- Header / Nav ---------- */
/* The blurred background lives on ::before (not on header itself) because a
   `backdrop-filter`/`filter` on an ancestor creates a containing block for
   `position: fixed` descendants — it would trap the fixed mobile nav panel
   inside the header's own 60px-tall box instead of the viewport. */
header.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-h);
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--surface-border);
}
header.site-header::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(8px);
}

.nav-wrap {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  font-family: Georgia, serif;
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--text);
  letter-spacing: .02em;
}
.logo span { background: var(--gradient); -webkit-background-clip: text; background-clip: text; color: transparent; }

.nav-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: none;
  border: none;
  cursor: pointer;
}
.nav-toggle span,
.nav-toggle::before,
.nav-toggle::after {
  content: "";
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text);
  margin: 4px 0;
  transition: transform .2s ease, opacity .2s ease;
}
.nav-toggle[aria-expanded="true"]::before { transform: translateY(6px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span { opacity: 0; }
.nav-toggle[aria-expanded="true"]::after { transform: translateY(-6px) rotate(-45deg); }

nav.site-nav {
  position: fixed;
  top: var(--header-h);
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  padding: 24px 20px;
  gap: 4px;
  transform: translateX(100%);
  transition: transform .25s ease;
  overflow-y: auto;
}
nav.site-nav.open { transform: translateX(0); }

nav.site-nav a {
  color: var(--text);
  font-size: 1.1rem;
  padding: 14px 8px;
  border-bottom: 1px solid var(--surface-border);
}
nav.site-nav a:hover { color: var(--accent-2); text-decoration: none; }
nav.site-nav a.active { color: var(--accent-2); }

@media (min-width: 720px) {
  .nav-toggle { display: none; }
  nav.site-nav {
    position: static;
    flex-direction: row;
    background: none;
    padding: 0;
    gap: 24px;
    transform: none;
    overflow: visible;
    width: auto;
  }
  nav.site-nav a {
    padding: 0;
    border-bottom: none;
    font-size: .95rem;
  }
}

/* ---------- Page tabs (mobile section indicator) ---------- */
.page-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 12px 20px;
  background: var(--bg-alt);
  border-bottom: 1px solid var(--surface-border);
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.page-tabs::-webkit-scrollbar { display: none; }
.page-tabs a {
  flex: 0 0 auto;
  padding: 7px 14px;
  border-radius: 999px;
  background: var(--bg);
  border: 1px solid var(--surface-border);
  color: var(--text-dim);
  font-size: .82rem;
  white-space: nowrap;
}
.page-tabs a:hover { text-decoration: none; border-color: var(--accent-2); color: var(--accent-2); }
.page-tabs a.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
@media (min-width: 720px) {
  .page-tabs { display: none; }
}

/* ---------- Banner ---------- */
.site-banner {
  position: relative;
  width: 100%;
  height: clamp(140px, 26vw, 280px);
  overflow: hidden;
}
.site-banner img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 68%;
  display: block;
}
.site-banner::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, rgba(255, 255, 255, 0) 55%, var(--bg) 100%);
}

/* ---------- Hero ---------- */
.hero {
  padding: 40px 0 40px;
  text-align: center;
}
.hero-wave {
  width: 100%;
  max-width: 420px;
  height: auto;
  margin: 0 auto 24px;
  display: block;
}

.avatar {
  width: 128px;
  height: 128px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  margin: 0 auto 20px;
  opacity: .92;
  filter: saturate(.85) contrast(.96);
  -webkit-mask-image: radial-gradient(circle, #000 58%, transparent 76%);
  mask-image: radial-gradient(circle, #000 58%, transparent 76%);
  transition: opacity .3s ease, filter .3s ease;
}
.avatar:hover {
  opacity: 1;
  filter: saturate(1) contrast(1);
}
.hero h1 {
  font-size: clamp(1.9rem, 6vw, 2.8rem);
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.alias {
  color: var(--text-dim);
  font-style: italic;
  margin-bottom: 16px;
}
.tagline {
  color: var(--accent-2);
  font-weight: 600;
  font-size: 1.05rem;
  letter-spacing: .01em;
  margin: -6px 0 20px;
}
.tags {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin: 16px 0 24px;
  list-style: none;
  padding: 0;
}
.tags li {
  background: var(--surface);
  border: 1px solid var(--surface-border);
  color: var(--text-dim);
  font-size: .8rem;
  padding: 6px 12px;
  border-radius: 999px;
}
.motto {
  font-family: Georgia, serif;
  font-size: 1.1rem;
  color: var(--text);
  margin: 24px 0;
}
.cta-row {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 20px;
}
.btn {
  display: inline-block;
  padding: 12px 24px;
  border-radius: 999px;
  font-size: .95rem;
  font-weight: 600;
}
.btn-primary {
  background: var(--gradient);
  color: #ffffff;
}
.btn-primary:hover { text-decoration: none; opacity: .92; }
.btn-ghost {
  border: 1px solid var(--surface-border);
  color: var(--text);
}
.btn-ghost:hover { text-decoration: none; border-color: var(--accent-2); color: var(--accent-2); }
.btn-light {
  background: linear-gradient(135deg, #b0d4f1, #6fa8d8);
  color: var(--text);
}
.btn-light:hover { text-decoration: none; opacity: .9; }

/* ---------- Page header (non-home pages) ---------- */
.page-header {
  padding: 40px 0 20px;
}
.page-header h1 { font-size: clamp(1.6rem, 5vw, 2.2rem); }
.page-header p { max-width: 60ch; }

/* ---------- Album spotlight ---------- */
.album-spotlight {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  margin: 24px 0;
}
.album-spotlight-info { flex: 1 1 280px; }
.album-spotlight-info h2, .album-spotlight-info h3 { font-size: 1.3rem; margin: 4px 0 10px; }
.album-tracklist {
  flex: 1 1 220px;
  list-style: decimal;
  padding-left: 1.2em;
  margin: 0;
  color: var(--text-dim);
  font-size: .9rem;
  align-self: center;
}
.album-tracklist li { margin-bottom: 6px; }

/* ---------- Works index (jump links) ---------- */
.works-index {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 8px;
}
.works-index a {
  padding: 7px 16px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--surface-border);
  color: var(--text-dim);
  font-size: .85rem;
  white-space: nowrap;
}
.works-index a:hover { text-decoration: none; border-color: var(--accent-2); color: var(--accent-2); }
@media (max-width: 480px) {
  .works-index {
    flex-direction: column;
    align-items: stretch;
  }
  .works-index a {
    white-space: normal;
    text-align: center;
  }
}

/* ---------- Featured logos ---------- */
.featured-logos {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  margin: 20px 0 28px;
}
.logo-chip {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 48px;
  padding: 0 18px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--surface-border);
}
.logo-chip.dark { background: var(--text); border-color: var(--text); }
.logo-chip img { height: 26px; width: auto; display: block; }

/* ---------- Sections & cards ---------- */
main { padding-bottom: 60px; }

.section {
  padding: 20px 0;
}
.section h2 {
  font-size: 1.3rem;
  color: var(--text);
  margin-bottom: 16px;
  scroll-margin-top: calc(var(--header-h) + 16px);
}

.card {
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 14px;
}
.card h3 {
  font-size: 1.05rem;
  margin-bottom: 4px;
  color: var(--text);
}
.card .meta {
  font-size: .8rem;
  color: var(--accent-2);
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-bottom: 8px;
  display: block;
}
.card p { margin: 0 0 10px; font-size: .93rem; }
.card p:last-child { margin-bottom: 0; }

.year-group {
  margin-bottom: 8px;
}
.year-group > h2 {
  font-family: Georgia, serif;
  color: var(--accent);
  border-bottom: 1px solid var(--surface-border);
  padding-bottom: 8px;
}

.pending-note {
  border: 1px dashed var(--surface-border);
  border-radius: var(--radius);
  padding: 14px 18px;
  font-size: .85rem;
  color: var(--text-dim);
  margin-top: 8px;
}

/* ---------- Info page lists ---------- */
.plain-list {
  list-style: none;
  padding: 0;
  margin: 0 0 1em;
}
.plain-list li {
  padding: 8px 0;
  border-bottom: 1px solid var(--surface-border);
  color: var(--text-dim);
}
.plain-list li:last-child { border-bottom: none; }
.plain-list strong { color: var(--text); }

/* ---------- Contact ---------- */
.contact-grid {
  display: grid;
  gap: 16px;
}
.contact-card {
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius);
  padding: 20px;
}
.contact-card a.big-link {
  font-size: 1.05rem;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 10px;
}
.contact-card a.big-link:hover { color: var(--accent-2); }

/* ---------- Work detail pages ---------- */
.work-detail .page-header { padding-top: 32px; }
.work-detail .page-header .meta {
  font-size: .8rem;
  color: var(--accent-2);
  text-transform: uppercase;
  letter-spacing: .04em;
  display: block;
  margin-bottom: 6px;
}
.work-body { max-width: 66ch; }
.work-body figure { margin: 20px 0; }
.work-body figure img {
  max-width: 100%;
  height: auto;
  display: block;
  border-radius: 8px;
  border: 1px solid var(--surface-border);
}
.work-body figcaption {
  font-size: .85rem;
  color: var(--text-dim);
  margin-top: 6px;
}
.work-body hr {
  border: none;
  border-top: 1px solid var(--surface-border);
  margin: 36px 0;
}
.zh-section h2 {
  font-family: Georgia, "Noto Serif TC", serif;
  font-size: 1.3rem;
}
.back-link { font-size: .9rem; }
.poem { margin: 20px 0; }
.poem p { font-style: italic; }

.zh-section blockquote {
  margin: 16px 0;
  padding: 4px 18px;
  border-left: 3px solid var(--surface-border);
  color: var(--text-dim);
}
.zh-section blockquote p { margin-bottom: 0; }

/* ---------- Footer ---------- */
footer.site-footer {
  border-top: 1px solid var(--surface-border);
  padding: 24px 0 40px;
  text-align: center;
  color: var(--text-dim);
  font-size: .8rem;
}
footer.site-footer a { color: var(--text-dim); }
footer.site-footer .social { margin-bottom: 10px; }
