/* ============================================================================
   濠江紀 — MACAO
   Design system for a Macau cultural-tourism journal.
   Ink-and-porcelain palette, gold hairlines, serif display, film grain.
   ========================================================================== */

/* --------------------------------------------------------------- 1. tokens */
:root {
  --ink:          #0a0f16;
  --ink-2:        #101823;
  --ink-3:        #17212e;
  --ink-4:        #22303f;
  --paper:        #faf7f0;
  --paper-2:      #f2ede3;
  --paper-3:      #e7e0d2;

  --gold:         #c3a061;
  --gold-2:       #e3c98e;
  --gold-dim:     rgba(195, 160, 97, .30);
  --vermilion:    #a32b23;
  --azulejo:      #2e5a78;
  --jade:         #3d6a5c;

  --fg:           #161b22;
  --fg-soft:      #4a5462;
  --fg-faint:     #7b8492;
  --fg-on-dark:   #e9e4d9;
  --fg-on-dark-soft: rgba(233, 228, 217, .72);
  --fg-on-dark-faint: rgba(233, 228, 217, .48);

  --rule:         rgba(22, 27, 34, .14);
  --rule-dark:    rgba(233, 228, 217, .16);

  --serif: "Noto Serif SC", "Source Han Serif SC", "Songti SC", "STSong",
           "SimSun", "宋体", "Noto Serif", Georgia, serif;
  --display: "Cormorant Garamond", "Noto Serif SC", Georgia, serif;
  --sans: "Inter", -apple-system, "Segoe UI", "PingFang SC",
          "Microsoft YaHei", "Hiragino Sans GB", sans-serif;

  --gut: clamp(20px, 5vw, 84px);
  --max: 1400px;
  --measure: 34em;

  --ease: cubic-bezier(.22, 1, .36, 1);
  --ease-io: cubic-bezier(.65, .05, .36, 1);

  --header-h: 76px;
}

/* ---------------------------------------------------------------- 2. reset */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--fg);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.85;
  font-feature-settings: "kern" 1;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}
img, svg, video { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
h1, h2, h3, h4, p, figure, blockquote, ul, ol { margin: 0; }
ul, ol { padding: 0; list-style: none; }
::selection { background: var(--gold); color: var(--ink); }

/* film grain — keeps large flat areas from looking digitally clean */
body::after {
  content: "";
  position: fixed; inset: 0; z-index: 9998;
  pointer-events: none; opacity: .045; mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ------------------------------------------------------------ 3. typography */
.display {
  font-family: var(--serif);
  font-weight: 600;
  line-height: 1.16;
  letter-spacing: .02em;
}
.eyebrow {
  font-family: var(--sans);
  font-size: .68rem;
  font-weight: 500;
  letter-spacing: .3em;
  text-transform: uppercase;
  color: var(--gold);
  display: inline-block;
  line-height: 2;
  max-width: 100%;
}
.eyebrow::before {
  content: ""; display: inline-block;
  width: 2.4em; height: 1px; background: currentColor; opacity: .55;
  vertical-align: middle; margin-right: .85em;
}
.eyebrow--plain::before { display: none; }
.on-dark .eyebrow { color: var(--gold-2); }

.lede {
  font-family: var(--serif);
  font-size: clamp(1.06rem, 1.55vw, 1.32rem);
  line-height: 2.05;
  color: var(--fg-soft);
  font-weight: 400;
}
.on-dark .lede { color: var(--fg-on-dark-soft); }

.num { font-family: var(--display); font-weight: 300; letter-spacing: -.01em; }

/* -------------------------------------------------------------- 4. layout */
.wrap { width: 100%; max-width: var(--max); margin-inline: auto; padding-inline: var(--gut); }
.section { padding-block: clamp(72px, 11vw, 148px); position: relative; }
.section--tight { padding-block: clamp(56px, 7vw, 96px); }
.section--ink { background: var(--ink); color: var(--fg-on-dark); }
.section--ink-2 { background: var(--ink-2); color: var(--fg-on-dark); }
.section--paper2 { background: var(--paper-2); }
.section--ruled { border-top: 1px solid var(--rule); }

/* vertical section marker pinned to the viewport edge */
.edge {
  position: absolute; top: 50%; transform: translateY(-50%);
  writing-mode: vertical-rl; text-orientation: mixed;
  font-family: var(--serif); font-size: .82rem; letter-spacing: .5em;
  color: var(--fg-faint); z-index: 3; user-select: none;
}
.edge--l { left: max(14px, calc(var(--gut) * .28)); }
.edge--r { right: max(14px, calc(var(--gut) * .28)); }
.edge b {
  font-family: var(--display); font-weight: 400; font-size: 1.5rem;
  letter-spacing: 0; color: var(--gold); margin-bottom: 1.2em;
}
.on-dark .edge { color: var(--fg-on-dark-faint); }
@media (max-width: 1280px) { .edge { display: none; } }

/* ---------------------------------------------------- 5. header + nav */
.site-header {
  position: fixed; inset: 0 0 auto 0; z-index: 900;
  height: var(--header-h);
  display: flex; align-items: center;
  transition: background .5s var(--ease), height .4s var(--ease),
              box-shadow .5s var(--ease), border-color .5s var(--ease);
  border-bottom: 1px solid transparent;
}
.site-header::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(to bottom, rgba(10,15,22,.72), rgba(10,15,22,0));
  opacity: 1; transition: opacity .5s var(--ease);
}
.site-header.is-stuck {
  height: 62px;
  background: rgba(10, 15, 22, .93);
  -webkit-backdrop-filter: blur(14px) saturate(1.2);
  backdrop-filter: blur(14px) saturate(1.2);
  border-bottom-color: rgba(195,160,97,.16);
}
.site-header.is-stuck::before { opacity: 0; }
.site-header.is-light { color: var(--fg-on-dark); }

.brand { display: flex; align-items: baseline; gap: .7rem; margin-right: auto; }
.brand__mark {
  font-family: var(--serif); font-weight: 600; font-size: 1.32rem;
  letter-spacing: .18em; white-space: nowrap;
}
.brand__mark i {
  font-style: normal; font-family: var(--display); font-size: .8rem;
  letter-spacing: .3em; opacity: .6; margin-left: .5rem; font-weight: 500;
}
.brand__sub {
  font-size: .6rem; letter-spacing: .28em; text-transform: uppercase;
  opacity: .5; white-space: nowrap;
}
@media (max-width: 520px) { .brand__sub { display: none; } }

.nav { display: flex; align-items: center; gap: clamp(.6rem, 1.6vw, 1.7rem); }
.nav a {
  font-size: .8rem; letter-spacing: .1em; color: inherit;
  position: relative; padding-block: .4rem; white-space: nowrap;
  opacity: .78; transition: opacity .3s;
}
.nav a::after {
  content: ""; position: absolute; left: 0; bottom: 0; width: 100%; height: 1px;
  background: var(--gold); transform: scaleX(0); transform-origin: right;
  transition: transform .45s var(--ease);
}
.nav a:hover, .nav a[aria-current="page"] { opacity: 1; }
.nav a:hover::after, .nav a[aria-current="page"]::after {
  transform: scaleX(1); transform-origin: left;
}
@media (max-width: 1080px) { .nav { display: none; } }

.burger {
  display: none; width: 42px; height: 42px; position: relative;
  border: 1px solid var(--rule-dark); border-radius: 50%;
}
.burger span {
  position: absolute; left: 50%; width: 16px; height: 1px; background: currentColor;
  transform: translateX(-50%); transition: transform .4s var(--ease), opacity .3s;
}
.burger span:nth-child(1) { top: 16px; }
.burger span:nth-child(2) { top: 20.5px; }
.burger span:nth-child(3) { top: 25px; }
.burger.is-open span:nth-child(1) { transform: translateX(-50%) translateY(4.5px) rotate(45deg); }
.burger.is-open span:nth-child(2) { opacity: 0; }
.burger.is-open span:nth-child(3) { transform: translateX(-50%) translateY(-4.5px) rotate(-45deg); }
@media (max-width: 1080px) { .burger { display: block; } }

.progress {
  position: fixed; top: 0; left: 0; height: 2px; z-index: 901;
  background: linear-gradient(90deg, var(--gold), var(--gold-2));
  width: 0; transform-origin: left;
}

/* mobile drawer */
.drawer {
  position: fixed; inset: 0; z-index: 890;
  background: var(--ink); color: var(--fg-on-dark);
  padding: calc(var(--header-h) + 24px) var(--gut) 48px;
  display: flex; flex-direction: column;
  transform: translateY(-100%); visibility: hidden;
  transition: transform .7s var(--ease), visibility .7s;
  overflow-y: auto;
}
.drawer.is-open { transform: translateY(0); visibility: visible; }
.drawer a {
  font-family: var(--serif); font-size: 1.55rem; letter-spacing: .08em;
  padding: .52em 0; border-bottom: 1px solid rgba(233,228,217,.1);
  display: flex; align-items: baseline; gap: 1rem;
}
.drawer a span {
  font-family: var(--display); font-size: .8rem; color: var(--gold); letter-spacing: .1em;
}
.drawer__foot { margin-top: auto; padding-top: 2rem; font-size: .78rem; color: var(--fg-on-dark-faint); }

/* ------------------------------------------------------------------ 6. hero */
.hero {
  position: relative; min-height: 100svh; max-height: 1080px;
  display: flex; align-items: flex-end;
  padding-block: calc(var(--header-h) + 40px) clamp(44px, 7vh, 92px);
  overflow: hidden; background: var(--ink);
}
.hero__bg { position: absolute; inset: 0; z-index: 0; }
.hero__bg img {
  width: 100%; height: 100%; object-fit: cover;
  object-position: center 62%;
  filter: saturate(.86) contrast(1.04);
  animation: kenburns 26s ease-in-out infinite alternate;
}
@keyframes kenburns {
  from { transform: scale(1.04) translate3d(0,0,0); }
  to   { transform: scale(1.15) translate3d(-1.2%, -1.6%, 0); }
}
.hero__bg::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(120% 80% at 78% 18%, rgba(195,160,97,.16), transparent 58%),
    linear-gradient(to top, rgba(10,15,22,.94) 4%, rgba(10,15,22,.52) 42%, rgba(10,15,22,.28) 72%);
}
.hero__inner { position: relative; z-index: 2; width: 100%; }
.hero__title {
  font-family: var(--serif); font-weight: 600;
  font-size: clamp(3rem, 8.6vw, 7.4rem); line-height: 1.04;
  letter-spacing: .06em; color: #fff;
  margin: .35em 0 .28em;
  text-shadow: 0 2px 40px rgba(0,0,0,.4);
}
.hero__title em {
  font-style: normal; color: var(--gold-2);
}
.hero__meta {
  display: flex; flex-wrap: wrap; gap: 1.6rem 2.6rem;
  padding-top: 1.6rem; border-top: 1px solid rgba(233,228,217,.2);
  font-size: .78rem; letter-spacing: .14em; color: var(--fg-on-dark-soft);
}
.hero__meta span { display: inline-flex; align-items: center; gap: .7em; }
.hero__meta span::before {
  content: ""; width: 5px; height: 5px; background: var(--gold);
  transform: rotate(45deg);
}
.scroll-cue {
  position: absolute; right: var(--gut); bottom: clamp(44px, 7vh, 92px);
  writing-mode: vertical-rl; font-size: .62rem; letter-spacing: .4em;
  color: var(--fg-on-dark-faint); z-index: 2; display: flex;
  align-items: center; gap: 1rem;
}
.scroll-cue::after {
  content: ""; width: 1px; height: 54px;
  background: linear-gradient(var(--gold), transparent);
  animation: cue 2.6s var(--ease-io) infinite;
}
@keyframes cue { 0%,100% { transform: scaleY(.35); opacity: .4; } 50% { transform: scaleY(1); opacity: 1; } }
@media (max-width: 860px) { .scroll-cue { display: none; } }

/* --------------------------------------------------------- 7. page opener */
.opener {
  position: relative; height: clamp(460px, 74svh, 820px); display: flex; align-items: flex-end;
  padding-block: calc(var(--header-h) + 60px) clamp(48px, 7vw, 96px);
  background: var(--ink); overflow: hidden;
}
.opener__bg { position: absolute; inset: 0; }
.opener__bg img {
  width: 100%; height: 100%; object-fit: cover;
  object-position: center 55%;
  filter: saturate(.8) contrast(1.05);
}
.opener__bg::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(to top, rgba(10,15,22,.95), rgba(10,15,22,.55) 55%, rgba(10,15,22,.42));
}
.opener__inner { position: relative; z-index: 2; color: #fff; width: 100%; }
.opener__title {
  font-family: var(--serif); font-weight: 600;
  font-size: clamp(2.4rem, 6.2vw, 5.2rem); line-height: 1.12; letter-spacing: .05em;
  margin: .3em 0 .3em;
}
.opener__lede { max-width: 44em; color: var(--fg-on-dark-soft); }

/* ------------------------------------------------------- 8. chapter heads */
.chapter { position: relative; }
.chapter__head { display: grid; gap: .6rem; margin-bottom: clamp(28px, 4vw, 54px); }
.chapter__num {
  font-family: var(--display); font-size: clamp(2.6rem, 5vw, 4rem); line-height: 1;
  color: var(--gold); font-weight: 300; letter-spacing: .04em;
}
.chapter__title {
  font-family: var(--serif); font-weight: 600;
  font-size: clamp(1.75rem, 3.4vw, 2.9rem); line-height: 1.3; letter-spacing: .04em;
}
.chapter__title small {
  display: block; font-family: var(--sans); font-size: .7rem; font-weight: 500;
  letter-spacing: .3em; text-transform: uppercase; color: var(--fg-faint);
  margin-top: .9em;
}
.on-dark .chapter__title small { color: var(--fg-on-dark-faint); }
.chapter__rule { height: 1px; background: var(--rule); margin-top: .5rem; }
.on-dark .chapter__rule { background: var(--rule-dark); }

/* ------------------------------------------------------------- 9. figures */
.figure { position: relative; }
.figure img {
  width: 100%; height: 100%; object-fit: cover;
  filter: saturate(.82) contrast(1.03);
  transition: filter .9s var(--ease), transform 1.2s var(--ease);
}
.figure:hover img { filter: saturate(1) contrast(1.05); transform: scale(1.035); }
.figure figcaption {
  margin-top: .85rem; font-family: var(--serif); font-size: .82rem;
  line-height: 1.75; color: var(--fg-faint); letter-spacing: .04em;
}
.figure figcaption b { color: var(--gold); font-weight: 600; margin-right: .6em; }
.on-dark .figure figcaption { color: var(--fg-on-dark-faint); }

.ratio-16-9 { aspect-ratio: 16 / 9; }
.ratio-4-3  { aspect-ratio: 4 / 3; }
.ratio-3-4  { aspect-ratio: 3 / 4; }
.ratio-1-1  { aspect-ratio: 1 / 1; }
.ratio-21-9 { aspect-ratio: 21 / 9; }
.bleed { width: 100vw; margin-left: 50%; transform: translateX(-50%); }

/* ------------------------------------------------------------- 10. prose */
.prose { max-width: var(--measure); }
.prose p + p { margin-top: 1.35em; }
.prose h3 {
  font-family: var(--serif); font-weight: 600; font-size: 1.32rem;
  letter-spacing: .04em; margin: 2.4em 0 .9em;
}
.prose h3::before {
  content: ""; display: inline-block; width: .42em; height: .42em;
  background: var(--gold); transform: rotate(45deg) translateY(-.04em);
  margin-right: .7em;
}
.prose strong { font-weight: 600; color: var(--fg); }
.prose em {
  font-style: normal; font-family: var(--serif); color: var(--vermilion);
  padding-inline: .12em;
}
.on-dark .prose strong { color: #fff; }
.on-dark .prose em { color: var(--gold-2); }
.prose a {
  border-bottom: 1px solid var(--gold-dim);
  transition: border-color .3s, color .3s;
}
.prose a:hover { border-color: var(--gold); color: var(--gold); }

.split {
  display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr);
  gap: clamp(28px, 5vw, 84px); align-items: start;
}
@media (max-width: 900px) { .split { grid-template-columns: 1fr; } }

.cols-2 { columns: 2; column-gap: clamp(28px, 4vw, 60px); }
@media (max-width: 760px) { .cols-2 { columns: 1; } }

/* --------------------------------------------------------- 11. pullquote */
.pullquote {
  position: relative; padding: clamp(34px, 5vw, 62px) 0;
  border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule);
  font-family: var(--serif); font-weight: 400;
  font-size: clamp(1.2rem, 2.3vw, 1.85rem); line-height: 1.75;
  letter-spacing: .03em; color: var(--fg);
}
.pullquote::before {
  content: "\201C"; position: absolute; top: -.06em; left: -.1em;
  font-family: var(--display); font-size: 5.2em; line-height: 1;
  color: var(--gold); opacity: .2;
}
.pullquote cite {
  display: block; margin-top: 1.2em; font-style: normal;
  font-family: var(--sans); font-size: .74rem; letter-spacing: .22em;
  color: var(--fg-faint); text-transform: uppercase;
}
.on-dark .pullquote { color: var(--fg-on-dark); border-color: var(--rule-dark); }

/* -------------------------------------------------------------- 12. stats */
.stats {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1px; background: var(--rule); border: 1px solid var(--rule);
}
.on-dark .stats { background: var(--rule-dark); border-color: var(--rule-dark); }
.stat { background: var(--paper); padding: clamp(20px, 2.6vw, 32px); }
.on-dark .stat { background: var(--ink); }
.stat__n {
  font-family: var(--display); font-weight: 300; line-height: 1;
  font-size: clamp(2rem, 3.4vw, 3.1rem); color: var(--fg); letter-spacing: -.01em;
}
.on-dark .stat__n { color: #fff; }
.stat__n sup { font-size: .42em; vertical-align: super; color: var(--gold); margin-left: .12em; }
.stat__l {
  margin-top: .7rem; font-size: .76rem; letter-spacing: .12em; color: var(--fg-faint);
}
.on-dark .stat__l { color: var(--fg-on-dark-faint); }

/* ---------------------------------------------------------- 13. timeline */
.timeline { position: relative; padding-left: 2.4rem; }
.timeline::before {
  content: ""; position: absolute; left: 5px; top: .6rem; bottom: .6rem;
  width: 1px; background: linear-gradient(var(--gold), var(--gold-dim) 70%, transparent);
}
.tl-item { position: relative; padding-bottom: clamp(28px, 4vw, 46px); }
.tl-item:last-child { padding-bottom: 0; }
.tl-item::before {
  content: ""; position: absolute; left: -2.4rem; top: .55rem;
  width: 11px; height: 11px; border-radius: 50%;
  background: var(--paper); border: 1px solid var(--gold);
  box-shadow: 0 0 0 4px var(--paper);
}
.on-dark .tl-item::before { background: var(--ink); }
.tl-year {
  font-family: var(--display); font-size: 1.5rem; color: var(--gold);
  letter-spacing: .04em; line-height: 1.2;
}
.tl-item h4 {
  font-family: var(--serif); font-weight: 600; font-size: 1.14rem;
  margin: .35rem 0 .5rem; letter-spacing: .03em;
}
.tl-item p { font-size: .93rem; color: var(--fg-soft); line-height: 1.9; }
.on-dark .tl-item p { color: var(--fg-on-dark-soft); }

/* ------------------------------------------------------------ 14. tables */
.dtable { width: 100%; border-collapse: collapse; font-size: .9rem; }
.dtable th, .dtable td {
  text-align: left; padding: .95rem 1.1rem .95rem 0;
  border-bottom: 1px solid var(--rule); vertical-align: top;
}
.dtable th {
  font-family: var(--sans); font-weight: 500; font-size: .68rem;
  letter-spacing: .2em; text-transform: uppercase; color: var(--gold);
  white-space: nowrap;
}
.dtable td:first-child { font-family: var(--serif); font-weight: 600; width: 32%; }
.on-dark .dtable th, .on-dark .dtable td { border-color: var(--rule-dark); }
.dtable tbody tr { transition: background .35s; }
.dtable tbody tr:hover { background: rgba(195,160,97,.06); }

/* -------------------------------------------------------------- 15. cards */
.cards { display: grid; gap: clamp(18px, 2.4vw, 32px); }
.cards--2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.cards--3 { grid-template-columns: repeat(auto-fit, minmax(272px, 1fr)); }
.cards--4 { grid-template-columns: repeat(auto-fit, minmax(214px, 1fr)); }

.card {
  position: relative; display: flex; flex-direction: column;
  background: var(--paper); border: 1px solid var(--rule);
  overflow: hidden; transition: transform .6s var(--ease), box-shadow .6s var(--ease),
              border-color .6s var(--ease);
}
.card:hover {
  transform: translateY(-5px);
  box-shadow: 0 26px 60px -28px rgba(10,15,22,.42);
  border-color: var(--gold-dim);
}
.card__media { position: relative; overflow: hidden; aspect-ratio: 4 / 3; background: var(--ink-3); }
.card__media img {
  width: 100%; height: 100%; object-fit: cover;
  filter: saturate(.8) contrast(1.03);
  transition: transform 1.3s var(--ease), filter .9s var(--ease);
}
.card:hover .card__media img { transform: scale(1.07); filter: saturate(1) contrast(1.05); }
.card__tag {
  position: absolute; top: 0; left: 0; z-index: 2;
  background: rgba(10,15,22,.78); color: var(--gold-2);
  font-size: .62rem; letter-spacing: .2em; text-transform: uppercase;
  padding: .5em .95em;
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.card__body { padding: clamp(18px, 2.2vw, 28px); display: flex; flex-direction: column; flex: 1; }
.card__body h3 {
  font-family: var(--serif); font-weight: 600; font-size: 1.24rem;
  letter-spacing: .04em; line-height: 1.5; margin-bottom: .55rem;
}
.card__body p { font-size: .88rem; line-height: 1.85; color: var(--fg-soft); }
.card__more {
  margin-top: auto; padding-top: 1.1rem;
  font-size: .72rem; letter-spacing: .2em; text-transform: uppercase;
  color: var(--gold); display: inline-flex; align-items: center; gap: .7em;
}
.card__more::after {
  content: ""; width: 22px; height: 1px; background: currentColor;
  transition: width .5s var(--ease);
}
.card:hover .card__more::after { width: 40px; }
.on-dark .card { background: var(--ink-2); border-color: var(--rule-dark); }
.on-dark .card__body p { color: var(--fg-on-dark-soft); }

/* -------------------------------------------------------- 16. index cards */
.rail { display: grid; gap: 1px; background: var(--rule-dark); }
.rail--2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.rail--4 { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.rail-item {
  background: var(--ink); position: relative; overflow: hidden;
  padding: clamp(26px, 3vw, 40px); min-height: 260px;
  display: flex; flex-direction: column; justify-content: flex-end;
  isolation: isolate;
}
.rail-item img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
  z-index: -2; opacity: .34; filter: saturate(.7) contrast(1.05);
  transition: transform 1.4s var(--ease), opacity .7s var(--ease);
}
.rail-item::after {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(to top, rgba(10,15,22,.96) 12%, rgba(10,15,22,.55) 55%, rgba(10,15,22,.3));
  transition: background .7s var(--ease);
}
.rail-item:hover img { transform: scale(1.06); opacity: .5; }
.rail-item:hover::after { background: linear-gradient(to top, rgba(10,15,22,.94) 20%, rgba(10,15,22,.35) 70%, rgba(10,15,22,.2)); }
.rail-item__n {
  font-family: var(--display); font-size: .78rem; letter-spacing: .2em;
  color: var(--gold); margin-bottom: .9rem;
}
.rail-item h3 {
  font-family: var(--serif); font-weight: 600; font-size: clamp(1.3rem, 2vw, 1.7rem);
  letter-spacing: .06em; color: #fff; line-height: 1.4;
}
.rail-item p {
  margin-top: .7rem; font-size: .85rem; color: var(--fg-on-dark-soft);
  max-width: 26em; line-height: 1.8;
}
.rail-item__arrow {
  position: absolute; top: clamp(26px, 3vw, 40px); right: clamp(26px, 3vw, 40px);
  width: 34px; height: 34px; border: 1px solid var(--gold-dim); border-radius: 50%;
  display: grid; place-items: center; color: var(--gold);
  transition: background .5s var(--ease), color .5s var(--ease), transform .5s var(--ease);
}
.rail-item:hover .rail-item__arrow { background: var(--gold); color: var(--ink); transform: rotate(-45deg); }

/* --------------------------------------------------------- 17. list rows */
.rows { border-top: 1px solid var(--rule); }
.on-dark .rows { border-color: var(--rule-dark); }
.row {
  display: grid; grid-template-columns: 4.5rem minmax(0,1.4fr) minmax(0,2fr) auto;
  gap: clamp(14px, 2.4vw, 34px); align-items: baseline;
  padding: clamp(18px, 2.2vw, 30px) 0;
  border-bottom: 1px solid var(--rule); position: relative;
  transition: background .45s, padding-left .45s var(--ease);
}
.on-dark .row { border-color: var(--rule-dark); }
.row:hover { background: rgba(195,160,97,.05); padding-left: .8rem; }
.row__n {
  font-family: var(--display); font-size: 1.4rem; color: var(--gold); font-weight: 300;
}
.row__t { font-family: var(--serif); font-weight: 600; font-size: 1.18rem; letter-spacing: .04em; }
.row__d { font-size: .89rem; color: var(--fg-soft); line-height: 1.85; }
.on-dark .row__d { color: var(--fg-on-dark-soft); }
.row__a { font-size: .7rem; letter-spacing: .2em; color: var(--gold); text-transform: uppercase; }
@media (max-width: 760px) {
  .row { grid-template-columns: 3rem 1fr; }
  .row__d, .row__a { grid-column: 2; }
}

/* ------------------------------------------------------------ 18. gallery */
.gallery { display: grid; grid-template-columns: repeat(12, 1fr); gap: clamp(12px, 1.6vw, 22px); }
.gallery .g { position: relative; overflow: hidden; background: var(--ink-3); }
.gallery .g img {
  width: 100%; height: 100%; object-fit: cover;
  filter: saturate(.82) contrast(1.03);
  transition: transform 1.3s var(--ease), filter .9s var(--ease);
}
.gallery .g:hover img { transform: scale(1.06); filter: saturate(1); }
.gallery .g figcaption {
  position: absolute; inset: auto 0 0 0; padding: 1.4rem 1.2rem .95rem;
  background: linear-gradient(to top, rgba(10,15,22,.9), transparent);
  color: #fff; font-family: var(--serif); font-size: .86rem; letter-spacing: .05em;
  opacity: 0; transform: translateY(10px);
  transition: opacity .5s var(--ease), transform .5s var(--ease);
}
.gallery .g:hover figcaption { opacity: 1; transform: none; }
.g-4 { grid-column: span 4; }
.g-6 { grid-column: span 6; }
.g-8 { grid-column: span 8; }
.g-12 { grid-column: span 12; }
.g-3 { grid-column: span 3; }
.g-5 { grid-column: span 5; }
.g-7 { grid-column: span 7; }
.g-9 { grid-column: span 9; }
@media (max-width: 900px) {
  .g-3, .g-4, .g-5, .g-6, .g-7, .g-8, .g-9 { grid-column: span 6; }
}
@media (max-width: 560px) { .gallery > * { grid-column: span 12 !important; } }

/* --------------------------------------------------------- 19. festival */
.filters { display: flex; flex-wrap: wrap; gap: .55rem; margin-bottom: clamp(26px, 3.4vw, 46px); }
.filter {
  font-size: .78rem; letter-spacing: .1em; padding: .55em 1.15em;
  border: 1px solid var(--rule); color: var(--fg-soft);
  transition: all .4s var(--ease); border-radius: 999px;
}
.filter:hover { border-color: var(--gold-dim); color: var(--fg); }
.filter.is-on { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.on-dark .filter { border-color: var(--rule-dark); color: var(--fg-on-dark-soft); }
.on-dark .filter.is-on { background: var(--gold); border-color: var(--gold); color: var(--ink); }

.fest-list { border-top: 1px solid var(--rule); }
.fest {
  display: grid; grid-template-columns: 8.5rem minmax(0,1fr); gap: clamp(16px, 3vw, 46px);
  padding: clamp(22px, 3vw, 38px) 0; border-bottom: 1px solid var(--rule);
  transition: opacity .45s var(--ease), background .45s;
}
.on-dark .fest { border-color: var(--rule-dark); }
.fest.is-hidden { display: none; }
.fest__when { font-family: var(--display); font-size: 1.45rem; color: var(--gold); line-height: 1.3; }
.fest__when small {
  display: block; font-family: var(--sans); font-size: .68rem; letter-spacing: .16em;
  color: var(--fg-faint); margin-top: .5rem; text-transform: uppercase;
}
.on-dark .fest__when small { color: var(--fg-on-dark-faint); }
.fest h3 { font-family: var(--serif); font-weight: 600; font-size: 1.3rem; letter-spacing: .04em; margin-bottom: .5rem; }
.fest p { font-size: .92rem; color: var(--fg-soft); line-height: 1.9; max-width: 56em; }
.on-dark .fest p { color: var(--fg-on-dark-soft); }
.fest__tag {
  display: inline-block; margin-top: .8rem; font-size: .66rem; letter-spacing: .18em;
  text-transform: uppercase; color: var(--gold); border: 1px solid var(--gold-dim);
  padding: .32em .8em;
}
@media (max-width: 640px) { .fest { grid-template-columns: 1fr; gap: 10px; } }

/* ------------------------------------------------------------ 20. notice */
.notice {
  border: 1px solid var(--rule); border-left: 3px solid var(--gold);
  padding: clamp(20px, 2.6vw, 32px); background: rgba(195,160,97,.05);
  font-size: .89rem; line-height: 1.9; color: var(--fg-soft);
}
.notice b { color: var(--fg); font-weight: 600; }
.notice--warn { border-left-color: var(--vermilion); background: rgba(163,43,35,.05); }

/* -------------------------------------------------------- 21. misc blocks */
.tagline {
  font-family: var(--serif); font-size: clamp(1.5rem, 3.4vw, 2.6rem);
  line-height: 1.55; letter-spacing: .04em; font-weight: 400;
}
.kv { display: grid; gap: .1rem; }
.kv div { display: flex; justify-content: space-between; gap: 1rem; padding: .8rem 0; border-bottom: 1px solid var(--rule); font-size: .9rem; }
.on-dark .kv div { border-color: var(--rule-dark); }
.kv dt, .kv .k { color: var(--fg-faint); font-size: .82rem; letter-spacing: .08em; }
.on-dark .kv .k { color: var(--fg-on-dark-faint); }
.kv .v { font-family: var(--serif); font-weight: 600; text-align: right; }

.badge {
  display: inline-flex; align-items: center; gap: .5em; font-size: .68rem;
  letter-spacing: .2em; text-transform: uppercase; color: var(--gold);
}
.badge::before { content: ""; width: 6px; height: 6px; background: var(--gold); transform: rotate(45deg); }

/* ---------------------------------------------------------- 22. footer */
.site-footer { background: var(--ink); color: var(--fg-on-dark); padding-block: clamp(56px, 8vw, 100px) 34px; }
.footer-grid {
  display: grid; grid-template-columns: minmax(0, 1.5fr) repeat(auto-fit, minmax(140px, 1fr));
  gap: clamp(26px, 4vw, 60px);
}
.site-footer h4 {
  font-size: .68rem; letter-spacing: .22em; text-transform: uppercase;
  color: var(--gold); margin-bottom: 1.1rem; font-weight: 500;
}
.site-footer a { display: block; padding: .3rem 0; font-size: .87rem; color: var(--fg-on-dark-soft); transition: color .3s; }
.site-footer a:hover { color: var(--gold-2); }
.footer-brand p { font-size: .86rem; color: var(--fg-on-dark-soft); max-width: 30em; line-height: 1.9; margin-top: 1rem; }
.footer-bottom {
  margin-top: clamp(34px, 5vw, 64px); padding-top: 24px;
  border-top: 1px solid var(--rule-dark);
  display: flex; flex-wrap: wrap; gap: 1rem 2rem; justify-content: space-between;
  font-size: .76rem; color: var(--fg-on-dark-faint);
}
.footer-bottom a { display: inline; padding: 0; }

/* -------------------------------------------------------- 23. reveal fx */
[data-reveal] {
  opacity: 0; transform: translateY(26px);
  transition: opacity .95s var(--ease), transform .95s var(--ease);
}
[data-reveal].is-in { opacity: 1; transform: none; }
[data-reveal="fade"] { transform: none; }
[data-reveal="clip"] {
  clip-path: inset(0 0 100% 0); opacity: 1; transform: none;
  transition: clip-path 1.15s var(--ease);
}
[data-reveal="clip"].is-in { clip-path: inset(0 0 0 0); }

/* --------------------------------------------------------- 24. utilities */
.stack-xs > * + * { margin-top: .5rem; }
.stack-sm > * + * { margin-top: 1rem; }
.stack   > * + * { margin-top: 1.6rem; }
.stack-lg > * + * { margin-top: clamp(24px, 3.4vw, 48px); }
.mt-0 { margin-top: 0 !important; }
.center { text-align: center; }
.max-60 { max-width: 60ch; }
.max-50 { max-width: 50ch; }
.muted { color: var(--fg-faint); }
.on-dark .muted { color: var(--fg-on-dark-faint); }
.serif { font-family: var(--serif); }
.gold { color: var(--gold); }
.nowrap { white-space: nowrap; }
.hide-sm { display: initial; }
@media (max-width: 700px) { .hide-sm { display: none; } }

/* page index links inside prose */
.toc { display: grid; gap: .1rem; margin-top: 2rem; }
.toc a {
  display: flex; gap: 1rem; align-items: baseline;
  padding: .7rem 0; border-bottom: 1px solid var(--rule); font-size: .92rem;
  transition: padding-left .4s var(--ease), color .3s;
}
.toc a:hover { padding-left: .7rem; color: var(--gold); }
.toc a span { font-family: var(--display); color: var(--gold); font-size: .9rem; }

/* ------------------------------------------------------------ 25. motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important; animation-iteration-count: 1 !important;
    transition-duration: .001ms !important; scroll-behavior: auto !important;
  }
  [data-reveal] { opacity: 1 !important; transform: none !important; clip-path: none !important; }
  .hero__bg img { animation: none; }
}

@media print {
  .site-header, .drawer, .progress, .scroll-cue, body::after { display: none !important; }
  .section { padding-block: 24px; }
}

/* --------------------------------------------------------- 25. lightbox */
.lightbox {
  position: fixed; inset: 0; z-index: 9990;
  background: rgba(6,9,13,.94);
  display: grid; place-items: center; padding: clamp(20px, 5vw, 70px);
  opacity: 0; visibility: hidden; transition: opacity .45s var(--ease), visibility .45s;
}
.lightbox.is-open { opacity: 1; visibility: visible; }
.lightbox img {
  max-width: 100%; max-height: 78vh; object-fit: contain;
  box-shadow: 0 40px 90px -30px rgba(0,0,0,.9);
  transform: scale(.97); transition: transform .5s var(--ease);
}
.lightbox.is-open img { transform: none; }
.lightbox__cap {
  margin-top: 1.1rem; color: var(--fg-on-dark-soft); font-family: var(--serif);
  font-size: .88rem; letter-spacing: .05em; text-align: center; max-width: 40em;
}
.lightbox__close {
  position: absolute; top: 22px; right: 26px; width: 44px; height: 44px;
  border: 1px solid rgba(233,228,217,.25); border-radius: 50%; color: var(--fg-on-dark);
  display: grid; place-items: center; font-size: 1.2rem; line-height: 1;
  transition: background .4s, color .4s, border-color .4s;
}
.lightbox__close:hover { background: var(--gold); color: var(--ink); border-color: var(--gold); }
[data-lightbox] { cursor: zoom-in; }

/* ------------------------------------------------- 26. chapter quick-nav */
.quicknav { display: grid; grid-template-columns: repeat(auto-fit, minmax(128px, 1fr)); gap: 1px; background: var(--rule-dark); }
.quicknav a {
  background: var(--ink); padding: 1.5rem 1.1rem; text-align: center;
  transition: background .45s var(--ease);
}
.quicknav a:hover { background: var(--ink-3); }
.quicknav b {
  display: block; font-family: var(--display); font-size: 1.5rem; color: var(--gold);
  font-weight: 300; line-height: 1; margin-bottom: .6rem;
}
.quicknav span { font-family: var(--serif); font-size: .92rem; letter-spacing: .14em; color: var(--fg-on-dark); }

/* header inner */
.site-header .wrap { display: flex; align-items: center; height: 100%; }
.site-header .brand { margin-right: auto; }
@media (max-width: 560px) { .brand__mark i { display: none; } }

/* favicon mark reused as a small ornament */
.mark-ornament {
  display: inline-block; width: .62em; height: .62em;
  background: var(--gold); transform: rotate(45deg); vertical-align: baseline;
}

/* focal helpers for opener photography */
.opener__bg img.op-right { object-position: 76% 45%; }
.opener__bg img.op-left  { object-position: 24% 45%; }
.opener__bg img.op-bottom{ object-position: 50% 78%; }
.hero__bg img.op-right   { object-position: 76% 60%; }

/* --------------------------------------------- narrow-screen safety net */
@media (max-width: 560px) {
  .hero__bg img { object-position: center 74%; }
  .opener__bg img { object-position: center 62%; }
  .hero { max-height: none; }
  .eyebrow { font-size: .62rem; letter-spacing: .22em; }
  .hero__title { letter-spacing: .01em; }
  .hero__meta { gap: .7rem 1.3rem; font-size: .72rem; }
  .hero__meta span { white-space: normal; }
  .chapter__title small { font-size: .64rem; letter-spacing: .22em; }
  .dtable th, .dtable td { padding: .7rem .6rem .7rem 0; }
  .row { grid-template-columns: 2.6rem 1fr; }
  .fest__when { font-size: 1.2rem; }
  .brand__mark { font-size: 1.1rem; letter-spacing: .12em; }
  .quicknav { grid-template-columns: repeat(2, 1fr); }
  .notice { font-size: .86rem; }
}
@media (max-width: 380px) {
  .hero__title { font-size: 2.5rem; }
  .eyebrow::before { width: 1.6em; margin-right: .6em; }
}

/* ------------------------------------------------ outbound banner link */
/* the whole banner is one outbound link; display:contents keeps the
   inner layout untouched while making every part of it clickable */
.opener__link { display: contents; }
.opener__link .opener__bg img {
  transition: transform 1.6s var(--ease), filter .9s var(--ease);
}
.opener__link:hover .opener__bg img,
.opener__link:focus-visible .opener__bg img {
  transform: scale(1.045);
  filter: saturate(.95) contrast(1.08);
}
.opener__link:focus-visible { outline: 2px solid var(--gold); outline-offset: -2px; }

.opener__cta {
  position: absolute; top: calc(var(--header-h) + 22px); right: var(--gut);
  z-index: 3; display: inline-flex; align-items: center; gap: .7em;
  padding: .62em 1.15em; border: 1px solid rgba(233,228,217,.3);
  border-radius: 999px; background: rgba(10,15,22,.42);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  color: var(--fg-on-dark); font-size: .74rem; letter-spacing: .14em;
  white-space: nowrap;
  transition: background .45s var(--ease), border-color .45s var(--ease),
              color .45s var(--ease), transform .45s var(--ease);
}
.opener__cta span { color: var(--gold-2); transition: color .45s var(--ease); }
.opener__cta:hover, .opener__cta:focus-visible {
  background: var(--gold); border-color: var(--gold); color: var(--ink);
  transform: translateY(-1px);
}
.opener__cta:hover span, .opener__cta:focus-visible span { color: var(--ink); }
@media (max-width: 560px) {
  .opener__cta { top: calc(var(--header-h) + 14px); right: 20px; font-size: .68rem; padding: .55em .9em; }
}
