/* ===========================================================================
   THE BULLETIN — styles
   A small paper on a phone. One column, serif for the issue, sans for the
   furniture. All colours come from CSS variables that are written into the
   page from src/config.js, so this file never names a colour directly.
   There is no red anywhere: warnings and destructive actions use ochre.
   =========================================================================== */

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family: var(--sans);
  font-size: var(--body-size);
  line-height: var(--line-height);
  -webkit-font-smoothing: antialiased;
  padding-bottom: calc(74px + env(safe-area-inset-bottom));
}
body.is-admin { padding-bottom: calc(64px + env(safe-area-inset-bottom)); }

.wrap {
  width: 100%;
  max-width: 40rem;
  margin: 0 auto;
  padding: 0 20px;
}

a { color: var(--teal); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }

img { max-width: 100%; height: auto; display: block; }

.skip {
  position: absolute; left: -9999px;
  background: var(--surface); color: var(--ink); padding: 12px 16px; z-index: 50;
}
.skip:focus { left: 12px; top: 12px; }

/* --- Top bar -------------------------------------------------------------- */

.topbar, .admin-bar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
  max-width: 40rem; margin: 0 auto;
  padding: 12px 20px;
  font-family: var(--sans);
}
.topbar-brand, .admin-brand {
  font-family: var(--sans);
  font-size: 13px; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--muted); text-decoration: none; font-weight: 600;
}
.admin-brand span { color: var(--ochre); }
.admin-bar { max-width: 46rem; }
.admin-bar-right { display: flex; align-items: center; gap: 10px; }

.theme-toggle {
  font-family: var(--sans); font-size: 13px;
  background: transparent; color: var(--muted);
  border: 1px solid var(--rule); border-radius: 999px;
  padding: 8px 14px; min-height: 36px; cursor: pointer;
}
:root[data-theme="light"] .theme-toggle-dark { display: none; }
:root[data-theme="dark"] .theme-toggle-light { display: none; }

/* --- The masthead --------------------------------------------------------- */

.masthead { padding: 8px 0 0; border-bottom: 2px solid var(--ink); }
.masthead h1 {
  font-family: var(--serif);
  font-size: clamp(2.1rem, 11vw, 2.9rem);
  line-height: 1.05;
  letter-spacing: -0.02em;
  font-weight: 700;
  margin: 0 0 6px;
}
.masthead .standfirst {
  font-family: var(--sans); font-size: 13px; color: var(--muted);
  margin: 0 0 14px;
}
.issueline {
  display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap;
  font-family: var(--sans); font-size: 13px;
  padding: 12px 0; border-bottom: 1px solid var(--rule);
  color: var(--muted);
}
.issueno {
  font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--ochre); font-size: 14px;
}
.issue-title {
  font-family: var(--serif);
  font-size: clamp(1.6rem, 7vw, 2rem);
  line-height: 1.22; font-weight: 600;
  margin: 26px 0 6px;
}

.draft-flag {
  background: var(--ochre); color: var(--page);
  font-family: var(--sans); font-size: 13px; font-weight: 600;
  padding: 8px 14px; border-radius: 2px; margin: 14px 0 0;
}

/* --- Blocks --------------------------------------------------------------- */

.block { padding: 26px 0; border-bottom: 1px solid var(--rule); }
.block:last-of-type { border-bottom: 0; }

.kicker {
  font-family: var(--sans);
  font-size: 12px; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--ochre); font-weight: 700;
  margin: 0 0 8px;
}
.block h2 {
  font-family: var(--serif);
  font-size: 1.4rem; line-height: 1.3; font-weight: 600;
  margin: 0 0 10px;
}
.block h3 {
  font-family: var(--serif);
  font-size: 1.2rem; line-height: 1.35; font-weight: 600;
  margin: 0 0 6px;
}

.prose { font-family: var(--serif); font-size: var(--body-size); line-height: var(--line-height); }
.prose p { margin: 0 0 1em; }
.prose p:last-child { margin-bottom: 0; }
.prose-read p { margin-bottom: 1.1em; }

/* Student work */
.gallery { display: grid; gap: 22px; margin-top: 14px; }
.work { margin: 0; }
.work img { width: 100%; border: 1px solid var(--rule); border-radius: 2px; background: var(--surface); }
.work figcaption {
  font-family: var(--sans); font-size: 15px; color: var(--muted);
  margin-top: 8px; line-height: 1.5;
}
.work-who { color: var(--ink); font-weight: 600; }
.work-note::before { content: " — "; }

/* What is on */
.listing { padding: 14px 0; border-top: 1px solid var(--rule); }
.listing:first-of-type { border-top: 0; padding-top: 4px; }
.listing-meta { font-family: var(--sans); font-size: 15px; color: var(--muted); margin: 6px 0 0; }
.listing-meta .dot { padding: 0 6px; }
.listing-ages { font-family: var(--sans); font-size: 15px; color: var(--teal); margin: 2px 0 0; }

/* Events */
.event { padding: 16px 0; }
.event-image { border: 1px solid var(--rule); margin-bottom: 12px; }
.event-meta { margin: 12px 0 0; font-family: var(--sans); font-size: 15px; }
.event-meta > div { display: flex; gap: 10px; padding: 3px 0; }
.event-meta dt { color: var(--muted); min-width: 4.2em; }
.event-meta dd { margin: 0; }

/* The standing reminder. Quiet on purpose: it is in every issue, so it should
   not shout over the thing the reader actually opened the bulletin for. */
.block-reminder {
  border-left: 3px solid var(--teal);
  border-bottom: 0;
  padding: 4px 0 4px 16px;
  margin: 22px 0;
}
.block-reminder .prose { font-size: 1rem; color: var(--muted); }

/* Try this at home. Teal, not ochre: it is an invitation, not a warning. */
.block-practice {
  border: 1px solid var(--rule);
  border-left: 3px solid var(--teal);
  border-bottom: 1px solid var(--rule);
  background: var(--surface);
  padding: 18px 20px;
  margin: 26px 0;
}
.practice-time {
  font-family: var(--sans); font-size: 15px; color: var(--muted);
  margin: 10px 0 0;
}

/* Notice */
.block-notice {
  border-left: 3px solid var(--ochre);
  border-bottom: 0;
  background: var(--surface);
  padding: 16px 18px;
  margin: 26px 0;
}
.block-notice .prose { font-size: 1rem; }

/* The board line at the foot of an issue */
.boardline {
  font-family: var(--sans); font-size: 15px; color: var(--muted);
  border-top: 1px solid var(--rule); padding-top: 18px; margin-top: 10px;
}

/* --- Buttons and forms ---------------------------------------------------- */

.button, button.button {
  display: inline-block;
  font-family: var(--sans); font-size: 17px; font-weight: 500;
  background: var(--teal); color: var(--page);
  border: 0; border-radius: 2px;
  padding: 14px 22px; min-height: 50px;
  text-decoration: none; text-align: center; cursor: pointer;
}
.button:hover { filter: brightness(1.08); }
.button-quiet { background: transparent; color: var(--teal); border: 1px solid var(--rule); }
.button-ochre { background: var(--ochre); color: var(--page); }
.button-block { display: block; width: 100%; }
.button-small { font-size: 15px; padding: 10px 14px; min-height: 42px; }

.field { margin: 0 0 18px; }
.field label, .label {
  display: block; font-family: var(--sans); font-size: 14px; font-weight: 600;
  color: var(--muted); margin-bottom: 6px;
}
.field .help { font-size: 14px; color: var(--muted); font-weight: 400; margin: 4px 0 0; }

input[type="text"], input[type="email"], input[type="password"],
input[type="date"], input[type="number"], input[type="search"], textarea, select {
  width: 100%;
  font-family: var(--sans); font-size: 17px;
  color: var(--ink); background: var(--surface);
  border: 1px solid var(--rule); border-radius: 2px;
  padding: 13px 14px;
  min-height: 50px;
}
textarea { font-family: var(--serif); font-size: 17px; line-height: 1.6; resize: vertical; }
input:focus, textarea:focus, select:focus {
  outline: 2px solid var(--teal); outline-offset: 1px; border-color: var(--teal);
}

.row { display: flex; gap: 10px; flex-wrap: wrap; }
.row > * { flex: 1 1 8rem; }

/* Messages. Warnings are ochre, confirmations green, never red. */
.note { padding: 14px 16px; border-radius: 2px; font-family: var(--sans); font-size: 16px; margin: 0 0 18px; line-height: 1.5; }
.note-warn { background: var(--surface); border-left: 3px solid var(--ochre); color: var(--ink); }
.note-ok { background: var(--surface); border-left: 3px solid var(--green); color: var(--ink); }
.note-quiet { background: var(--surface); border-left: 3px solid var(--rule); color: var(--muted); }

/* The word counter. This is the product, so it is always visible. */
.counter {
  font-family: var(--sans); font-size: 14px; color: var(--muted);
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 6px; min-height: 22px;
}
.counter.warn { color: var(--ochre); font-weight: 600; }
.counter.over { color: var(--ochre); font-weight: 700; }
.counter-note { font-size: 13px; }

/* --- Lists ---------------------------------------------------------------- */

.card {
  background: var(--surface); border: 1px solid var(--rule); border-radius: 2px;
  padding: 16px 18px; margin: 0 0 14px;
}
.card h2, .card h3 { margin-top: 0; }

.stack { display: grid; gap: 14px; }

.meta { font-family: var(--sans); font-size: 14px; color: var(--muted); }

.issue-row {
  display: block; text-decoration: none; color: inherit;
  padding: 16px 0; border-bottom: 1px solid var(--rule);
}
.issue-row .n { color: var(--ochre); font-weight: 700; font-size: 13px; letter-spacing: 0.1em; text-transform: uppercase; }
.issue-row .t { font-family: var(--serif); font-size: 1.15rem; margin: 4px 0 2px; }

.pill {
  display: inline-block; font-family: var(--sans); font-size: 13px; font-weight: 600;
  padding: 5px 11px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--rule); color: var(--muted);
  text-decoration: none;
}
.pill-ochre { background: var(--ochre); color: var(--page); border-color: var(--ochre); }
.pill-teal { background: var(--teal); color: var(--page); border-color: var(--teal); }
.pill-green { background: var(--green); color: var(--page); border-color: var(--green); }
.pill-on { background: var(--ink); color: var(--page); border-color: var(--ink); }

.chiprow { display: flex; gap: 8px; overflow-x: auto; padding: 4px 0 12px; -webkit-overflow-scrolling: touch; }
.chiprow .pill { white-space: nowrap; padding: 9px 14px; font-size: 14px; }

/* --- The board ------------------------------------------------------------ */

.post-type {
  font-family: var(--sans); font-size: 12px; font-weight: 700;
  letter-spacing: 0.08em; text-transform: uppercase; color: var(--ochre);
}
.post-title { font-family: var(--serif); font-size: 1.2rem; margin: 4px 0 6px; }
.post-body { font-family: var(--serif); }
.reply { border-left: 2px solid var(--rule); padding: 10px 0 10px 14px; margin: 12px 0 0; }

.typegrid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.typegrid label {
  display: block; border: 1px solid var(--rule); background: var(--surface);
  border-radius: 2px; padding: 14px; cursor: pointer; text-align: left;
}
.typegrid input { position: absolute; opacity: 0; }
.typegrid label:has(input:checked) { border-color: var(--teal); box-shadow: inset 0 0 0 1px var(--teal); }
.typegrid .tname { font-family: var(--sans); font-weight: 600; font-size: 16px; color: var(--ink); }
.typegrid .thint { font-family: var(--sans); font-size: 13px; color: var(--muted); }

/* --- The practice card ----------------------------------------------------
   One big button, then a quiet grid. Filled squares are days done; blank
   squares are just blank, never marked as missed.
   -------------------------------------------------------------------------- */

.practice-mark { font-size: 19px; padding: 20px; min-height: 64px; }
.practice-done {
  background: var(--green); font-size: 19px; padding: 16px 20px; min-height: 64px;
  line-height: 1.3;
}
.practice-undo {
  display: block; font-size: 13px; opacity: 0.85; font-weight: 400; margin-top: 2px;
}

.practice-grid { display: grid; gap: 8px; margin-top: 10px; }
.practice-week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; }
.practice-cellform { margin: 0; display: block; }

.practice-cell {
  display: flex; align-items: center; justify-content: center;
  width: 100%; aspect-ratio: 1 / 1;
  border: 1px solid var(--rule); border-radius: 3px;
  background: var(--surface); color: var(--muted);
  font-family: var(--sans); font-size: 14px;
  cursor: pointer; padding: 0;
}
.practice-cell.on { background: var(--teal); border-color: var(--teal); color: var(--page); font-weight: 600; }
.practice-cell.today { box-shadow: inset 0 0 0 2px var(--ochre); }
.practice-cell.locked { cursor: default; opacity: 0.75; }
.practice-num { pointer-events: none; }

/* --- Bottom tab bar ------------------------------------------------------- */

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: flex;
  background: var(--page);
  border-top: 1px solid var(--rule);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar a {
  flex: 1; text-align: center; text-decoration: none;
  color: var(--muted); font-family: var(--sans); font-size: 12px; font-weight: 600;
  padding: 10px 4px 8px; min-height: 62px;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
}
.tabbar a.on { color: var(--teal); }
.tabicon { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.5; }

.admin-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: flex; background: var(--page); border-top: 1px solid var(--rule);
  padding-bottom: env(safe-area-inset-bottom);
}
.admin-nav a {
  flex: 1; text-align: center; text-decoration: none; color: var(--muted);
  font-family: var(--sans); font-size: 13px; font-weight: 600;
  padding: 16px 4px; min-height: 54px;
}
.admin-nav a.on { color: var(--teal); }
.dotcount {
  display: inline-block; background: var(--ochre); color: var(--page);
  border-radius: 999px; font-size: 11px; padding: 1px 6px; vertical-align: 1px;
}

.pagefoot {
  font-family: var(--sans); font-size: 14px; color: var(--muted);
  border-top: 1px solid var(--rule); margin-top: 34px; padding: 20px 0 30px;
}
.pagefoot p { margin: 0 0 6px; }

/* --- Admin ---------------------------------------------------------------- */

.is-admin .wrap { max-width: 46rem; }
.admin-h1 { font-family: var(--serif); font-size: 1.7rem; margin: 6px 0 4px; }
.admin-sub { font-family: var(--sans); font-size: 15px; color: var(--muted); margin: 0 0 20px; }

.tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 22px; }
.tile {
  background: var(--surface); border: 1px solid var(--rule); border-radius: 2px;
  padding: 16px; text-decoration: none; color: inherit; display: block;
}
.tile .big { font-family: var(--serif); font-size: 2rem; line-height: 1; color: var(--ink); }
.tile .lbl { font-family: var(--sans); font-size: 13px; color: var(--muted); margin-top: 6px; }
.tile.alert { border-color: var(--ochre); }
.tile.alert .big { color: var(--ochre); }

.blockcard {
  background: var(--surface); border: 1px solid var(--rule); border-radius: 2px;
  margin: 0 0 16px; overflow: hidden;
}
.blockcard > summary {
  list-style: none; cursor: pointer;
  padding: 14px 16px; display: flex; align-items: center; justify-content: space-between; gap: 10px;
  font-family: var(--sans); font-weight: 600;
}
.blockcard > summary::-webkit-details-marker { display: none; }
.blockcard[open] > summary { border-bottom: 1px solid var(--rule); }
.blockcard-body { padding: 16px; }
.blockcard .type { color: var(--ochre); font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; }
.blockcard .peek { font-weight: 400; color: var(--muted); font-size: 14px; }

.miniform { display: flex; gap: 8px; align-items: center; }
.inline-form { display: inline; }

.tablelike { width: 100%; border-collapse: collapse; font-family: var(--sans); font-size: 15px; }
.tablelike th { text-align: left; font-size: 13px; color: var(--muted); padding: 8px 6px; border-bottom: 1px solid var(--rule); }
.tablelike td { padding: 10px 6px; border-bottom: 1px solid var(--rule); vertical-align: top; }

.savestate { font-family: var(--sans); font-size: 13px; color: var(--muted); min-height: 18px; }
.savestate.ok { color: var(--green); }
.savestate.warn { color: var(--ochre); }

.artgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 14px; }
.artcell { background: var(--page); border: 1px solid var(--rule); padding: 8px; }
.artcell img { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; margin-bottom: 8px; }
.artcell input { font-size: 15px; min-height: 42px; padding: 8px 10px; margin-bottom: 6px; }

.sticky-actions {
  position: sticky; bottom: calc(56px + env(safe-area-inset-bottom));
  background: var(--page); border-top: 1px solid var(--rule);
  padding: 12px 0; display: flex; gap: 10px; z-index: 10;
}
.sticky-actions .button { flex: 1; }

@media (min-width: 700px) {
  .tiles { grid-template-columns: repeat(4, 1fr); }
  .gallery { grid-template-columns: 1fr; }
}

/* People who prefer less movement get none. */
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* --- The fees table --------------------------------------------------------
   Not a real table: rows that stay readable on a narrow phone. */
.feetable { border-top: 1px solid var(--rule); margin-top: 8px; }
.feerow {
  display: flex; justify-content: space-between; align-items: baseline; gap: 14px;
  padding: 14px 0; border-bottom: 1px solid var(--rule);
}
.feelabel { font-family: var(--serif); font-size: 1.05rem; }
.feeamount {
  font-family: var(--sans); font-size: 1.05rem; font-weight: 600;
  color: var(--ink); white-space: nowrap;
}
