/* Daybook: product layer on top of family.css.
   Identity: a morning broadsheet. A double-ruled masthead, serif rank
   numerals, a heat column read like a stock table, provenance in mono. One
   accent: ember, used for heat, action, focus and the current filter only.
   Status is always text plus shape (filled, outlined, dashed), never colour
   alone. */

:root {
  --accent: #9c3b12;
  --accent-hover: #7a2c0b;
  --accent-soft: #f1dfd3;
  --on-accent: #fbf9f5;
  --focus: #9c3b12;
  --heat-track: #e4ded3;
  --rise: #1e6f36;
  --fall: #57524a;
  --late: #8a4a00;
}

[data-theme="dark"] {
  --accent: #f4a27c;
  --accent-hover: #f8c2a8;
  --accent-soft: #3a2419;
  --on-accent: #1a0f0a;
  --focus: #f4a27c;
  --heat-track: #2a2723;
  --rise: #62cf88;
  --fall: #aaa397;
  --late: #f0b66a;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --accent: #f4a27c;
    --accent-hover: #f8c2a8;
    --accent-soft: #3a2419;
    --on-accent: #1a0f0a;
    --focus: #f4a27c;
    --heat-track: #2a2723;
    --rise: #62cf88;
    --fall: #aaa397;
    --late: #f0b66a;
  }
}

/* ---- Small shared pieces ---------------------------------------------- */

.label {
  margin-right: var(--space-2);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.clock {
  font-weight: 600;
}

.demo-inline {
  font-weight: 700;
}

.heat-num {
  display: block;
  font-family: var(--font-mono);
  font-size: var(--text-md);
  font-weight: 700;
  line-height: 1.1;
}

.heat-num.big {
  font-size: var(--text-xl);
}

.heat-cap {
  display: block;
  margin-top: var(--space-1);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.75rem;
}

.meter {
  display: block;
  width: 5rem;
  height: 6px;
  margin-top: var(--space-1);
}

.meter-track {
  fill: var(--heat-track);
}

.meter-fill {
  fill: var(--accent);
}

.spark {
  display: block;
  width: 100px;
  height: 24px;
  overflow: visible;
}

.spark-base {
  stroke: var(--border);
  stroke-width: 1;
}

.spark-line {
  stroke: var(--accent);
  stroke-width: 1.5;
  stroke-linejoin: round;
}

.spark-dot {
  fill: var(--accent);
}

.spark-empty {
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.75rem;
}

/* Status tags: filled = new, outlined accent = follow-up, outlined neutral =
   continuing, dashed = earlier. */
.tag {
  display: inline-flex;
  align-items: center;
  min-height: 1.5rem;
  padding: 0 var(--space-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  white-space: nowrap;
}

.tag-new {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--on-accent);
}

.tag-follow-up {
  border: 2px solid var(--accent);
  color: var(--accent);
}

.tag-earlier {
  border-style: dashed;
}

.trend {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 600;
}

.trend::before {
  margin-right: 0.3em;
}

.trend-rising {
  color: var(--rise);
}

.trend-rising::before {
  content: "\2191";
  content: "\2191" / "";
}

.trend-cooling {
  color: var(--fall);
}

.trend-cooling::before {
  content: "\2193";
  content: "\2193" / "";
}

.trend-steady::before {
  content: "\2192";
  content: "\2192" / "";
}

.trend-note {
  color: var(--late);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
}

.fstate {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 600;
}

.fstate::before {
  content: "";
  flex: none;
  width: 8px;
  height: 8px;
  border: 1.5px solid currentColor;
}

.fstate-fresh {
  color: var(--rise);
}

.fstate-fresh::before {
  border-radius: 50%;
  background: currentColor;
}

.fstate-late {
  color: var(--late);
}

.fstate-late::before {
  border-radius: 50%;
}

.fstate-stale {
  color: var(--danger);
}

.fstate-stale::before {
  transform: rotate(45deg);
}

.crumbs ol {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1) var(--space-2);
  margin: 0 0 var(--space-3);
  padding: 0;
  list-style: none;
  font-size: var(--text-sm);
}

.crumbs li + li {
  margin-top: 0;
}

.crumbs li + li::before {
  content: "/";
  margin-right: var(--space-2);
  color: var(--text-muted);
}

.crumbs a {
  display: inline-flex;
  align-items: center;
  min-height: var(--target);
}

.crumbs [aria-current] {
  display: inline-flex;
  align-items: center;
  min-height: var(--target);
  color: var(--text-muted);
}

.cell-note {
  display: block;
  margin-top: var(--space-1);
  color: var(--text-muted);
  font-size: var(--text-xs);
  font-weight: 400;
}

.formula {
  padding: var(--space-3) var(--space-4);
  border-left: 3px solid var(--accent);
  background: var(--surface-raised);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
}

.other-title {
  margin-top: var(--space-7);
  font-size: var(--text-lg);
}

/* ---- Masthead and the briefing ---------------------------------------- */

.masthead {
  padding: var(--space-6) 0 var(--space-4);
  border-bottom: 4px double var(--rule);
}

.masthead h1 {
  margin: var(--space-2) 0 0;
}

.masthead-line {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1) var(--space-4);
  margin: 0;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.masthead-line span + span::before {
  content: "\00b7";
  margin-right: var(--space-4);
}

.front-grid {
  display: grid;
  gap: var(--space-7);
  padding-top: var(--space-6);
}

@media (min-width: 1024px) {
  .front-grid {
    grid-template-columns: minmax(0, 8fr) minmax(0, 4fr);
  }
}

.edition-head {
  margin-bottom: var(--space-4);
  padding-bottom: var(--space-3);
  border-bottom: 2px solid var(--rule);
}

.edition-head h2 {
  margin-bottom: var(--space-2);
}

.edition-line {
  margin: 0;
  color: var(--text-muted);
  font-size: var(--text-sm);
}

.brief {
  margin: 0;
  padding: 0;
  list-style: none;
}

.brief-item {
  display: grid;
  grid-template-columns: 2.5rem minmax(0, 1fr);
  gap: var(--space-2) var(--space-4);
  padding: var(--space-5) 0;
  border-bottom: 1px solid var(--border);
}

.brief li + li {
  margin-top: 0;
}

.brief-rank {
  color: var(--accent);
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 600;
  line-height: 1;
}

.brief-meta,
.er-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-1) var(--space-3);
  margin-bottom: var(--space-2);
  color: var(--text-muted);
  font-size: var(--text-sm);
}

.brief-title {
  margin-bottom: var(--space-2);
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 600;
}

.brief-title a,
.er-title a {
  color: var(--text);
  text-decoration: none;
}

.brief-title a:hover,
.er-title a:hover {
  color: var(--accent);
  text-decoration: underline;
}

.brief-summary {
  max-width: 62ch;
  margin-bottom: var(--space-2);
}

.brief-latest,
.er-latest {
  margin-bottom: var(--space-2);
  padding-left: var(--space-3);
  border-left: 2px solid var(--accent);
  font-size: var(--text-sm);
}

.brief-prov,
.er-prov {
  margin: 0;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
}

.brief-heat {
  grid-column: 2;
}

@media (min-width: 600px) {
  .brief-item {
    grid-template-columns: 3rem minmax(0, 1fr) 7rem;
  }

  .brief-heat {
    grid-column: 3;
    text-align: right;
  }

  .brief-heat .meter {
    margin-left: auto;
  }
}

.also {
  margin-top: var(--space-5);
  padding: var(--space-4) var(--space-5);
  background: var(--surface);
  border-radius: var(--radius);
}

.also-title {
  margin-bottom: var(--space-3);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  font-weight: 650;
  letter-spacing: 0;
}

.also-list {
  margin: 0;
}

.also-why {
  display: block;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
}

.more-link {
  margin-top: var(--space-5);
  font-weight: 600;
}

/* ---- Briefing side column --------------------------------------------- */

.front-aside {
  display: grid;
  gap: var(--space-5);
  align-content: start;
}

.aside-block {
  padding-top: var(--space-3);
  border-top: 2px solid var(--rule);
}

.aside-title {
  margin-bottom: var(--space-2);
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.aside-note {
  color: var(--text-muted);
  font-size: var(--text-sm);
}

.aside-list {
  margin: 0 0 var(--space-3);
  padding: 0;
  list-style: none;
  font-size: var(--text-sm);
}

.aside-list li + li {
  margin-top: var(--space-3);
}

.aside-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  margin-top: var(--space-1);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
}

.rising-list li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--space-1) var(--space-3);
}

.rising-list .spark {
  grid-column: 1 / -1;
  width: 100%;
}

.rise {
  color: var(--rise);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 700;
}

.fresh-counts {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-4);
}

@media (min-width: 1024px) {
  .front-aside {
    position: sticky;
    top: calc(var(--header-height) + var(--space-4));
  }
}

/* ---- Latest: filters and event rows ------------------------------------ */

.latest {
  padding-top: var(--space-5);
}

.desk-filter {
  margin-bottom: var(--space-6);
  padding: var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface-raised);
}

.js .desk-filter {
  display: grid;
  gap: var(--space-4);
}

.filter-search .input {
  max-width: 36rem;
}

.filter-topics .field-label {
  display: block;
  margin-bottom: var(--space-2);
}

.filter-row {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: var(--space-3);
}

.filter-row .field {
  min-width: 12rem;
}

.filter-count {
  margin: 0 0 0 auto;
  align-self: center;
  color: var(--text-muted);
}

.nojs-topics {
  margin-bottom: var(--space-6);
}

.day {
  margin-bottom: var(--space-6);
}

.day-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-2);
  margin-bottom: 0;
  padding-bottom: var(--space-2);
  border-bottom: 2px solid var(--rule);
  font-size: var(--text-lg);
}

.day-count {
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 500;
  letter-spacing: 0.02em;
}

.event-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.event-list li + li {
  margin-top: 0;
}

.event-row {
  display: grid;
  grid-template-columns: 4.5rem minmax(0, 1fr);
  gap: var(--space-2) var(--space-4);
  padding: var(--space-4) 0;
  border-bottom: 1px solid var(--border);
}

.er-heat .meter {
  width: 4rem;
}

.er-title {
  margin-bottom: var(--space-2);
  font-size: var(--text-md);
}

.er-time {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
}

.er-spark {
  grid-column: 2;
}

@media (min-width: 769px) {
  .event-row {
    grid-template-columns: 5rem minmax(0, 1fr) 7rem;
  }

  .er-spark {
    grid-column: 3;
    align-self: center;
  }
}

/* Read marks: dimmed title plus a text label, never colour alone. */
.is-read .er-title a,
.is-read .brief-title a {
  color: var(--text-muted);
  font-weight: 500;
}

.read-mark {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.read-mark::before {
  content: "\2713";
  content: "\2713" / "";
  margin-right: 0.25em;
}

.read-tools {
  margin-top: var(--space-5);
}

/* ---- Event page -------------------------------------------------------- */

.event-head {
  padding: var(--space-5) 0 var(--space-6);
  border-bottom: 4px double var(--rule);
}

.event-head h1 {
  max-width: 24em;
  margin-bottom: var(--space-3);
}

.event-tags {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-3);
}

.latest-dev {
  max-width: 62ch;
  margin: var(--space-4) 0;
  padding: var(--space-3) var(--space-4);
  border-left: 3px solid var(--accent);
  background: var(--accent-soft);
  border-radius: 0 var(--radius) var(--radius) 0;
}

.latest-dev p {
  margin-bottom: var(--space-2);
}

.latest-dev p:last-child {
  margin-bottom: 0;
}

.latest-dev-title {
  font-weight: 650;
}

.event-facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr));
  gap: var(--space-4);
  margin: var(--space-5) 0 0;
}

.event-facts dt {
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.event-facts dd {
  margin: var(--space-1) 0 0;
  font-weight: 600;
}

.fact-heat dd {
  display: grid;
  gap: var(--space-1);
}

.event-grid {
  display: grid;
  gap: var(--space-7);
  padding-top: var(--space-6);
}

@media (min-width: 1024px) {
  .event-grid {
    grid-template-columns: minmax(0, 6fr) minmax(0, 6fr);
  }
}

.event-block {
  margin-bottom: var(--space-6);
}

.event-block h2 {
  padding-bottom: var(--space-2);
  border-bottom: 2px solid var(--rule);
  font-size: var(--text-lg);
}

.tl {
  margin: 0;
  padding: 0;
  list-style: none;
}

.tl-item {
  position: relative;
  padding: 0 0 var(--space-5) var(--space-5);
  border-left: 2px solid var(--border);
}

.tl li + li {
  margin-top: 0;
}

.tl-item::before {
  content: "";
  position: absolute;
  top: 0.45rem;
  left: -7px;
  width: 12px;
  height: 12px;
  border: 2px solid var(--accent);
  border-radius: 50%;
  background: var(--bg);
}

.tl-first::before,
.tl-follow-up::before {
  background: var(--accent);
}

.tl-syndicated::before {
  border-style: dashed;
  border-color: var(--border-strong);
}

.tl-item:target {
  background: var(--accent-soft);
}

.tl-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-3);
  margin-bottom: var(--space-1);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
}

.role {
  padding: 0 var(--space-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-weight: 600;
}

.role-first,
.role-follow-up {
  border-color: var(--accent);
  color: var(--accent);
}

.role-syndicated {
  border-style: dashed;
  color: var(--text-muted);
}

.tl-title {
  margin-bottom: var(--space-1);
}

.tl-source {
  margin-bottom: var(--space-2);
  font-weight: 600;
  font-size: var(--text-sm);
}

.tl-source .muted {
  font-weight: 400;
}

.tl-summary {
  margin-bottom: var(--space-2);
}

.tl-link,
.tl-dupe {
  margin-bottom: var(--space-1);
  font-size: var(--text-sm);
}

.tl-dupe {
  color: var(--late);
}

.heat-table tr.not-counted td,
.heat-table tr.not-counted th {
  color: var(--text-muted);
}

.heat-table tfoot th,
.heat-table tfoot td {
  border-top: 2px solid var(--rule);
  border-bottom: 0;
  color: var(--text);
  font-weight: 700;
}

.log-table td {
  font-size: var(--text-sm);
}

/* ---- Index pages ------------------------------------------------------- */

.topic-stats {
  margin: var(--space-3) 0 0;
  color: var(--text-muted);
}

.edition-list {
  margin: 0;
  padding: 0;
  list-style: none;
  border-top: 2px solid var(--rule);
}

.edition-list li + li {
  margin-top: 0;
}

.edition-list a {
  display: grid;
  grid-template-columns: 4.5rem minmax(0, 1fr);
  gap: var(--space-1) var(--space-4);
  padding: var(--space-4) var(--space-2);
  border-bottom: 1px solid var(--border);
  color: var(--text);
  text-decoration: none;
}

.edition-list a:hover {
  background: var(--surface-raised);
}

.edition-list a:hover .ed-date {
  color: var(--accent);
  text-decoration: underline;
}

.ed-no {
  grid-row: span 3;
  color: var(--accent);
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 600;
}

.ed-date {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 600;
}

.ed-top {
  color: var(--text-muted);
}

.ed-count {
  color: var(--text-muted);
}

.edition-page {
  padding-top: var(--space-6);
}

.pager {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--space-3);
  margin-top: var(--space-6);
}

/* ---- Method ------------------------------------------------------------ */

.method {
  padding-top: var(--space-5);
}

.method-toc {
  margin-bottom: var(--space-6);
}

.method-block {
  max-width: 72ch;
  margin-bottom: var(--space-7);
}

.method-block h2 {
  padding-bottom: var(--space-2);
  border-bottom: 2px solid var(--rule);
}

.pipeline li,
.worked li {
  margin-top: var(--space-2);
}

.worked {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
}

.scope-cols {
  display: grid;
  gap: var(--space-5);
}

@media (min-width: 769px) {
  .scope-cols {
    grid-template-columns: 1fr 1fr;
  }
}

.scope-cols h3 {
  font-size: var(--text-base);
}

.mark-list {
  padding: 0;
  list-style: none;
}

.mark-list li {
  position: relative;
  padding-left: var(--space-5);
}

.mark-list li::before {
  position: absolute;
  left: 0;
  font-weight: 700;
}

.mark-yes li::before {
  content: "+";
  color: var(--rise);
}

.mark-no li::before {
  content: "\2013";
  color: var(--text-muted);
}

/* ---- Preferences ------------------------------------------------------- */

@media (forced-colors: active) {
  .meter-fill,
  .spark-dot {
    fill: Highlight;
  }

  .spark-line {
    stroke: Highlight;
  }

  .meter-track {
    fill: Canvas;
    stroke: CanvasText;
  }

  .tag-new {
    forced-color-adjust: none;
    background: Highlight;
    color: HighlightText;
  }
}

@media print {
  .desk-filter,
  .read-tools,
  .er-spark,
  .pager {
    display: none !important;
  }

  .front-aside {
    position: static;
  }
}
