/* ============================================================
   Tidebok — a typographic book of hours for Myrvann
   Scoped to .tb. Uses all three theme families on purpose:
     roca          — stonecut labels, display
     new-spirit    — body, drop caps, editorial
     new-spirit-condensed — running heads, pull quotes, masthead
   ============================================================ */

.tb {
  --tb-paper: oklch(0.965 0.018 78);
  --tb-paper-deep: oklch(0.93 0.028 76);
  --tb-ink: oklch(0.27 0.035 48);
  --tb-ink-soft: oklch(0.44 0.042 48);
  --tb-brass: oklch(0.64 0.115 72);
  --tb-moss: oklch(0.40 0.045 140);
  --tb-rule: oklch(0.27 0.035 48 / 0.28);

  --tb-serif: "new-spirit", "Iowan Old Style", Georgia, serif;
  --tb-cond:  "new-spirit-condensed", "new-spirit", Georgia, serif;
  --tb-sans:  "roca", "Inter Tight", ui-sans-serif, sans-serif;

  background: var(--tb-paper);
  color: var(--tb-ink);
  font-family: var(--tb-serif);
  font-weight: 300;
  line-height: 1.6;
  padding-block: clamp(3rem, 6vw, 6rem);
  padding-inline: clamp(1.25rem, 4vw, 4rem);
  position: relative;
  overflow: hidden;
}

/* paper grain */
.tb::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(1px 1px at 20% 30%, oklch(0.27 0.035 48 / 0.06) 100%, transparent 100%),
    radial-gradient(1px 1px at 70% 80%, oklch(0.27 0.035 48 / 0.05) 100%, transparent 100%),
    radial-gradient(1px 1px at 40% 60%, oklch(0.27 0.035 48 / 0.04) 100%, transparent 100%);
  background-size: 13px 13px, 19px 19px, 23px 23px;
  pointer-events: none;
  opacity: 0.7;
}

.tb > * { position: relative; }

.tb :is(p, h1, h2, h3, h4, li, blockquote, figcaption, cite, a, span) {
  color: inherit;
}

/* ---------------- Masthead ---------------- */

.tb-mast {
  max-width: 88rem;
  margin-inline: auto;
  padding-block: clamp(1rem, 3vw, 3rem);
  border-top: 1px solid var(--tb-rule);
  border-bottom: 1px solid var(--tb-rule);
}

.tb-mast__rule {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  font-family: var(--tb-sans);
  font-weight: 800;
  font-size: 0.72rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  padding-block: 0.9rem;
  color: var(--tb-ink-soft);
}
.tb-mast__rule--top { border-bottom: 1px solid var(--tb-rule); }
.tb-mast__rule--bot { border-top: 1px solid var(--tb-rule); }

.tb-mast__ornament {
  font-family: var(--tb-serif);
  font-weight: 300;
  letter-spacing: 0.6em;
  font-size: 0.95rem;
  color: var(--tb-brass);
}

.tb-mast__title {
  font-family: var(--tb-sans);
  font-weight: 100;
  font-size: clamp(5rem, 22vw, 19rem);
  line-height: 0.88;
  letter-spacing: -0.04em;
  text-align: center;
  margin: clamp(2rem, 4vw, 3.5rem) 0 clamp(1rem, 2vw, 1.5rem);
  display: flex;
  justify-content: center;
  gap: 0.02em;
}
.tb-mast__title span {
  display: inline-block;
}
.tb-mast__title span:nth-child(1) { transform: translateY(0.04em); }
.tb-mast__title span:nth-child(2) { transform: translateY(-0.03em) rotate(-2deg); font-weight: 300; color: var(--tb-brass); }
.tb-mast__title span:nth-child(3) { transform: translateY(0.05em); font-weight: 400; }
.tb-mast__title span:nth-child(4) { transform: translateY(-0.02em); font-family: var(--tb-serif); font-weight: 700; font-style: italic; }
.tb-mast__title span:nth-child(5) { transform: translateY(0.03em); font-weight: 300; }
.tb-mast__title span:nth-child(6) { transform: translateY(-0.04em) rotate(1.5deg); font-family: var(--tb-cond); font-weight: 600; }
.tb-mast__title span:nth-child(7) { transform: translateY(0.02em); font-weight: 800; color: var(--tb-ink); }

.tb-mast__kicker {
  font-family: var(--tb-cond);
  font-weight: 500;
  font-style: italic;
  font-size: clamp(1.1rem, 2vw, 1.6rem);
  text-align: center;
  color: var(--tb-ink-soft);
  letter-spacing: 0.01em;
  margin: 0 0 clamp(1.5rem, 3vw, 2.5rem);
}

/* ---------------- Prelude ---------------- */

.tb-prelude {
  max-width: 72rem;
  margin: clamp(4rem, 8vw, 8rem) auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 2rem;
  position: relative;
}
@media (min-width: 56rem) {
  .tb-prelude { grid-template-columns: 14rem 1fr; gap: 4rem; }
}

.tb-prelude__note {
  font-family: var(--tb-sans);
  font-weight: 100;
  font-size: 0.82rem;
  line-height: 1.6;
  color: var(--tb-ink-soft);
  padding-top: 1.1rem;
  border-top: 1px solid var(--tb-rule);
  letter-spacing: 0.02em;
}

.tb-prelude__lede {
  font-family: var(--tb-serif);
  font-weight: 300;
  font-size: clamp(1.3rem, 2.2vw, 1.9rem);
  line-height: 1.45;
  max-width: 38ch;
  margin: 0;
}

.tb-drop {
  float: left;
  font-family: var(--tb-serif);
  font-weight: 700;
  font-size: 5.6em;
  line-height: 0.82;
  padding: 0.05em 0.12em 0 0;
  margin: 0.02em 0.08em -0.05em 0;
  color: var(--tb-brass);
  font-feature-settings: "liga", "dlig";
}

/* ---------------- Hours ---------------- */

.tb-hour {
  max-width: 80rem;
  margin: clamp(5rem, 10vw, 10rem) auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1.5rem 3rem;
  position: relative;
}

@media (min-width: 62rem) {
  .tb-hour {
    grid-template-columns: 7rem 1fr 1fr 7rem;
    grid-template-areas:
      "stamp  lede  lede  marg"
      ".      body  quote marg";
  }
  .tb-hour__stamp { grid-area: stamp; }
  .tb-hour__lede  { grid-area: lede; }
  .tb-hour__body  { grid-area: body; }
  .tb-hour__quote { grid-area: quote; }
  .tb-hour__marg  { grid-area: marg; }
}

.tb-hour__stamp {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.4rem;
  border-top: 2px solid var(--tb-ink);
  padding-top: 0.6rem;
}
.tb-hour__numeral {
  font-family: var(--tb-cond);
  font-weight: 600;
  font-size: 3rem;
  line-height: 0.9;
  color: var(--tb-ink);
}
.tb-hour__clock {
  font-family: var(--tb-sans);
  font-weight: 800;
  font-size: 0.8rem;
  letter-spacing: 0.24em;
  color: var(--tb-ink-soft);
}
.tb-hour__glyph {
  font-family: var(--tb-serif);
  font-weight: 300;
  font-size: 1.4rem;
  color: var(--tb-brass);
  margin-top: 0.2rem;
}

.tb-hour__lede {
  border-bottom: 1px solid var(--tb-rule);
  padding-bottom: clamp(1rem, 2vw, 1.5rem);
  margin-bottom: clamp(0.25rem, 1vw, 0.5rem);
}
.tb-hour__eyebrow {
  font-family: var(--tb-sans);
  font-weight: 800;
  font-size: 0.7rem;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--tb-ink-soft);
  margin: 0 0 0.4rem;
}
.tb-hour__title {
  font-family: var(--tb-cond);
  font-weight: 400;
  font-size: clamp(3.5rem, 10vw, 9rem);
  line-height: 0.94;
  letter-spacing: -0.015em;
  margin: 0;
  font-style: normal;
}
.tb-hour__sub {
  font-family: var(--tb-serif);
  font-weight: 300;
  font-style: italic;
  font-size: clamp(1.05rem, 1.8vw, 1.35rem);
  color: var(--tb-ink-soft);
  margin: 0.5rem 0 0;
  max-width: 40ch;
}

.tb-hour__body p {
  font-family: var(--tb-serif);
  font-weight: 300;
  font-size: 1.05rem;
  line-height: 1.7;
  max-width: 34ch;
  margin: 0 0 1rem;
}
.tb-hour__body p:first-child::first-letter {
  font-family: var(--tb-cond);
  font-weight: 600;
  font-size: 1.8em;
  line-height: 0.8;
  vertical-align: -0.08em;
  padding-right: 0.05em;
  color: var(--tb-ink);
}

.tb-hour__quote {
  margin: 0;
  padding-left: 0;
  align-self: end;
  max-width: 22ch;
}
.tb-hour__quote p {
  font-family: var(--tb-serif);
  font-weight: 500;
  font-style: italic;
  font-size: clamp(1.5rem, 3vw, 2.4rem);
  line-height: 1.22;
  margin: 0;
  color: var(--tb-ink);
  text-wrap: balance;
  hanging-punctuation: first last;
}

.tb-hour__marg {
  font-family: var(--tb-sans);
  font-weight: 100;
  font-size: 0.82rem;
  line-height: 1.55;
  color: var(--tb-ink-soft);
  padding-top: 0.6rem;
  border-top: 1px solid var(--tb-rule);
}
.tb-hour__marg-head {
  display: block;
  font-family: var(--tb-cond);
  font-weight: 500;
  font-style: italic;
  font-size: 1.1rem;
  color: var(--tb-brass);
  margin-bottom: 0.3rem;
}

/* variant accents — keep mostly monochrome, shift one element per hour */
.tb-hour--dawn  .tb-hour__glyph  { color: var(--tb-brass); }
.tb-hour--noon  .tb-hour__title  { color: var(--tb-ink); }
.tb-hour--noon  .tb-hour__glyph  { color: var(--tb-ink); }
.tb-hour--dusk  .tb-hour__title  { font-style: italic; }
.tb-hour--dusk  .tb-hour__glyph  { color: var(--tb-moss); }
.tb-hour--night .tb-hour__title  { font-weight: 500; letter-spacing: -0.02em; }
.tb-hour--night .tb-hour__glyph  { color: var(--tb-brass); }

/* ---------------- Ephemeris ---------------- */

.tb-ephemeris {
  max-width: 88rem;
  margin: clamp(5rem, 8vw, 8rem) auto 0;
  border-top: 2px solid var(--tb-ink);
  border-bottom: 2px solid var(--tb-ink);
  padding-block: 1.25rem;
}

.tb-ephemeris__band {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: baseline;
  gap: 0.6rem 1rem;
  font-family: var(--tb-sans);
  font-weight: 800;
  font-size: clamp(0.7rem, 1.1vw, 0.85rem);
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--tb-ink);
  padding-block: 0.8rem;
  border-bottom: 1px solid var(--tb-rule);
}
.tb-ephemeris__dot {
  color: var(--tb-brass);
  font-weight: 300;
  font-size: 1.2em;
  letter-spacing: 0;
}

.tb-ephemeris__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
  margin-top: 1.25rem;
}
.tb-ephemeris__cell {
  padding: 1.25rem 1.5rem;
  border-right: 1px solid var(--tb-rule);
}
.tb-ephemeris__cell:last-child { border-right: none; }

.tb-ephemeris__label {
  font-family: var(--tb-sans);
  font-weight: 800;
  font-size: 0.7rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--tb-ink-soft);
  margin: 0 0 0.4rem;
}
.tb-ephemeris__value {
  font-family: var(--tb-cond);
  font-weight: 500;
  font-size: 1.6rem;
  line-height: 1.15;
  margin: 0;
  color: var(--tb-ink);
}
.tb-ephemeris__value em {
  font-family: var(--tb-serif);
  font-weight: 300;
  font-style: italic;
  color: var(--tb-brass);
}

/* ---------------- Colophon ---------------- */

.tb-colophon {
  max-width: 60rem;
  margin: clamp(5rem, 8vw, 8rem) auto 0;
  text-align: center;
  padding-block: 3rem;
}

.tb-colophon__mark {
  font-family: var(--tb-sans);
  font-weight: 800;
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  letter-spacing: 0.18em;
  margin: 0 0 1.5rem;
  color: var(--tb-ink);
}
.tb-colophon__mark span {
  color: var(--tb-brass);
  font-weight: 300;
  padding: 0 0.08em;
}

.tb-colophon__set {
  font-family: var(--tb-serif);
  font-weight: 300;
  font-size: 0.95rem;
  line-height: 1.7;
  color: var(--tb-ink-soft);
  max-width: 48ch;
  margin: 0 auto 1rem;
  text-wrap: balance;
}
.tb-colophon__set em {
  font-family: var(--tb-cond);
  font-weight: 500;
  font-style: italic;
  color: var(--tb-ink);
}

.tb-colophon__sign {
  font-family: var(--tb-serif);
  font-weight: 300;
  font-style: italic;
  font-size: 1rem;
  color: var(--tb-brass);
  margin: 1.5rem 0 0;
}

@media (prefers-reduced-motion: no-preference) {
  .tb-mast__title span { transition: transform 600ms cubic-bezier(0.2, 0.8, 0.2, 1); }
  .tb-mast:hover .tb-mast__title span { transform: translateY(0); }
}
