/* ──────────────────────────────────────────────────────────────
   Shared "cabinet" stylesheet for the per-category pages.
   Same lamp-lit Victorian palette as the homepage. Each category
   page links to this file so design tweaks only need to happen
   in one place; layout-specific touches live inline.
   ────────────────────────────────────────────────────────────── */

/* Cross-platform fonts. The CJK chain previously relied on
   "Songti SC" / "STSong" which only ship on macOS + iOS — Android
   visitors got the OS default (Noto Sans, sans-serif) and lost the
   vintage feel entirely. Noto Serif SC + Cormorant Garamond load
   the same elegant rendering everywhere via Google Fonts. The
   display=swap parameter lets the system font paint immediately
   and swap to the webfont when it lands, so phones on slow
   networks still see content during the loading window. */
@import url("https://fonts.googleapis.com/css2?family=Cinzel:wght@400;500;600&family=Cormorant+Garamond:ital,wght@0,300;0,400;0,500;1,300;1,400&family=Noto+Serif+SC:wght@300;400;500&display=swap");

:root {
  --bg:        #0e0905;
  --bg-warm:   #1a1108;
  --bg-card:   #160d05;
  --bg-cardhi: #221608;
  --ink:       #f0e2bf;
  --ink-soft:  #d4c4a0;
  --ink-mute:  #968762;
  --ink-dim:   #5f543d;
  --amber:     #d99a3c;
  --amber-hot: #f0b454;
  --amber-soft:#b87f2c;
  --gold:      #a07a32;
  --oxblood:   #6d1916;
  --rule:      #4a3c28;
  --rule-soft: #2b2418;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Iowan Old Style", "Charter", "Cormorant Garamond", "Georgia", "Times New Roman", serif;
  font-size: 18px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  background-image:
    radial-gradient(ellipse 90% 55% at 50% 0%, rgba(217, 154, 60, 0.20), transparent 70%),
    radial-gradient(ellipse 60% 50% at 50% 30%, rgba(184, 127, 44, 0.08), transparent 75%);
  background-attachment: fixed;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='240' height='240'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.92  0 0 0 0 0.72  0 0 0 0 0.36  0 0 0 0.10 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
  mix-blend-mode: overlay;
  opacity: 0.6;
}
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(ellipse at center top, transparent 30%, rgba(8, 4, 0, 0.55) 90%),
    linear-gradient(to bottom, transparent 70%, rgba(0,0,0,0.55) 100%);
}
main, header, footer { position: relative; z-index: 1; }

a {
  color: var(--amber);
  text-decoration: none;
  border-bottom: 1px solid rgba(217, 154, 60, 0.28);
  transition: border-color 0.2s ease, color 0.2s ease;
}
a:hover { border-bottom-color: var(--amber-hot); color: var(--amber-hot); }

/* ============ Top bar (back to home) ============ */
nav.topbar {
  padding: 22px 36px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--rule);
}
nav.topbar a.back {
  font-family: "Helvetica Neue", Arial, sans-serif;
  font-size: 10.5px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--ink-mute);
  border: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
nav.topbar a.back:hover { color: var(--amber); }
nav.topbar .crumb {
  font-family: "Didot", Georgia, serif;
  font-size: 14px;
  letter-spacing: 0.04em;
  color: var(--ink-mute);
  font-style: italic;
}

/* ============ Header (lamp glow over category title) ============ */
header.cat-head {
  position: relative;
  text-align: center;
  padding: 88px 28px 36px;
  max-width: 880px;
  margin: 0 auto;
}
header.cat-head::after {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 80%;
  max-width: 560px;
  aspect-ratio: 5 / 2;
  background: radial-gradient(ellipse at center 35%, rgba(240, 180, 84, 0.18), transparent 65%);
  pointer-events: none;
  z-index: -1;
}
header.cat-head .roman {
  font-family: "Didot", Georgia, serif;
  font-style: italic;
  font-size: 12px;
  letter-spacing: 0.42em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 16px;
}
header.cat-head h1 {
  font-family: "Noto Serif SC", "Songti SC", "STSong", "STKaiti", "KaiTi", "PingFang SC", "Didot", Georgia, serif;
  font-weight: 400;
  font-size: clamp(56px, 10vw, 120px);
  line-height: 1;
  margin: 0;
  letter-spacing: 0.04em;
  color: var(--ink);
  text-shadow: 0 4px 36px rgba(217, 154, 60, 0.22);
}
header.cat-head .en {
  font-family: "Didot", "Playfair Display", Georgia, serif;
  font-style: italic;
  font-size: clamp(20px, 2.5vw, 26px);
  color: var(--ink-mute);
  margin: 16px 0 0;
  letter-spacing: 0.03em;
}
header.cat-head .ornament {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin: 26px auto;
  color: var(--gold);
  font-family: "Didot", Georgia, serif;
  font-size: 18px;
  opacity: 0.75;
}
header.cat-head .ornament::before,
header.cat-head .ornament::after {
  content: "";
  width: 90px;
  height: 1px;
  background: linear-gradient(to right, transparent, var(--rule), transparent);
}
header.cat-head .deck {
  font-style: italic;
  color: var(--ink-soft);
  font-size: 18px;
  max-width: 620px;
  margin: 0 auto;
  line-height: 1.65;
}

/* ============ Body content ============ */
article.cat-body {
  max-width: 720px;
  margin: 0 auto;
  padding: 40px 28px 80px;
}
article.cat-body .placeholder {
  border: 1px solid var(--rule);
  background: var(--bg-card);
  padding: 56px 36px;
  text-align: center;
  margin: 40px 0;
  position: relative;
}
article.cat-body .placeholder::before {
  content: "";
  position: absolute;
  inset: 8px;
  border: 1px solid rgba(160, 122, 50, 0.22);
  pointer-events: none;
}
article.cat-body .placeholder .stamp {
  display: inline-block;
  font-family: "Helvetica Neue", Arial, sans-serif;
  font-size: 10px;
  letter-spacing: 0.42em;
  text-transform: uppercase;
  color: var(--oxblood);
  border: 2px solid var(--oxblood);
  padding: 6px 12px;
  margin-bottom: 22px;
  transform: rotate(-2deg);
}
article.cat-body .placeholder h2 {
  font-family: "Didot", "Playfair Display", Georgia, serif;
  font-weight: 400;
  font-size: 28px;
  line-height: 1.2;
  margin: 0 0 14px;
  color: var(--ink);
}
article.cat-body .placeholder p {
  color: var(--ink-mute);
  font-style: italic;
  font-size: 16px;
  max-width: 480px;
  margin: 0 auto 8px;
}

/* ============ Footer ============ */
footer.colophon {
  border-top: 3px double var(--gold);
  padding: 26px 36px;
  text-align: center;
  font-family: "Helvetica Neue", Arial, sans-serif;
  font-size: 10.5px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--ink-dim);
}
footer.colophon .mark {
  font-family: "Didot", Georgia, serif;
  text-transform: none;
  font-size: 14px;
  letter-spacing: 0.05em;
  color: var(--ink-mute);
  font-style: italic;
}

/* ============ Sub-categories within a drawer ============
   The grid is sized to whatever max-width its parent gives it
   (typically 720px inside .cat-body, but we lift it to ~960px on
   the immersive page so the 2-big + 3-small layout breathes). */
.sub-section {
  margin: 0 auto 56px;
  max-width: 960px;
  padding: 0 28px;
}
.sub-section .eyebrow {
  display: block;
  text-align: center;
  font-family: "Helvetica Neue", Arial, sans-serif;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.42em;
  color: var(--gold);
  margin: 0 0 22px;
}

.sub-grid {
  display: grid;
  grid-template-columns: repeat(var(--cols, 2), 1fr);
  gap: 18px;
}
.sub-grid.cols-3 { --cols: 3; }
.sub-grid.cols-4 { --cols: 4; gap: 16px; }
.sub-grid.cols-1 { --cols: 1; }

.subcat {
  position: relative;
  display: block;
  background: rgba(22, 13, 5, 0.78);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  color: var(--ink);
  text-decoration: none;
  border: 1px solid var(--rule);
  padding: 26px 22px 22px;
  overflow: hidden;
  transition: border-color 0.3s ease, transform 0.3s ease, background 0.3s ease;
  border-bottom: 1px solid var(--rule);
  cursor: default;
}
.subcat::before {
  content: "";
  position: absolute;
  inset: 7px;
  border: 1px solid rgba(160, 122, 50, 0.18);
  pointer-events: none;
  transition: border-color 0.3s ease;
}
.subcat:hover {
  border-color: var(--amber);
  background: rgba(34, 22, 8, 0.85);
  transform: translateY(-2px);
}
.subcat:hover::before { border-color: rgba(217, 154, 60, 0.45); }
.subcat .corn {
  position: absolute;
  width: 12px;
  height: 12px;
  border: 1px solid var(--gold);
  opacity: 0.4;
}
.subcat .corn.tl { top: 10px; left: 10px; border-right: none; border-bottom: none; }
.subcat .corn.tr { top: 10px; right: 10px; border-left: none; border-bottom: none; }
.subcat .corn.bl { bottom: 10px; left: 10px; border-right: none; border-top: none; }
.subcat .corn.br { bottom: 10px; right: 10px; border-left: none; border-top: none; }

.subcat .zh {
  font-family: "Noto Serif SC", "Songti SC", "STSong", "STKaiti", "KaiTi", "PingFang SC", serif;
  font-size: 24px;
  line-height: 1.1;
  color: var(--ink);
  margin: 0 0 4px;
  letter-spacing: 0.04em;
}
.subcat .en {
  font-family: "Cormorant Garamond", "Didot", "Playfair Display", Georgia, serif;
  font-style: italic;
  font-size: 14px;
  color: var(--ink-mute);
  margin: 0 0 10px;
  letter-spacing: 0.02em;
}
.subcat .blurb {
  font-size: 13px;
  line-height: 1.55;
  color: var(--ink-soft);
  margin: 0;
}

/* "Featured" variant — bigger card, taller, more breathing room.
   Used for the immersive page's two hero projects (Undeveloped
   Memory + Archived Bloom). The chiaroscuro panel at the top
   stands in for project imagery until KK drops in real photos. */
.subcat.featured {
  padding: 0;
  display: flex;
  flex-direction: column;
}
.subcat.featured .vis {
  height: 220px;
  background:
    radial-gradient(ellipse at 30% 30%, rgba(217, 154, 60, 0.32), transparent 60%),
    radial-gradient(ellipse at 70% 80%, rgba(109, 25, 22, 0.45), transparent 65%),
    linear-gradient(160deg, rgba(34, 22, 8, 0.85), rgba(10, 6, 2, 0.95));
  position: relative;
  overflow: hidden;
  border-bottom: 1px solid var(--rule);
}
.subcat.featured.bloom .vis {
  background:
    radial-gradient(ellipse at 70% 30%, rgba(240, 180, 84, 0.30), transparent 55%),
    radial-gradient(ellipse at 25% 75%, rgba(160, 122, 50, 0.30), transparent 65%),
    linear-gradient(140deg, rgba(28, 18, 6, 0.92), rgba(14, 8, 2, 0.95));
}
.subcat.featured .vis::after {
  content: "";
  position: absolute;
  inset: 14px;
  border: 1px solid rgba(217, 154, 60, 0.3);
  pointer-events: none;
}
.subcat.featured .body {
  padding: 22px 24px 22px;
}
.subcat.featured .zh { font-size: 30px; letter-spacing: 0.08em; }
.subcat.featured .en { font-size: 16px; }
.subcat.featured .blurb { font-size: 13.5px; }

/* "Compact" variant — smaller projects in a tighter row. */
.subcat.compact { padding: 20px 18px 18px; }
.subcat.compact .zh { font-size: 20px; margin-bottom: 2px; }
.subcat.compact .en { font-size: 12.5px; margin-bottom: 0; }

@media (max-width: 760px) {
  .sub-grid { grid-template-columns: 1fr !important; }
  .subcat.featured .vis { height: 160px; }
}

@media (max-width: 600px) {
  nav.topbar { padding: 16px 22px; }
  header.cat-head { padding: 60px 22px 28px; }
  header.cat-head .ornament::before,
  header.cat-head .ornament::after { width: 48px; }
  article.cat-body { padding: 20px 22px 56px; }
  article.cat-body .placeholder { padding: 40px 24px; }
  .sub-section { padding: 0 22px; }
}
