/* ==========================================================================
   Chokgyur Lingpa Foundation: "Lapis & Lotus" design system
   Colours sampled from the CGLF emblem (lotus, vajra, scrolls) and the
   2016 Zangdok Palri booklet (lapis ground, gold line drawing).
   Full rules: docs/design-system.md. Live specimen: /design.html
   ========================================================================== */

:root {
  /* Lapis: the ground. Booklet blue and the emblem's scroll tips. */
  --lapis-950: #071f40;
  --lapis-900: #0b2f5e;
  --lapis-700: #0a4790;   /* booklet cover blue, exact */
  --lapis-300: #8fb0d2;   /* emblem scroll tips */
  --lapis-100: #e3ebf4;

  /* Lotus: the accent. Emblem petals. */
  --lotus-800: #7d1220;
  --lotus-600: #b3162b;   /* primary accent, buttons, links on paper */
  --lotus-400: #d84860;
  --lotus-100: #f6e2e0;   /* inner petals */

  /* Vajra gold: ornament and text on lapis only. */
  --gold-600: #a26a1c;    /* rules and icons on paper, never body text */
  --gold-400: #d9b36a;    /* text and line art on lapis */
  --gold-200: #efdcae;

  /* Leaf: sparing, for "live" or "done" states. */
  --jade-600: #4f6b3c;
  --jade-300: #a7bf9a;

  /* Paper and ink */
  --paper: #f8f3ea;
  --paper-2: #f1e8d8;
  --ink: #221b17;
  --ink-2: #5b4f47;
  --line: #e2d5bf;

  /* Type */
  --font-display: "Cormorant Garamond", "Iowan Old Style", Georgia, serif;
  --font-body: "Source Serif 4", "Iowan Old Style", Georgia, serif;
  --font-label: "Source Sans 3", "Gill Sans", "Segoe UI", sans-serif;

  --step--1: clamp(0.84rem, 0.82rem + 0.1vw, 0.9rem);
  --step-0: clamp(1.06rem, 1.02rem + 0.2vw, 1.15rem);
  --step-1: clamp(1.3rem, 1.2rem + 0.5vw, 1.55rem);
  --step-2: clamp(1.7rem, 1.45rem + 1.1vw, 2.3rem);
  --step-3: clamp(2.2rem, 1.7rem + 2.2vw, 3.4rem);
  --step-4: clamp(2.7rem, 1.9rem + 3.6vw, 4.6rem);

  /* Space and shape */
  --space-1: 0.5rem;
  --space-2: 1rem;
  --space-3: 1.5rem;
  --space-4: 2.5rem;
  --space-5: 4rem;
  --space-6: clamp(4.5rem, 3rem + 6vw, 8rem);
  --measure: 38rem;
  --wide: 72rem;
  --radius: 3px;
  --shadow: 0 1px 0 rgb(34 27 23 / 0.04), 0 12px 30px -18px rgb(34 27 23 / 0.35);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 5rem; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } *, *::before, *::after { animation: none !important; transition: none !important; } }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 var(--step-0)/1.65 var(--font-body);
  font-optical-sizing: auto;
  text-rendering: optimizeLegibility;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--lotus-600); text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
a:hover { color: var(--lotus-800); text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--lotus-400); outline-offset: 3px; border-radius: 2px; }

h1, h2, h3 { font-family: var(--font-display); font-weight: 600; line-height: 1.08; letter-spacing: -0.005em; margin: 0 0 var(--space-2); text-wrap: balance; }
h1 { font-size: var(--step-4); }
h2 { font-size: var(--step-3); }
h3 { font-size: var(--step-1); line-height: 1.2; }
p { margin: 0 0 var(--space-2); max-width: var(--measure); text-wrap: pretty; }

.skip { position: absolute; left: -999px; top: 0; background: var(--ink); color: var(--paper); padding: 0.6rem 1rem; z-index: 99; }
.skip:focus { left: 1rem; top: 1rem; }

.wrap { width: min(100% - 2.5rem, var(--wide)); margin-inline: auto; }

/* Label: small tracked caps used for eyebrows and meta */
.label {
  font: 600 var(--step--1)/1.3 var(--font-label);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--lotus-600);
  margin: 0 0 var(--space-2);
}
.on-lapis .label { color: var(--gold-400); }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 20;
  background: rgb(248 243 234 / 0.92);
  backdrop-filter: saturate(1.2) blur(8px);
  border-bottom: 1px solid var(--line);
}
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); min-height: 4.25rem; }
.brand { display: flex; align-items: center; gap: 0.75rem; text-decoration: none; color: var(--ink); }
.brand img { width: 46px; height: auto; }
.brand span { font: 600 1.28rem/1.05 var(--font-display); }
.brand small { display: block; font: 600 0.68rem/1.4 var(--font-label); letter-spacing: 0.18em; text-transform: uppercase; color: var(--ink-2); }
.nav { display: flex; gap: clamp(0.8rem, 2vw, 1.8rem); font: 600 0.86rem/1 var(--font-label); letter-spacing: 0.06em; }
.nav a { white-space: nowrap; color: var(--ink-2); text-decoration: none; padding: 0.5rem 0; border-bottom: 2px solid transparent; }
.nav a:hover, .nav a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--lotus-600); }
@media (max-width: 760px) {
  .site-header .wrap { flex-wrap: wrap; padding-block: 0.6rem; gap: 0.4rem; }
  .nav { width: 100%; overflow-x: auto; padding-bottom: 0.2rem; }
}

/* ---------- Lapis band (hero, Zangdok Palri) ---------- */
.on-lapis {
  position: relative; isolation: isolate;
  background: radial-gradient(120% 90% at 85% 10%, var(--lapis-700) 0%, var(--lapis-900) 55%, var(--lapis-950) 100%);
  color: #f3eee4;
}
.on-lapis::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: url("../img/clouds.svg") 0 0 / 360px 220px repeat;
  opacity: 0.16;
}
.on-lapis h1, .on-lapis h2, .on-lapis h3 { color: #fbf6ec; }
.on-lapis p { color: #dfe6f0; }
.on-lapis a:not(.btn) { color: var(--gold-200); }

.hero { padding-block: var(--space-6); overflow: hidden; }
.hero .wrap { display: grid; grid-template-columns: 1.35fr 1fr; gap: var(--space-5); align-items: center; }
.hero h1 { max-width: 15ch; }
.hero h1 em { font-style: italic; color: var(--gold-400); font-weight: 600; }
.hero .lede { font-size: var(--step-1); line-height: 1.5; max-width: 34rem; }
.hero-emblem { position: relative; justify-self: center; width: min(100%, 25rem); aspect-ratio: 1; display: grid; place-items: center; }
.hero-emblem::before, .hero-emblem::after {
  content: ""; position: absolute; border-radius: 50%; border: 1px solid rgb(217 179 106 / 0.55);
}
.hero-emblem::before { inset: 0; }
.hero-emblem::after { inset: 7%; border-style: dashed; border-color: rgb(217 179 106 / 0.35); animation: turn 120s linear infinite; }
.hero-emblem .disc { width: 72%; aspect-ratio: 1; border-radius: 50%; background: radial-gradient(circle at 50% 40%, #fffaf0 0%, var(--paper) 55%, var(--paper-2) 100%); display: grid; place-items: center; box-shadow: 0 30px 60px -30px rgb(0 0 0 / 0.6), inset 0 0 0 6px rgb(217 179 106 / 0.35); }
.hero-emblem img { width: 78%; }
@keyframes turn { to { transform: rotate(360deg); } }
@media (max-width: 860px) {
  .hero .wrap { grid-template-columns: 1fr; }
  .hero-emblem { width: min(70%, 16rem); order: -1; }
}

/* Load-in: one staggered reveal on the hero only */
.rise { animation: rise 0.9s cubic-bezier(.2,.7,.2,1) both; }
.rise:nth-child(2) { animation-delay: 0.08s; }
.rise:nth-child(3) { animation-delay: 0.16s; }
.rise:nth-child(4) { animation-delay: 0.24s; }
.rise:nth-child(5) { animation-delay: 0.32s; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }

/* ---------- Buttons ---------- */
.actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: var(--space-3); }
.btn {
  display: inline-flex; align-items: center; gap: 0.5rem;
  font: 600 0.95rem/1 var(--font-label); letter-spacing: 0.04em;
  padding: 0.95rem 1.35rem; border-radius: var(--radius);
  text-decoration: none; border: 1px solid transparent;
  transition: background-color .2s, color .2s, border-color .2s, transform .2s;
}
.btn:hover { transform: translateY(-1px); text-decoration: none; }
.btn-primary { background: var(--lotus-600); color: #fff; }
.btn-primary:hover { background: var(--lotus-800); color: #fff; }
.btn-ghost { border-color: currentColor; color: var(--ink); }
.btn-ghost:hover { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.on-lapis .btn-ghost { color: var(--gold-200); }
.on-lapis .btn-ghost:hover { background: var(--gold-400); color: var(--lapis-950); border-color: var(--gold-400); }
.ext::after { content: "\2197"; font-size: 0.9em; }

/* ---------- Sections ---------- */
.section { padding-block: var(--space-6); }
.section-tint { background: var(--paper-2); }
.section-head { max-width: 46rem; margin-bottom: var(--space-4); }
.section-head p:not(.label) { font-size: var(--step-1); line-height: 1.5; color: var(--ink-2); }

/* Ornamental divider: double gold rule with a centre jewel */
.ornament { display: flex; align-items: center; gap: 1rem; color: var(--gold-600); margin: 0 auto; width: min(100% - 2.5rem, 20rem); }
.ornament::before, .ornament::after { content: ""; flex: 1; height: 4px; border-block: 1px solid currentColor; opacity: 0.7; }
.ornament span { width: 9px; height: 9px; background: var(--lotus-600); transform: rotate(45deg); box-shadow: 0 0 0 3px var(--paper), 0 0 0 4px var(--gold-600); }

/* Two-column split */
.split { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-5); align-items: start; }
.split.media-right > :last-child { position: sticky; top: 6rem; }
@media (max-width: 860px) { .split { grid-template-columns: 1fr; gap: var(--space-4); } .split.media-right > :last-child { position: static; } }

/* Framed photo: thin gold keyline offset behind the image */
.frame { position: relative; margin: 0; }
.frame img { border-radius: var(--radius); width: calc(100% - 14px); box-shadow: 14px 14px 0 -1px var(--paper), 14px 14px 0 0 var(--gold-600); }
.frame figcaption { margin-top: 1.4rem; font: 500 var(--step--1)/1.4 var(--font-label); color: var(--ink-2); }

/* Pull quote */
.quote { margin: 0 0 var(--space-4); padding-left: var(--space-3); border-left: 3px solid var(--lotus-600); }
.quote p { font: italic 500 var(--step-2)/1.2 var(--font-display); color: var(--ink); max-width: 30ch; margin-bottom: 0.6rem; }
.quote cite { font: 600 var(--step--1)/1.3 var(--font-label); letter-spacing: 0.1em; text-transform: uppercase; font-style: normal; color: var(--ink-2); }
.on-lapis .quote { border-left-color: var(--gold-400); }
.on-lapis .quote p { color: #fbf6ec; }
.on-lapis .quote cite { color: var(--lapis-300); }

/* Stats */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); border-block: 1px solid var(--line); margin: var(--space-4) 0; }
.stat { padding: var(--space-3) var(--space-2); text-align: center; }
.stat + .stat { border-left: 1px solid var(--line); }
.stat b { font-variant-numeric: lining-nums; display: block; font: 600 var(--step-3)/1 var(--font-display); color: var(--lotus-600); }
.stat span { font: 600 var(--step--1)/1.35 var(--font-label); letter-spacing: 0.06em; color: var(--ink-2); }
@media (max-width: 560px) { .stats { grid-template-columns: 1fr; } .stat + .stat { border-left: 0; border-top: 1px solid var(--line); } }

/* The monastic year: numbered list with lotus numerals */
.year { list-style: none; padding: 0; margin: var(--space-3) 0 0; counter-reset: y; display: grid; gap: var(--space-3); }
.year li { counter-increment: y; display: grid; grid-template-columns: 2.6rem 1fr; gap: 1rem; }
.year li::before { content: counter(y, lower-roman); font: italic 600 1.5rem/1.2 var(--font-display); color: var(--gold-600); text-align: right; }
.year h4 { font: 600 var(--step-1)/1.2 var(--font-display); margin: 0 0 0.25rem; }
.year p { margin: 0; color: var(--ink-2); }

/* Cards */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); gap: var(--space-3); }
.card {
  background: var(--paper); border: 1px solid var(--line); border-top: 3px solid var(--lotus-600);
  border-radius: var(--radius); padding: var(--space-3); box-shadow: var(--shadow);
  display: flex; flex-direction: column;
}
.card p { color: var(--ink-2); font-size: 1rem; }
.card .btn { margin-top: auto; align-self: flex-start; }
.card.is-lapis { border-top-color: var(--lapis-700); }
.card.is-gold { border-top-color: var(--gold-600); }
.card .price { font-variant-numeric: lining-nums; font: 600 var(--step-2)/1 var(--font-display); color: var(--ink); margin: 0 0 0.4rem; }

.note { font-size: 0.98rem; color: var(--ink-2); border-top: 1px solid var(--line); margin-top: var(--space-4); padding-top: var(--space-3); max-width: 48rem; }

/* Zangdok Palri band */
.zp { padding-block: var(--space-6); }
.zp .wrap { display: grid; grid-template-columns: 1.1fr 1fr; gap: var(--space-5); align-items: center; }
.zp-art { margin: 0; border-radius: var(--radius); overflow: hidden; box-shadow: 0 40px 80px -40px rgb(0 0 0 / 0.7); outline: 1px solid rgb(217 179 106 / 0.45); outline-offset: 10px; }
@media (max-width: 860px) { .zp .wrap { grid-template-columns: 1fr; } }

/* Timeline (Zangdok Palri page) */
.timeline { list-style: none; margin: var(--space-4) 0 0; padding: 0; position: relative; }
.timeline::before { content: ""; position: absolute; left: 6.2rem; top: 0.6rem; bottom: 0.6rem; width: 1px; background: var(--gold-600); opacity: 0.6; }
.timeline li { display: grid; grid-template-columns: 5.4rem 1fr; gap: 2rem; padding-block: 0.9rem; position: relative; }
.timeline li::after { content: ""; position: absolute; left: calc(6.2rem - 5px); top: 1.55rem; width: 9px; height: 9px; transform: rotate(45deg); background: var(--paper); border: 1px solid var(--gold-600); }
.timeline time { font-variant-numeric: lining-nums; font: 600 1.6rem/1.05 var(--font-display); color: var(--lotus-600); text-align: right; }
.timeline p { margin: 0; }
.timeline li.open time { color: var(--jade-600); }
.timeline li.open::after { background: var(--jade-600); border-color: var(--jade-600); }

/* Organisation details (legal) */
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 0.7rem 2rem; margin: 0; font-size: 1rem; }
.facts dt { font: 600 var(--step--1)/1.6 var(--font-label); letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-2); }
.facts dd { margin: 0; }
@media (max-width: 560px) { .facts { grid-template-columns: 1fr; gap: 0.15rem; } .facts dd { margin-bottom: 0.8rem; } }

/* ---------- Footer ---------- */
.site-footer { background: var(--lapis-950); color: #c9d4e3; padding-block: var(--space-5) var(--space-4); font-size: 0.95rem; }
.site-footer a { color: var(--gold-200); }
.site-footer .wrap { display: grid; grid-template-columns: auto 1fr; gap: var(--space-3) var(--space-4); align-items: start; }
.site-footer img { width: 64px; }
.site-footer p { max-width: none; margin-bottom: 0.4rem; }
.site-footer .fine { grid-column: 1 / -1; border-top: 1px solid rgb(143 176 210 / 0.25); padding-top: var(--space-3); font-size: 0.85rem; color: #93a6c0; }

.subhead { font-size: var(--step-2); margin-top: var(--space-2); }
