/* ==========================================================================
   Daybook -- component families
   Allowed families only: band, sheet, rail, rule, stamp, mark, control,
   legend row, status list. No card grid anywhere.
   ========================================================================== */

/* ---- brand mark + masthead -------------------------------------------- */
.masthead {
  position: sticky;
  top: 0;
  z-index: 100;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: saturate(1.3) blur(12px);
  border-bottom: var(--hair) solid var(--rule);
}
.masthead--night {
  background: color-mix(in srgb, var(--night) 88%, transparent);
  border-bottom-color: var(--night-rule);
}
.masthead .wrap {
  display: flex;
  align-items: center;
  gap: var(--s5);
  min-height: 62px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: var(--s3);
  text-decoration: none;
  flex: 0 0 auto;
}
.brand svg { display: block; flex: 0 0 auto; }
.brand-name {
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}
.brand-sub {
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 400;
  letter-spacing: 0.02em;
  text-transform: none;
  color: var(--ink-muted);
}
.masthead--night .brand-sub { color: var(--ivory-muted); }

.sitenav {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: var(--s5);
  flex-wrap: wrap;
}
.sitenav a {
  font-family: var(--sans);
  font-size: var(--t-ui);
  letter-spacing: 0.01em;
  color: var(--ink-muted);
  text-decoration: none;
  padding-block: var(--s2);
  border-bottom: var(--hair) solid transparent;
}
.sitenav a:hover { color: var(--ink); border-bottom-color: var(--promised-rule); }
.masthead--night .sitenav a { color: var(--ivory-muted); }
.masthead--night .sitenav a:hover { color: var(--ivory); }
.sitenav .sep {
  width: var(--hair);
  height: 16px;
  background: var(--rule-strong);
  flex: 0 0 auto;
}
.masthead--night .sitenav .sep { background: var(--night-rule); }

.nav-sections { display: contents; }

@media (max-width: 860px) {
  .masthead { position: static; }
  .masthead .wrap {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--s3);
    padding-block: var(--s4);
  }
  .sitenav { margin-left: 0; gap: var(--s4) var(--s5); }
  .sitenav .sep { display: none; }
}

/* On a phone the masthead keeps the brand and the suite. The in-page section
   anchors are a desktop convenience and are reachable by scrolling. */
@media (max-width: 620px) {
  .nav-sections { display: none; }
  .masthead .wrap { flex-direction: row; align-items: center; gap: var(--s5); }
  .sitenav { margin-left: auto; }
}

/* ---- controls ---------------------------------------------------------- */
.ctl {
  font-family: var(--sans);
  font-size: var(--t-ui);
  line-height: 1.35;
  letter-spacing: 0.02em;
  font-weight: 500;
  padding: 11px 18px;
  border-radius: var(--r-control);
  border: var(--hair) solid var(--ink);
  background: var(--ink);
  color: var(--paper);
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: var(--s2);
  transition: background var(--d-control) var(--ease),
              color var(--d-control) var(--ease),
              border-color var(--d-control) var(--ease);
}
.ctl:hover { background: var(--decided); border-color: var(--decided); color: var(--sheet); }

.ctl--quiet {
  background: transparent;
  color: var(--ink);
  border-color: var(--rule-strong);
}
.ctl--quiet:hover { background: transparent; border-color: var(--ink); color: var(--ink); }

.ctl--inline {
  background: none;
  border: 0;
  padding: 2px 0;
  color: var(--ink-muted);
  font-size: var(--t-ui);
  text-decoration: underline;
  text-decoration-color: var(--rule-strong);
  text-underline-offset: 3px;
}
.ctl--inline:hover { color: var(--ink); text-decoration-color: currentColor; }

.ctl[aria-pressed="true"] { background: var(--decided); border-color: var(--decided); color: var(--sheet); }
.ctl[disabled] { opacity: 0.42; cursor: default; }
.ctl[disabled]:hover { background: var(--ink); border-color: var(--ink); color: var(--paper); }

.on-night .ctl,
.band--night .ctl {
  background: var(--ivory);
  border-color: var(--ivory);
  color: var(--night);
}
.on-night .ctl:hover,
.band--night .ctl:hover { background: var(--promised-rule); border-color: var(--promised-rule); color: var(--night); }
.on-night .ctl--quiet,
.band--night .ctl--quiet {
  background: transparent;
  color: var(--ivory);
  border-color: var(--night-rule);
}
.on-night .ctl--quiet:hover,
.band--night .ctl--quiet:hover { border-color: var(--ivory); background: transparent; color: var(--ivory); }
.on-night .ctl--inline,
.band--night .ctl--inline { color: var(--ivory-muted); }
.on-night .ctl--inline:hover,
.band--night .ctl--inline:hover { color: var(--ivory); }

.ctl-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s3);
  align-items: center;
}

/* ---- availability line ------------------------------------------------- */
.avail {
  font-family: var(--mono);
  font-size: var(--t-mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
  color: var(--ink-faint);
  display: inline-flex;
  align-items: flex-start;
  gap: var(--s3);
}
.avail::before {
  content: "";
  width: 7px; height: 7px;
  margin-top: 0.46em;
  border-radius: 50%;
  border: var(--hair) solid var(--promised-rule);
  flex: 0 0 auto;
}
.band--night .avail, .on-night .avail { color: var(--ivory-faint); }

/* ---- sheet: the written page object ------------------------------------ */
.sheet {
  background: var(--sheet);
  border: var(--hair) solid var(--rule);
  padding: clamp(var(--s5), 4vw, var(--s7)) clamp(var(--s5), 4.5vw, var(--s8));
  position: relative;
}
.sheet-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--s4);
  padding-bottom: var(--s3);
  margin-bottom: var(--s5);
  border-bottom: var(--hair) solid var(--rule);
  font-family: var(--serif);
  font-size: 20px;
}
.sheet-head .head-state {
  font-family: var(--sans);
  font-size: var(--t-ui);
  color: var(--ink-faint);
  text-align: right;
}

/* ---- the five states, as marks ---------------------------------------- */
/* Two independent channels on every state: form and colour. */

.m-heard {               /* someone said it */
  font-family: var(--serif);
  font-style: italic;
  color: var(--ink);
}
.m-heard::before { content: "\201C"; }
.m-heard::after  { content: "\201D"; }

.m-said {                /* you said it */
  font-family: var(--serif);
  font-style: italic;
  color: var(--mine);
  border-left: 2px solid var(--mine);
  padding-left: var(--s3);
  display: inline-block;
}
.m-said::before { content: "\201C"; }
.m-said::after  { content: "\201D"; }

.m-proposed {            /* SAFIYA's inference: different typeface, offset, labelled */
  display: block;
  font-family: var(--sans);
  font-size: var(--t-body);
  line-height: 1.55;
  color: var(--ink-muted);
  background: color-mix(in srgb, var(--decided) 5%, transparent);
  border-left: 2px solid var(--decided);
  padding: var(--s3) var(--s4);
  margin: var(--s4) 0;
}
.m-proposed .micro {
  display: block;
  color: var(--decided);
  margin-bottom: var(--s2);
}

.m-decided {             /* you settled it */
  border-bottom: 1.5px solid var(--decided);
  padding-bottom: 1px;
  color: var(--ink);
}

.m-done {                /* carried out: underline plus a stamp glyph */
  border-bottom: 1.5px solid var(--decided);
  padding-bottom: 1px;
  color: var(--ink);
}
.m-done::after {
  content: "";
  display: inline-block;
  width: 7px; height: 7px;
  margin-left: 6px;
  vertical-align: 0.08em;
  border-radius: 50%;
  background: var(--decided);
}

/* two line kinds, which are not states */
.m-unsettled {
  border-bottom: 1.5px dotted var(--promised-rule);
  padding-bottom: 1px;
  color: var(--ink);
}
.m-withdrawn {
  position: relative;
  color: var(--struck);
  display: inline-block;
}
.m-withdrawn::after {
  content: "";
  position: absolute;
  left: 0; right: 0; top: 52%;
  height: 1px;
  background: var(--struck-rule);
  transform: scaleX(0);
  transform-origin: left;
  animation: draw var(--d-reset) var(--ease) forwards;
}

/* an absence: no mark, no container */
.m-absence {
  display: block;
  font-family: var(--serif);
  font-style: italic;
  color: var(--ink-muted);
  margin-top: var(--s4);
}

/* a fact kept */
.m-fact { color: var(--ink); }
.m-fact::before { content: "["; color: var(--ink-faint); }
.m-fact::after  { content: "]"; color: var(--ink-faint); }

/* the person's own writing */
.m-mine { color: var(--mine); }

/* ---- stamp: provenance control ---------------------------------------- */
.stamp {
  font-family: var(--mono);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  color: var(--ink-faint);
  width: 40px; height: 40px;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: var(--hair) solid var(--rule-strong);
  border-radius: var(--r-stamp);
  background: transparent;
  cursor: pointer;
  transition: border-color var(--d-control) var(--ease),
              color var(--d-control) var(--ease);
}
.stamp:hover { border-color: var(--promised-rule); color: var(--promised); }
.stamp[aria-pressed="true"] {
  border-color: var(--promised-rule);
  color: var(--promised);
  box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--promised-rule) 22%, transparent);
}
.on-night .stamp, .band--night .stamp { border-color: var(--night-rule); color: var(--ivory-faint); }
.on-night .stamp:hover, .band--night .stamp:hover { border-color: var(--promised-rule); color: var(--promised-rule); }

/* footnote marker, inline in prose */
.fn {
  font-family: var(--sans);
  font-size: 10.5px;
  font-weight: 600;
  vertical-align: super;
  color: var(--decided);
  background: none;
  border: 0;
  padding: 0 2px;
  cursor: pointer;
  line-height: 1;
}
.fn:hover { text-decoration: underline; }
.fn[aria-pressed="true"] { color: var(--promised); }

/* ---- rail: a row of repeated small items, never cards ----------------- */
.rail {
  display: flex;
  gap: var(--s5);
  flex-wrap: wrap;
}
.rail--cols {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: var(--s6) var(--s7);
}
.rail-item { min-width: 0; }
.rail-item h3 { margin-bottom: var(--s2); }
.rail-item p { font-size: 15.5px; color: var(--ink-muted); margin-bottom: 0; }
.band--night .rail-item p { color: var(--ivory-muted); }
.rail-item .rail-rule {
  border-top: var(--hair) solid var(--rule);
  padding-top: var(--s4);
  margin-bottom: var(--s4);
}
.band--night .rail-item .rail-rule { border-top-color: var(--night-rule); }

/* ---- legend row: label, specimen, definition --------------------------- */
.legend { border-top: var(--hair) solid var(--rule); }
.legend-row {
  display: grid;
  grid-template-columns: 148px minmax(0, 1.1fr) minmax(0, 1.3fr) 20px;
  gap: var(--s5);
  align-items: baseline;
  padding: var(--s5) 0;
  border-bottom: var(--hair) solid var(--rule);
  width: 100%;
  text-align: left;
  background: none;
  border-left: 0;
  border-right: 0;
  border-top: 0;
  cursor: pointer;
  font: inherit;
  color: inherit;
  transition: background var(--d-control) var(--ease);
}
.legend-row:hover { background: color-mix(in srgb, var(--promised-rule) 5%, transparent); }
.legend-row[aria-expanded="true"] { background: color-mix(in srgb, var(--promised-rule) 7%, transparent); }
.legend-row .specimen {
  font-family: var(--serif);
  font-size: 17.5px;
  line-height: 1.5;
}
.legend-row .definition {
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink-muted);
}
.legend-row .chev {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  color: var(--ink-faint);
  transition: transform var(--d-control) var(--ease), color var(--d-control) var(--ease);
}
.legend-row:hover .chev { color: var(--ink); }
.legend-row[aria-expanded="true"] .chev { transform: rotate(180deg); color: var(--promised); }

.legend-note {
  margin-top: var(--s5);
  font-size: 15px;
  color: var(--ink-muted);
  max-width: var(--measure-ui);
}
@media (max-width: 760px) {
  .legend-row { grid-template-columns: 1fr; gap: var(--s3); }
}

/* ---- status list: plain truths ---------------------------------------- */
.status { margin: 0; border-top: var(--hair) solid var(--rule); }
.band--night .status { border-top-color: var(--night-rule); }
.status-item {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: var(--s5);
  padding: var(--s4) 0;
  border-bottom: var(--hair) solid var(--rule);
  align-items: baseline;
}
.band--night .status-item { border-bottom-color: var(--night-rule); }
.status-item dt {
  font-family: var(--mono);
  font-size: var(--t-mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--promised);
}
.band--night .status-item dt { color: var(--promised-rule); }
.status-item dd { margin: 0; font-size: 15.5px; line-height: 1.6; }
.status-item dd.plain { color: var(--ink-muted); }
.band--night .status-item dd.plain { color: var(--ivory-muted); }
@media (max-width: 680px) {
  .status-item { grid-template-columns: 1fr; gap: var(--s2); }
}

/* ---- demonstration label ---------------------------------------------- */
.demo-label {
  display: inline-flex;
  align-items: flex-start;
  gap: var(--s3);
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--promised);
  border: var(--hair) dashed var(--promised-rule);
  padding: 6px 10px;
  margin-bottom: var(--s4);
  max-width: 100%;
}
.demo-label .what {
  font-family: var(--sans);
  font-size: 11.5px;
  letter-spacing: 0;
  text-transform: none;
  color: var(--ink-muted);
}
.band--night .demo-label, .on-night .demo-label { color: var(--promised-rule); }
.band--night .demo-label .what, .on-night .demo-label .what { color: var(--ivory-muted); }

/* ---- voice bar: whose voice, before any word is read ------------------ */
.bars {
  display: flex;
  gap: 2px;
  align-items: flex-end;
  height: 22px;
}
.bars i {
  display: block;
  width: 4px;
  height: 4px;
  border-radius: 2px;
  background: var(--rule-strong);
  transition: height 90ms linear, background var(--d-control) var(--ease);
}
.v-other i { background: var(--promised-rule); }
.v-me i     { background: var(--mine); }
.v-safiya i { background: var(--ink-faint); }
.on-night .v-other i  { background: var(--promised-rule); }
.on-night .v-me i     { background: var(--ivory); }
.on-night .v-safiya i { background: #8E867C; }
.on-night .bars i     { background: var(--night-rule); }

/* ---- footer ------------------------------------------------------------ */
.sitefoot {
  border-top: var(--hair) solid var(--rule);
  padding-block: var(--s7) var(--s8);
  background: var(--paper);
}
.sitefoot--night {
  background: var(--night);
  color: var(--ivory);
  border-top-color: var(--night-rule);
}
.sitefoot .wrap { display: grid; gap: var(--s6); }
.foot-top {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s5) var(--s7);
  align-items: baseline;
  justify-content: space-between;
}
.foot-links { display: flex; flex-wrap: wrap; gap: var(--s5); }
.foot-links a { font-family: var(--sans); font-size: var(--t-ui); color: var(--ink-muted); text-decoration: none; }
.foot-links a:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
.sitefoot--night .foot-links a { color: var(--ivory-muted); }
.sitefoot--night .foot-links a:hover { color: var(--ivory); }
.foot-fine {
  font-family: var(--mono);
  font-size: 11.5px;
  line-height: 1.7;
  color: var(--ink-faint);
  max-width: 68ch;
}
.sitefoot--night .foot-fine { color: var(--ivory-faint); }

/* ---- motion keyframes -------------------------------------------------- */
@keyframes draw   { to { transform: scaleX(1); } }
@keyframes post   { from { opacity: 0; transform: translateY(-7px); } to { opacity: 1; transform: translateY(0); } }
@keyframes resolve{ from { opacity: 0; filter: blur(1.5px); } to { opacity: 1; filter: blur(0); } }

.is-post    { animation: post var(--d-reset) var(--ease) both; }
.is-resolve { animation: resolve var(--d-resolve) var(--ease) both; }

/* cross-fade in place, for a word that re-sets */
.swap { transition: opacity var(--d-reset) var(--ease); }
.swap.is-out { opacity: 0; }
