/*
 * The Astute Ink design system (step 2).
 * Colours, fonts, light/dark mode and the shared building blocks from the approved mockups.
 * Loaded only on this theme's own templates, so Newspaper's pages are not affected.
 */

/* ---------- Fonts (stored in the theme, SIL Open Font License) ---------- */
/* Note: the mockups used the 500 file for regular serif text; kept here so the site matches what the client approved. */
@font-face { font-family: "Source Serif 4"; src: url("../fonts/source-serif-4-500.woff2") format("woff2"); font-weight: 400 500; font-style: normal; font-display: swap; }
@font-face { font-family: "Source Serif 4"; src: url("../fonts/source-serif-4-600.woff2") format("woff2"); font-weight: 600; font-style: normal; font-display: swap; }
@font-face { font-family: "Source Serif 4"; src: url("../fonts/source-serif-4-700.woff2") format("woff2"); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: "Source Serif 4"; src: url("../fonts/source-serif-4-400-italic.woff2") format("woff2"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "Open Sans"; src: url("../fonts/open-sans-400.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Open Sans"; src: url("../fonts/open-sans-600.woff2") format("woff2"); font-weight: 600; font-style: normal; font-display: swap; }
@font-face { font-family: "Open Sans"; src: url("../fonts/open-sans-700.woff2") format("woff2"); font-weight: 700; font-style: normal; font-display: swap; }

/* ---------- Colour and type tokens ---------- */
:root {
  --ink: #103080;        /* brand navy, from the wordmark */
  --ink-deep: #0b2260;
  --sky: #4db2ec;        /* second accent, from the printed newspaper */
  --paper: #ffffff;
  --paper-2: #f2f5fa;
  --text: #0e1428;
  --muted: #566079;
  --rule: #dce2ed;
  --link: #103080;
  --ad-bg: #eef2f8;
  --ad-line: #b9c4d8;
  --on-ink: #ffffff;
  --on-ink-muted: #c4d0ea;
  --tag-fg: #0b2260;
  --display: "Source Serif 4", Georgia, "Times New Roman", serif;
  --body: "Open Sans", "Segoe UI", Arial, sans-serif;
  --wrap: 1200px;
}
/* Dark mode: follows the device unless the reader chose light or dark with the toggle. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0a0f1f; --paper-2: #111a33; --text: #e9eef8; --muted: #9ba7c1; --rule: #25314f;
    --link: #9cc9f2; --ad-bg: #111a33; --ad-line: #33426a; --ink: #13348a; --ink-deep: #0b1d4d;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #0a0f1f; --paper-2: #111a33; --text: #e9eef8; --muted: #9ba7c1; --rule: #25314f;
  --link: #9cc9f2; --ad-bg: #111a33; --ad-line: #33426a; --ink: #13348a; --ink-deep: #0b1d4d;
  color-scheme: dark;
}

/* ---------- Base (scoped to our templates' body class) ---------- */
body.ai-site { margin: 0; background: var(--paper); color: var(--text); font-family: var(--body); font-size: 16px; line-height: 1.55; }
.ai-site *, .ai-site *::before, .ai-site *::after { box-sizing: border-box; }
.ai-site [hidden] { display: none !important; }
.ai-site a { color: inherit; text-decoration: none; }
/* Headings and paragraphs take their colour from the page, so they follow light and dark mode
   even if another stylesheet (for example tagDiv's) gives them a fixed colour. */
.ai-site :is(h1, h2, h3, h4, h5, h6, p, li, blockquote, figcaption) { color: inherit; }
.ai-site :is(h1, h2, h3, h4, h5, h6) { margin: 0; }
.ai-site img { display: block; max-width: 100%; height: auto; }
.ai-site :focus-visible { outline: 3px solid var(--sky); outline-offset: 2px; }
.ai-site .sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ---------- Building blocks ---------- */
.ai-site .wrap { max-width: var(--wrap); margin-inline: auto; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.ai-site .hl { font-family: var(--display); font-weight: 600; text-wrap: balance; letter-spacing: -0.005em; transition: color .2s ease; }
/* House rule (user decisions, 6 November 2026): long reading text is justified (stories, About,
   Privacy Policy, Disclaimer, writer biographies). Narrow text is left-aligned, because justifying
   5 or 6 words per line leaves uneven gaps: card summaries, search results, footer text, headlines. */
.ai-site span.hl { display: block; }
.ai-site a:hover .hl, .ai-site a:focus-visible .hl { color: var(--link); }
.ai-site .meta { display: flex; flex-wrap: wrap; column-gap: 14px; row-gap: 2px; font-size: 13px; color: var(--muted); }
.ai-site .meta b { color: var(--text); font-weight: 600; }
.ai-site .hl + .meta { margin-top: 8px; }
.ai-site .tag { display: inline-block; justify-self: start; align-self: start; background: var(--ink); color: #ffffff; padding: 4px 8px 3px; border-radius: 2px; line-height: 1.3; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.ai-site .thumb { aspect-ratio: 3 / 2; width: 100%; object-fit: cover; object-position: 50% 30%; background: var(--paper-2); }
.ai-site .btn { display: inline-block; font-family: var(--body); font-weight: 700; font-size: 13px; padding: 7px 14px; border-radius: 3px; border: 0; cursor: pointer; background: var(--ink); color: #ffffff; }
.ai-site .btn-sky { background: var(--sky); color: var(--tag-fg); }
.ai-site .btn-sky:hover { background: #7cc6f1; }
.ai-site .section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; border-top: 3px solid var(--text); padding-top: 10px; margin-bottom: 20px; }
.ai-site .section-head h2 { font-family: var(--display); font-size: 26px; margin: 0; font-weight: 700; }
.ai-site .section-head a { font-size: 13px; font-weight: 700; color: var(--link); }
/* Ad spaces keep their size, so the page does not jump when an ad loads. */
.ai-site .ad { display: grid; place-items: center; text-align: center; background: var(--ad-bg); border: 1px dashed var(--ad-line); color: var(--muted); font-size: 12px; margin-inline: auto; }
.ai-site .ad-leader { width: 100%; max-width: 728px; aspect-ratio: 728 / 90; }
.ai-site .ad-box { width: 100%; max-width: 300px; aspect-ratio: 300 / 250; }

/* ---------- Light/dark toggle button ---------- */
.ai-site .theme-toggle { width: 38px; height: 38px; display: grid; place-items: center; border: 0; border-radius: 50%; background: var(--paper-2); color: var(--text); cursor: pointer; }
.ai-site .theme-toggle .sun { display: none; }
.ai-site.is-dark .theme-toggle .sun { display: block; }
.ai-site.is-dark .theme-toggle .moon { display: none; }

/* House ads ("Book this space"): fixed standard sizes, brand blend instead of empty placeholders. */
.ai-site .ad.house { position: relative; border: 0; overflow: hidden; color: #ffffff; text-align: left; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 22px;
  background: radial-gradient(60% 120% at 100% 0%, rgba(77,178,236,.45), rgba(77,178,236,0) 70%), linear-gradient(150deg, #1d43a8, #103080 50%, #0a1d55); border-radius: 6px; }
.ai-site .ad.house .ad-tag { position: absolute; top: 6px; right: 10px; font-size: 10.5px; color: #a9badf; }
.ai-site .ad.house .ad-copy { display: grid; gap: 2px; min-width: 0; }
.ai-site .ad.house strong { font-family: var(--display); font-weight: 600; font-size: clamp(16px, 2vw, 22px); line-height: 1.2; }
.ai-site .ad.house .ad-copy span { font-size: 13px; color: #c9d3ea; }
.ai-site .ad.house .btn { flex: none; }
.ai-site .ad-box.house { flex-direction: column; align-items: flex-start; justify-content: flex-end; padding: 22px; }
.ai-site .ad-box.house strong { font-size: 24px; }
@media (max-width: 640px) {
  .ai-site .ad-leader.house { aspect-ratio: auto; min-height: 90px; padding: 14px 16px; }
  .ai-site .ad-leader.house .ad-copy span { display: none; }
  .ai-site .ad-leader.house strong { font-size: 16px; }
}

/* Story grid used under stories and on lists (three across, stacking on phones). */
.ai-site .row-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.ai-site .row-grid article { display: grid; gap: 8px; align-content: start; }
.ai-site .row-grid h3 { font-size: 19px; line-height: 1.28; margin: 4px 0 0; }
.ai-site .crumbs { display: flex; flex-wrap: wrap; gap: 8px; font-size: 13px; color: var(--muted); }
.ai-site .crumbs a:hover { color: var(--link); }
@media (max-width: 960px) { .ai-site .row-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px) {
  .ai-site .row-grid { grid-template-columns: 1fr; gap: 0; }
  .ai-site .row-grid article { padding-block: 18px; border-top: 1px solid var(--rule); }
  .ai-site .row-grid article:first-child { padding-top: 0; border-top: 0; }
  .ai-site .row-grid article:not(:first-child) { grid-template-columns: minmax(0, 1fr) 104px; column-gap: 14px; row-gap: 6px; }
  .ai-site .row-grid article:not(:first-child) > * { grid-column: 1; }
  .ai-site .row-grid article:not(:first-child) > a:first-child { grid-column: 2; grid-row: 1 / span 4; }
  .ai-site .row-grid article:not(:first-child) .thumb { width: 104px; aspect-ratio: 1; }
  .ai-site .row-grid h3 { font-size: 18px; }
}
