:root {
  --desk: #efe7d8;
  --paper: #fffdf8;
  --ink: #231f1a;
  --muted: #6e655a;
  --red: #b8322a;
  --red-deep: #8f241e;
  --rule: #e4dccd;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, "Noto Serif", serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
html { background: var(--desk); }
body {
  margin: 0; min-height: 100dvh; color: var(--ink); background: var(--desk); font: 16px/1.4 var(--sans);
  padding: max(20px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom));
  overflow-x: clip;   /* the page-turn tilt must never make the page scroll sideways */
}
main { max-width: 440px; margin: 0 auto; display: grid; gap: 14px; }

/* A desk-calendar sheet: two binder rings, red band, big date, quote. */
.sheet {
  position: relative; background: var(--paper); border-radius: 4px; padding-bottom: 26px;
  box-shadow: 0 1px 0 #d8cfbe, 0 3px 0 -1px var(--paper), 0 4px 0 -1px #d8cfbe, 0 6px 0 -2px var(--paper), 0 7px 0 -2px #d8cfbe, 0 18px 30px -18px rgba(60, 40, 20, .35);
  touch-action: pan-y; user-select: none; -webkit-user-select: none;
  transition: transform .18s ease, opacity .18s ease;
}
.sheet.turn-left { transform: translateX(-14px) rotate(-1deg); opacity: .4; }
.sheet.turn-right { transform: translateX(14px) rotate(1deg); opacity: .4; }
@media (prefers-reduced-motion: reduce) { .sheet { transition: none; } }
.rings { position: absolute; top: -10px; left: 0; right: 0; display: flex; justify-content: space-around; padding: 0 22%; z-index: 1; }
.rings i { width: 12px; height: 26px; border-radius: 6px; background: linear-gradient(90deg, #8d877e, #d9d4cc 45%, #77726a); box-shadow: 0 1px 2px rgba(0,0,0,.3); }
.band {
  background: var(--red); color: #fff; border-radius: 4px 4px 0 0; padding: 18px 18px 10px;
  display: flex; justify-content: space-between; align-items: baseline;
  font: 700 14px var(--sans); letter-spacing: .22em; text-transform: uppercase;
  /* Perforated tear line along the bottom of the band. */
  background-image: radial-gradient(circle at 6px 100%, var(--paper) 2.5px, transparent 3px);
  background-size: 12px 6px; background-repeat: repeat-x; background-position: 0 100%;
}
.date { text-align: center; padding: 8px 16px 4px; border-bottom: 1px solid var(--rule); margin: 0 18px; }
.num { margin: 0; font: 400 clamp(88px, 30vw, 128px)/1 var(--serif); color: var(--red-deep); font-variant-numeric: lining-nums; }
.weekday { margin: 2px 0 12px; font: 600 13px var(--sans); letter-spacing: .3em; text-transform: uppercase; color: var(--muted); }
blockquote { margin: 0; padding: 22px 24px 0; }
blockquote p {
  margin: 0; font: 400 clamp(22px, 6.2vw, 27px)/1.32 var(--serif); text-wrap: pretty; hyphens: manual;
}
blockquote p::before { content: "\201C"; color: var(--red); margin-left: -.42em; }
blockquote p::after { content: "\201D"; color: var(--red); }
blockquote footer { margin-top: 16px; }
cite { display: grid; gap: 2px; font-style: normal; }
#quote-author { font: 600 15px var(--sans); letter-spacing: .04em; }
#quote-author::before { content: "\2014\2009"; color: var(--red); }
.source { font: italic 15px var(--serif); color: var(--muted); padding-left: 1.2em; }

button {
  font: 600 15px var(--sans); color: var(--ink); background: var(--paper); border: 1px solid #cfc5b3; border-radius: 999px;
  min-height: 44px; padding: 0 16px; cursor: pointer;
}
button:disabled { opacity: .4; cursor: default; }
button:focus-visible { outline: 3px solid var(--red); outline-offset: 2px; }
button.primary { background: var(--red); border-color: var(--red-deep); color: #fff; }
button.link { background: none; border: 0; color: var(--muted); text-decoration: underline; text-underline-offset: 3px; font-weight: 500; }
.days { display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px; }
.actions { display: flex; gap: 8px; justify-content: center; }
.actions button { flex: 1; }
.status { margin: 0; min-height: 1.4em; text-align: center; font-size: 14px; color: var(--muted); }
.foot { text-align: center; }
#lab-offline-status { margin: 0; font-size: 13px; color: var(--muted); }
#lab-offline-status:empty { display: none; }
dialog { max-width: min(26rem, 90vw); border: 0; border-top: 8px solid var(--red); border-radius: 6px; background: var(--paper); color: var(--ink); padding: 20px; }
dialog::backdrop { background: rgba(35, 31, 26, .45); }
dialog h2 { margin: 0 0 8px; font: 400 22px var(--serif); }
.row { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
