/* SPDX-License-Identifier: GPL-3.0-only */
/* HomeLan News public site. Neutral surfaces come from the shared shell;
   rubric colours and the editorial type scale belong to News. */
:root {
  color-scheme: light;
  --bg: #fbfaf7;
  --surface: var(--hl-surface, #ffffff);
  --ink: #111820;
  --ink-soft: #2c3640;
  --muted: #66707a;
  --rule: #111820;
  --line: #dcdcd6;
  --accent: var(--hl-accent, #075da7);
  /* Rubric families: hardware, systems, AI. */
  --r-hardware: #b4471f;
  --r-systems: #0f6f78;
  --r-ai: #0b5cad;
  --warn: #8a6400;
  --night: #0b1117;
  --night-accent: #9ec7f0;
  --on-night: rgba(255, 255, 255, .78);
  --on-night-link: rgba(255, 255, 255, .72);
  --on-night-muted: rgba(255, 255, 255, .5);
  --on-night-line: rgba(255, 255, 255, .14);
  --on-night-strong: #f4f6f8;
  --sans: var(--hl-font, "Commissioner", ui-sans-serif, system-ui, sans-serif);
  --serif: "Literata", "Source Serif 4", "Noto Serif", Georgia, serif;
}

* { box-sizing: border-box; }

html,
body { overflow-x: clip; }

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 16px/1.55 var(--sans);
  overflow-wrap: break-word;
  -webkit-font-smoothing: antialiased;
}

.skip-link {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 30;
  padding: 10px 14px;
  background: var(--ink);
  color: var(--bg);
  font-weight: 600;
  text-decoration: none;
  transform: translateY(-200%);
}

.skip-link:focus { transform: none; }

img { display: block; max-width: 100%; }
a { color: inherit; }

a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 2px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.container,
.nav {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
}

[data-rubric="hardware"],
[data-rubric="sbc"],
[data-rubric="mcu"] { --rubric: var(--r-hardware); }
[data-rubric="linux"],
[data-rubric="smart-home"] { --rubric: var(--r-systems); }
[data-rubric="ai"],
[data-rubric="agents"],
[data-rubric="rag"] { --rubric: var(--r-ai); }

/* ---- Header ---- */
.site-header { background: var(--bg); }

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 64px;
}

.brand img { width: 132px; height: auto; }

.nav-actions {
  display: flex;
  align-items: center;
  gap: 22px;
  font-size: 14px;
}

.lang-switch { display: flex; gap: 2px; color: var(--muted); letter-spacing: .04em; }
.lang-switch a,
.lang-switch span,
.sign-in { display: inline-flex; align-items: center; min-height: 44px; padding: 0 6px; }
.lang-switch a { color: var(--muted); text-decoration: none; }
.lang-switch a:hover { color: var(--ink); }
.lang-switch [aria-current="true"] { color: var(--ink); font-weight: 600; }

.sign-in { font-weight: 600; text-decoration: none; }
.sign-in:hover { text-decoration: underline; text-underline-offset: 3px; }

/* ---- Masthead ---- */
.masthead {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px 24px;
  padding: 10px 0 14px;
}

.masthead-title {
  margin: 0;
  font: 600 clamp(26px, 2.6vw, 34px)/1.1 var(--serif);
  letter-spacing: -.01em;
}

.masthead-updated { margin: 0; color: var(--muted); font-size: 13px; }

/* ---- Section bar ---- */
.sections {
  display: flex;
  flex-wrap: wrap;
  gap: 0 26px;
  border-top: 3px solid var(--rule);
  border-bottom: 1px solid var(--line);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.sections a { display: inline-flex; align-items: center; min-height: 44px; color: var(--muted); text-decoration: none; white-space: nowrap; }
.sections a:hover { color: var(--ink); }
.sections a[aria-current="page"] { color: var(--ink); box-shadow: inset 0 -2px 0 var(--ink); }

/* ---- Shared story parts ---- */
.kicker {
  margin: 0 0 6px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
}

.kicker a { color: var(--rubric, var(--accent)); text-decoration: none; }
.kicker a:hover { text-decoration: underline; }
.kicker time { color: var(--muted); font-weight: 500; letter-spacing: .02em; }
.kicker a + time { margin-left: 8px; }

.byline { margin: 10px 0 0; color: var(--muted); font-size: 13px; }

h2, h3, h4 { margin: 0; }

.lead-title a,
.second-title a,
.item-title a,
.related a { text-decoration: none; }

.lead-title a:hover,
.second-title a:hover,
.item-title a:hover,
.related a:hover { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 4px; }

.media { display: block; align-self: start; }
.media svg { display: block; width: 100%; height: auto; }

/* ---- Lead ---- */
.lead-story {
  display: grid;
  grid-template-columns: minmax(0, 6fr) minmax(0, 5fr);
  gap: 32px;
  align-items: start;
  padding: 28px 0 32px;
  border-bottom: 1px solid var(--line);
}

.lead-story > .media { grid-column: 1; grid-row: 1; }
.lead-body { grid-column: 2; grid-row: 1; }

.lead-story:not(:has(.media)) { grid-template-columns: minmax(0, 1fr); }
.lead-story:not(:has(.media)) .lead-body { grid-column: 1; max-width: 820px; }

.lead-title {
  font: 600 clamp(30px, 3vw, 40px)/1.12 var(--serif);
  letter-spacing: -.01em;
  text-wrap: balance;
}

.lead-text {
  margin: 16px 0 0;
  text-wrap: pretty;
  color: var(--ink-soft);
  font: 400 19px/1.5 var(--serif);
}

/* ---- Second row ---- */
.second-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0 32px;
  padding: 26px 0 30px;
  border-bottom: 3px solid var(--rule);
}

.second + .second { position: relative; }
.second + .second::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 -16px;
  border-left: 1px solid var(--line);
}

.second > .media { margin-bottom: 14px; }

.second-title {
  font: 600 22px/1.25 var(--serif);
  text-wrap: balance;
}

/* ---- Chronicle ---- */
.feed {
  display: grid;
  grid-template-columns: minmax(0, 820px);
  padding: 8px 0 56px;
}

.day-label {
  margin: 30px 0 0;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--rule);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 168px;
  gap: 24px;
  padding: 20px 0;
  border-bottom: 1px solid var(--line);
}

.item:not(:has(.media)) { grid-template-columns: minmax(0, 1fr); }
.item > .media { grid-column: 2; grid-row: 1; margin-top: 4px; }
.item-text { grid-column: 1; grid-row: 1; }

.item-title { font: 600 20px/1.3 var(--serif); text-wrap: balance; }

.item-lead {
  margin: 8px 0 0;
  text-wrap: pretty;
  color: var(--ink-soft);
  font-size: 15.5px;
  line-height: 1.5;
}

.state-line { margin: 32px 0; color: var(--muted); }

/* ---- Article ---- */
.article-layout { padding: 8px 0 64px; }

.article {
  max-width: 760px;
  margin: 0 auto;
  padding-top: 32px;
}

.article-title {
  margin: 0;
  font: 600 clamp(32px, 4.2vw, 50px)/1.08 var(--serif);
  letter-spacing: -.012em;
  text-wrap: balance;
}

.article-lead {
  margin: 18px 0 0;
  text-wrap: pretty;
  color: var(--ink-soft);
  font: 400 21px/1.5 var(--serif);
}

.article .byline { margin-top: 14px; padding-bottom: 22px; border-bottom: 1px solid var(--line); }

.article > .media { margin: 28px 0 6px; }

.article-body { margin-top: 26px; font: 400 19px/1.7 var(--serif); }
.article-body p { margin: 0 0 1.1em; }
.article-subheading {
  margin: 1.6em 0 .55em;
  text-wrap: balance;
  color: var(--ink);
  font: 600 22px/1.3 var(--serif);
  letter-spacing: -.005em;
}

.correction-note {
  margin: 24px 0 0;
  padding: 12px 16px;
  border: 1px solid var(--line);
  background: var(--surface);
  font-size: 15px;
}

.article-sources {
  margin-top: 28px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 14px;
}

.article-sources p { margin: 0; }
.article-sources .method-note { margin-top: 6px; }
.article-sources a { color: var(--ink); text-underline-offset: 3px; }

.related {
  max-width: 760px;
  margin: 44px auto 0;
  padding-top: 12px;
  border-top: 3px solid var(--rule);
}

.related-heading {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.related ul { margin: 6px 0 0; padding: 0; list-style: none; }
.related li { padding: 12px 0; border-bottom: 1px solid var(--line); font: 600 18px/1.35 var(--serif); }
.related time { display: block; margin-top: 3px; color: var(--muted); font: 400 13px/1.4 var(--sans); }

/* ---- Footer (layout from the HomeLan site v2) ---- */
.site-footer {
  margin-top: auto;
  background: var(--night);
  color: var(--on-night);
}

.footer-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 18px 38px;
  padding: 34px 0;
}

.footer-main .brand { grid-column: 1; justify-self: start; }
.footer-main .brand img { width: 148px; height: auto; }

.footer-main p {
  grid-column: 2;
  justify-self: center;
  margin: 0;
  font-size: .94rem;
  line-height: 1.6;
  text-align: center;
}

.back-top {
  grid-column: 3;
  grid-row: 1;
  justify-self: end;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--on-night);
  font-size: .9rem;
  font-weight: 700;
  text-decoration: none;
}

.back-top span { margin-left: 14px; color: var(--night-accent); }
.back-top:hover { color: var(--on-night-strong); }

.footer-bottom {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 20px;
  padding: 14px 0 18px;
  border-top: 1px solid var(--on-night-line);
  color: var(--on-night-muted);
  font-size: .84rem;
}

.footer-links { display: flex; flex-wrap: wrap; gap: 0 20px; }
.footer-links a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--on-night-link);
  text-underline-offset: 3px;
}
.footer-links a:hover { color: var(--on-night-strong); }
.site-footer a:focus-visible { outline-color: var(--night-accent); }

/* ---- Narrow screens ---- */
@media (max-width: 900px) {
  .footer-main { grid-template-columns: minmax(0, 1fr); gap: 18px; }
  .footer-main p { grid-column: 1; }
  .back-top { grid-column: 1; grid-row: auto; justify-self: end; }
  .lead-story { grid-template-columns: minmax(0, 1fr); gap: 18px; }
  .lead-story > .media,
  .lead-body { grid-column: 1; grid-row: auto; }
  .second-row { grid-template-columns: minmax(0, 1fr); }
  .second { padding: 16px 0; border-bottom: 1px solid var(--line); }
  .second:last-child { border-bottom: 0; }
  .second + .second::before { display: none; }
  .second > .media { display: none; }
}

@media (max-width: 600px) {
  .container, .nav { width: calc(100% - 32px); }
  .nav-actions { gap: 16px; }
  .sections {
    flex-wrap: nowrap;
    gap: 0 18px;
    overflow-x: auto;
    scrollbar-width: thin;
    font-size: 12px;
  }
  .masthead { padding-top: 4px; }
  .item { grid-template-columns: minmax(0, 1fr) 96px; gap: 14px; }
  .item-title { font-size: 18px; }
  .item-lead { display: none; }
  .lead-text { font-size: 17px; }
  .article-body { font-size: 18px; }
}
