/* MisterGeeks — common visual system for the portal and the 50 thematic blogs.
   Per-site hue is injected by assets/theme.css (--accent-h). */

:root {
  color-scheme: light;
  --ink: #16181d;
  --muted: #5f6572;
  --line: #e4e4df;
  --paper: #fbfbf8;
  --surface: #ffffff;
  --surface-2: #f4f4ef;
  --accent-h: 84;
  --accent: hsl(var(--accent-h) 52% 38%);
  --accent-strong: hsl(var(--accent-h) 58% 30%);
  --accent-soft: hsl(var(--accent-h) 62% 94%);
  --accent-line: hsl(var(--accent-h) 38% 82%);
  --radius: 14px;
  --shadow: 0 1px 2px rgb(20 24 31 / 4%), 0 8px 24px rgb(20 24 31 / 4%);
  --max: 1440px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 16px/1.65 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }
img, svg { display: block; max-width: 100%; }
button { font: inherit; }

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  z-index: 20;
  background: var(--ink);
  color: #fff;
  padding: .7rem 1rem;
}
.skip-link:focus { left: 1rem; top: 1rem; }

.wrap {
  width: min(var(--max), calc(100% - 2rem));
  margin-inline: auto;
}

/* ---------- Masthead ---------- */

.masthead {
  background: linear-gradient(180deg, var(--accent-soft), var(--paper) 78%);
  border-bottom: 1px solid var(--line);
}

.ad {
  border: 1px dashed var(--accent-line);
  border: 1px dashed color-mix(in srgb, var(--accent) 45%, #fff);
  background: var(--accent-soft);
  background: color-mix(in srgb, var(--accent-soft) 70%, #fff);
  color: var(--accent-strong);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .2rem;
  text-align: center;
  border-radius: 10px;
  overflow: hidden;
}
.ad ins { display: block; width: 100%; height: 100%; }
.ad-placeholder::before {
  content: attr(data-label);
  font-size: .72rem;
  letter-spacing: .16em;
  text-transform: uppercase;
  font-weight: 800;
}
.ad-placeholder::after {
  content: attr(data-size);
  font-size: .66rem;
  letter-spacing: .08em;
  text-transform: none;
  font-weight: 600;
  color: var(--muted);
}
.ad-top {
  width: min(970px, calc(100% - 2rem));
  min-height: 90px;
  margin: .9rem auto 0;
}
.ad-left { min-height: 600px; }
.ad-right { min-height: 250px; }

.brandbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.05rem 0 1.15rem;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: .8rem;
  text-decoration: none;
  min-width: 0;
}
.brand-mark {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  background: var(--accent);
  color: #fff;
  box-shadow: var(--shadow);
  flex: 0 0 auto;
}
.brand-mark svg { width: 30px; height: 30px; }
.brand-copy { display: grid; line-height: 1.15; min-width: 0; }
.brand-copy strong {
  font-size: 1.42rem;
  letter-spacing: -.045em;
  font-weight: 850;
}
.brand-copy span {
  color: var(--accent-strong);
  font-size: .86rem;
  font-weight: 650;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.topnav {
  display: flex;
  align-items: center;
  gap: .35rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.topnav a {
  text-decoration: none;
  font-size: .86rem;
  font-weight: 650;
  padding: .45rem .7rem;
  border-radius: 999px;
  color: var(--muted);
}
.topnav a:hover,
.topnav a[aria-current="page"] {
  background: var(--surface);
  color: var(--accent-strong);
  box-shadow: 0 0 0 1px var(--line);
}

/* ---------- Layout ---------- */

.layout {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr) 300px;
  gap: 1.5rem;
  align-items: start;
  padding: 1.6rem 0 3rem;
}
.rail { display: grid; gap: 1rem; position: sticky; top: 1rem; }
.content { min-width: 0; }

.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
  margin: 0 0 1rem;
}
.section-head h1 {
  margin: 0;
  font-size: clamp(1.55rem, 3vw, 2.15rem);
  line-height: 1.1;
  letter-spacing: -.045em;
}
.section-head p {
  margin: .35rem 0 0;
  color: var(--muted);
  font-size: .95rem;
  max-width: 60ch;
}
.section-head .count {
  color: var(--muted);
  font-size: .8rem;
  white-space: nowrap;
  padding-bottom: .2rem;
}

/* ---------- Cards ---------- */

.cards { display: grid; gap: .9rem; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.15rem 1.25rem 1rem;
  box-shadow: var(--shadow);
  transition: border-color .15s ease, transform .15s ease;
}
.card:hover { border-color: var(--accent-line); transform: translateY(-1px); }
.card-link { text-decoration: none; display: block; }
.card-kicker {
  margin: 0 0 .35rem;
  color: var(--accent-strong);
  font-size: .7rem;
  font-weight: 800;
  letter-spacing: .14em;
  text-transform: uppercase;
}
.card-title {
  margin: 0;
  font-size: clamp(1.16rem, 2vw, 1.42rem);
  line-height: 1.22;
  letter-spacing: -.025em;
}
.card-summary {
  margin: .45rem 0 0;
  color: var(--muted);
  font-size: .97rem;
}
.card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: .8rem;
  padding-top: .65rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: .78rem;
}
.card-more { color: var(--accent-strong); font-weight: 700; }

.sentinel { height: 1px; }
.load-more {
  display: flex;
  justify-content: center;
  padding: 1.4rem 0 .4rem;
}
.load-more button {
  border: 1px solid var(--accent-line);
  background: var(--surface);
  color: var(--accent-strong);
  padding: .7rem 1.2rem;
  border-radius: 999px;
  font-weight: 700;
  cursor: pointer;
}
.load-more button:hover { background: var(--accent-soft); }
.load-more button[disabled] { opacity: .55; cursor: default; }

.empty {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 2.4rem 1.5rem;
  text-align: center;
  box-shadow: var(--shadow);
}
.empty h2 { margin: 0 0 .5rem; letter-spacing: -.03em; }
.empty p { margin: 0 auto 1.2rem; color: var(--muted); max-width: 48ch; }
.empty a {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  padding: .65rem 1.1rem;
  border-radius: 999px;
}
.demo-note {
  margin: 0 0 1rem;
  padding: .6rem .8rem;
  border: 1px solid var(--accent-line);
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: .82rem;
  font-weight: 650;
}

/* ---------- Blog widget ---------- */

.widget {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem;
  box-shadow: var(--shadow);
}
.widget h2 {
  margin: 0 0 .15rem;
  font-size: .82rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--accent-strong);
}
.widget p {
  margin: 0 0 .8rem;
  color: var(--muted);
  font-size: .78rem;
}
.widget-group { margin-top: .8rem; }
.widget-group h3 {
  margin: 0 0 .3rem;
  font-size: .7rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 750;
}
.widget-links {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .1rem .7rem;
}
.widget-links a {
  display: block;
  text-decoration: none;
  font-size: .79rem;
  padding: .2rem 0;
  color: var(--ink);
  border-bottom: 1px solid transparent;
}
.widget-links a:hover {
  color: var(--accent-strong);
  border-bottom-color: var(--accent-line);
}
.widget-more {
  display: inline-block;
  margin-top: .9rem;
  font-size: .8rem;
  font-weight: 700;
  color: var(--accent-strong);
  text-decoration: none;
}

/* ---------- Article ---------- */

.article {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: clamp(1.3rem, 4vw, 3rem);
  box-shadow: var(--shadow);
}
.article .eyebrow {
  margin: 0 0 .5rem;
  color: var(--accent-strong);
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .14em;
  text-transform: uppercase;
}
.article h1 {
  margin: 0 0 .6rem;
  font-size: clamp(2rem, 5vw, 3.2rem);
  line-height: 1.05;
  letter-spacing: -.05em;
}
.article .lead {
  color: var(--muted);
  font-size: 1.14rem;
  margin: 0 0 1rem;
}
.article time { color: var(--muted); font-size: .82rem; }
.article-body {
  margin-top: 1.6rem;
  font-size: 1.07rem;
  max-width: 70ch;
}
.article-body h2, .article-body h3 { letter-spacing: -.03em; line-height: 1.2; }
.article-body a { color: var(--accent-strong); text-underline-offset: .18em; }
.article-body blockquote {
  margin: 1.2rem 0;
  padding: .4rem 1rem;
  border-left: 3px solid var(--accent);
  color: var(--muted);
}
.article-body pre {
  overflow: auto;
  background: var(--surface-2);
  padding: 1rem;
  border-radius: 10px;
}
.backlink {
  display: inline-block;
  margin-bottom: 1rem;
  text-decoration: none;
  font-weight: 700;
  font-size: .86rem;
  color: var(--accent-strong);
}

/* ---------- Footer ---------- */

.site-footer {
  border-top: 1px solid var(--line);
  background: var(--surface);
}
.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.4rem 0;
  color: var(--muted);
  font-size: .82rem;
  flex-wrap: wrap;
}
.footer-inner a { color: var(--accent-strong); text-decoration: none; font-weight: 650; }
.footer-brand { display: inline-flex; align-items: center; gap: .5rem; color: var(--ink); font-weight: 800; }
.footer-brand svg { width: 20px; height: 20px; color: var(--accent); }

/* ---------- Utilities ---------- */

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}
:focus-visible { outline: 3px solid var(--accent-line); outline-offset: 2px; }

/* ---------- Responsive ---------- */

@media (max-width: 1180px) {
  .layout { grid-template-columns: minmax(0, 1fr) 300px; }
  .rail-left { display: none; }
}
@media (max-width: 920px) {
  .layout { grid-template-columns: minmax(0, 1fr); padding-top: 1rem; }
  .rail-right { position: static; grid-row: 2; }
  .ad-right { display: none; }
  .widget-links { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
  .brandbar { align-items: flex-start; }
  .topnav { display: none; }
}
@media (max-width: 620px) {
  .ad-top { min-height: 60px; }
  .brand-mark { width: 44px; height: 44px; border-radius: 13px; }
  .brand-mark svg { width: 25px; height: 25px; }
  .brand-copy strong { font-size: 1.2rem; }
  .card { padding: 1rem; }
  .article { padding: 1.2rem; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
