/* Ponte News: the reader design (spec section 7).

   Calm and plain: soft off-white page, deep blue-grey text, one gentle teal accent, alerts in muted amber
   (never flashing red), a readable serif for headlines and a clean sans-serif for summaries, one column.
   Dark mode follows the reader's device setting.

   Colours are named once below ("tokens") and used everywhere else, so a colour changes in one place.
   tests/test_design.py reads these tokens and checks every text colour against its background for
   WCAG 2.1 AA contrast (4.5 to 1), in light and dark mode. Change a colour, run the tests.

   No web fonts: the font stacks use fonts already on the reader's device, so the page loads fast and no font
   service learns who reads Ponte News. */

:root {
  color-scheme: light;
  --bg: #f7f6f2;          /* page: soft off-white */
  --surface: #efede6;     /* settings box, folded stories */
  --text: #2b3a48;        /* deep blue-grey */
  --muted: #55626e;       /* times, sources, small notes */
  --accent: #1d6b66;      /* gentle teal: links, the logo, "New" */
  --line: #d9d6cc;        /* thin rules under headings */
  --alert-bg: #f8eed8;    /* muted amber */
  --alert-edge: #a8792a;
  --alert-text: #4a3510;  /* "Alert" label inside the amber box */
  --focus: #1d6b66;

  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #161c22;
    --surface: #1f272f;
    --text: #e3e8ec;
    --muted: #a9b4be;
    --accent: #72c7be;
    --line: #34404b;
    --alert-bg: #2e2717;
    --alert-edge: #c9a24f;
    --alert-text: #f0d9a8;
    --focus: #72c7be;
  }
}

/* --- Page --- */

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 1.125rem;  /* 18px: generous, easy to read on a phone (was 17px; Suman, 9 November 2026) */
  line-height: 1.65;
}

.page { max-width: 38rem; margin: 0 auto; padding: 1.5rem 1rem 2.5rem; }

a { color: var(--accent); text-underline-offset: 0.15em; }
a:hover { text-decoration-thickness: 2px; }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 2px; }

.skip-link { position: absolute; left: -999px; top: 0; background: var(--bg); padding: 0.5rem 1rem; }
.skip-link:focus { left: 0.5rem; top: 0.5rem; }

h1, h2, h3 { font-family: var(--serif); font-weight: normal; line-height: 1.3; }

h2 {
  font-size: 1.5rem;
  border-bottom: 1px solid var(--line);
  padding-bottom: 0.25rem;
  margin: 2.75rem 0 0.5rem;
}

h3 { font-size: 1.375rem; margin: 0 0 0.25rem; }  /* 22px headlines */

/* --- Header and logo --- */

.site-header { margin-bottom: 1.5rem; }

.brand { display: inline-flex; flex-direction: column; align-items: flex-start; color: var(--text); text-decoration: none; }
.brand:hover { text-decoration: none; }

.logo { width: 4.5rem; height: auto; color: var(--accent); margin-bottom: -0.35rem; }

.brand-name { font-family: var(--serif); font-size: 2.1rem; line-height: 1.15; margin: 0; }

.tagline { color: var(--muted); margin: 0.15rem 0 0; font-style: italic; font-family: var(--serif); }

/* --- Settings --- */

.settings { background: var(--surface); border-radius: 0.6rem; padding: 0.25rem 1rem; }
.settings > summary { cursor: pointer; padding: 0.6rem 0; min-height: 2.75rem; }
.settings label { display: block; margin: 0.75rem 0; }
.settings fieldset { border: 1px solid var(--line); border-radius: 0.4rem; margin: 0.75rem 0; }
.interests label { display: inline-block; margin: 0.25rem 1rem 0.25rem 0; }

select, input[type="number"], button {
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--muted);
  border-radius: 0.4rem;
  padding: 0.4rem 0.6rem;
  min-height: 2.75rem;  /* easy to tap */
  max-width: 100%;
}
select { display: block; width: 100%; margin-top: 0.25rem; }
input[type="number"] { width: 5rem; margin-left: 0.5rem; }
input[type="checkbox"] { width: 1.15rem; height: 1.15rem; accent-color: var(--accent); vertical-align: -0.15em; }

button {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
  padding: 0.5rem 1.25rem;
  cursor: pointer;
}

/* --- Stories --- */

.story { margin: 1.75rem 0; }
.story p { margin: 0.4rem 0; }

.meta, .sources, .updates { font-size: 0.9375rem; color: var(--muted); }  /* 15px */
.sources, .updates { margin: 0.4rem 0 0; padding-left: 1.1rem; }
.sources li { margin: 0.15rem 0; }

.alert {
  background: var(--alert-bg);
  border-left: 4px solid var(--alert-edge);
  border-radius: 0 0.5rem 0.5rem 0;
  padding: 0.85rem 1rem;
}
.alert-label { display: block; font-size: 0.875rem; font-weight: 600; letter-spacing: 0.03em; color: var(--alert-text); }
.alert .meta, .alert .sources, .alert .updates { color: var(--text); }
.what-to-do { margin-top: 0.6rem; }

.new-label {
  display: none;
  font-family: var(--sans);
  font-size: 0.875rem;
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 1rem;
  padding: 0 0.5rem;
  margin-left: 0.4rem;
  vertical-align: 0.2em;
}
.is-new .new-label { display: inline-block; }

details.folded { background: var(--surface); border-radius: 0.5rem; padding: 0 1rem; }
details.folded > summary { cursor: pointer; color: var(--muted); padding: 0.6rem 0; min-height: 2.75rem; }
details.folded[open] { padding-bottom: 0.25rem; }
details.folded .story { margin-top: 0.5rem; }

.empty { color: var(--muted); }

/* --- The end of the page --- */

.end { text-align: center; margin-top: 3.5rem; }
.end h2 { border-bottom: none; }
.end-mark { display: block; width: 3rem; margin: 0 auto 0.5rem; color: var(--accent); }
.support { color: var(--muted); font-size: 0.95rem; max-width: 30rem; margin: 1.5rem auto 0; }

/* --- About page --- */

.prose h1 { font-size: 1.9rem; margin: 0 0 0.5rem; }
.prose h2 { font-size: 1.35rem; }
.prose li { margin: 0.35rem 0; }

/* --- Footer --- */

.site-footer {
  border-top: 1px solid var(--line);
  margin-top: 3rem;
  padding-top: 1rem;
  font-size: 0.9375rem;
  color: var(--muted);
}
.site-footer ul { list-style: none; padding: 0; margin: 0 0 0.5rem; display: flex; flex-wrap: wrap; gap: 0.25rem 1.25rem; }
.site-footer a { display: inline-block; padding: 0.35rem 0; }
.site-footer p { margin: 0; }

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; }
}

/* --- Section menu: one row of tabs that stays at the top while reading --- */

.section-menu {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  margin: 1rem -1rem 0;
  padding: 0 1rem;
}
.section-menu ul { list-style: none; margin: 0; padding: 0; display: flex; }
.section-menu li { flex: 1; }
.section-menu a {
  display: block;
  text-align: center;
  white-space: nowrap;
  padding: 0.8rem 0.25rem 0.65rem;  /* a comfortable tap target on a phone */
  border-bottom: 3px solid transparent;
  text-decoration: none;
  color: var(--muted);
  font-size: 1rem;
}
.section-menu a:hover { color: var(--text); }
.section-menu a.current { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
/* Headings land below the menu, not hidden under it. */
section h2[id] { scroll-margin-top: 4.5rem; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

/* --- Category on each story --- */

.topic-label {
  display: inline-block;
  font-size: 0.875rem;  /* 14px: small labels stay readable */
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--accent);
  margin-right: 0.35rem;
}

/* --- Support card at the very bottom (design; buttons link once DONATION_URL is set) --- */

.support-card {
  background: var(--surface);
  border-radius: 0.8rem;
  padding: 1.25rem 1.25rem 0.75rem;
  margin-top: 2.5rem;
  text-align: center;
}
.support-card h2 { border-bottom: none; margin-top: 0; }
.support-buttons { display: flex; gap: 0.75rem; justify-content: center; flex-wrap: wrap; margin: 1.25rem 0 0.5rem; }
.support-card .button {
  display: inline-block;
  min-width: 8.5rem;
  padding: 0.65rem 1.25rem;
  border-radius: 999px;
  background: var(--accent);
  color: var(--bg);
  border: 2px solid var(--accent);
  text-decoration: none;
  font-weight: 600;
}
.support-card .button-quiet { background: transparent; color: var(--accent); }
.support-card .button.is-disabled { opacity: 0.55; cursor: default; }

/* --- Earlier days --- */

.day-banner { margin-top: 1.25rem; padding: 0.75rem 1rem; background: var(--surface); border-radius: 0.6rem; }
.day-banner .day-label { margin: 0; color: var(--muted); font-size: 0.875rem; text-transform: uppercase; letter-spacing: 0.04em; }
.day-banner .day-heading { margin: 0.15rem 0 0.25rem; border-bottom: none; }
.day-banner p { margin: 0; }
.day-nav { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-top: 1.5rem; }
.day-nav a { display: inline-block; padding: 0.5rem 0; }

.field-hint { margin: -0.4rem 0 0.9rem; }
