/* =====================================================================
   almanack.css: the Almanack's own rules (R126).
   The tokens, the bar, day and night, and the fonts are the fleet's
   dress (R145: /lg/looking-glass.css, then /lg/roses.css for the
   Roses-era class names this page was written with). What's left here
   is the Almanack's: the shape of a calendar, and a per-house rule on
   each entry that exists for recognition rather than decoration. The
   house's colour is Humpty's Wall's (LG.colour), never this file's.

   The page's own idea, and the only one worth defending at length: today
   is not a card in a list. It is the top of the page, in the largest
   type on it, whether or not anything is happening. Everything after it
   is a list of the days that have something on them, with the empty ones
   left out (R126.4).
   ===================================================================== */

:root {
  --plaque-radius: 12px;
  --hair: rgba(var(--ink-rgb), .16);
  --hair2: rgba(var(--ink-rgb), .3);
  --vellum: rgba(var(--ink-rgb), .03);
  --accent-house: var(--info);
}

html { scroll-behavior: smooth; }
body { min-height: 100vh; -webkit-text-size-adjust: 100%; }
[hidden] { display: none !important; }
button { font: inherit; border: 2px solid var(--line); background: var(--paper); color: var(--ink); border-radius: 14px; padding: 7px 16px; min-height: 44px; cursor: pointer; font-family: var(--sans); font-size: 15px; font-weight: 700; }
button:active { background: var(--panel2); }
button.primary { background: var(--ink); border-color: var(--ink); color: var(--cream); font-weight: 800; }
button.ghost { border-color: var(--line); color: var(--muted); background: var(--paper); }
button.danger { border-color: var(--danger); color: var(--danger); background: var(--paper); }
button:disabled { opacity: .5; cursor: default; }
input, select, textarea { font: inherit; border: 1px solid var(--line); border-radius: 10px; padding: 9px 11px; background: var(--field); color: var(--ink); min-height: 44px; }
textarea { min-height: 78px; resize: vertical; }
input::placeholder, textarea::placeholder { color: var(--placeholder); }
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible { outline: 2px solid var(--gold-text); outline-offset: 2px; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ---- the door ---- */
#login { position: fixed; inset: 0; background: var(--cream); display: flex; align-items: center; justify-content: center; z-index: 30; padding: 16px; }
#login .box { background: var(--paper); border: 1px solid var(--line); box-shadow: 0 4px 14px var(--shadow); border-radius: var(--r); padding: 30px 28px 26px; max-width: 400px; width: 100%; text-align: center; }
#login h2 { font-family: var(--fell); color: var(--ink); font-size: 32px; font-weight: 400; margin: 10px 0 4px; }
#login .logo { height: 54px; max-width: 100%; }
:root:not([data-theme="dark"]) .logo.night, :root[data-theme="dark"] .logo.day { display: none; }
#login input { width: 100%; margin-top: 8px; }
#login .err { color: var(--danger); font-size: 14px; min-height: 1.2em; margin: 8px 0 6px; font-family: var(--sans); }

/* ---- the bar is the fleet's (R145); the horizon chips and the jump sit under it ---- */
.bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 10px 22px; border-bottom: 1px solid var(--hair); background: var(--cream); position: sticky; top: var(--lg-barh, 62px); z-index: 7; }
@media (max-width: 860px) { .bar { position: static; } }
.bar .jump { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.bar .jump input { min-height: 40px; padding: 6px 10px; width: auto; }
.bar .count { font-size: 14px; color: var(--muted); font-family: var(--sans); }

/* ---- main ---- */
main { max-width: 1120px; margin: 0 auto; padding: 18px 22px 120px; }
@media (max-width: 640px) { main { padding: 14px 14px 120px; } .bar { padding-left: 14px; padding-right: 14px; } }

/* ---- TODAY: the top of the page, always, empty or not ---- */
.today {
  position: relative; background: var(--paper); border: 1px solid var(--line);
  border-radius: var(--r); box-shadow: inset 0 0 80px var(--vellum), 0 4px 14px var(--shadow);
  padding: 22px 24px 18px; margin-bottom: 26px;
}
.today::before { content: ""; position: absolute; left: 18px; right: 18px; top: 0; height: 3px; background: var(--gold); border-radius: 0 0 3px 3px; }
.today .stamp { font-family: var(--fellsc); font-size: 16px; letter-spacing: .14em; color: var(--muted); }
.today .date { font-family: var(--fell); font-size: 46px; line-height: 1.05; margin: 4px 0 2px; }
.today .date .dow { display: block; font-family: var(--fellsc); font-size: 25px; color: var(--muted); letter-spacing: .08em; }
.today .nothing { font-family: var(--fell); font-style: italic; color: var(--muted); padding: 18px 0 6px; font-size: 18px; }
@media (max-width: 560px) { .today { padding: 18px 16px 14px; } .today .date { font-size: 36px; } .today .date .dow { font-size: 20px; } }

/* ---- a day rule: the engraved divider with the date on it ---- */
.dayrule { display: flex; align-items: center; gap: 14px; margin: 26px 0 12px; color: var(--ink); font-family: var(--fellsc); font-size: 20px; letter-spacing: .06em; }
.dayrule::before, .dayrule::after { content: ""; flex: 1; height: 0; border-top: 1px solid var(--hair2); }
.dayrule .far { font-family: var(--fell); font-style: italic; letter-spacing: 0; font-size: 15px; color: var(--muted); }
.gapnote { text-align: center; font-family: var(--fell); font-style: italic; color: var(--faint); font-size: 15px; margin: -4px 0 2px; }
@media (max-width: 560px) { .dayrule { flex-wrap: wrap; gap: 4px 12px; } .dayrule::before { display: none; } }

/* ---- an entry ---- */
.list { display: flex; flex-direction: column; gap: 9px; }
.item {
  position: relative; display: flex; gap: 14px; align-items: flex-start;
  background: var(--paper); border: 1px solid var(--line); border-left: 6px solid var(--accent-house);
  border-radius: var(--plaque-radius); padding: 12px 14px 12px 15px; cursor: pointer;
  text-align: left; width: 100%; min-height: 0; font-family: inherit; color: inherit;
  transition: box-shadow .15s, transform .1s;
}
.item:hover { box-shadow: 0 5px 16px var(--shadow2); }
.item:active { transform: translateY(1px); }
.item .when { flex: none; width: 122px; font-family: var(--sans); font-size: 15px; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; padding-top: 2px; }
.item .when .allday { color: var(--muted); font-style: normal; letter-spacing: .08em; font-size: 12px; text-transform: uppercase; }
.item .what { min-width: 0; flex: 1; }
.item .name { font-family: var(--fell); font-size: 21px; line-height: 1.2; overflow-wrap: anywhere; }
.item .sub { font-family: var(--sans); font-size: 13.5px; color: var(--muted); margin-top: 3px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.item .house { color: var(--ink); font-weight: 800; letter-spacing: .02em; display: inline-flex; align-items: center; gap: 6px; }
.item .house::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--accent-house); flex: none; }
.item .marks { flex: none; display: flex; gap: 5px; align-items: center; padding-top: 3px; }
.today .item { background: var(--cream); }
@media (max-width: 560px) {
  /* Narrow: the time goes top left and the social tick top right, with
     the entry itself on the line under them. Left as it was, the tick
     landed on a third line of its own and read as a stray button. */
  .item { flex-wrap: wrap; gap: 6px 12px; }
  .item .when { width: auto; padding-top: 0; order: 1; }
  .item .marks { order: 2; margin-left: auto; padding-top: 0; }
  .item .what { order: 3; flex-basis: 100%; }
}

/* the four kinds, told apart without reading a word */
.item.internal { border-style: dashed; border-left-style: solid; background: var(--panel2); }
.item.social { border-left-style: double; border-left-width: 8px; }
.item.booking { cursor: default; background: repeating-linear-gradient(135deg, var(--paper), var(--paper) 9px, var(--panel2) 9px, var(--panel2) 10px); }
.item.booking:hover { box-shadow: none; }
.item.off .name, .item.off .when { text-decoration: line-through; opacity: .65; }

/* the little marks: partners, social, a series, and the day-of-span counter */
.mark { font-size: 12.5px; line-height: 1; border: 1px solid var(--line2); border-radius: 99px; padding: 4px 8px; color: var(--muted); font-family: var(--sans); white-space: nowrap; }
.mark.on { border-color: var(--gold-text); color: var(--gold-text); background: var(--gold-tint); }
.mark.span { border-style: dashed; }
.mark.off { border-color: var(--danger); color: var(--danger); }
.mark.play { border-color: var(--info); color: var(--info); }   /* R152: who is playing */

/* the tick that makes a thing a social post, right on the card, because
   Séb asked for a tickbox next to each event and not a trip into a form */
.sotick { flex: none; width: auto; min-width: 38px; height: 34px; min-height: 34px; padding: 0 8px; gap: 4px; border-radius: 9px; border: 1.5px solid var(--line2); background: var(--paper); color: var(--faint); font-size: 16px; line-height: 1; display: inline-flex; align-items: center; justify-content: center; }
.sotick.on { border-color: var(--gold-text); background: var(--gold-tint); color: var(--gold-text); }
.sotick:hover { border-color: var(--gold-text); }
.sotick .pip { width: 6px; height: 6px; border-radius: 50%; background: none; box-shadow: 0 0 0 1.5px var(--line2); flex: none; }
.sotick .pip.lit { background: var(--gold-text); box-shadow: 0 0 0 1.5px var(--gold-text); }

/* ---- add-here: the empty strip under a day that takes a tap ---- */
.addhere { width: 100%; border: 1.5px dashed var(--line2); background: none; border-radius: var(--plaque-radius); color: var(--muted); font-family: var(--fell); font-style: italic; font-weight: 400; font-size: 16px; min-height: 40px; padding: 8px; margin-top: 2px; opacity: .7; }
.addhere:hover { opacity: 1; color: var(--ink); border-color: var(--ink); }

/* ---- the drawer: full height on the right, the list stays clickable
   behind it (R32's ruling for the Vetting Room, kept). It sits over the
   bar, as a sheet does. ---- */
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 100vw); background: var(--paper); border-left: 2px solid var(--gold); box-shadow: -14px 0 50px var(--shadow2); z-index: 50; display: flex; flex-direction: column; transform: translateX(100%); transition: transform .18s ease-out; visibility: hidden; }
.drawer.open { transform: none; visibility: visible; }
.drawer .head { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--hair2); background: var(--panel2); }
.drawer .head h3 { margin: 0; font-family: var(--fell); font-weight: 400; font-size: 26px; color: var(--ink); flex: 1; }
.drawer .body { flex: 1; overflow: auto; padding: 18px; -webkit-overflow-scrolling: touch; }
.drawer .foot { display: flex; gap: 8px; align-items: center; padding: 12px 18px calc(12px + env(safe-area-inset-bottom, 0px)); border-top: 1px solid var(--hair2); background: var(--panel2); flex-wrap: wrap; }
.drawer .foot .spacer { flex: 1; }
@media (max-width: 620px) { .drawer { width: 100vw; } }

.fields { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 12px; }
.fields .wide { grid-column: 1 / -1; }
.fields label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); font-family: var(--sans); min-width: 0; }
.fields label input, .fields label select, .fields label textarea { text-transform: none; letter-spacing: 0; font-size: 16px; font-weight: 400; width: 100%; }
.fields fieldset { grid-column: 1 / -1; border: 1px solid var(--line); border-radius: var(--plaque-radius); padding: 10px 14px 14px; margin: 4px 0 0; display: grid; grid-template-columns: 1fr 1fr; gap: 10px 12px; min-width: 0; }
.fields legend { font-family: var(--fellsc); color: var(--muted); font-size: 17px; letter-spacing: .08em; padding: 0 6px; }
@media (max-width: 520px) { .fields, .fields fieldset { grid-template-columns: 1fr; } }
.check { display: flex !important; flex-direction: row !important; align-items: center; gap: 10px; text-transform: none !important; letter-spacing: 0 !important; font-size: 15.5px !important; font-weight: 600 !important; color: var(--ink) !important; flex-wrap: wrap; }
.check input { width: 22px !important; height: 22px; min-height: 22px; flex: none; accent-color: var(--gold); }
.check.locked { opacity: .55; }
.check .why { font-size: 13px; color: var(--muted); font-weight: 400; }
.problem { color: var(--danger); font-size: 14px; min-height: 1.2em; margin-top: 8px; font-family: var(--sans); }
.hint { font-family: var(--fell); font-style: italic; color: var(--muted); font-size: 16px; margin: 2px 0 10px; }

/* R128: the FR twin of a field is retired. The rule went with it. */

/* the weekday picker for a weekly series */
.dows { display: flex; gap: 5px; flex-wrap: wrap; }
.dows button { min-height: 40px; min-width: 48px; padding: 0 6px; border-radius: 10px; border-color: var(--line2); color: var(--muted); font-family: var(--sans); font-size: 13px; }
.dows button.on { border-color: var(--ink); background: var(--ink); color: var(--cream); font-weight: 800; }

/* the house picker: a row of coloured pips, because ten businesses in a
   dropdown is a dropdown nobody reads */
.houses { display: flex; gap: 6px; flex-wrap: wrap; }
.houses button { display: inline-flex; align-items: center; gap: 7px; min-height: 40px; padding: 0 12px; border-radius: 99px; border: 1.5px solid var(--line2); color: var(--muted); background: var(--paper); font-family: var(--sans); font-size: 14px; }
.houses button .pip { width: 12px; height: 12px; border-radius: 50%; background: var(--pip, var(--info)); box-shadow: 0 0 0 1.5px rgba(var(--ink-rgb), .25); flex: none; }
.houses button.on { border-color: var(--pip, var(--ink)); border-width: 2px; color: var(--ink); background: var(--panel2); font-weight: 800; }

/* ---- scrim behind the drawer, on small screens only: on a tablet the
   list stays live beside it, on a phone it would be unusable ---- */
.scrim { position: fixed; inset: 0; background: var(--scrim); z-index: 49; opacity: 0; pointer-events: none; transition: opacity .18s; }
@media (max-width: 620px) { .scrim.on { opacity: 1; pointer-events: auto; } }

/* ---- dialogs ---- */
dialog { border: 1px solid var(--line); border-radius: var(--r); background: var(--paper); color: var(--ink); padding: 0; width: min(560px, calc(100vw - 24px)); max-height: calc(100vh - 32px); box-shadow: 0 16px 60px var(--shadow2); }
dialog::backdrop { background: var(--scrim); }
dialog .body { padding: 22px 24px 20px; }
dialog h3 { font-family: var(--fell); color: var(--ink); font-weight: 400; font-size: 28px; margin: 0 0 4px; }
.dlg-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; flex-wrap: wrap; }
.dlg-actions .left { margin-right: auto; }

/* ---- the foot of the list ---- */
.more { display: block; margin: 22px auto 0; }
.end { text-align: center; color: var(--faint); font-family: var(--fell); font-style: italic; padding: 22px 8px; }

@media print { .bar, .drawer, .scrim, .addhere, .more, .sotick { display: none !important; } }

/* =====================================================================
   R128. Three posts, not one tick.
   In the drawer they are three small boxes, because the question "when
   do we post about this" has three ordinary answers and any combination
   of them is legitimate, including none. On the card the same three read
   as pips, so a glance across a week says how much posting it carries
   without anybody opening anything.
   ===================================================================== */
.leads { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 2px; }
.leadbox {
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 40px; padding: 0 13px 0 10px; border-radius: 10px;
  border: 1.5px solid var(--line2); background: var(--paper); color: var(--muted);
  font-family: var(--sans); font-size: 14px; text-transform: none; letter-spacing: 0;
}
.leadbox .box { position: relative; width: 17px; height: 17px; flex: none; border-radius: 4px; border: 1.5px solid var(--line2); background: var(--field); }
.leadbox:hover { border-color: var(--ink); color: var(--ink); }
.leadbox.on { border-color: var(--gold-text); background: var(--gold-tint); color: var(--gold-text); font-weight: 800; }
.leadbox.on .box { border-color: var(--gold-text); background: var(--gold); }
.leadbox.on .box::after { content: "✓"; position: absolute; inset: 0; text-align: center; font: 700 12px/15px var(--sans); color: var(--gold-ink); }
@media (max-width: 420px) { .leads { flex-direction: column; } .leadbox { width: 100%; } }
