/* Fonts are served from this site (no request to Google). Variable fonts, latin subset: covers English, Portuguese and German. */
@font-face { font-family: "Newsreader"; font-style: normal; font-weight: 200 800; font-display: swap; src: url("/assets/fonts/newsreader-latin.woff2") format("woff2"); }
@font-face { font-family: "Public Sans"; font-style: normal; font-weight: 100 900; font-display: swap; src: url("/assets/fonts/public-sans-latin.woff2") format("woff2"); }

/* DenkenBits: editorial, reader-first. Change colours and fonts in the :root tokens. */
:root {
  --paper: #faf7f2;
  --ink: #1c1b19;
  --muted: #6a655c;
  --line: #e4ddd0;
  --soft: #f1ebdf;
  --accent: #b4410b;
  --serif: "Newsreader", Georgia, "Times New Roman", serif;
  --sans: "Public Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --measure: 34rem;
  --page: 64rem;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #17150f;
    --ink: #efeae0;
    --muted: #a39c8e;
    --line: #2e2a21;
    --soft: #221f17;
    --accent: #f08a4b;
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font-family: var(--sans); font-size: 1rem; line-height: 1.6;
}
a { color: inherit; text-decoration-color: var(--line); text-underline-offset: 3px; }
a:hover { text-decoration-color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.wrap {
  max-width: var(--page); margin-inline: auto;
  padding-inline: max(1.25rem, env(safe-area-inset-left, 0px));
}
.wrap.narrow { max-width: calc(var(--measure) + 2.5rem); }
.skip { position: absolute; left: -999px; top: 0; background: var(--ink); color: var(--paper); padding: 0.5rem 1rem; z-index: 100; }
.skip:focus { left: 0; }

h1, h2, h3 { font-family: var(--serif); line-height: 1.12; letter-spacing: -0.015em; text-wrap: balance; }

/* Header */
.site-nav { border-bottom: 1px solid var(--line); }
.site-nav .wrap { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding-block: 0.9rem; }
.brand { display: inline-flex; align-items: center; gap: 0.55rem; font-family: var(--serif); font-weight: 700; font-size: 1.4rem; letter-spacing: -0.01em; text-decoration: none; }
.brand img { display: block; position: relative; top: -1px; }
.brand-name { line-height: 1; position: relative; top: 0.09em; } /* Newsreader sits high in its line box; nudge it to the icon's centre line */
.nav-links { display: flex; align-items: center; gap: 1.25rem; list-style: none; margin: 0; padding: 0; font-size: 0.9rem; color: var(--muted); }
.nav-links a { text-decoration: none; }
.nav-links a:hover, .nav-links a[aria-current="page"] { color: var(--ink); }
.nav-links a[aria-current="page"] { text-decoration: underline; text-decoration-color: var(--accent); }

/* Language menu */
.flag { display: inline-block; width: 20px; height: 14px; border-radius: 2px; background: center/cover no-repeat; box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.2); flex: none; }
.flag-uk { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 60 30'%3E%3CclipPath id='s'%3E%3Cpath d='M0 0v30h60V0z'/%3E%3C/clipPath%3E%3CclipPath id='t'%3E%3Cpath d='M30 15h30v15zv15H0V15zH0V0zV0h30z'/%3E%3C/clipPath%3E%3Cg clip-path='url(%23s)'%3E%3Cpath d='M0 0v30h60V0z' fill='%23012169'/%3E%3Cpath d='M0 0l60 30M60 0L0 30' stroke='%23fff' stroke-width='6'/%3E%3Cpath d='M0 0l60 30M60 0L0 30' clip-path='url(%23t)' stroke='%23C8102E' stroke-width='4'/%3E%3Cpath d='M30 0v30M0 15h60' stroke='%23fff' stroke-width='10'/%3E%3Cpath d='M30 0v30M0 15h60' stroke='%23C8102E' stroke-width='6'/%3E%3C/g%3E%3C/svg%3E"); }
.flag-br { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 14'%3E%3Crect width='20' height='14' fill='%23009C3B'/%3E%3Cpath d='M10 1.2L18.2 7 10 12.8 1.8 7z' fill='%23FFDF00'/%3E%3Ccircle cx='10' cy='7' r='3.5' fill='%23002776'/%3E%3Cpath d='M6.6 6.2c2.2-.6 4.9-.2 6.9 1.5' stroke='%23fff' stroke-width='.6' fill='none'/%3E%3C/svg%3E"); }
.nav-lang { position: relative; }
.lang-menu summary {
  display: flex; align-items: center; gap: 0.5rem; cursor: pointer; list-style: none;
  padding: 0.35rem 0.75rem; border: 1px solid var(--line); border-radius: 999px;
  font-weight: 600; font-size: 0.85rem; color: var(--ink);
}
.lang-menu summary::-webkit-details-marker { display: none; }
.lang-menu summary::after { content: ""; width: 6px; height: 6px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg) translateY(-2px); }
.lang-menu summary:hover { border-color: var(--accent); }
.lang-menu ul {
  position: absolute; right: 0; top: calc(100% + 8px); min-width: 12.5rem; z-index: 60;
  list-style: none; margin: 0; padding: 0.35rem; background: var(--paper);
  border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}
.lang-menu ul a { display: flex; align-items: center; gap: 0.7rem; border-radius: 6px; padding: 0.55rem 0.7rem; color: var(--ink); }
.lang-menu ul a:hover { background: var(--soft); }
.lang-menu ul a[aria-current] { background: var(--soft); color: var(--accent); font-weight: 600; }

/* Pages */
.hero { padding-block: clamp(2.5rem, 8vw, 5rem) 1.5rem; }
.hero h1 { font-weight: 600; font-size: clamp(2.2rem, 6vw, 3.4rem); margin: 0 0 0.75rem; max-width: 18ch; }
.lead { font-size: 1.15rem; color: var(--muted); max-width: 40ch; margin: 0; }
.page { padding-block: clamp(2rem, 6vw, 3.5rem); }
.page h1 { font-size: clamp(2rem, 5vw, 2.6rem); font-weight: 700; margin: 0 0 1rem; }
.page p { font-family: var(--serif); font-size: 1.2rem; line-height: 1.6; max-width: var(--measure); }

/* Footer */
.site-footer { border-top: 1px solid var(--line); margin-top: 4rem; padding-block: 2rem; color: var(--muted); font-size: 0.9rem; }
.site-footer .wrap { display: flex; flex-direction: column; gap: 1rem; }
.footer-brand { font-family: var(--serif); font-weight: 700; font-size: 1.15rem; color: var(--ink); text-decoration: none; }
.site-footer p { margin: 0.25rem 0 0; }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 0.5rem 1.25rem; }
.site-footer nav a { text-decoration: none; }
.site-footer nav a:hover { color: var(--ink); text-decoration: underline; }

@media (max-width: 520px) {
  .nav-links { gap: 0.9rem; }
  .brand { font-size: 1.2rem; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; animation: none !important; } }

/* Topics and patterns. --topic is set per topic by the build (see topicStyles in build.js). */
.pattern { display: block; flex: none; fill: var(--topic, var(--accent)); }
.topic-label { color: var(--topic, var(--accent)); }
.topic-strip ul { display: flex; flex-wrap: wrap; gap: 0.65rem; list-style: none; margin: 0; padding: 0; }
.topic-chip {
  display: inline-flex; align-items: center; gap: 0.5rem; padding: 0.3rem 0.8rem; border-radius: 999px;
  border: 1px solid var(--topic, var(--line)); color: var(--topic, var(--ink)); font-size: 0.9rem; font-weight: 600; text-decoration: none;
}
.topic-chip .count { font-size: 0.75rem; font-weight: 500; opacity: 0.75; }
.topic-chip:hover, .topic-chip[aria-current="page"] { background: var(--topic, var(--ink)); color: var(--paper); }
.topic-chip.all { --topic: var(--ink); }
.page .topic-strip { margin-bottom: 0.9rem; }

/* Home */
.hero h1 { font-size: clamp(2.6rem, 8vw, 4.6rem); line-height: 1.02; letter-spacing: -0.025em; max-width: 14ch; }
.hero .lead { font-size: 1.25rem; max-width: 36ch; margin-top: 1rem; }
.block { padding-block: clamp(2.25rem, 6vw, 4rem) 0; }
.hero + .block { padding-top: 1.5rem; } /* the featured article sits close under the intro */
.section-title { font-size: 0.8rem; font-family: var(--sans); font-weight: 600; letter-spacing: 0.09em; text-transform: uppercase; color: var(--muted); margin: 0 0 1rem; }
.section-lead { margin: 0.3rem 0 0; color: var(--muted); }
.featured {
  display: grid; grid-template-columns: 1fr auto; gap: 1.5rem; align-items: center;
  padding: clamp(1.25rem, 4vw, 2rem); background: var(--soft); border: 1px solid var(--line); border-radius: 4px;
}
.featured h2 { font-size: clamp(1.7rem, 4.5vw, 2.5rem); font-weight: 700; margin: 0.4rem 0 0.6rem; }
.featured h2 a { text-decoration: none; }
.featured h2 a:hover { color: var(--topic); }
.featured .desc { margin: 0; color: var(--muted); font-size: 1.05rem; max-width: 44ch; }
.featured .thumb { display: block; }
.times { margin: 0; font-size: 0.8rem; color: var(--muted); font-weight: 500; }

/* Article lists */
.article-list { display: flex; flex-direction: column; margin-top: 0.5rem; }
.article-list .item { display: grid; grid-template-columns: auto 1fr; gap: 1.1rem; padding-block: 1.2rem; border-top: 1px solid var(--line); }
.article-list .thumb { display: block; padding-top: 0.2rem; }
.article-list .meta, .featured .meta { margin: 0; font-size: 0.76rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.article-list .meta a { color: var(--ink); }
.article-list h3 { font-size: 1.5rem; font-weight: 600; margin: 0.3rem 0; }
.article-list h3 a { text-decoration: none; }
.article-list h3 a:hover { color: var(--topic); }
.article-list .desc { margin: 0 0 0.35rem; color: var(--muted); max-width: 52ch; }
.empty { color: var(--muted); }
.topic-title { color: var(--topic); }

/* Article page */
.crumbs { margin: 0; font-size: 0.85rem; color: var(--muted); }
.article-top { display: flex; align-items: center; gap: 1rem; }
.crumbs a { text-decoration: none; }
.crumbs a:hover { color: var(--accent); }
.article-head { padding-top: clamp(1.5rem, 5vw, 3rem); }
.article-head h1 { font-weight: 700; font-size: clamp(2rem, 6vw, 3.1rem); line-height: 1.08; margin: 0.9rem 0 0.7rem; }
.byline { margin: 0; padding-bottom: 1.25rem; border-bottom: 1px solid var(--line); font-size: 0.88rem; color: var(--muted); }
.byline a { color: var(--ink); }
.prose { font-family: var(--serif); font-size: 1.22rem; line-height: 1.65; max-width: var(--measure); }
.prose > p:first-child { font-size: 1.36rem; line-height: 1.5; }
.prose p, .prose ul, .prose ol { margin: 1.15rem 0 0; }
.prose h2 { font-size: 1.5rem; margin: 2rem 0 0; }
.prose blockquote { margin: 1.4rem 0 0; padding-left: 1.1rem; border-left: 2px solid var(--line); color: var(--muted); font-style: italic; }
.prose li + li { margin-top: 0.35rem; }
.prose .action { margin-top: 2rem; padding: 1.1rem 1.3rem 1.3rem; background: var(--soft); border: 1px solid var(--line); border-left: 4px solid var(--topic, var(--accent)); font-size: 1.1rem; }
.prose .action h2 { margin: 0; font-family: var(--sans); font-size: 0.8rem; font-weight: 700; letter-spacing: 0.09em; text-transform: uppercase; color: var(--topic, var(--accent)); }
.prose .action p, .prose .action ul, .prose .action ol { margin-top: 0.7rem; }
.article-disclaimer { margin-top: 2.5rem; padding-top: 1.25rem; border-top: 1px solid var(--line); max-width: var(--measure); color: var(--muted); font-size: 0.9rem; }
.article-disclaimer p { margin: 0; }
.article-disclaimer a { color: var(--ink); }

@media (max-width: 560px) {
  .featured { grid-template-columns: 1fr; }
  .featured .thumb { order: -1; }
  .article-list .item { grid-template-columns: 1fr; gap: 0.6rem; }
}
