/* The Daily Edition.
   Quiet page, one loud idea: the 30-day strip under each story.
   Amber, not red, marks urgent wording: red would itself be an alarm. */

:root {
  --paper: #f4f7f6;
  --surface: #ffffff;
  --ink: #15212b;
  --ink-soft: #55646e;
  --rule: #d3dbda;
  --link: #0d5964;
  --bar: #9db0b6;
  --urgent: #cf861a;
  --bar-hover: #6f8890;
  --today: rgba(13, 89, 100, 0.07);
  --focus: #0d5964;
  --head: "Frank Ruhl Libre", "David Libre", "Times New Roman", serif;
  --body: "Assistant", "Segoe UI", "Arial Hebrew", Arial, sans-serif;
  --measure: 41rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #121a20;
    --surface: #1a242c;
    --ink: #e6ecee;
    --ink-soft: #9aa9b1;
    --rule: #2c3a43;
    --link: #7fc4cf;
    --bar: #5f747d;
    --urgent: #e0a13c;
    --bar-hover: #8aa0a8;
    --today: rgba(127, 196, 207, 0.09);
    --focus: #7fc4cf;
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  font-size: 1.0625rem;
  line-height: 1.55;
}

a { color: var(--link); text-underline-offset: 0.18em; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

main, .mast, .foot {
  max-width: var(--measure);
  margin-inline: auto;
  padding-inline: 1.15rem;
}

/* ---------- masthead ---------- */

.mast {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 1.25rem;
  padding-block: 1.1rem 0.9rem;
  border-bottom: 2px solid var(--ink);
}
.mast-name {
  font-family: var(--head);
  font-weight: 700;
  font-size: 1.35rem;
  color: var(--ink);
  text-decoration: none;
}
.mast-nav { display: flex; flex-wrap: wrap; gap: 0.2rem 1.1rem; flex: 1; }
.mast-nav a { color: var(--ink-soft); text-decoration: none; padding-block: 0.25rem; }
.mast-nav a:hover { color: var(--ink); }
.mast-nav a[aria-current="page"] { color: var(--ink); font-weight: 600; box-shadow: 0 2px 0 var(--ink); }
.mast-lang { margin-inline-start: auto; font-size: 0.95rem; }

.preview {
  margin: 0;
  padding: 0.45rem 1.15rem;
  background: var(--ink);
  color: var(--paper);
  font-size: 0.95rem;
  text-align: center;
}
.preview a { color: inherit; }

/* ---------- page head ---------- */

.page-head { padding-block: 1.6rem 0.4rem; }
.page-head h1, .narrow h1, .full h1 {
  font-family: var(--head);
  font-weight: 700;
  font-size: clamp(1.7rem, 5.2vw, 2.3rem);
  line-height: 1.15;
  margin: 0 0 0.45rem;
  text-wrap: balance;
}
.page-head p { margin: 0 0 0.4rem; color: var(--ink-soft); }

/* ---------- story list ---------- */

.stories { margin-top: 0.6rem; }
.story {
  display: grid;
  grid-template-columns: 2.1rem minmax(0, 1fr);
  padding-block: 1.25rem;
  border-top: 1px solid var(--rule);
}
.story:first-child { border-top: 0; }
.story-n {
  font-family: var(--head);
  font-size: 1.05rem;
  color: var(--ink-soft);
  padding-top: 0.12rem;
  font-variant-numeric: tabular-nums;
}
.story-body { grid-column: 2; min-width: 0; }
.story:not(:has(.story-n)) { grid-template-columns: minmax(0, 1fr); }
.story:not(:has(.story-n)) .story-body { grid-column: 1; }

.story h2, .story h3 {
  font-family: var(--head);
  font-weight: 500;
  font-size: 1.32rem;
  line-height: 1.25;
  margin: 0 0 0.35rem;
  text-wrap: pretty;
}
.story h3 { font-size: 1.15rem; }
.story-lead h2 { font-weight: 700; font-size: clamp(1.55rem, 4.6vw, 1.95rem); line-height: 1.17; }
.story h2 a, .story h3 a { color: var(--ink); text-decoration: none; }
.story h2 a:hover, .story h3 a:hover { text-decoration: underline; text-decoration-thickness: 1px; }

/* ---------- photos ---------- */
/* The outlet's photo, with the outlet's logo on it as credit. Same for every study group. */

.pic { position: relative; margin: 0; overflow: hidden; border-radius: 0.5rem; background: var(--rule); }
.pic > img, .pic > a > img { display: block; width: 100%; height: 100%; object-fit: cover; }
.pic a { display: block; height: 100%; }

.pic-thumb {
  float: inline-end; width: 7.25rem; aspect-ratio: 4 / 3;
  margin-inline-start: 0.9rem; margin-bottom: 0.4rem;
}
.pic-lead { aspect-ratio: 16 / 9; margin-bottom: 0.85rem; }
.pic-hero { aspect-ratio: 16 / 9; margin: 0.4rem 0 1rem; }
.story-body::after { content: ""; display: block; clear: both; }

.pic-credit {
  position: absolute; inset-block-end: 0.4rem; inset-inline-start: 0.4rem;
  display: inline-flex; align-items: center; gap: 0.35rem; max-width: calc(100% - 0.8rem);
  padding: 0.2rem 0.5rem 0.2rem 0.25rem; border-radius: 1rem;
  background: rgba(255, 255, 255, 0.92); color: #15212b;
  font-size: 0.78rem; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  box-shadow: 0 1px 2px rgba(21, 33, 43, 0.18);
}
[dir="rtl"] .pic-credit { padding: 0.2rem 0.25rem 0.2rem 0.5rem; }
.pic-credit img { width: 1rem; height: 1rem; border-radius: 0.2rem; object-fit: contain; flex: none; }
.pic-initial {
  width: 1rem; height: 1rem; border-radius: 0.2rem; flex: none;
  display: inline-grid; place-items: center; font-weight: 600; font-size: 0.7rem;
  background: #15212b; color: #fff;
}
/* On a thumbnail the logo alone credits the photo; the outlet's name is in the line below. */
.pic-thumb .pic-credit { inset-block-end: 0.3rem; inset-inline-start: 0.3rem; padding: 0.18rem; }
.pic-thumb .pic-credit bdi { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }

@media (min-width: 40rem) {
  .pic-thumb { width: 9.5rem; }
}

.dek { margin: 0 0 0.45rem; color: var(--ink); max-width: 38rem; }
.story .dek { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.meta { margin: 0; font-size: 0.93rem; color: var(--ink-soft); }

/* ---------- the 30-day strip ---------- */

.strip { clear: both; margin: 0.9rem 0 0; display: grid; gap: 0.25rem; max-width: 34rem; }
.strip-chart { position: relative; padding-top: 1.15rem; }
.strip svg { display: block; width: 100%; height: 3.4rem; overflow: visible; }
.strip-big svg { height: 6rem; }
.strip-big { max-width: none; }

.strip-base { stroke: var(--ink-soft); stroke-width: 1; vector-effect: non-scaling-stroke; opacity: 0.55; }
.strip-week { stroke: var(--rule); stroke-width: 1; stroke-dasharray: 2 3; vector-effect: non-scaling-stroke; }
.strip-today { fill: var(--today); }
.strip-hatch line { stroke: var(--bar); stroke-width: 1; vector-effect: non-scaling-stroke; opacity: 0.45; }
.strip-all { fill: var(--bar); }
.strip-urgent { fill: var(--urgent); }
.strip-none { fill: var(--bar); opacity: 0.55; }
.strip-hit { fill: transparent; }
.strip-bars g:hover .strip-all { fill: var(--bar-hover); }

.strip-peak {
  position: absolute; top: 0; transform: translateX(-50%);
  font-size: 0.78rem; line-height: 1; font-variant-numeric: tabular-nums;
  color: var(--ink-soft); padding: 0.1rem 0.3rem; border-radius: 0.6rem; background: var(--surface);
  box-shadow: 0 0 0 1px var(--rule);
}
.strip-axis {
  display: flex; justify-content: space-between;
  font-size: 0.78rem; color: var(--ink-soft); font-variant-numeric: tabular-nums;
}
.strip figcaption { font-size: 0.93rem; color: var(--ink-soft); margin-top: 0.15rem; }

/* One moment of motion: bars rise once when the page opens. */
@media (prefers-reduced-motion: no-preference) {
  .strip-bars path, .strip-bars rect.strip-urgent {
    transform-box: fill-box; transform-origin: bottom;
    animation: strip-rise 520ms cubic-bezier(.2, .7, .2, 1) both;
  }
}
@keyframes strip-rise { from { transform: scaleY(0); } to { transform: scaleY(1); } }

.legend { font-size: 0.9rem; color: var(--ink-soft); margin: 0.5rem 0 0; display: flex; flex-wrap: wrap; align-items: center; gap: 0.3rem 0.45rem; }
.key { display: inline-block; width: 0.7rem; height: 0.7rem; }
.key-all { background: var(--bar); }
.legend { column-gap: 1rem; }
.legend-item { display: inline-flex; align-items: center; gap: 0.4rem; white-space: nowrap; }
.key-urgent { background: var(--urgent); }
.key-none { background: var(--bar); opacity: 0.55; height: 0.2rem; width: 0.45rem; }

/* ---------- story page ---------- */

.back { margin: 1.2rem 0 0; font-size: 0.95rem; }
.full { padding-top: 0.9rem; }
.full > .dek { font-size: 1.12rem; }
.full section { margin-top: 2.1rem; }
.full section > h2 {
  font-family: var(--body);
  font-weight: 600;
  font-size: 1.02rem;
  margin: 0 0 0.3rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--ink);
}
.coverage, .timeline { list-style: none; margin: 0; padding: 0; }
.coverage li { padding-block: 0.7rem; border-bottom: 1px solid var(--rule); display: grid; gap: 0.15rem; }
.coverage a { font-family: var(--head); font-size: 1.12rem; line-height: 1.3; }
.src { font-size: 0.9rem; color: var(--ink-soft); display: flex; flex-wrap: wrap; gap: 0 0.75rem; }
.timeline li {
  display: grid;
  grid-template-columns: 6.2rem minmax(0, 1fr);
  column-gap: 0.9rem;
  padding-block: 0.6rem;
  border-bottom: 1px solid var(--rule);
}
.timeline time { color: var(--ink-soft); font-size: 0.93rem; padding-top: 0.12rem; }
.tl-head { font-family: var(--head); font-size: 1.07rem; line-height: 1.3; }
.timeline .src { grid-column: 2; }
.stories-compact .story { padding-block: 0.95rem; }

/* ---------- end of edition ---------- */

.end { margin-top: 1rem; padding-block: 1.8rem 1rem; border-top: 2px solid var(--ink); }
.end p { margin: 0 0 0.9rem; font-family: var(--head); font-size: 1.2rem; }
.empty { padding-block: 2rem; color: var(--ink-soft); }

/* ---------- forms ---------- */

.narrow { max-width: 30rem; padding-block: 2.2rem 1rem; }
.prose p { margin: 0 0 0.85rem; }
.note { color: var(--ink-soft); margin: 0 0 1rem; }
.error { color: #a3271c; font-weight: 600; }
@media (prefers-color-scheme: dark) { .error { color: #f0907f; } }

.form { display: grid; gap: 0.55rem; margin-top: 1.2rem; }
.form label { font-weight: 600; }
.form label.choice, .choice { font-weight: 400; display: flex; align-items: baseline; gap: 0.5rem; padding-block: 0.3rem; }
input[type="text"], input[type="password"], input[type="number"], input:not([type]), select {
  font: inherit;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--ink-soft);
  border-radius: 4px;
  padding: 0.6rem 0.7rem;
  width: 100%;
}
#code { font-size: 1.4rem; letter-spacing: 0.18em; text-transform: uppercase; }
fieldset { border: 0; padding: 0; margin: 0.6rem 0 0; }
legend { font-weight: 600; padding: 0; margin-bottom: 0.25rem; }
input[type="radio"], input[type="checkbox"] { width: 1.15rem; height: 1.15rem; accent-color: var(--link); flex: none; translate: 0 0.15rem; }

.button {
  font: inherit;
  font-weight: 600;
  display: inline-block;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  color: var(--paper);
  background: var(--ink);
  border: 1px solid var(--ink);
  border-radius: 4px;
  padding: 0.7rem 1.2rem;
  min-height: 2.9rem;
  margin-top: 0.7rem;
}
.button:hover { background: var(--link); border-color: var(--link); }
.button-quiet { color: var(--ink); background: transparent; border-color: var(--ink-soft); font-weight: 400; }
.button-quiet:hover { color: var(--paper); }
.link-button { font: inherit; color: var(--link); background: none; border: 0; padding: 0; text-decoration: underline; cursor: pointer; }

/* mood: five large taps */
.mood { display: grid; gap: 0.55rem; margin-top: 1.3rem; }
.mood button {
  font: inherit;
  font-size: 1.1rem;
  text-align: start;
  display: flex;
  align-items: center;
  gap: 0.9rem;
  cursor: pointer;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 6px;
  padding: 0.85rem 1rem;
  min-height: 3.4rem;
}
.mood button:hover { border-color: var(--ink); }
.mood-n { font-family: var(--head); font-size: 1.25rem; color: var(--ink-soft); width: 1.2rem; text-align: center; }

/* questionnaires */
.survey-intro { font-weight: 600; margin: 0 0 0.6rem; }
.survey fieldset { margin: 0; padding-block: 1.05rem; border-top: 1px solid var(--rule); }
/* floated so the question sits inside the fieldset instead of on its top border */
.survey legend { float: inline-start; width: 100%; font-family: var(--head); font-weight: 500; font-size: 1.15rem; line-height: 1.3; margin-bottom: 0.5rem; }
.survey .options { clear: both; }
.survey .choice { padding: 0.5rem 0.6rem; border-radius: 4px; }
.survey .choice:has(input:checked) { background: var(--surface); box-shadow: inset 0 0 0 1px var(--ink-soft); }
.survey + form { margin-top: 0.2rem; }

/* ---------- footer ---------- */

.foot { padding-block: 2.2rem 2.5rem; font-size: 0.9rem; color: var(--ink-soft); }
.foot p { margin: 0 0 0.35rem; }

/* ---------- admin ---------- */

.admin main { max-width: 68rem; }
.admin .page-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.admin section { margin-top: 2rem; }
.admin h2 { font-family: var(--head); font-size: 1.35rem; margin: 0 0 0.5rem; padding-bottom: 0.3rem; border-bottom: 1px solid var(--ink); }
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 0.95rem; }
th, td { text-align: start; padding: 0.4rem 0.7rem 0.4rem 0; border-bottom: 1px solid var(--rule); white-space: nowrap; }
th { font-weight: 600; color: var(--ink-soft); }
tr.gone td { color: var(--ink-soft); text-decoration: line-through; }
.codes { background: var(--surface); border: 1px solid var(--rule); padding: 0.8rem 1rem; font-size: 1.05rem; letter-spacing: 0.08em; max-height: 18rem; overflow: auto; }
.form-inline { grid-template-columns: auto minmax(8rem, 14rem) auto 6rem auto; align-items: center; column-gap: 0.7rem; }
.form-inline .button { margin-top: 0; }
details { margin-top: 0.9rem; }
summary { cursor: pointer; color: var(--link); }
details .form { max-width: 30rem; }

@media (max-width: 34rem) {
  .story { grid-template-columns: 1.7rem minmax(0, 1fr); }
  .timeline li { grid-template-columns: 1fr; }
  .timeline .src { grid-column: 1; }
  .form-inline { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: no-preference) {
  .button, .mood button { transition: background-color 0.12s, border-color 0.12s; }
}
