/* The Stillroom — one stylesheet for every leaf.
   The seven planets are the organising system of the book, so they are the
   only strong colours on the page; everything else is ink on cool paper. */

:root {
  --paper: #ECEEF3;
  --leaf: #F7F8FB;
  --ink: #1A1F3D;
  --ink-2: #545B80;
  --rule: #C5CADB;
  --gold: #855A08;

  --saturn: #3F3F4C;
  --jupiter: #2B4FA8;
  --mars: #A8322B;
  --sun: #8F6400;
  --venus: #26734A;
  --mercury: #A9501A;
  --moon: #65499F;
  --warn: #9C2F1F;

  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0E1124;
    --leaf: #151935;
    --ink: #E3E5F3;
    --ink-2: #969DC2;
    --rule: #2B3058;
    --gold: #E2B453;
    --saturn: #ABABBB;
    --jupiter: #86A3F2;
    --mars: #EE7F72;
    --sun: #F0C24B;
    --venus: #6FCB93;
    --mercury: #F09A55;
    --moon: #BBA7EE;
    --warn: #F08A76;
  }
}
:root[data-theme="dark"] {
  --paper: #0E1124;
  --leaf: #151935;
  --ink: #E3E5F3;
  --ink-2: #969DC2;
  --rule: #2B3058;
  --gold: #E2B453;
  --saturn: #ABABBB;
  --jupiter: #86A3F2;
  --mars: #EE7F72;
  --sun: #F0C24B;
  --venus: #6FCB93;
  --mercury: #F09A55;
  --moon: #BBA7EE;
  --warn: #F08A76;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 18px;
  line-height: 1.6;
}

a { color: inherit; text-decoration-color: var(--gold); text-underline-offset: 3px; }
a:hover { color: var(--gold); }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

/* ---- frame ---- */
.frame {
  display: grid;
  grid-template-columns: 15rem minmax(0, 1fr);
  max-width: 76rem;
  margin: 0 auto;
}

.contents {
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  overflow-y: auto;
  padding: 2.25rem 1.5rem 2rem 1.75rem;
  border-right: 1px solid var(--rule);
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}
.contents .title {
  font-size: 1.45rem;
  line-height: 1.15;
  text-decoration: none;
  letter-spacing: 0.01em;
}
.contents .title small {
  display: block;
  margin-top: 0.4rem;
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-2);
}
.contents nav { display: flex; flex-direction: column; gap: 1.25rem; }
.contents .part { display: flex; flex-direction: column; gap: 0.2rem; }
.contents .part > span {
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-2);
  margin-bottom: 0.2rem;
}
.contents .part a {
  text-decoration: none;
  padding: 0.12rem 0 0.12rem 0.75rem;
  border-left: 2px solid transparent;
  font-size: 1rem;
}
.contents .part a:hover { border-left-color: var(--rule); }
.contents .part a[aria-current="page"] { border-left-color: var(--gold); color: var(--gold); }

main {
  padding: 2.75rem 2.5rem 4rem;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
}

footer.colophon {
  grid-column: 1 / -1;
  border-top: 1px solid var(--rule);
  padding: 1.25rem 1.75rem 2rem;
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--ink-2);
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
}

@media (max-width: 860px) {
  .frame { display: block; }
  .contents {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--rule);
    padding: 1.1rem 16px 0.9rem;
    gap: 0.8rem;
  }
  .contents nav { gap: 0.45rem; }
  .contents .part { flex-direction: row; flex-wrap: wrap; align-items: baseline; gap: 0.1rem 0.9rem; }
  .contents .part > span { margin: 0; min-width: 6.2rem; }
  .contents .part a { padding: 0.1rem 0; border-left: 0; border-bottom: 2px solid transparent; white-space: nowrap; }
  .contents .part a:hover { border-bottom-color: var(--rule); }
  .contents .part a[aria-current="page"] { border-bottom-color: var(--gold); }
  main { padding: 1.75rem 16px 3rem; }
  footer.colophon { padding: 1rem 16px 1.5rem; }
}

/* ---- type ---- */
.eyebrow {
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-2);
  margin: 0;
}
h1 {
  font-size: clamp(2rem, 5vw, 2.9rem);
  font-weight: 400;
  line-height: 1.08;
  margin: 0;
  text-wrap: balance;
}
h2 {
  font-size: 1.4rem;
  font-weight: 400;
  margin: 0;
  text-wrap: balance;
}
h3 { font-size: 1.05rem; margin: 0; font-weight: 600; }
p { margin: 0; }
.head { display: flex; flex-direction: column; gap: 0.6rem; }
.lede { font-size: 1.12rem; color: var(--ink-2); max-width: 38rem; }
.prose { display: flex; flex-direction: column; gap: 0.9rem; max-width: 40rem; }
.prose ul { margin: 0; padding-left: 1.2rem; display: flex; flex-direction: column; gap: 0.3rem; }
.note { font-size: 0.9rem; color: var(--ink-2); max-width: 40rem; }
.mono { font-family: var(--mono); font-size: 0.82em; }
.section { display: flex; flex-direction: column; gap: 0.9rem; }
hr { border: 0; border-top: 1px solid var(--rule); margin: 0; width: 100%; }

/* ---- planets ---- */
.p-saturn { --p: var(--saturn); }
.p-jupiter { --p: var(--jupiter); }
.p-mars { --p: var(--mars); }
.p-sun { --p: var(--sun); }
.p-venus { --p: var(--venus); }
.p-mercury { --p: var(--mercury); }
.p-moon { --p: var(--moon); }
.glyph { color: var(--p, var(--ink)); font-family: "Apple Symbols", "Segoe UI Symbol", "Noto Sans Symbols 2", "DejaVu Sans", sans-serif; }
.planet { color: var(--p); white-space: nowrap; }

/* ---- controls ---- */
.controls { display: flex; flex-wrap: wrap; gap: 0.75rem 1rem; align-items: end; }
.field { display: flex; flex-direction: column; gap: 0.3rem; }
.field > span, label.field > span {
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-2);
}
input[type="text"], input[type="number"], input[type="date"], input[type="search"], select, textarea {
  font: inherit;
  font-size: 1rem;
  color: var(--ink);
  background: var(--leaf);
  border: 1px solid var(--rule);
  border-radius: 3px;
  padding: 0.45rem 0.6rem;
  min-width: 0;
}
textarea { width: 100%; resize: vertical; }
button, .button {
  font-family: var(--mono);
  font-size: 0.74rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink);
  background: transparent;
  border: 1px solid var(--ink);
  border-radius: 3px;
  padding: 0.6rem 0.9rem;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}
button:hover, .button:hover { background: var(--ink); color: var(--paper); }
button.quiet { border-color: var(--rule); color: var(--ink-2); }
button.quiet:hover { background: transparent; color: var(--ink); border-color: var(--ink); }
button[aria-pressed="true"], button.quiet[aria-pressed="true"], button.quiet[aria-pressed="true"]:hover { background: var(--ink); color: var(--paper); border-color: var(--ink); }

/* ---- leaves (panels) ---- */
.leaf {
  background: var(--leaf);
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: 1.25rem 1.4rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.now { display: grid; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); gap: 1rem; }
.now .big { font-size: 1.7rem; line-height: 1.15; }
.now .big .glyph { font-size: 1.1em; margin-right: 0.2em; }

/* ---- tables ---- */
.scroll { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; }
th {
  text-align: left;
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 400;
  color: var(--ink-2);
  padding: 0.4rem 0.75rem 0.4rem 0;
  border-bottom: 1px solid var(--ink);
}
td { padding: 0.42rem 0.75rem 0.42rem 0; border-bottom: 1px solid var(--rule); vertical-align: baseline; }
td.t { font-family: var(--mono); font-size: 0.85rem; white-space: nowrap; }
tr.is-now td { background: color-mix(in srgb, var(--gold) 14%, transparent); }
tr.is-now td:first-child { padding-left: 0.4rem; font-weight: 700; }
.hours-pair { display: grid; grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr)); gap: 1.5rem 2.5rem; }

/* ---- lists of entries ---- */
.entries { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); gap: 0.75rem; }
.entry {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  height: 100%;
  padding: 0.9rem 1rem;
  background: var(--leaf);
  border: 1px solid var(--rule);
  border-radius: 3px;
  text-decoration: none;
}
.entry:hover { border-color: var(--p, var(--ink)); color: inherit; }
.entry .name { font-size: 1.15rem; line-height: 1.2; }
.entry .sub { font-size: 0.88rem; color: var(--ink-2); font-style: italic; }
.entry .meta { font-family: var(--mono); font-size: 0.7rem; letter-spacing: 0.06em; color: var(--ink-2); margin-top: auto; padding-top: 0.4rem; }
.tags { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.tag {
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border: 1px solid var(--rule);
  border-radius: 2px;
  padding: 0.12rem 0.4rem;
  color: var(--ink-2);
}
.caution {
  border: 1px solid var(--warn);
  padding: 0.6rem 0.9rem;
  color: var(--warn);
  background: color-mix(in srgb, var(--warn) 8%, transparent);
  max-width: 40rem;
  font-size: 0.95rem;
}
.verse {
  white-space: pre-wrap;
  font-size: 1.08rem;
  line-height: 1.55;
  padding: 1.25rem 1.4rem;
  background: var(--leaf);
  border: 1px solid var(--rule);
  border-radius: 3px;
  max-width: 40rem;
  margin: 0;
  font-family: var(--serif);
}
dl.facts { display: grid; grid-template-columns: max-content 1fr; gap: 0.3rem 1.25rem; margin: 0; max-width: 40rem; }
dl.facts dt { font-family: var(--mono); font-size: 0.7rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-2); padding-top: 0.3rem; }
dl.facts dd { margin: 0; }

/* ---- instruments ---- */
.bench { display: grid; grid-template-columns: minmax(0, 22rem) minmax(0, 1fr); gap: 1.5rem 2.5rem; align-items: start; }
@media (max-width: 720px) { .bench { grid-template-columns: 1fr; } }
.bench .side { display: flex; flex-direction: column; gap: 1rem; }
.plate { background: var(--leaf); border: 1px solid var(--rule); border-radius: 4px; padding: 1rem; }
.plate svg { display: block; width: 100%; height: auto; }
.row { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.figures { display: flex; flex-wrap: wrap; gap: 0.75rem; }
.fig { display: flex; flex-direction: column; align-items: center; gap: 0.3rem; min-width: 4.6rem; padding: 0.6rem 0.4rem; border: 1px solid var(--rule); border-radius: 3px; background: var(--leaf); }
.fig .dots { font-family: var(--mono); line-height: 1.05; letter-spacing: 0.3em; color: var(--p, var(--ink)); text-align: center; white-space: pre; padding-left: 0.3em; }
.fig .n { font-size: 0.82rem; text-align: center; line-height: 1.15; }
.fig .r { font-family: var(--mono); font-size: 0.6rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-2); }
.hex { font-family: var(--mono); display: flex; flex-direction: column; gap: 5px; width: 7rem; }
.hex i { display: block; height: 9px; background: var(--ink); }
.hex i.yin { background: linear-gradient(90deg, var(--ink) 0 42%, transparent 42% 58%, var(--ink) 58%); }
.hex i.moving { background-color: var(--gold); }
.hex i.yin.moving { background: linear-gradient(90deg, var(--gold) 0 42%, transparent 42% 58%, var(--gold) 58%); }
.script { font-size: 2rem; line-height: 1.5; word-break: break-word; min-height: 3rem; font-family: "Noto Sans Runic", "Noto Sans Ogham", "Segoe UI Historic", "Apple Symbols", "Segoe UI Symbol", sans-serif; }
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; max-width: 34rem; }
.cal div { border: 1px solid var(--rule); border-radius: 3px; padding: 0.3rem 0.35rem; min-height: 3.6rem; font-family: var(--mono); font-size: 0.7rem; display: flex; flex-direction: column; justify-content: space-between; background: var(--leaf); }
.cal div.head { min-height: 0; border: 0; background: none; color: var(--ink-2); letter-spacing: 0.1em; text-transform: uppercase; font-size: 0.7rem; }
.cal div.blank { border: 0; background: none; }
.cal div.today { border-color: var(--gold); box-shadow: inset 0 0 0 1px var(--gold); }
.cal .disc { align-self: center; }
.cal .mark { color: var(--gold); }

@media (prefers-reduced-motion: no-preference) {
  a, button, .entry { transition: color 0.15s, background-color 0.15s, border-color 0.15s; }
}

/* ---- almanac ---- */
table.almanac td { font-size: 0.86rem; padding-top: 0.3rem; padding-bottom: 0.3rem; }
table.almanac .moon-cell { white-space: nowrap; }
table.almanac .sep { display: block; }
table.almanac .moon-cell svg { vertical-align: -3px; }
table.finder td, table.finder th { text-align: center; padding-right: 0.3rem; }
table.finder td.t { text-align: left; }
.cover { display: flex; flex-direction: column; justify-content: center; gap: 0.75rem; padding: 1.5rem 0; }

@media print {
  .contents, footer.colophon, .no-print { display: none !important; }
  .frame { display: block; max-width: none; }
  :root, :root[data-theme="dark"], :root:not([data-theme="light"]) {
    --paper: #fff; --leaf: #fff; --ink: #000; --ink-2: #444; --rule: #bbb; --gold: #6b4a00;
    --saturn: #333; --jupiter: #1f3f8f; --mars: #8f2219; --sun: #7a5600; --venus: #1d5c3a; --mercury: #8a3f12; --moon: #523a85;
  }
  @page { margin: 12mm; }
  body { font-size: 9pt; line-height: 1.3; }
  h2 { font-size: 15pt; }
  table.almanac .sep { display: inline; }
  table.almanac .sep::before { content: "  \00B7  "; color: #888; }
  th { padding-top: 2px; padding-bottom: 2px; }
  main { padding: 0; gap: 0.6rem; }
  .month { break-after: page; }
  .cover { break-after: page; min-height: 85vh; }
  table.almanac td { font-size: 7.8pt; padding-top: 1.5px; padding-bottom: 1.5px; }
  table.almanac td.t { font-size: 7.4pt; }
  table.almanac .mono { font-size: 0.92em; }
  tr.is-now td { background: none; box-shadow: none; }
  tr.is-now td:first-child { padding-left: 0; }
  .scroll { overflow: visible; }
}
.entries.wide { grid-template-columns: repeat(auto-fill, minmax(19rem, 1fr)); }
.entries.wide .entry > span:nth-child(3) { font-size: 0.95rem; }
table.finder .glyph { font-size: 1.25em; }

/* ---- seals: black line on a white plate, the same in both themes ---- */
.seal { margin: 0; background: #fff; border: 1px solid var(--rule); border-radius: 4px; padding: 1rem; max-width: 17rem; display: flex; flex-direction: column; gap: 0.6rem; }
.seal img { display: block; width: 100%; height: auto; }
.seal figcaption { font-family: var(--mono); font-size: 0.7rem; letter-spacing: 0.04em; color: #545B80; line-height: 1.4; }
.seal.small { display: block; max-width: 9rem; padding: 0.5rem; margin-bottom: 0.4rem; }
.seal.thumb { display: block; width: 4.5rem; padding: 0.3rem; margin-bottom: 0.35rem; }
@media print { .seal { border-color: #bbb; } }

/* ---- menu: always open in the sidebar, folds away on a phone ---- */
.menu > summary { display: none; }
.menu { display: flex; flex-direction: column; }
.seal .cap { display: block; font-family: var(--mono); font-size: 0.7rem; letter-spacing: 0.04em; color: #545B80; text-align: center; margin-top: 0.3rem; }
@media (max-width: 860px) {
  .menu > summary {
    display: inline-block; list-style: none; cursor: pointer; font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.1em; text-transform: uppercase;
    border: 1px solid var(--ink); border-radius: 3px; padding: 0.5rem 0.8rem;
  }
  .menu > summary::-webkit-details-marker { display: none; }
  .menu[open] > summary { margin-bottom: 0.8rem; background: var(--ink); color: var(--paper); }
}
table .row { flex-wrap: nowrap; }
table .seal.small { width: 5.4rem; max-width: none; flex: none; margin: 0; padding: 0.3rem; }

.sources ul { font-size: 0.92rem; color: var(--ink-2); }
.sources h2 { font-size: 1.15rem; }
.plates { align-items: flex-start; }
.plates .seal { max-width: 20rem; flex: 1 1 15rem; }
.seal.strip { display: inline-block; max-width: 100%; padding: 0.4rem 0.6rem; }
.seal.strip img { width: auto; max-width: 100%; height: 2.6rem; }

/* ---- dates are entered day, month, year ---- */
.dmy { display: flex; gap: 0.3rem; }
.dmy input.d { width: 3.3rem; }
.dmy input.y { width: 4.8rem; }
.dmy select { padding-right: 0.3rem; }
.dmy.bad input, .dmy.bad select { border-color: var(--warn); }

/* ---- updates log and banner ---- */
.log { max-height: 8.5rem; overflow-y: auto; border: 1px solid var(--rule); background: var(--leaf); padding: 0.5rem 0.8rem; font-size: 0.92rem; display: flex; flex-direction: column; gap: 0.35rem; }
.log b { font-family: var(--mono); font-weight: 400; font-size: 0.85em; margin-right: 0.4rem; color: var(--ink-2); }
.contents .banner { display: block; width: 100%; height: auto; }
.sticker { display: none; }

/* ---- the card table of the card oracles ---- */
.spread { list-style: none; margin: 0.8rem 0 0; padding: 0; display: flex; flex-direction: column; gap: 0.5rem; max-width: 40rem; }
.spread li { border: 1px solid var(--rule); background: var(--leaf); padding: 0.5rem 0.8rem; }
.spread .place { font-size: 0.8em; color: var(--ink-2); margin-right: 0.3rem; }
.spread .place::after { content: ":"; }
.spread .tagline { font-size: 0.85em; color: var(--ink-2); }

/* numbered steps of a working */
ol.steps { margin: 0; padding-left: 1.4rem; display: flex; flex-direction: column; gap: 0.5rem; max-width: 40rem; }

/* ---- the picture under a page's title: image on the left, its caption beside it ---- */
.pic { margin: 0; display: flex; gap: 0.9rem; align-items: flex-end; }
.pic a { flex: none; display: block; line-height: 0; }
.pic img { display: block; max-width: 15rem; max-height: 17rem; width: auto; height: auto; border: 1px solid var(--rule); background: #fff; padding: 4px; }
.pic figcaption { font-size: 0.82rem; color: var(--ink-2); max-width: 22rem; }
@media (max-width: 560px) { .pic { flex-direction: column; align-items: flex-start; } .pic img { max-width: 100%; } }
/* a row of small captioned photographs */
.signs { display: grid; grid-template-columns: repeat(auto-fill, minmax(8.5rem, 1fr)); gap: 0.7rem; }
.signs figure { margin: 0; border: 1px solid var(--rule); background: #fff; padding: 4px; }
.signs img { display: block; width: 100%; height: auto; }
.signs figcaption { font-size: 0.78rem; color: #2A211B; padding: 0.3rem 0.15rem 0.1rem; line-height: 1.35; }

