/* Concept: a block calendar you tear. Every day is one page in one flat colour (set by the fact's subject),
   the date numeral is the artwork, and learning the fact means tearing the page off to find tomorrow underneath.
   Layout: left-aligned; the numeral is the one grid-breaking element. The manage view is the same stock and ink, kept quiet.
   One visual world, so a single theme by choice. */
:root {
  --ink: #161225;        /* aubergine black */
  --paper: #fbf7ec;      /* calendar stock */
  --card: #fffdf7;
  --muted: #5d5870;
  --rule: #16122526;
  --field: #f2c230;      /* the day's colour, replaced per fact subject */
  --on: #2b2003;         /* text on the field */
  --good: #0b6b43;
  --bad: #c22a1c;
  --flag: #f2c230;       /* needs attention (the History ochre) */
  --font-display: "Bricolage Grotesque", "Arial Narrow", "Helvetica Neue", sans-serif;
  --font-body: "Atkinson Hyperlegible", Verdana, "Segoe UI", sans-serif;
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --ease-ui: cubic-bezier(.65, 0, .35, 1);
  color-scheme: light;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body { background: var(--paper); color: var(--ink); font-family: var(--font-body); font-size: 18px; line-height: 1.5; }
button { font: inherit; color: inherit; cursor: pointer; }
button:disabled { opacity: .5; cursor: default; }
::selection { background: var(--ink); color: var(--paper); }
:focus-visible { outline: 3px solid currentColor; outline-offset: 3px; }
.d { font-family: var(--font-display); font-stretch: 75%; font-weight: 800; letter-spacing: -0.02em; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 18px 20px 56px; display: flex; flex-direction: column; gap: 26px; }
#reader, #manage { display: flex; flex-direction: column; gap: 34px; }

header.top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 20px; }
.brand { font-family: var(--font-display); font-stretch: 85%; font-weight: 700; font-size: 1.35rem; margin: 0; }
.topright { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; font-size: 0.92rem; }

.btn { font-family: var(--font-display); font-stretch: 85%; font-weight: 700; font-size: 1.05rem; border: 3px solid currentColor; border-radius: 999px; padding: 10px 20px; background: transparent; transition: transform .28s var(--ease-ui); }
.btn:active:not(:disabled) { transform: scale(.97); }
.btn.solid { background: var(--on); border-color: var(--on); color: var(--field); }
.btn.primary { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.btn.small { font-size: 0.88rem; padding: 4px 14px; border-width: 2px; }

/* The calendar block */
.block { position: relative; overflow: hidden; border-radius: 0 0 22px 22px; background: var(--field); color: var(--on); padding-top: 22px; }
.binding { position: absolute; left: 0; right: 0; top: 0; height: 22px; background: var(--ink); z-index: 3; display: flex; justify-content: space-between; padding: 0 24%; }
.binding i { width: 16px; height: 34px; margin-top: -7px; border-radius: 8px; background: var(--paper); border: 3px solid var(--ink); }
.page, .under { padding: clamp(18px, 3vw, 34px) clamp(18px, 3.4vw, 40px) clamp(22px, 3.4vw, 40px); }
.page { position: relative; z-index: 2; background: var(--field); color: var(--on); touch-action: pan-y; transform-origin: 0 0; transition: transform .28s var(--ease-ui);
  border-top: 3px dashed color-mix(in srgb, var(--on) 45%, transparent);
  display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 20px clamp(20px, 4vw, 56px); align-items: end; }
.page.dragging { transition: none; }
.lead { display: flex; flex-direction: column; gap: clamp(10px, 1.6vw, 20px); min-width: 0; }
.dateline { display: grid; grid-template-columns: auto 1fr; align-items: end; gap: 0 clamp(10px, 1.6vw, 22px); }
.num { font-size: clamp(9.5rem, 25vw, 19rem); line-height: .78; margin-left: -0.05em; font-variant-numeric: tabular-nums; }
.when { margin: 0 0 0.45em; display: flex; flex-direction: column; gap: 1px; font-family: var(--font-display); font-stretch: 85%; font-weight: 600; font-size: clamp(1.15rem, 2vw, 1.6rem); line-height: 1.12; }
.when .cat { margin-top: 10px; align-self: flex-start; font-family: var(--font-body); font-weight: 700; font-size: 0.85rem; border: 2px solid currentColor; border-radius: 999px; padding: 2px 12px; }
.qfirst { margin: 0; font-family: var(--font-display); font-stretch: 85%; font-weight: 700; font-size: clamp(1.1rem, 2.2vw, 1.6rem); line-height: 1.15; text-wrap: balance; }
.fact { font-size: clamp(1.9rem, 5vw, 4rem); line-height: 1; margin: 0; text-wrap: balance; }
.aside { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.sheet { background: var(--paper); color: var(--ink); border-radius: 4px 4px 18px 18px; padding: 16px 18px 18px; display: flex; flex-direction: column; gap: 10px; }
.sheet p { margin: 0; }
.src { font-size: 0.78rem; color: var(--muted); overflow-wrap: anywhere; margin: 0; }
.src a { color: inherit; }
.ask { border-top: 2px dashed var(--rule); padding-top: 10px; }
.ask b { display: block; font-size: 0.8rem; color: var(--muted); }
.hint { margin: -6px 0 0; font-size: 0.8rem; text-align: center; display: none; }
@media (hover: none) { .hint { display: block; } }

.under { position: absolute; inset: 22px 0 0; z-index: 1; display: flex; flex-direction: column; align-items: flex-start; gap: 18px; }
.block.torn .under { position: relative; inset: auto; min-height: 420px; }
.stamp { margin: 0; font-size: 1.7rem; line-height: 1; border: 4px double currentColor; border-radius: 10px; padding: 6px 16px 8px; transform: rotate(-5deg); }
.stamp.thud { animation: thud .4s .35s cubic-bezier(.2, 1.6, .4, 1) backwards; }
@keyframes thud { from { transform: rotate(8deg) scale(2.4); opacity: 0; } }
.big { font-size: clamp(2.4rem, 7vw, 5rem); line-height: .95; margin: 0; text-wrap: balance; }
.next { align-self: stretch; display: grid; grid-template-columns: auto 1fr; align-items: end; gap: 0 clamp(10px, 1.6vw, 22px); border-top: 3px dashed color-mix(in srgb, var(--on) 45%, transparent); padding-top: 18px; }
.next .num { font-size: clamp(7rem, 16vw, 12rem); }
.next p { margin: 0 0 0.5em; display: flex; flex-direction: column; gap: 2px; }
.next p b { font-family: var(--font-display); font-stretch: 85%; font-weight: 700; font-size: 1.3rem; }
.underbtns { margin-top: auto; display: flex; flex-wrap: wrap; gap: 10px; }

@media (max-width: 800px) {
  .page { grid-template-columns: 1fr; align-items: start; }
  .aside .btn { width: 100%; }
  .num { font-size: clamp(8rem, 44vw, 13rem); }
}

/* Sections under the block */
.sec { display: flex; flex-direction: column; gap: 14px; }
.sec > h2 { font-size: clamp(2.2rem, 5vw, 3.4rem); line-height: .95; margin: 0; }
.sec > p { margin: 0; color: var(--muted); max-width: 52ch; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.daytile { text-align: left; border: 0; border-radius: 4px 4px 14px 14px; padding: 10px 12px 12px; background: var(--field); color: var(--on); display: flex; flex-direction: column; gap: 6px; border-top: 3px dashed color-mix(in srgb, var(--on) 45%, transparent); min-height: 158px; }
.daytile .n { display: flex; align-items: baseline; gap: 8px; }
.daytile .n span { font-size: 3.3rem; line-height: .85; }
.daytile .n small { font-family: var(--font-display); font-stretch: 85%; font-weight: 600; font-size: 0.92rem; }
.daytile .t { font-weight: 700; font-size: 0.9rem; line-height: 1.22; }
.daytile .s { margin-top: auto; font-size: 0.78rem; }
.daytile.locked { background: transparent; color: var(--ink); border: 2px dashed var(--ink); }
.daytile[aria-current="true"] { outline: 3px solid var(--ink); outline-offset: 2px; }

.pingrow { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px 28px; align-items: start; }
@media (max-width: 800px) { .pingrow { grid-template-columns: 1fr; } }
.opts { display: flex; flex-direction: column; gap: 8px; }
.opt { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border: 2px solid var(--rule); border-radius: 14px; font-weight: 700; font-size: 0.98rem; }
.opt:has(input:checked) { border-color: var(--ink); background: var(--ink); color: var(--paper); }
.opt input { width: 20px; height: 20px; accent-color: var(--field); margin: 0; }
.opt small { margin-left: auto; font-weight: 400; font-variant-numeric: tabular-nums; opacity: .8; }
.lockdemo { background: var(--ink); color: var(--paper); border-radius: 22px; padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.lockdemo .clock { font-size: 4.2rem; line-height: .85; font-variant-numeric: tabular-nums; }
.notif { display: flex; gap: 12px; align-items: flex-start; background: var(--paper); color: var(--ink); border-radius: 18px; padding: 12px 14px; }
.notif .icon { flex: none; width: 38px; height: 38px; border-radius: 10px; background: var(--field); color: var(--on); display: grid; place-items: center; font-size: 1.4rem; line-height: 1; }
.notif .txt { min-width: 0; font-size: 0.9rem; line-height: 1.35; }
.notif .txt b { display: flex; justify-content: space-between; gap: 10px; }
.notif .txt b span { font-weight: 400; opacity: .65; }
.note { color: var(--muted); font-size: 0.85rem !important; margin: 0; }
.lockdemo .note { color: inherit; opacity: .7; }
footer { font-size: 0.88rem; color: var(--muted); }
.linkbtn { background: none; border: 0; padding: 0; font: inherit; color: inherit; text-decoration: underline; }

/* Manage view: the maintenance desk, same stock and ink */
.mhead { display: flex; flex-direction: column; gap: 4px; }
.mhead h2 { font-size: clamp(2.2rem, 5vw, 3.4rem); line-height: .95; margin: 0; }
.mhead p { margin: 0; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.tile { text-align: left; background: var(--card); border: 2px solid var(--ink); border-top: 3px dashed var(--ink); border-radius: 4px 4px 14px 14px; padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 2px; }
.tile b { font-family: var(--font-display); font-stretch: 75%; font-weight: 800; font-size: 3rem; line-height: .9; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.tile span { font-weight: 700; font-size: 0.95rem; }
.tile small { font-size: 0.8rem; color: var(--muted); }
.tile.warn { background: var(--flag); }
.tile.warn small { color: var(--ink); }
.tile[aria-pressed="true"] { outline: 3px solid var(--ink); outline-offset: 2px; }
.panel { background: var(--card); border: 2px solid var(--ink); border-radius: 16px; padding: 18px 20px; display: flex; flex-direction: column; gap: 12px; }
.panel h2 { font-family: var(--font-display); font-stretch: 85%; font-weight: 700; font-size: 1.3rem; margin: 0; }
.panel p { margin: 0; font-size: 0.97rem; }
.toolbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.toolbar .group { display: flex; gap: 8px; align-items: center; }
.toolbar select { width: auto; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.tab { border: 2px solid var(--ink); border-radius: 999px; background: transparent; padding: 4px 14px; font-weight: 700; font-size: 0.88rem; }
.tab[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.filters input { flex: 1 1 200px; width: auto; }
label { font-weight: 700; font-size: 0.95rem; }
select, input[type="text"], input[type="password"], input[type="date"], input[type="file"], textarea { font: inherit; color: var(--ink); background: var(--paper); border: 2px solid var(--ink); border-radius: 12px; padding: 8px 12px; width: 100%; }
textarea { resize: vertical; min-height: 4.6em; }
.field { display: flex; flex-direction: column; gap: 6px; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.pill { display: inline-block; border-radius: 999px; padding: 1px 10px; font-size: 0.78rem; font-weight: 700; border: 2px solid currentColor; white-space: nowrap; }
.pill.ok { color: var(--good); }
.pill.warn { color: var(--ink); background: var(--flag); border-color: var(--ink); }
.pill.bad { color: var(--bad); }
.rows { display: flex; flex-direction: column; gap: 10px; }
.row { border: 2px solid var(--rule); border-radius: 14px; padding: 10px 14px; background: var(--paper); }
.row.flag { border-color: var(--ink); border-left: 10px solid var(--flag); }
.row[open] { border-color: var(--ink); }
.row summary { cursor: pointer; display: grid; grid-template-columns: 7.2em minmax(0, 1fr) auto; gap: 4px 12px; align-items: baseline; list-style: none; }
.row summary::-webkit-details-marker { display: none; }
.row summary::after { content: "Open"; font-size: 0.8rem; font-weight: 700; text-decoration: underline; grid-column: 3; grid-row: 1; }
.row[open] summary::after { content: "Close"; }
.row .when { margin: 0; display: block; font-family: var(--font-body); font-weight: 700; font-size: 0.86rem; font-variant-numeric: tabular-nums; color: var(--muted); }
.row .f { font-weight: 700; line-height: 1.3; }
.row .pills { grid-column: 2 / -1; display: flex; flex-wrap: wrap; gap: 6px; }
.row .body { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; padding-top: 10px; border-top: 2px dashed var(--rule); font-size: 0.95rem; }
.row .body p { margin: 0; }
.row .lbl { display: block; font-size: 0.78rem; font-weight: 700; color: var(--muted); }
.row .why { border-left: 4px solid var(--flag); padding-left: 10px; }
.row .bt { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.row .src { font-size: 0.88rem; }
@media (max-width: 560px) { .row summary { grid-template-columns: minmax(0, 1fr) auto; } .row .when { grid-column: 1; } .row .f { grid-column: 1 / -1; grid-row: 2; } .row .pills { grid-column: 1 / -1; } .row summary::after { grid-column: 2; } }
.msg { font-size: 0.92rem; min-height: 1.4em; margin: 0; }
.steps { margin: 0; padding-left: 1.3em; font-size: 0.92rem; display: flex; flex-direction: column; gap: 4px; }
dialog { border: 3px solid var(--ink); border-radius: 18px; background: var(--card); color: var(--ink); padding: 22px; width: min(580px, calc(100vw - 32px)); max-height: calc(100% - 32px); overflow: auto; }
dialog::backdrop { background: #161225b3; }
dialog form { display: flex; flex-direction: column; gap: 12px; }
dialog h2 { font-family: var(--font-display); font-stretch: 85%; font-weight: 700; font-size: 1.5rem; margin: 0; }
/* Review queue and video desk: same stock, ink and pills */
.row.gone { opacity: .78; border-style: dashed; }
.row .bt .group { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.row .bt input[type="date"], .row .bt input[type="text"] { width: auto; padding: 3px 10px; font-size: 0.88rem; border-radius: 999px; }
.row .bt input[type="text"] { min-width: 14em; }
.row .body.vid { display: grid; grid-template-columns: minmax(0, 220px) minmax(0, 1fr); gap: 14px 22px; align-items: start; }
.vid .stage { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.vid video, .vid .poster { width: 100%; aspect-ratio: 9 / 16; border-radius: 4px 4px 14px 14px; background: var(--ink); color: var(--paper); border-top: 3px dashed var(--paper); }
.vid .poster { display: grid; place-items: center; padding: 14px; text-align: center; font-size: 0.85rem; }
.vid .vside { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.vid .bt { grid-column: 1 / -1; }
@media (max-width: 560px) { .row .body.vid { grid-template-columns: 1fr; } .vid .stage { max-width: 240px; } }
.checks { display: flex; flex-wrap: wrap; gap: 8px; }
.chk { display: inline-flex; align-items: center; gap: 6px; border: 2px solid var(--ink); border-radius: 999px; padding: 3px 12px; font-size: 0.86rem; font-weight: 700; cursor: pointer; }
.chk:has(input:checked) { background: var(--ink); color: var(--paper); }
.chk:has(input:disabled) { cursor: default; opacity: .75; }
.chk input { margin: 0; accent-color: var(--flag); }
fieldset.field { border: 0; padding: 0; margin: 0; min-width: 0; }
fieldset.field legend { font-weight: 700; font-size: 0.95rem; padding: 0; margin-bottom: 6px; }
.vbox { display: flex; flex-direction: column; gap: 4px; }
.vbox .lbl { display: block; font-size: 0.78rem; font-weight: 700; color: var(--muted); }
@media (prefers-reduced-motion: reduce) { .page, .btn { transition: none; } .stamp.thud { animation: none; } }
