/* phages.ai: one stylesheet for the public digest and the editor pages. Follows the visitor's light or dark setting. */

@font-face {
  font-family: "Schibsted Grotesk";
  src: url("fonts/schibsted-grotesk-latin-wght-normal.woff2") format("woff2");
  font-weight: 400 900;
  font-display: swap;
}
@font-face {
  font-family: "Atkinson Hyperlegible Next";
  src: url("fonts/atkinson-hyperlegible-next-latin-wght-normal.woff2") format("woff2");
  font-weight: 200 800;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("fonts/ibm-plex-mono-latin-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}

:root {
  color-scheme: light;
  --bg: #f7f7f4;
  --surface: #ffffff;
  --text: #1d2320;
  --muted: #5d6661;
  --line: #e2e4de;
  --line-strong: #c8ccc4;
  --teal: #0f6e56;
  --teal-strong: #0a5543;
  --teal-wash: #e3f0ea;
  --on-teal: #ffffff;
  --danger: #a3392a;
  --danger-wash: #f7e5e1;
  --display: "Schibsted Grotesk", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --body: "Atkinson Hyperlegible Next", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #121614;
    --surface: #18201c;
    --text: #e7ece9;
    --muted: #9aa5a0;
    --line: #253029;
    --line-strong: #36423b;
    --teal: #5dcaa5;
    --teal-strong: #86dcbd;
    --teal-wash: #173229;
    --on-teal: #0b211a;
    --danger: #ef8b7b;
    --danger-wash: #3a1f1a;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font: 400 1.0625rem/1.6 var(--body);
  overflow-wrap: break-word;
}
main { flex: 1; }
a { color: var(--teal); text-underline-offset: .18em; }
a:hover { color: var(--teal-strong); }
:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }
p { margin: 0 0 1rem; }
h1, h2, h3 { font-family: var(--display); color: var(--text); letter-spacing: -.015em; }
h1 { font-size: clamp(1.9rem, 1.3rem + 2.2vw, 2.75rem); line-height: 1.1; font-weight: 700; margin: 0 0 .75rem; }
h2 { font-size: 1.35rem; line-height: 1.25; font-weight: 650; margin: 0 0 .3rem; }
h3 { font-size: 1.08rem; line-height: 1.3; font-weight: 650; margin: 0; }

.wrap { width: min(72rem, 100% - 2rem); margin-inline: auto; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* Header and footer */
.site-header { border-bottom: 1px solid var(--line); }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding-block: .9rem; }
.brand { display: inline-flex; align-items: center; gap: .55rem; color: var(--text); text-decoration: none; font: 700 1.25rem/1 var(--display); letter-spacing: -.02em; }
.brand:hover { color: var(--text); }
.brand .mark { height: 2.2rem; width: auto; flex: none; color: var(--teal); }
.dot-ai { color: var(--teal); }
.site-nav { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .25rem 1.25rem; font-size: .95rem; }
.site-nav a { color: var(--text); text-decoration: none; }
.site-nav a:hover { color: var(--teal); text-decoration: underline; }
main.wrap { padding-block: 2.5rem 4rem; }
.site-footer { border-top: 1px solid var(--line); color: var(--muted); font-size: .88rem; }
.site-footer .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .4rem 1.5rem; padding-block: 1.4rem; }

/* Shared pieces */
.eyebrow { margin: 0 0 .6rem; font: 400 .78rem/1.4 var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.lede { max-width: 44rem; font-size: 1.15rem; color: var(--muted); }
.section { margin-top: 3rem; }
.section-note { color: var(--muted); margin-bottom: 1.25rem; }
.meta { display: flex; flex-wrap: wrap; align-items: center; gap: .2rem .9rem; margin: 0; font: 400 .78rem/1.5 var(--mono); color: var(--muted); }
.tags { display: flex; flex-wrap: wrap; gap: .4rem; margin: 0; }
.tag { display: inline-block; padding: .3rem .6rem; border-radius: 999px; background: var(--teal-wash); color: var(--teal-strong); font: 400 .74rem/1.2 var(--mono); text-decoration: none; }
a.tag:hover { background: var(--teal); color: var(--on-teal); }
.tag .count { margin-left: .2rem; opacity: .75; }
.badge { display: inline-block; padding: .2rem .45rem; border-radius: 4px; background: var(--line); color: var(--text); font: 400 .72rem/1.2 var(--mono); }
.badge.ai { background: var(--teal-wash); color: var(--teal-strong); }
.badge.live { background: var(--teal); color: var(--on-teal); }
.notice { max-width: 48rem; padding: .75rem 1rem; border-radius: 6px; background: var(--teal-wash); color: var(--text); }
.notice.error { background: var(--danger-wash); }
.status-line { color: var(--muted); }
.plain { white-space: pre-wrap; }
.narrow { max-width: 30rem; }

/* Digest cards: the teal edge marks the AI × phage section */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 21rem), 1fr)); gap: 1rem; }
.card { display: flex; flex-direction: column; gap: .5rem; padding: 1.1rem 1.25rem 1.2rem; background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--line-strong); border-radius: 6px; }
.card.ai { border-left-color: var(--teal); }
.card h3 a { color: var(--text); text-decoration: none; }
.card h3 a:hover { color: var(--teal); text-decoration: underline; }
.card .summary { flex-grow: 1; margin: 0; }
.archive { display: flex; flex-wrap: wrap; gap: .5rem 1.5rem; margin: 0; padding: 0; list-style: none; }

/* Buttons and forms */
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 2.5rem; padding: .5rem 1.05rem; border: 1px solid var(--teal); border-radius: 6px; background: var(--teal); color: var(--on-teal); font: 600 .95rem/1.2 var(--body); text-decoration: none; cursor: pointer; }
.btn:hover { border-color: var(--teal-strong); background: var(--teal-strong); color: var(--on-teal); }
.btn.secondary { background: transparent; color: var(--teal); }
.btn.secondary:hover { background: var(--teal-wash); color: var(--teal-strong); }
.btn.quiet { border-color: var(--line-strong); background: transparent; color: var(--text); }
.btn.quiet:hover { border-color: var(--danger); background: var(--danger-wash); color: var(--text); }
.actions { display: flex; flex-wrap: wrap; gap: .6rem; margin: 1rem 0 0; }
.field { margin-bottom: 1rem; }
label { display: block; margin: 0 0 .35rem; font-size: .92rem; font-weight: 600; }
input, select, textarea { width: 100%; padding: .55rem .7rem; border: 1px solid var(--line-strong); border-radius: 6px; background: var(--surface); color: var(--text); font: inherit; }
textarea { resize: vertical; line-height: 1.5; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--teal); outline-offset: 0; border-color: var(--teal); }

/* Search */
.search-form { display: flex; gap: .6rem; max-width: 40rem; margin: 1.25rem 0 1.5rem; }
.search-form input { flex: 1; min-width: 0; }
.results { max-width: 48rem; margin: 0; padding: 0; list-style: none; }
.results li { padding: 1.1rem 0; border-top: 1px solid var(--line); }
.results h3 { margin: .3rem 0 .35rem; }
.results .snippet { margin: 0; color: var(--muted); }

/* Article page */
.reading { max-width: 46rem; }
.byline { color: var(--muted); }
.reading .lede { font-size: 1.2rem; line-height: 1.55; color: var(--text); }
.private { margin-top: 3rem; padding: 1.25rem 1.4rem; border: 1px dashed var(--line-strong); border-radius: 6px; }
.private h3 { margin: 1.25rem 0 .4rem; }

/* Review page */
.status-list { margin: 1.25rem 0 0; padding: 0; list-style: none; color: var(--muted); }
.week-heading { margin: 2.5rem 0 1rem; }
.queue { display: grid; gap: 1rem; max-width: 52rem; }
.queue-item { padding: 1.1rem 1.25rem 1.25rem; background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--line-strong); border-radius: 6px; }
.queue-item.ai { border-left-color: var(--teal); }
.queue-item h3 { margin: .45rem 0 .5rem; }
.queue-item .tags { margin-bottom: .75rem; }
.queue-item details { margin: 0 0 1rem; }
.queue-item summary { cursor: pointer; color: var(--teal); font-size: .92rem; }
.queue-item details p { margin: .6rem 0 0; color: var(--muted); font-size: .95rem; }
.add-item { max-width: 40rem; }

/* Pre-launch page, same layout as the old placeholder */
.launch { min-height: 72vh; max-width: 34rem; margin-inline: auto; display: flex; flex-direction: column; justify-content: center; }
.launch-brand { display: flex; align-items: center; gap: 16px; margin: 0 0 .9rem; }
.launch-brand .mark { height: clamp(56px, 13vw, 76px); width: auto; flex: none; color: var(--teal); }
.launch h1 { margin: 0; font-size: clamp(2.2rem, 7vw, 3.4rem); letter-spacing: -.02em; }
.launch p { margin: 0 0 .5rem; font-size: 1.125rem; color: var(--muted); }
.launch .launch-lead { color: var(--text); }
