/* Whom Scroll
   Deep space behind a gruvbox page, in the manner of the old web.
   Colors: gruvbox, after Gemini's revision of the Grimoire of the Still Mind.
   Type: IM Fell English and its small caps, after the Grimoire of Stillness.
   Layout: one calm column with a plain top bar and a clear index, after the Stillroom Grimoire. */

@font-face { font-family: "IM Fell English"; src: url("fonts/im-fell-english.woff2") format("woff2"); font-style: normal; font-weight: 400; font-display: swap; }
@font-face { font-family: "IM Fell English"; src: url("fonts/im-fell-english-italic.woff2") format("woff2"); font-style: italic; font-weight: 400; font-display: swap; }
@font-face { font-family: "IM Fell English SC"; src: url("fonts/im-fell-english-sc.woff2") format("woff2"); font-style: normal; font-weight: 400; font-display: swap; }

/* Night page: gruvbox dark */
:root {
  color-scheme: dark;
  --space: #141617;          /* the sky behind everything */
  --sky-text: #d5c4a1;
  --sky-muted: #a89984;
  --sky-line: #3c3836;

  --page: #282828;           /* bg0 */
  --page-raised: #32302f;    /* bg0_s */
  --well: #1d2021;           /* bg0_h */
  --text: #ebdbb2;           /* fg1 */
  --text-soft: #d5c4a1;      /* fg2 */
  --text-muted: #a89984;     /* fg4 */
  --gold: #fabd2f;           /* yellow */
  --gold-soft: #d79921;
  --rubric: #fe8019;         /* orange */
  --aqua: #8ec07c;
  --rule: #665c54;           /* bg3 */
  --bevel-light: #665c54;
  --bevel-dark: #0d0e0f;
  --chip-on-bg: #ebdbb2;
  --chip-on-text: #282828;

  --serif: "IM Fell English", "Iowan Old Style", Georgia, "Times New Roman", serif;
  --caps: "IM Fell English SC", "IM Fell English", Georgia, serif;
  --measure: 38rem;
}

/* Vellum page: gruvbox light, chosen with the lamp button */
:root[data-page="vellum"] {
  --page: #fbf1c7;
  --page-raised: #f2e5bc;
  --well: #ebdbb2;
  --text: #3c3836;
  --text-soft: #504945;
  --text-muted: #7c6f64;
  --gold: #b57614;
  --gold-soft: #b57614;
  --rubric: #af3a03;
  --aqua: #427b58;
  --rule: #bdae93;
  --bevel-light: #fff8dc;
  --bevel-dark: #7c6f64;
  --chip-on-bg: #3c3836;
  --chip-on-text: #fbf1c7;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; background: var(--space); }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--space);
  color: var(--sky-text);
  font-family: var(--serif);
  font-size: 1.1875rem;
  line-height: 1.65;
  isolation: isolate; /* keeps the sky layer above the body's own background */
}
/* The sky: one large scattered starfield fixed behind the page, never tiled. */
body::before {
  content: ""; position: fixed; inset: 0; z-index: -1;
  background: var(--space) url("sky.svg") center / cover no-repeat;
}

a { color: var(--gold); text-underline-offset: .18em; text-decoration-thickness: 1px; }
a:hover { color: var(--rubric); }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }

.skip { position: absolute; left: -999px; top: 0; padding: .5rem 1rem; background: var(--page); color: var(--text); }
.skip:focus { left: 1rem; z-index: 10; }

.wrap { max-width: calc(var(--measure) + 2rem); margin: 0 auto; padding: 0 1rem 2rem; }

/* Top bar */
.topbar {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .25rem 1rem;
  max-width: calc(var(--measure) + 2rem); margin: 0 auto; padding: .75rem 1rem;
  border-bottom: 1px solid var(--sky-line);
  font-family: var(--caps); letter-spacing: .12em; font-size: 1rem;
}
.topbar a { color: var(--sky-muted); text-decoration: none; padding: .35rem 0; }
.topbar a:hover { color: #fabd2f; }
.topbar-home { color: var(--sky-text) !important; }
.topbar .star { color: #fabd2f; }
.topbar-nav { display: flex; align-items: center; gap: 1.1rem; }
.lamp {
  font: inherit; font-size: 1.1rem; line-height: 1; color: var(--sky-muted);
  background: transparent; border: 1px solid var(--sky-line); width: 2.25rem; height: 2.25rem; cursor: pointer;
}
.lamp:hover { color: #fabd2f; border-color: #665c54; }

/* Labels: small spaced capitals */
.label { font-family: var(--caps); letter-spacing: .18em; font-size: .85rem; color: var(--sky-muted); margin: 0 0 .75rem; }

/* Masthead */
.masthead { text-align: center; padding: 2.5rem 0 1.75rem; }
.masthead.small { padding: 1.5rem 0 1rem; }
.wordmark {
  font-family: var(--caps); font-weight: 400; font-size: clamp(2.6rem, 12vw, 4rem);
  letter-spacing: .04em; line-height: 1.05; margin: .1rem 0 .5rem; color: #fbf1c7;
  text-shadow: 0 2px 0 #000, 0 0 26px rgba(250, 189, 47, .16);
  text-wrap: balance;
}
.masthead.small .wordmark { font-size: clamp(2.1rem, 9vw, 3rem); }
.subtitle { font-style: italic; color: var(--sky-muted); margin: 0 auto; font-size: 1.15rem; max-width: 30rem; }
.school-plain-big { font-family: var(--caps); letter-spacing: .14em; color: #8ec07c; margin: 0 0 .5rem; }

/* The page, with an old-web bevel */
.page {
  background: var(--page);
  color: var(--text);
  border: 3px solid;
  border-color: var(--bevel-light) var(--bevel-dark) var(--bevel-dark) var(--bevel-light);
  outline: 1px solid var(--bevel-dark);
  outline-offset: 3px;
  padding: 1.75rem 1.25rem 2rem;
  margin: .75rem 0 2.5rem;
  box-shadow: 0 12px 36px rgba(0, 0, 0, .6);
}
@media (min-width: 40rem) { .page { padding: 2.5rem 2.75rem 2.75rem; } }
.page .label { color: var(--text-muted); }
.page h1 {
  font-family: var(--serif); font-weight: 400; font-size: clamp(2rem, 8vw, 2.6rem);
  line-height: 1.12; margin: 0 0 .5rem; color: var(--text); text-wrap: balance;
}

.welcome { text-align: center; }
.welcome .prose { max-width: 30rem; margin: 0 auto 1.5rem; font-size: 1.2rem; color: var(--text-soft); }
.sigil { display: block; margin: 1.75rem auto 0; color: var(--gold-soft); opacity: .75; }

/* Buttons: raised, old-web */
.button {
  display: inline-block; font-family: var(--serif); font-size: 1.1rem; line-height: 1.3;
  padding: .7rem 1.25rem; min-height: 2.75rem;
  background: var(--page-raised); color: var(--text) !important; text-decoration: none;
  border: 2px solid; border-color: var(--bevel-light) var(--bevel-dark) var(--bevel-dark) var(--bevel-light);
  cursor: pointer;
}
.button:hover { color: var(--gold) !important; }
.button:active { border-color: var(--bevel-dark) var(--bevel-light) var(--bevel-light) var(--bevel-dark); }

/* The index */
.index { border: 1px solid var(--sky-line); background: rgba(29, 32, 33, .72); margin-bottom: 2.5rem; }
.index-head {
  display: flex; justify-content: space-between; align-items: baseline; gap: 1rem;
  padding: 1rem 1.1rem .8rem; border-bottom: 1px solid var(--sky-line);
}
.index-head h2 { font-family: var(--serif); font-weight: 400; font-size: 1.7rem; margin: 0; color: #fbf1c7; }
.index-head .label { margin: 0; }
.index-list { list-style: none; margin: 0; padding: 0; }
.index-list li {
  position: relative; display: grid; grid-template-columns: 2.6rem 1fr; gap: .75rem; align-items: baseline;
  padding: 1rem 1.1rem;
}
.schools .index-list li, .school-list li { grid-template-columns: 1fr; }
/* Numbered lists share one numeral column, as wide as the longest numeral, so XVIII never runs into its title */
@supports (grid-template-columns: subgrid) {
  .index-list:not(.school-list) { display: grid; grid-template-columns: minmax(2.6rem, max-content) 1fr; }
  .index-list:not(.school-list) li { grid-column: 1 / -1; grid-template-columns: subgrid; }
}
@supports not (grid-template-columns: subgrid) {
  .index-list:not(.school-list) li { grid-template-columns: minmax(2.6rem, max-content) 1fr; }
}
.index-list .numeral { white-space: nowrap; }
.index-list li + li { border-top: 1px solid var(--sky-line); }
.index-list li:hover { background: rgba(250, 189, 47, .05); }
.numeral { font-family: var(--caps); color: #fabd2f; letter-spacing: .06em; }
.entry { min-width: 0; }
.entry-title { display: block; font-size: 1.25rem; line-height: 1.3; color: #ebdbb2; text-decoration: none; }
a.entry-title::after { content: ""; position: absolute; inset: 0; }
a.entry-title:hover { color: #fabd2f; }
.entry-summary { display: block; color: #bdae93; font-style: italic; font-size: 1.02rem; line-height: 1.45; margin-top: .2rem; }
.entry-meta { display: flex; flex-wrap: wrap; gap: .25rem 1rem; align-items: baseline; margin-top: .35rem; }
.school-plain-line { display: block; font-family: var(--caps); letter-spacing: .12em; font-size: .9rem; color: #8ec07c; margin-top: .1rem; }
.minutes { font-family: var(--caps); font-size: .85rem; letter-spacing: .1em; color: var(--sky-muted); white-space: nowrap; }

/* School label, e.g. "Evocation · Breath" */
.school {
  position: relative; z-index: 1;
  font-family: var(--caps); font-size: .85rem; letter-spacing: .1em; text-decoration: none; color: #8ec07c;
}
.school:hover { color: #fabd2f; }
.school-plain { color: var(--sky-muted); }
.folio-school { margin: 0 0 .75rem; }
.page .school { color: var(--aqua); font-size: .95rem; }
.page .school-plain { color: var(--text-muted); }

/* A single meditation */
.crumbs { font-family: var(--caps); font-size: .9rem; letter-spacing: .1em; color: var(--sky-muted); padding: 1.25rem 0 .25rem; }
.crumbs a { color: var(--sky-muted); }
.epigraph { font-style: italic; color: var(--text-soft); font-size: 1.15rem; margin: 0 0 .5rem; }
.ornament { text-align: center; color: var(--rule); letter-spacing: .6em; margin: 1.25rem 0; font-size: 1rem; }

.prose p, .prose ol, .prose ul { margin: 0 0 1.1rem; }
.folio .prose > p:first-child::first-letter {
  float: left; font-family: var(--serif); color: var(--rubric);
  font-size: 3.4em; line-height: .8; padding: .06em .1em 0 0;
}
.prose h2 {
  font-family: var(--caps); font-weight: 400; letter-spacing: .1em; font-size: 1.2rem;
  color: var(--rubric); margin: 2rem 0 .75rem; text-align: center;
}
.prose ol { padding-left: 1.6rem; }
.prose li { margin-bottom: .6rem; padding-left: .2rem; }
.prose ol li::marker { font-family: var(--caps); color: var(--rubric); }
.prose a { color: var(--gold); }
.prose strong { font-weight: 400; color: var(--rubric); }
.prose blockquote { margin: 1.25rem 0; padding: .25rem 0 .25rem 1rem; border-left: 2px solid var(--rule); font-style: italic; color: var(--text-soft); }
.prose hr { border: 0; text-align: center; margin: 1.5rem 0; }
.prose hr::after { content: "✦ ☾ ✦"; color: var(--rule); letter-spacing: .6em; }
.breath-link { text-align: center; margin: 2rem 0 0; }

/* Recessed wells: the hourglass and the astrolabe */
.hourglass, .astrolabe {
  margin-top: 2rem; padding: 1.25rem 1rem 1rem; text-align: center;
  background: var(--well);
  border: 2px solid; border-color: var(--bevel-dark) var(--bevel-light) var(--bevel-light) var(--bevel-dark);
}
.time { font-family: var(--caps); font-size: 2.6rem; line-height: 1; margin: .1rem 0 .9rem; letter-spacing: .06em; color: var(--text); font-variant-numeric: tabular-nums; }
.small-time { font-size: 1.5rem; margin-bottom: .75rem; color: var(--text-muted); }
.chips { display: flex; flex-wrap: wrap; justify-content: center; gap: .4rem; margin-bottom: 1rem; }
.chip {
  font-family: var(--caps); font-size: .95rem; letter-spacing: .06em; padding: .45rem .8rem; min-height: 2.5rem;
  background: transparent; color: var(--text-soft); border: 1px solid var(--rule); cursor: pointer;
}
.chip[aria-pressed="true"] { background: var(--chip-on-bg); color: var(--chip-on-text); border-color: var(--chip-on-bg); }
.hourglass p, .astrolabe p { margin: 0 0 .6rem; }
.hint { font-size: .95rem; font-style: italic; color: var(--text-muted); text-align: center; }

/* The Breath Astrolabe */
.breath .intro { color: var(--text-soft); }
.astro-svg { display: block; width: min(17rem, 100%); height: auto; margin: 0 auto .5rem; overflow: visible; }
.astro-g { transform-origin: 150px 150px; transform: scale(.55); }
.a-faint { stroke: var(--rule); }
.a-gold { stroke: var(--gold-soft); }
.a-rubric { stroke: var(--rubric); }
.a-rubric-fill { fill: var(--rubric); }
.a-disc { fill: var(--page); fill-opacity: .8; stroke: var(--gold-soft); }
.a-core { fill: var(--text); }
.phase { font-family: var(--caps); font-size: 1.6rem; letter-spacing: .1em; color: var(--text); min-height: 1.6em; }
.phase-sub { font-style: italic; color: var(--text-muted); }
.astro-settings { margin-top: 1.5rem; }
.astro-settings .label { text-align: center; margin-top: 1rem; }
.presets { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; margin-bottom: .5rem; }
.preset {
  display: flex; flex-direction: column; align-items: center; gap: .1rem; padding: .6rem .5rem; min-height: 3.25rem;
  font: inherit; color: var(--text); background: var(--page-raised); cursor: pointer;
  border: 2px solid; border-color: var(--bevel-light) var(--bevel-dark) var(--bevel-dark) var(--bevel-light);
}
.preset:last-child:nth-child(odd) { grid-column: 1 / -1; }
.preset[aria-pressed="true"] { border-color: var(--bevel-dark) var(--bevel-light) var(--bevel-light) var(--bevel-dark); background: var(--well); }
.preset[aria-pressed="true"] .preset-name { color: var(--rubric); }
.preset-name { font-size: 1.1rem; line-height: 1.2; }
.preset-plain { font-family: var(--caps); font-size: .78rem; letter-spacing: .08em; color: var(--text-muted); }
.own { margin: .5rem 0 1rem; border-top: 1px solid var(--rule); padding-top: .75rem; }
.own summary { cursor: pointer; text-align: center; color: var(--text-soft); font-style: italic; }
.own-grid { display: grid; grid-template-columns: auto 1fr 2.5rem; gap: .6rem .75rem; align-items: center; margin-top: .9rem; }
.own-grid label { font-size: 1rem; }
.own-grid input { width: 100%; accent-color: var(--rubric); }
.own-grid output { font-family: var(--caps); text-align: right; color: var(--text-muted); }

/* While the sand runs or the astrolabe turns, everything else dims. */
.topbar, .crumbs, .turn, .colophon, .page > *, .folio-side > *, .astro-settings, .hourglass .chips, .hint { transition: opacity 1.2s ease; }
body.sitting .topbar, body.sitting .crumbs, body.sitting .turn, body.sitting .colophon,
body.sitting .page > :not(.hourglass):not(.astrolabe):not(.folio-side),
body.sitting .folio-side > :not(.hourglass) { opacity: .12; }
body.sitting .hourglass .chips, body.sitting .hint { opacity: .35; }

/* Turning pages */
.turn { display: flex; justify-content: space-between; gap: .75rem; flex-wrap: wrap; margin: -1rem 0 2.5rem; }
.button.quiet { background: #1d2021; color: #ebdbb2 !important; border-color: #665c54 #0d0e0f #0d0e0f #665c54; font-size: 1rem; }
.button.quiet:hover { color: #fabd2f !important; }

/* Colophon */
.colophon { text-align: center; color: var(--sky-muted); font-size: 1rem; padding: 1rem 1rem 3rem; max-width: calc(var(--measure) + 2rem); margin: 0 auto; }
.colophon p { margin: 0 0 .6rem; }
.colophon .ornament { color: #d79921; }

@media (max-width: 30rem) {
  body { font-size: 1.125rem; }
  .index-list li { gap: .6rem; }
  .turn .button { flex: 1 1 100%; text-align: center; }
  .topbar-nav { gap: .9rem; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

/* Origins: where each practice comes from */
.origins { margin: 2rem 0 0; padding-top: 1rem; border-top: 1px solid var(--rule); font-size: .95rem; color: var(--text-soft); }
.origins .label { margin: 0 0 .35rem; }
.origins p { margin: 0; }
.origins-list ul { margin: .75rem 0 0; padding-left: 1.1rem; font-size: .95rem; color: var(--text-soft); }
.origins-list li { margin: 0 0 .5rem; }
.origins-list strong { font-weight: 400; color: var(--rubric); }
.origins .read-more { margin: .75rem 0 .25rem; }
.origins .sources { margin: 0; padding-left: 1.1rem; }
.origins .sources li { margin: 0 0 .3rem; }
.origins .by { color: var(--text-muted); }
.index-note { color: var(--sky-muted); font-style: italic; margin: 0; padding: 1rem 1.1rem 0; }
.index-all { text-align: center; margin: 1.5rem 0 0; }

/* Desktop: a wider scroll. Phones and tablets keep the single column above. */
@media (min-width: 64rem) {
  :root { --wide: 68rem; }
  body { font-size: 1.25rem; }
  .wrap { max-width: calc(var(--wide) + 4rem); padding: 0 2rem 3rem; }
  .topbar { max-width: calc(var(--wide) + 4rem); padding: 1rem 2rem; font-size: 1.05rem; }
  .topbar-nav { gap: 1.75rem; }
  .crumbs { padding-top: 1.75rem; }
  .masthead { padding: 3.5rem 0 2.5rem; }

  /* Home: the welcome on the left, the schools in two columns on the right */
  .home .wrap { display: grid; grid-template-columns: 21rem minmax(0, 1fr); gap: 0 2.5rem; align-items: start; }
  .home .masthead { grid-column: 1 / -1; }
  .home .welcome { margin: 0; position: sticky; top: 1.5rem; padding: 2rem 1.75rem 2rem; }
  .home .welcome .prose { font-size: 1.15rem; }
  .home .index { margin: 0 0 3rem; }
  .school-list { display: grid; grid-template-columns: 1fr 1fr; }
  .school-list li, .school-list li + li { border-top: 1px solid var(--sky-line); padding: 1.1rem 1.3rem; }
  .school-list li:nth-child(-n+2) { border-top: 0; }
  .school-list li:nth-child(odd) { border-right: 1px solid var(--sky-line); }

  /* A meditation: the reading on the left, the hourglass and origins beside it */
  .folio {
    display: grid; grid-template-columns: minmax(0, 1fr) 19rem; gap: 0 3rem;
    padding: 3rem 3.25rem 3.25rem;
  }
  .folio > * { grid-column: 1 / -1; }
  .folio > .prose { grid-column: 1; max-width: var(--measure); }
  .folio > .folio-side { grid-column: 2; position: sticky; top: 1.5rem; align-self: start; }
  .folio > .label, .folio > h1, .folio > .folio-school, .folio > .epigraph, .folio > .ornament { text-align: center; }
  .folio > h1 { font-size: 3rem; }
  .folio-side .breath-link { margin: 0 0 1.25rem; }
  .folio-side .breath-link .button { display: block; }
  .folio-side .hourglass { margin-top: 0; }
  .folio-side .origins { margin-top: 1.5rem; }
  .turn { max-width: none; }

  /* Lists of meditations: one wider, centred column */
  .index:not(.schools) { max-width: 54rem; margin-left: auto; margin-right: auto; }

  /* The breath astrolabe beside its settings */
  .breath { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 3rem; padding: 3rem 3.25rem 3.25rem; }
  .breath > * { grid-column: 1 / -1; }
  .breath > .label, .breath > h1 { text-align: center; }
  .breath > .intro { max-width: var(--measure); margin: 0 auto 1rem; }
  .breath > .astrolabe { grid-column: 1; align-self: start; position: sticky; top: 1.5rem; }
  .breath > .astro-settings { grid-column: 2; margin-top: 2rem; }
  .astro-svg { width: min(22rem, 100%); }

  /* Other pages, like a missing page, stay a reading width */
  .lost { max-width: calc(var(--measure) + 6rem); margin-left: auto; margin-right: auto; }
  .page:not(.folio):not(.breath):not(.welcome) { max-width: calc(var(--measure) + 6rem); margin-left: auto; margin-right: auto; }
}
