/* ============================================================
   THE KALENDAR OF TIANMU — fine-press design system
   cream · ink · vermillion — a printed almanac that is alive
   ============================================================ */

:root{
  --serif: 'Iowan Old Style','Palatino Linotype',Palatino,'Book Antiqua','URW Palladio L',Georgia,serif;
  --paper:      #f5eeda;
  --paper-deep: #efe5cb;
  --ink:        #241e14;
  --ink-soft:   #6d6250;
  --ink-faint:  #a89a80;
  --verm:       #a02b1a;
  --verm-deep:  #7c1f12;
  --gold:       #8a6d3b;
  --rule:       #c9bb9e;
  --moon-bright:#f3ead2;
  --moon-dark:  #4a4132;
  --card:       #f9f3e3;
  --shadow:     0 1px 0 rgba(60,45,20,.08), 0 10px 30px -18px rgba(60,45,20,.35);
}
/* Day (cream) is the default in all skies; night only by the toggle. */
:root[data-theme="night"]{
  --paper:#16120d; --paper-deep:#100d09; --ink:#e6dabe; --ink-soft:#a3947a;
  --ink-faint:#6d614d; --verm:#d0603f; --verm-deep:#e5764f; --gold:#b08d4f;
  --rule:#3a3226; --moon-bright:#ecdfc0; --moon-dark:#2a241a; --card:#1d1811;
  --shadow: 0 1px 0 rgba(0,0,0,.4), 0 10px 30px -18px rgba(0,0,0,.7);
}

*{ 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:17px; line-height:1.62;
  background-image:
    radial-gradient(ellipse at 50% -10%, rgba(255,250,230,.5), transparent 60%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3CfeColorMatrix values='0 0 0 0 0.4 0 0 0 0 0.33 0 0 0 0 0.2 0 0 0 0.05 0'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)'/%3E%3C/svg%3E");
}
:root[data-theme="night"] body{ background-attachment:fixed; }

a{ color:var(--verm); text-decoration:none; }
a:hover{ text-decoration:underline; text-underline-offset:3px; }

.page{ max-width:920px; margin:0 auto; padding:0 20px 90px; }

/* ---------------- masthead ---------------- */
.masthead{ text-align:center; padding:30px 0 0; }
.mast-rule{ border:none; border-top:1px solid var(--ink); margin:0; position:relative; }
.mast-rule.double{ border-top:3px double var(--ink); }
.mast-orn{ letter-spacing:.6em; text-indent:.6em; color:var(--verm); font-size:13px; margin:10px 0 4px; }
.mast-title{
  margin:6px 0 2px; font-weight:600; letter-spacing:.14em; text-indent:.14em;
  font-size:clamp(26px, 5.4vw, 46px); text-transform:uppercase; line-height:1.1;
}
.mast-title a{ color:var(--ink); }
.mast-title a:hover{ text-decoration:none; color:var(--verm); }
.mast-sub{
  margin:2px 0 12px; color:var(--ink-soft); font-style:italic; font-size:15px; letter-spacing:.04em;
}
.nav{
  display:flex; flex-wrap:wrap; justify-content:center; gap:2px 22px;
  padding:9px 0; margin:0 0 26px;
  border-top:1px solid var(--ink); border-bottom:3px double var(--ink);
  font-size:13.5px; letter-spacing:.18em; text-transform:uppercase;
}
.nav a{ color:var(--ink-soft); padding:2px 1px; }
.nav a.on{ color:var(--verm); border-bottom:2px solid var(--verm); text-decoration:none; }
.nav a:hover{ color:var(--verm); text-decoration:none; }
#theme-toggle{
  position:absolute; right:14px; top:14px;
  background:none; border:1px solid var(--rule); color:var(--ink-soft);
  font-size:17px; line-height:1; padding:7px 9px; border-radius:50%;
  cursor:pointer; font-family:var(--serif);
}
#theme-toggle:hover{ color:var(--verm); border-color:var(--verm); }
header{ position:relative; }

/* ---------------- shared type ---------------- */
.kicker{
  color:var(--verm); text-transform:uppercase; letter-spacing:.24em; text-indent:.24em;
  font-size:12.5px; text-align:center; margin:26px 0 6px;
}
h1{ font-weight:600; text-align:center; margin:0 0 6px; line-height:1.12;
    font-size:clamp(30px, 6vw, 46px); letter-spacing:.01em; }
.lede{ max-width:680px; margin:14px auto; text-align:center; font-size:17.5px; color:var(--ink); }
.lede a{ font-style:italic; }
.sec-head{
  text-align:center; text-transform:uppercase; letter-spacing:.2em; text-indent:.2em;
  font-size:14.5px; font-weight:600; color:var(--ink);
  margin:44px 0 14px; position:relative;
}
.sec-head::before, .sec-head::after{
  content:""; display:block; width:110px; margin:8px auto; border-top:1px solid var(--rule);
}
.orn{ text-align:center; color:var(--gold); margin:34px 0 6px; font-size:15px; letter-spacing:.7em; text-indent:.7em; }
.missing{ text-align:center; font-style:italic; color:var(--ink-soft); margin:70px 0; }

/* ---------------- frontispiece / today ---------------- */
.frontis{ text-align:center; }
.frontis-date{ font-size:clamp(34px, 7.4vw, 60px); margin-top:2px; }
.frontis-year{
  color:var(--verm); text-transform:uppercase; letter-spacing:.22em; text-indent:.22em;
  font-size:14px; margin:4px 0 18px;
}
.today-obs{ display:flex; flex-wrap:wrap; gap:12px; justify-content:center; margin:6px 0 20px; }
.today-obs-card{
  display:flex; flex-direction:column; gap:1px; min-width:230px; max-width:340px;
  border:1px solid var(--verm); outline:1px solid var(--verm); outline-offset:3px;
  padding:13px 22px; background:var(--card); box-shadow:var(--shadow); color:var(--ink);
}
.today-obs-card:hover{ text-decoration:none; background:var(--paper-deep); }
.toc-k{ color:var(--verm); font-size:11.5px; text-transform:uppercase; letter-spacing:.24em; }
.toc-n{ font-size:22px; font-weight:600; }
.toc-a{ font-style:italic; color:var(--ink-soft); font-size:14px; }
.moon-line{ color:var(--ink-soft); font-style:italic; margin:8px 0 0; }

/* ---------------- the wheel (fine-press plate) ---------------- */
.wheel{ width:100%; max-width:680px; height:auto; margin:10px auto 4px; display:block; }
.w-rim{ fill:none; stroke:var(--ink); stroke-width:1.5; }
.w-hair{ fill:none; stroke:var(--ink-soft); stroke-width:.55; opacity:.55; }
.w-seg{ fill:var(--tint); fill-opacity:.07; stroke:none; transition:fill-opacity .25s; }
a:hover .w-seg{ fill-opacity:.22; }
.w-name{ font-family:var(--serif); font-size:14.5px; letter-spacing:.17em; fill:var(--ink); }
.w-glyph{ font-size:26px; fill:var(--ink-soft); font-family:var(--serif); }
.w-spoke{ stroke:var(--ink-soft); stroke-width:.55; opacity:.6; }
.w-tick{ stroke:var(--ink); stroke-width:1; }
.w-guide{ fill:none; stroke:var(--rule); stroke-width:.6; stroke-dasharray:2 7; opacity:.8; }
.w-year-star{ fill:var(--verm); font-size:13px; }
.w-day{ fill:var(--gold); stroke:var(--paper); stroke-width:.8; }
.w-day.high{ fill:var(--verm); }
a:hover .w-day{ fill:var(--verm-deep); }
.w-today{ stroke:var(--verm); stroke-width:1.25; }
.w-today-diamond{ fill:var(--verm); }
.w-today-ring{ fill:none; stroke:var(--verm); stroke-width:.8; }
.moon-halo{ fill:none; stroke:var(--ink-soft); stroke-width:.55; opacity:.6; }
.w-moonring{ fill:none; stroke:var(--ink-soft); stroke-width:.55; opacity:.35; }
.w-moon-full{ fill:var(--paper); stroke:var(--ink); stroke-width:1.1; }
.w-moon-new{ fill:var(--ink); stroke:none; }
.w-moon-full.ecl{ stroke:var(--verm); }
.w-moon-new.ecl{ fill:var(--verm); }
.w-moon-ecl-ring{ fill:none; stroke:var(--verm); stroke-width:.7; }
a:hover .w-moon-full{ stroke:var(--verm); }
a:hover .w-moon-new{ fill:var(--verm-deep); }
.wheel-legend{
  text-align:center; color:var(--ink-faint); font-size:13.5px; font-style:italic;
  margin:2px 0 0; letter-spacing:.02em;
}
.wheel-legend .lg-high{ color:var(--verm); font-style:normal; }
.wheel-legend .lg-feast{ color:var(--gold); font-style:normal; }
.wheel-legend .lg-ecl{ color:var(--verm); }
.w-cdate{ font-size:25px; letter-spacing:.14em; fill:var(--ink); font-weight:600; }
.w-cyear{ font-size:14px; letter-spacing:.22em; fill:var(--verm); }
.w-civil{ font-size:14px; fill:var(--ink-soft); font-style:italic; }

/* ---------------- observance tables ---------------- */
.obs-table{
  width:100%; max-width:700px; margin:0 auto; border-collapse:collapse; font-size:16px;
}
.obs-table tr{ border-bottom:1px solid var(--rule); }
.obs-table tr:first-child{ border-top:3px double var(--rule); }
.obs-table td{ padding:9px 10px; vertical-align:baseline; text-align:left; }
.ob-date{ white-space:nowrap; width:86px; color:var(--ink-soft); font-variant-numeric:tabular-nums;
  text-transform:uppercase; font-size:13.5px; letter-spacing:.08em; }
.ob-name a{ color:var(--ink); font-weight:600; }
.ob-name a:hover{ color:var(--verm); }
.ob-alt{ font-style:italic; color:var(--ink-soft); font-weight:400; font-size:14.5px; }
.ob-tide{ text-align:right !important; color:var(--ink-soft); font-size:13.5px;
  text-transform:uppercase; letter-spacing:.1em; white-space:nowrap; }
.hd-star{ color:var(--verm); font-size:13px; }
.ob-moon .ob-name a{ font-weight:400; font-style:italic; color:var(--ink-soft); }
.moon-glyph{ color:var(--ink); font-style:normal; }
.moon-glyph.big{ font-size:26px; vertical-align:-2px; }
.ecl{ color:var(--verm); font-style:normal; font-size:13.5px; letter-spacing:.06em; text-transform:uppercase; }

/* ---------------- month grid ---------------- */
.kal-head{
  display:flex; align-items:center; justify-content:space-between; gap:10px;
  border-top:3px double var(--ink); border-bottom:1px solid var(--ink);
  padding:18px 4px; margin-top:24px;
}
.kal-title{ text-align:center; flex:1; }
.kal-title h1{ display:inline; font-size:clamp(30px, 5.5vw, 42px); letter-spacing:.06em; text-transform:uppercase; }
.kal-glyph{ display:block; font-size:30px; color:var(--tint); line-height:1; margin-bottom:2px; }
.kal-sub{ margin:4px 0 0; color:var(--ink-soft); font-style:italic; }
.kal-age{ margin:2px 0 0; color:var(--verm); font-size:13px; text-transform:uppercase; letter-spacing:.18em; }
.kal-nav{ font-size:30px; color:var(--ink-soft); padding:6px 12px; }
.kal-nav:hover{ color:var(--verm); text-decoration:none; }
.kal-tools{
  display:flex; justify-content:center; align-items:center; gap:18px;
  margin:12px 0 18px; color:var(--ink-soft); font-size:14.5px; flex-wrap:wrap;
}
.kal-tools input{
  width:84px; font-family:var(--serif); font-size:15px; text-align:center;
  background:var(--card); color:var(--ink); border:1px solid var(--rule); padding:4px 6px;
}
.kal-tools select, .kal-tools button, .btn-today{
  font-family:var(--serif); font-size:14.5px; background:var(--card); color:var(--ink);
  border:1px solid var(--rule); padding:4px 10px; cursor:pointer;
}
.btn-today{ text-transform:uppercase; letter-spacing:.14em; font-size:12.5px; padding:6px 14px; }
.btn-today:hover, .kal-tools button:hover{ border-color:var(--verm); color:var(--verm); text-decoration:none; }

.grid{ width:100%; border-collapse:collapse; table-layout:fixed; }
.grid th{
  font-weight:600; text-transform:uppercase; letter-spacing:.2em; font-size:12px;
  color:var(--ink-soft); border-bottom:1px solid var(--ink); padding:6px 0;
}
.grid td{
  border:1px solid var(--rule); vertical-align:top; height:86px; padding:5px 6px;
  font-size:13px; position:relative; background:var(--card);
}
.grid td.empty{ background:transparent; border-color:transparent; }
.grid td.today{ outline:2px solid var(--verm); outline-offset:-2px; }
.gd-num{ color:var(--ink-soft); font-size:13.5px; font-variant-numeric:tabular-nums; }
.grid td.today .gd-num{ color:var(--verm); font-weight:700; }
.gd-moon{ float:right; font-size:13px; color:var(--ink); }
.gd-moon.gd-ecl{ color:var(--verm); font-weight:700; }
.gd-day{
  display:block; color:var(--gold); font-size:12.5px; line-height:1.25; margin-top:3px;
  font-weight:600; overflow:hidden; text-overflow:ellipsis;
}
.gd-day.high{ color:var(--verm); }
.gd-day:hover{ color:var(--verm-deep); text-decoration:none; }
.kal-note{ text-align:center; color:var(--ink-faint); font-style:italic; font-size:14px; margin-top:26px; }

/* ---------------- day page ---------------- */
.daypage{ max-width:700px; margin:0 auto; }
.day-title{ font-size:clamp(34px, 7vw, 54px); }
.day-alt{ text-align:center; font-style:italic; color:var(--ink-soft); margin:0 0 8px; font-size:18px; }
.day-meta{ text-align:center; margin:12px 0 4px; }
.day-hall{ color:var(--ink-soft); font-size:14px; text-transform:uppercase; letter-spacing:.12em; margin-left:8px; }
.day-next{ text-align:center; color:var(--ink-soft); font-size:15.5px; margin:8px 0 0; }
.tide-chip{
  display:inline-flex; align-items:center; gap:6px; border:1px solid var(--tint);
  color:var(--ink); padding:3px 12px; font-size:13.5px; letter-spacing:.14em;
  text-transform:uppercase; background:var(--card);
}
.tide-chip:hover{ text-decoration:none; color:var(--verm); }
.tc-glyph{ color:var(--tint); font-size:15px; }
.day-sec{ margin:26px auto; }
.day-sec h2{
  color:var(--verm); text-transform:uppercase; letter-spacing:.24em; text-indent:.24em;
  font-size:13.5px; text-align:center; font-weight:600; margin:0 0 10px;
}
.day-sec h2::after{ content:""; display:block; width:70px; margin:8px auto 0; border-top:1px solid var(--rule); }
.day-sec p{ margin:0; font-size:17.5px; }
.dropcap::first-letter{
  float:left; font-size:64px; line-height:.82; padding:6px 10px 0 0; color:var(--verm);
  font-weight:600;
}
.keeping{ list-style:none; margin:0; padding:0; }
.keeping li{ padding:10px 0 10px 30px; position:relative; border-bottom:1px solid var(--rule); }
.keeping li:first-child{ border-top:1px solid var(--rule); }
.keeping li::before{ content:"❧"; position:absolute; left:2px; color:var(--gold); }
.day-nav{
  display:flex; justify-content:space-between; gap:14px; margin:40px 0 0;
  border-top:3px double var(--rule); padding-top:14px; font-size:14.5px; flex-wrap:wrap;
}
.day-nav a{ color:var(--ink-soft); }
.day-nav a:hover{ color:var(--verm); }

/* ---------------- days index / tides ---------------- */
.di-tide{ margin:34px auto; max-width:740px; }
.di-tide h2{
  font-size:21px; border-bottom:1px solid var(--ink); padding-bottom:6px; margin-bottom:4px;
}
.di-tide h2 span{ color:var(--tint); margin-right:6px; }
.di-tide h2 em{ font-size:14.5px; color:var(--ink-soft); font-weight:400; letter-spacing:.06em; }
.di-none{ color:var(--ink-faint); font-style:italic; }

.tide-card, .allgod-card{
  max-width:740px; margin:26px auto; background:var(--card); box-shadow:var(--shadow);
  border:1px solid var(--rule); border-top:3px solid var(--tint, var(--gold));
  padding:24px 28px;
}
.tide-card.focus{ outline:2px solid var(--verm); outline-offset:3px; }
.tide-head{ display:flex; gap:16px; align-items:center; margin-bottom:8px; }
.tide-glyph{ font-size:40px; color:var(--tint, var(--gold)); line-height:1; }
.tide-glyph.rune{ font-size:34px; }
.tide-head h2{ margin:0; font-size:26px; }
.tide-sub{ margin:0; color:var(--ink-soft); font-style:italic; font-size:15px; }
.tide-line{ font-style:italic; color:var(--verm); margin:6px 0 8px; font-size:17px; }
.tide-ess{ margin:0; font-size:16.5px; }
.tide-days{ margin:14px 0 0; font-size:14.5px; border-top:1px solid var(--rule); padding-top:10px; }

/* ---------------- moons ---------------- */
.moon-cols{ display:grid; grid-template-columns:1fr 1fr; gap:20px; max-width:820px; margin:26px auto; }
@media (max-width:700px){ .moon-cols{ grid-template-columns:1fr; } }
.moon-card{
  background:var(--card); border:1px solid var(--rule); box-shadow:var(--shadow); padding:22px 26px;
}
.moon-card h2{ margin:0 0 2px; font-size:23px; }
.moon-sub{ font-style:italic; color:var(--ink-soft); margin:0 0 12px; }
.moon-card.full{ border-top:3px solid var(--gold); }
.moon-keep-head{
  color:var(--verm); text-transform:uppercase; letter-spacing:.22em;
  font-size:12.5px; font-weight:600; margin:18px 0 8px;
}
.moon-card.new{ border-top:3px solid var(--ink-soft); }
.ecl-card{ max-width:820px; margin:0 auto 8px; border-top:3px solid var(--verm); }

/* ---------------- ages ---------------- */
.anchor-block{ max-width:660px; margin:18px auto; }
.anchor-block p{ margin:10px 0; font-size:16.5px; color:var(--ink); }
.ages-table{ max-width:780px; margin:0 auto; }
.age-row{
  display:grid; grid-template-columns:230px 1fr; gap:4px 22px; align-items:baseline;
  border-bottom:1px solid var(--rule); padding:18px 6px;
}
.age-row.current{ background:var(--card); outline:2px solid var(--verm); outline-offset:-2px; }
.age-name h3{ margin:0; font-size:20px; }
.age-glyph{ color:var(--tint); font-size:18px; margin-right:4px; }
.age-sign{ margin:0; color:var(--ink-soft); font-style:italic; font-size:14px; }
.age-span{
  grid-column:2; grid-row:1; color:var(--verm); font-size:13.5px; letter-spacing:.12em;
  text-transform:uppercase; font-variant-numeric:tabular-nums;
}
.age-note{ grid-column:2; margin:0; font-size:15.5px; color:var(--ink); }
@media (max-width:640px){
  .age-row{ grid-template-columns:1fr; }
  .age-span, .age-note{ grid-column:1; }
}

/* ---------------- church runes (oracle-bone glyphs) ---------------- */
.rune-g{ display:inline-block; vertical-align:-0.18em; width:1.05em; height:1.05em; }
.rune-g:not(.rune-art) path{
  fill:none; stroke:currentColor; stroke-width:9;
  stroke-linecap:round; stroke-linejoin:round;
}
.rune-g.rune-art path{ fill:currentColor; stroke:none; }
.w-rune-art{ fill:var(--ink-soft); stroke:none; }
a:hover .w-rune-art{ fill:var(--verm); }
.rune-lg{ width:44px; height:44px; color:var(--tint, var(--gold)); }
.rune-md{ width:30px; height:30px; }
.rune-sm{ width:17px; height:17px; }
.kal-glyph .rune-g{ width:38px; height:38px; color:var(--tint); }
.w-rune{ fill:none; stroke:var(--ink-soft); stroke-width:9; stroke-linecap:round; stroke-linejoin:round; }
a:hover .w-rune{ stroke:var(--verm); }
.age-glyph .rune-g{ width:20px; height:20px; color:var(--tint); }

/* ---------------- the Words (day-page quotation) ---------------- */
.words{
  margin:0; padding:20px 26px; background:var(--card);
  border-left:3px solid var(--verm); border-right:3px solid var(--verm);
  box-shadow:var(--shadow);
}
.words p{ margin:0; font-size:18.5px; font-style:italic; line-height:1.55; }
.words cite{
  display:block; margin-top:10px; font-style:normal; color:var(--ink-soft);
  font-size:13px; text-transform:uppercase; letter-spacing:.18em;
}
.day-sec p + p, .tide-ess + .tide-ess, .age-note p + p, .moon-card p.deep + p.deep{ margin-top:12px; }
.day-sec p{ margin:0 0 0; }
.day-sec p + p{ margin-top:13px; }

/* ---------------- colophon rune credits ---------------- */
.rune-credits{
  text-align:center; max-width:680px; margin:10px auto 4px; line-height:2.4;
  color:var(--ink-soft); font-size:15px;
}
.rune-credits a{ color:var(--ink); white-space:nowrap; }
.rune-credits a:hover{ color:var(--verm); text-decoration:none; }
.rune-credits .rune-g{ color:var(--gold); }
.lede.small{ font-size:14.5px; color:var(--ink-soft); font-style:italic; }

/* ---------------- footer ---------------- */
footer{
  margin-top:70px; border-top:3px double var(--ink); padding:18px 0 8px;
  text-align:center; color:var(--ink-soft); font-size:14px; font-style:italic;
}
footer a{ color:var(--ink-soft); }
footer a:hover{ color:var(--verm); }
.foot-sym{ font-style:normal; font-size:16px; letter-spacing:.3em; text-indent:.3em; display:block; margin-top:6px; }

/* ---------------- small screens ---------------- */
@media (max-width:640px){
  body{ font-size:16px; }
  .grid td{ height:64px; padding:3px 4px; }
  .gd-day{ font-size:10.5px; }
  .ob-tide{ display:none; }
  .nav{ gap:2px 14px; font-size:12px; letter-spacing:.12em; }
  #theme-toggle{ top:8px; right:8px; }
  .day-nav{ flex-direction:column; text-align:center; }
}
@media print{
  .nav, #theme-toggle, .kal-tools, footer{ display:none; }
  body{ background:white; color:black; }
}
