/* ==========================================================================
   inbefore — modern frontend prototype
   Hand-written CSS, no framework. Replaces Bootstrap 4 + 193 KB styles.css.
   Structure:
     01. Tokens
     02. Reset & base
     03. Layout primitives
     04. Header & nav
     05. Search
     06. Cards (feed grid)
     07. Hero / top stories
     08. Section headings, chips, pagination
     09. Sidebar widgets (trending, popular)
     10. Ad slots
     11. Sources directory & source profile
     12. Article page
     13. Footer
     14. Utilities
     15. Responsive
   ========================================================================== */

/* 01. Tokens ============================================================== */

:root {
  color-scheme: light;

  /* Brand: a deep editorial green, one step off black so headlines stay the
     strongest thing on the page. Every accent on the site — buttons, links,
     ranks, the wordmark, the tag chip — is this one colour. */
  --brand: oklch(0.44 0.09 158);
  --brand-hover: oklch(0.37 0.08 158);
  --brand-soft: oklch(0.955 0.022 158);
  --brand-ink: oklch(1 0 0);

  --bg: oklch(0.985 0.002 260);
  --surface: oklch(1 0 0);
  --surface-2: oklch(0.965 0.004 260);
  --text: oklch(0.24 0.021 265);
  --text-strong: oklch(0.17 0.024 265);
  --muted: oklch(0.55 0.019 265);
  --muted-2: oklch(0.66 0.015 265);
  --line: oklch(0.918 0.006 265);
  --line-strong: oklch(0.86 0.008 265);
  /* Rule under section and topic heads. A subtle grey rather than a dark
     bar: it should separate two blocks of content, not out-shout either of
     them. Dark mode gets the equivalent soft step up from its own line
     colour below. */
  --rule-strong: oklch(0.8 0.008 265);

  --accent-good: oklch(0.62 0.16 150);

  --radius-xs: 6px;
  --radius-sm: 10px;
  --radius: 14px;
  --radius-lg: 20px;
  --radius-pill: 999px;

  --shadow-sm: 0 1px 2px oklch(0.2 0.02 265 / 0.06),
    0 1px 3px oklch(0.2 0.02 265 / 0.04);
  --shadow-md: 0 2px 6px oklch(0.2 0.02 265 / 0.07),
    0 8px 24px oklch(0.2 0.02 265 / 0.06);
  --shadow-lg: 0 12px 40px oklch(0.2 0.02 265 / 0.12);

  --container: 1240px;
  --gutter: 20px;

  --font: "DM Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;

  --header-h: 116px;

  --ease: cubic-bezier(0.32, 0.72, 0, 1);
}

[data-theme="dark"] {
  color-scheme: dark;

  --brand: oklch(0.68 0.13 158);
  --brand-hover: oklch(0.75 0.13 158);
  --brand-soft: oklch(0.27 0.05 158);
  --brand-ink: oklch(0.16 0.02 158);

  --bg: oklch(0.165 0.012 265);
  --surface: oklch(0.205 0.014 265);
  --surface-2: oklch(0.245 0.016 265);
  --text: oklch(0.93 0.006 265);
  --text-strong: oklch(0.985 0.003 265);
  --muted: oklch(0.71 0.014 265);
  --muted-2: oklch(0.6 0.014 265);
  --line: oklch(0.29 0.014 265);
  --line-strong: oklch(0.36 0.016 265);
  --rule-strong: oklch(0.38 0.012 265);

  --shadow-sm: 0 1px 2px oklch(0 0 0 / 0.4);
  --shadow-md: 0 2px 6px oklch(0 0 0 / 0.45), 0 8px 24px oklch(0 0 0 / 0.3);
  --shadow-lg: 0 12px 40px oklch(0 0 0 / 0.55);
}

/* 02. Reset & base ======================================================== */

*,
*::before,
*::after {
  box-sizing: border-box;
}

* {
  margin: 0;
  padding: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 16px);
}

body {
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img,
svg,
video {
  display: block;
  max-width: 100%;
}

img {
  height: auto;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  background: none;
  border: 0;
  cursor: pointer;
}

ul,
ol {
  list-style: none;
}

h1,
h2,
h3,
h4 {
  color: var(--text-strong);
  line-height: 1.2;
  letter-spacing: -0.018em;
  font-weight: 700;
  text-wrap: balance;
}

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

::selection {
  background: var(--brand);
  color: var(--brand-ink);
}

/* Skip link ---------------------------------------------------------------- */

.skip-link {
  position: absolute;
  left: 12px;
  top: -60px;
  z-index: 100;
  background: var(--brand);
  color: var(--brand-ink);
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  transition: top 0.18s var(--ease);
}

.skip-link:focus {
  top: 12px;
}

/* 03. Layout primitives ================================================== */

.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 324px;
  gap: 40px;
  align-items: start;
  padding-block: 28px 56px;
}

.layout--full {
  grid-template-columns: minmax(0, 1fr);
}

.stack > * + * {
  margin-top: 24px;
}

.card-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

/* 04. Header & nav ======================================================= */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in oklab, var(--surface) 88%, transparent);
  backdrop-filter: saturate(1.6) blur(14px);
  -webkit-backdrop-filter: saturate(1.6) blur(14px);
  border-bottom: 1px solid var(--line);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 24px;
  min-height: 68px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: none;
}

.brand-word {
  font-size: 27px;
  font-weight: 700;
  letter-spacing: -0.045em;
  color: var(--brand);
  line-height: 1;
}

.brand-tag {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  background: var(--brand);
  color: var(--brand-ink);
  padding: 3px 6px;
  border-radius: 4px;
  transform: translateY(-8px);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  flex: none;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-pill);
  color: var(--muted);
  border: 1px solid transparent;
  transition: background 0.16s var(--ease), color 0.16s var(--ease),
    border-color 0.16s var(--ease);
}

.icon-btn:hover {
  background: var(--surface-2);
  color: var(--text-strong);
  border-color: var(--line);
}

.icon-btn svg {
  width: 20px;
  height: 20px;
}

/* Account menu ------------------------------------------------------------ */

.account {
  position: relative;
  flex: none;
}

.account__btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 8px 0 4px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text-strong);
  font-size: 14px;
  font-weight: 600;
  transition: border-color 0.16s var(--ease);
}

.account__btn:hover {
  border-color: var(--line-strong);
}

.account__avatar {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-pill);
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  background: var(--brand);
}

.account__menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 60;
  min-width: 232px;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  display: none;
}

.account__menu[data-open="true"] {
  display: block;
}

.account__head {
  padding: 10px 12px 12px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 6px;
}

.account__name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-strong);
}

.account__mail {
  font-size: 12.5px;
  color: var(--muted-2);
}

.account__link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--text);
}

.account__link:hover {
  background: var(--surface-2);
  color: var(--text-strong);
}

.account__link svg {
  width: 16px;
  height: 16px;
  color: var(--muted-2);
  flex: none;
}

.account__count {
  margin-left: auto;
  font-size: 12px;
  color: var(--muted-2);
  font-variant-numeric: tabular-nums;
}

/* Signed-out prompt used on "For you". */
.auth-card {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  flex-wrap: wrap;
}

.auth-card__icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius);
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--brand-soft);
  color: var(--brand);
}

.auth-card__icon svg {
  width: 23px;
  height: 23px;
}

.auth-card__body {
  flex: 1;
  min-width: 220px;
}

.auth-card__title {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-strong);
}

.auth-card__text {
  margin-top: 5px;
  font-size: 14px;
  color: var(--muted);
  max-width: 56ch;
}

.auth-card__actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

@media (max-width: 520px) {
  .auth-card {
    flex-direction: column;
    align-items: flex-start;
  }

  .auth-card__actions {
    width: 100%;
  }

  .auth-card__actions .btn {
    flex: 1;
  }
}

/* Category rail ----------------------------------------------------------- */

.cat-rail {
  --rail-bg: color-mix(in oklab, var(--surface) 94%, transparent);
  position: relative;
  border-top: 1px solid var(--line);
}

/* Fade the right edge so it is obvious the rail scrolls for more categories. */
.cat-rail::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 64px;
  background: linear-gradient(
    to right,
    transparent,
    var(--rail-bg) 62%
  );
  pointer-events: none;
}

.cat-rail__scroll {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  padding-block: 9px;
  scroll-snap-type: x proximity;
}

.cat-rail__scroll::-webkit-scrollbar {
  display: none;
}

.cat-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  flex: none;
  padding: 7px 14px;
  border-radius: var(--radius-pill);
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
  white-space: nowrap;
  scroll-snap-align: start;
  transition: background 0.16s var(--ease), color 0.16s var(--ease);
}

.cat-pill:hover {
  background: var(--surface-2);
  color: var(--text-strong);
}

.cat-pill[aria-current="page"] {
  background: var(--brand);
  color: var(--brand-ink);
  font-weight: 600;
}

.cat-pill__count {
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  opacity: 0.62;
}

.cat-pill[aria-current="page"] .cat-pill__count {
  opacity: 0.8;
}

/* 05. Search ============================================================= */

.search {
  position: relative;
  flex: 1 1 auto;
  /* Without this the automatic minimum size of the form keeps it at its
     content width and the header overflows on narrow phones. */
  min-width: 0;
  max-width: 560px;
}

.search__field {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  padding: 0 6px 0 14px;
  height: 42px;
  transition: border-color 0.16s var(--ease), background 0.16s var(--ease),
    box-shadow 0.16s var(--ease);
}

.search__field:focus-within {
  background: var(--surface);
  border-color: var(--brand);
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--brand) 18%, transparent);
}

.search__icon {
  width: 18px;
  height: 18px;
  color: var(--muted-2);
  flex: none;
}

.search__input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: none;
  outline: none;
  font-size: 15px;
}

.search__input::placeholder {
  color: var(--muted-2);
}

.search__submit {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 14px;
  border-radius: var(--radius-pill);
  background: var(--brand);
  color: var(--brand-ink);
  font-size: 13px;
  font-weight: 600;
  transition: background 0.16s var(--ease);
}

.search__submit:hover {
  background: var(--brand-hover);
}

.search__submit svg {
  width: 15px;
  height: 15px;
}

/* Suggestions -------------------------------------------------------------- */

.suggest {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  z-index: 60;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  padding: 6px;
  display: none;
}

.suggest[data-open="true"] {
  display: block;
}

.suggest__item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  font-size: 14.5px;
  color: var(--text);
}

.suggest__item svg {
  width: 15px;
  height: 15px;
  color: var(--muted-2);
  flex: none;
}

.suggest__item:hover,
.suggest__item[data-active="true"] {
  background: var(--surface-2);
  color: var(--text-strong);
}

.suggest__item b {
  font-weight: 700;
  color: var(--text-strong);
}

.suggest__label {
  padding: 8px 12px 4px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted-2);
}

/* 06. Cards ============================================================== */

.feed {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(266px, 1fr));
  gap: 26px 22px;
}

.feed--wide {
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
}

.card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: relative;
  min-width: 0;
}

/* Stretched-link pattern: the whole card is clickable through the title link,
   with no duplicate "image link" for screen readers to announce twice. */
.card__title a::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: var(--radius);
}

/* Anything else that must stay individually clickable sits above the overlay.
   (.card__cat is already absolutely positioned with its own z-index.) */
.source-chip,
.follow-btn,
.like-btn {
  position: relative;
  z-index: 3;
}

.card__media {
  position: relative;
}

/* Fixed-ratio media: the single biggest visual fix. */
.card__media {
  aspect-ratio: 16 / 9;
  border-radius: var(--radius);
  overflow: hidden;
  background: linear-gradient(
    135deg,
    var(--surface-2) 0%,
    color-mix(in oklab, var(--surface-2) 70%, var(--line)) 100%
  );
  border: 1px solid var(--line);
}

.card__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s var(--ease), opacity 0.4s ease;
}

.card:hover .card__img {
  transform: scale(1.035);
}

.card__img[data-loaded="false"] {
  opacity: 0;
}

.card__cat {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
  background: color-mix(in oklab, var(--surface) 92%, transparent);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: var(--text-strong);
  box-shadow: var(--shadow-sm);
}

.card__body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
  min-width: 0;
}

/* Source identity: logo + name as real text, not a stretched logo image. */
.source-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.source-chip__logo {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  object-fit: contain;
  flex: none;
  background: var(--surface-2);
}

.source-chip__mono {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0;
}

.source-chip__name {
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--text-strong);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.source-chip:hover .source-chip__name {
  color: var(--brand);
}

.card__title {
  font-size: 17.5px;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.014em;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card__title a:hover {
  color: var(--brand);
}

.card__excerpt {
  font-size: 14px;
  line-height: 1.5;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card__meta {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: auto;
  padding-top: 2px;
  font-size: 12.5px;
  color: var(--muted-2);
  font-variant-numeric: tabular-nums;
}

.meta-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.meta-item svg {
  width: 14px;
  height: 14px;
  flex: none;
}

/* Compact card: horizontal, used in "top stories" rails and sidebars. */
.card--compact {
  flex-direction: row;
  gap: 12px;
  align-items: flex-start;
}

.card--compact .card__media {
  width: 108px;
  flex: none;
  aspect-ratio: 4 / 3;
  border-radius: var(--radius-sm);
}

.card--compact .card__body {
  gap: 6px;
}

.card--compact .card__title {
  font-size: 15px;
  -webkit-line-clamp: 3;
}

.card--compact .card__excerpt {
  display: none;
}

.card--compact .card__meta {
  font-size: 12px;
}

/* Small card: grid item without media, for dense sidebars. */
.card--text .card__title {
  font-size: 15px;
  -webkit-line-clamp: 3;
}

.card__rank {
  font-size: 20px;
  font-weight: 700;
  color: var(--brand);
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
  flex: none;
  width: 26px;
}

/* Skeleton placeholders for progressive loading. */
.skeleton {
  border-radius: var(--radius);
  background: linear-gradient(
    100deg,
    var(--surface-2) 30%,
    color-mix(in oklab, var(--surface-2) 55%, var(--line)) 50%,
    var(--surface-2) 70%
  );
  background-size: 220% 100%;
  animation: shimmer 1.35s linear infinite;
}

.skeleton--media {
  aspect-ratio: 16 / 9;
}

.skeleton--line {
  height: 12px;
  border-radius: 5px;
  margin-top: 10px;
}

.skeleton--line.is-short {
  width: 55%;
}

@keyframes shimmer {
  from {
    background-position: 120% 0;
  }
  to {
    background-position: -120% 0;
  }
}

/* 07. Hero / top stories ================================================= */

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr);
  gap: 28px;
  padding: 26px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
}

.hero__lead {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.hero__lead .card__media {
  aspect-ratio: 16 / 9;
  border-radius: var(--radius);
}

.hero__lead .card__title {
  font-size: 30px;
  line-height: 1.16;
  letter-spacing: -0.026em;
  -webkit-line-clamp: 3;
}

.hero__lead .card__excerpt {
  font-size: 15.5px;
  -webkit-line-clamp: 3;
}

.hero__rail {
  display: flex;
  flex-direction: column;
  gap: 0;
  border-left: 1px solid var(--line);
  padding-left: 24px;
}

.hero__rail .card--compact + .card--compact {
  padding-top: 16px;
  margin-top: 16px;
  border-top: 1px solid var(--line);
}

.section-head {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
}

.section-head__title {
  font-size: 20px;
  letter-spacing: -0.02em;
  display: inline-flex;
  align-items: center;
  gap: 9px;
}

.section-head__title::before {
  content: "";
  width: 4px;
  height: 19px;
  border-radius: 2px;
  background: var(--brand);
  flex: none;
}

.section-head__rule {
  flex: 1;
  height: 1px;
  background: var(--line);
}

.section-head__link {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--brand);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex: none;
}

.section-head__link svg {
  width: 14px;
  height: 14px;
}

/* 08. Chips & pagination ================================================= */

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 13px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--line);
  background: var(--surface);
  font-size: 13.5px;
  font-weight: 500;
  color: var(--muted);
  transition: all 0.16s var(--ease);
}

.chip:hover {
  border-color: var(--line-strong);
  color: var(--text-strong);
}

.chip[aria-pressed="true"] {
  background: var(--text-strong);
  border-color: var(--text-strong);
  color: var(--bg);
  font-weight: 600;
}

/* A chip carrying a number, as the category page's sibling strip does: sized
   down and dimmed so it reads as a count rather than part of the name. */
.chip__count {
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  opacity: 0.62;
}

.load-more {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin-top: 34px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 44px;
  padding: 0 22px;
  border-radius: var(--radius-pill);
  font-size: 14.5px;
  font-weight: 600;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text-strong);
  transition: all 0.16s var(--ease);
}

.btn:hover {
  border-color: var(--line-strong);
  box-shadow: var(--shadow-sm);
}

.btn--brand {
  background: var(--brand);
  border-color: var(--brand);
  color: var(--brand-ink);
}

.btn--brand:hover {
  background: var(--brand-hover);
  border-color: var(--brand-hover);
}

.btn--sm {
  height: 36px;
  padding: 0 16px;
  font-size: 13.5px;
}

.btn svg {
  width: 16px;
  height: 16px;
}

.btn.is-done {
  background: var(--surface);
  border-color: var(--line);
  color: var(--muted-2);
  box-shadow: none;
  cursor: default;
  pointer-events: none;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 34px;
}

.pagination a,
.pagination span {
  min-width: 40px;
  height: 40px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--surface);
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
}

.pagination [aria-current="page"] {
  background: var(--brand);
  border-color: var(--brand);
  color: var(--brand-ink);
  font-weight: 700;
}

.pagination a:hover {
  color: var(--text-strong);
  border-color: var(--line-strong);
}

.results-note {
  font-size: 13.5px;
  color: var(--muted-2);
  margin-bottom: 22px;
}

/* Page hero (category / archive) ----------------------------------------- */

.page-hero {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.page-hero__inner {
  padding-block: 30px 26px;
}

.page-hero__eyebrow {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--brand);
  margin-bottom: 8px;
}

.page-hero__title {
  font-size: clamp(28px, 4vw, 40px);
  letter-spacing: -0.03em;
}

.page-hero__meta {
  margin-top: 10px;
  font-size: 14px;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
}

/* 09. Sidebar ============================================================ */

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 22px;
  position: sticky;
  top: calc(var(--header-h) + 8px);
}

.widget {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.widget__head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 15px 18px 12px;
  border-bottom: 1px solid var(--line);
}

.widget__title {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.widget__head svg {
  width: 17px;
  height: 17px;
  color: var(--brand);
}

.widget__body {
  padding: 16px 18px;
}

.q-list {
  display: flex;
  flex-direction: column;
}

.q-list li {
  display: flex;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}

.q-list li:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.q-list li:first-child {
  padding-top: 0;
}

.q-list__rank {
  font-size: 12px;
  font-weight: 700;
  color: var(--brand);
  font-variant-numeric: tabular-nums;
  flex: none;
  width: 16px;
  padding-top: 2px;
}

.q-list a {
  color: var(--text);
  line-height: 1.4;
}

.q-list a:hover {
  color: var(--brand);
}

.pop-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Source strip widget ----------------------------------------------------- */

.src-strip {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.src-strip__row {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 8px;
  border-radius: var(--radius-sm);
  transition: background 0.16s var(--ease);
}

.src-strip__row:hover {
  background: var(--surface-2);
}

.src-strip__logo {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  object-fit: contain;
  background: var(--surface-2);
  flex: none;
}

.src-strip__name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-strong);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.src-strip__time {
  margin-left: auto;
  font-size: 12px;
  color: var(--muted-2);
  flex: none;
}

/* Sidebar variant of the compact card: the rail version is too heavy for a
   324px column, so the thumb shrinks and the rank gutter tightens. */
.sidebar .card--compact {
  gap: 10px;
}

.sidebar .card--compact .card__media {
  width: 72px;
  aspect-ratio: 1 / 1;
  border-radius: var(--radius-xs);
}

.sidebar .card--compact .card__title {
  font-size: 14.5px;
  -webkit-line-clamp: 3;
}

.sidebar .card__rank {
  width: 20px;
  font-size: 17px;
  padding-top: 1px;
}

.sidebar .pop-list .card__meta {
  font-size: 11.5px;
  gap: 9px;
}

/* 10. Ad slots =========================================================== */

.ad-slot {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 110px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  background: repeating-linear-gradient(
    -45deg,
    transparent 0 8px,
    color-mix(in oklab, var(--line) 45%, transparent) 8px 9px
  );
  color: var(--muted-2);
  font-size: 12px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  font-weight: 600;
}

.ad-slot--tall {
  min-height: 260px;
}

.ad-slot--inline {
  min-height: 128px;
}

.ad-slot__label {
  padding: 4px 10px;
  background: var(--surface);
  border-radius: var(--radius-pill);
  border: 1px solid var(--line);
}

/* 10b. Category sections on the homepage ================================= */

/* Mirrors the homepage categories the controller already reads via the
   category_feat_at_home flag. Google-News style topic columns. */
.topic-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(296px, 1fr));
  gap: 30px 36px;
}

.topic__head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding-bottom: 13px;
  margin-bottom: 4px;
  border-bottom: 2px solid var(--rule-strong);
}

.topic__name {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.012em;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.topic__dot {
  width: 9px;
  height: 9px;
  border-radius: 3px;
  background: var(--brand);
  flex: none;
}

.topic__more {
  margin-left: auto;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 3px;
  flex: none;
}

.topic__more:hover {
  color: var(--brand);
}

.topic__more svg {
  width: 13px;
  height: 13px;
}

.topic-item {
  display: flex;
  gap: 11px;
  padding: 13px 0;
  border-bottom: 1px solid var(--line);
  align-items: flex-start;
}

.topic-item:last-child {
  border-bottom: 0;
}

.topic-item__logo {
  width: 22px;
  height: 22px;
  border-radius: 5px;
  object-fit: contain;
  background: var(--surface-2);
  flex: none;
  margin-top: 1px;
}

.topic-item__title {
  font-size: 14.5px;
  font-weight: 600;
  line-height: 1.34;
  letter-spacing: -0.008em;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.topic-item__title a:hover {
  color: var(--brand);
}

.topic-item__meta {
  margin-top: 5px;
  font-size: 11.5px;
  color: var(--muted-2);
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
}

/* 11. Sources directory ================================================== */

.src-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 18px;
}

.src-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: box-shadow 0.2s var(--ease), transform 0.2s var(--ease),
    border-color 0.2s var(--ease);
}

.src-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--line-strong);
  transform: translateY(-2px);
}

.src-card__head {
  display: flex;
  align-items: center;
  gap: 12px;
}

.src-card__logo {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  object-fit: contain;
  background: var(--surface-2);
  border: 1px solid var(--line);
  flex: none;
}

.src-card__name {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.012em;
  line-height: 1.25;
}

.src-card__domain {
  font-size: 12.5px;
  color: var(--muted-2);
}

.src-card__desc {
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.src-card__foot {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  font-size: 12.5px;
  color: var(--muted-2);
}

.follow-btn {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 13px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--line-strong);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-strong);
  background: var(--surface);
  transition: all 0.16s var(--ease);
}

.follow-btn:hover {
  border-color: var(--brand);
  color: var(--brand);
}

.follow-btn[aria-pressed="true"] {
  background: var(--brand-soft);
  border-color: var(--brand);
  color: var(--brand);
}

.follow-btn svg {
  width: 13px;
  height: 13px;
}

/* Source profile header --------------------------------------------------- */

.profile {
  display: flex;
  align-items: flex-start;
  gap: 22px;
  padding: 28px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
}

.profile__logo {
  width: 76px;
  height: 76px;
  border-radius: var(--radius);
  object-fit: contain;
  background: var(--surface-2);
  border: 1px solid var(--line);
  padding: 10px;
  flex: none;
}

.profile__main {
  flex: 1;
  min-width: 0;
}

.profile__name {
  font-size: clamp(24px, 3vw, 32px);
  letter-spacing: -0.028em;
}

.profile__domain {
  margin-top: 4px;
  font-size: 14px;
  color: var(--brand);
  font-weight: 500;
}

.profile__desc {
  margin-top: 12px;
  font-size: 15px;
  line-height: 1.6;
  color: var(--muted);
  max-width: 68ch;
}

.profile__actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 16px;
}

.profile__actions .btn svg {
  width: 14px;
  height: 14px;
  opacity: 0.8;
}

.profile__stats {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 28px;
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.stat__value {
  font-size: 19px;
  font-weight: 700;
  color: var(--text-strong);
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}

.stat__label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted-2);
}

/* 12. Article page ======================================================= */

.crumbs {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted-2);
  padding-block: 20px 0;
  flex-wrap: wrap;
}

.crumbs a:hover {
  color: var(--brand);
}

.crumbs svg {
  width: 13px;
  height: 13px;
  opacity: 0.55;
}

.article {
  max-width: 760px;
}

.article__head {
  padding-block: 18px 24px;
}

.article__cat {
  display: inline-flex;
  align-items: center;
  padding: 5px 12px;
  border-radius: var(--radius-pill);
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
  margin-bottom: 14px;
}

.article__title {
  font-size: clamp(28px, 4.4vw, 43px);
  line-height: 1.1;
  letter-spacing: -0.033em;
  margin-bottom: 18px;
}

.article__byline {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
}

.byline__avatar {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-pill);
  object-fit: contain;
  background: var(--surface-2);
  border: 1px solid var(--line);
  flex: none;
}

.byline__name {
  font-size: 14.5px;
  font-weight: 700;
  color: var(--text-strong);
}

.byline__meta {
  font-size: 12.5px;
  color: var(--muted-2);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.byline__sep {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--muted-2);
  display: inline-block;
}

.article__hero {
  margin-block: 26px;
  border-radius: var(--radius);
  overflow: hidden;
  aspect-ratio: 16 / 9;
  border: 1px solid var(--line);
}

.article__hero img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.article__body {
  font-size: 17.5px;
  line-height: 1.75;
  color: var(--text);
}

.article__body > * + * {
  margin-top: 1.15em;
}

.article__body p {
  max-width: 68ch;
}

.article__body a {
  color: var(--brand);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.article__body h2 {
  font-size: 24px;
  margin-top: 1.7em;
  letter-spacing: -0.022em;
}

.article__body blockquote {
  border-left: 3px solid var(--brand);
  padding: 4px 0 4px 20px;
  font-size: 19px;
  font-style: italic;
  color: var(--muted);
}

.article__note {
  margin-top: 30px;
  padding: 16px 18px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid var(--line);
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--muted);
}

.article__note strong {
  color: var(--text-strong);
}

/* Action bar: share + like ------------------------------------------------- */

.action-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 28px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}

.action-bar__label {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted-2);
  margin-right: 2px;
}

.share-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  transition: all 0.16s var(--ease);
}

.share-btn:hover {
  color: var(--text-strong);
  border-color: var(--line-strong);
  transform: translateY(-1px);
}

.share-btn svg {
  width: 17px;
  height: 17px;
}

.share-btn[data-copied="true"] {
  color: var(--accent-good);
  border-color: var(--accent-good);
}

/* Like / reaction widget -------------------------------------------------- */

.like-btn {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  height: 40px;
  padding: 0 16px 0 14px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--text-strong);
  font-size: 14px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  transition: all 0.18s var(--ease);
}

.like-btn:hover {
  border-color: var(--brand);
  color: var(--brand);
}

.like-btn svg {
  width: 18px;
  height: 18px;
  transition: transform 0.24s var(--ease);
}

.like-btn[aria-pressed="true"] {
  background: var(--brand-soft);
  border-color: var(--brand);
  color: var(--brand);
}

.like-btn[aria-pressed="true"] svg {
  fill: currentColor;
}

.like-btn.is-pop svg {
  animation: heartbeat 0.42s var(--ease);
}

@keyframes heartbeat {
  0% {
    transform: scale(1);
  }
  35% {
    transform: scale(1.34);
  }
  70% {
    transform: scale(0.94);
  }
  100% {
    transform: scale(1);
  }
}

.read-original {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 16px 18px;
  margin-top: 26px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.read-original__logo {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  object-fit: contain;
  background: var(--surface-2);
  border: 1px solid var(--line);
  flex: none;
}

.read-original__text {
  flex: 1;
  min-width: 0;
  font-size: 13.5px;
  color: var(--muted);
}

.read-original__text b {
  display: block;
  font-size: 14.5px;
  color: var(--text-strong);
}

/* 12a. Embedded social + video content =================================== */

/* Imported bodies can carry a YouTube iframe or a social post embed. The
   importer already whitelists iframes from iframe_allowed_domains; these
   rules make whatever survives look intentional instead of unstyled. */
.embed {
  margin: 1.6em 0;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--surface);
}

.embed__media {
  position: relative;
  aspect-ratio: 16 / 9;
  background: oklch(0.2 0.01 265);
}

.embed__media iframe,
.embed__media video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.embed__cap {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 11px 14px;
  font-size: 12.5px;
  color: var(--muted);
  border-top: 1px solid var(--line);
}

.embed__cap svg {
  width: 15px;
  height: 15px;
  color: var(--muted-2);
  flex: none;
}

/* Social post embeds (X / Bluesky / Mastodon / Threads style blockquote). */
.embed--social {
  padding: 16px 18px;
}

.embed--social .social-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.embed--social .social-avatar {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-pill);
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
}

.embed--social .social-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-strong);
}

.embed--social .social-handle {
  font-size: 12.5px;
  color: var(--muted-2);
}

.embed--social p {
  font-size: 16px;
  line-height: 1.55;
}

.embed--social .social-foot {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 12.5px;
  color: var(--muted-2);
}

/* 12b. Comments ========================================================== */

.comments {
  margin-top: 44px;
}

.composer {
  display: flex;
  gap: 12px;
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.composer__avatar {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-pill);
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  background: var(--muted-2);
}

.composer__main {
  flex: 1;
  min-width: 0;
}

.composer__input {
  width: 100%;
  min-height: 74px;
  resize: vertical;
  padding: 11px 13px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
  outline: none;
  transition: border-color 0.16s var(--ease), box-shadow 0.16s var(--ease);
}

.composer__input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--brand) 16%, transparent);
}

.composer__foot {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.composer__hint {
  font-size: 12.5px;
  color: var(--muted-2);
}

.comment {
  display: flex;
  gap: 13px;
  padding: 20px 0;
  border-bottom: 1px solid var(--line);
}

.comment:last-child {
  border-bottom: 0;
}

.comment__avatar {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-pill);
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
}

.comment__body {
  flex: 1;
  min-width: 0;
}

.comment__head {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
}

.comment__author {
  font-size: 14.5px;
  font-weight: 700;
  color: var(--text-strong);
}

.comment__time {
  font-size: 12.5px;
  color: var(--muted-2);
}

.comment__text {
  margin-top: 7px;
  font-size: 15px;
  line-height: 1.6;
  color: var(--text);
}

.comment__actions {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 10px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted-2);
}

.comment__action {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: inherit;
}

.comment__action:hover {
  color: var(--brand);
}

.comment__action svg {
  width: 14px;
  height: 14px;
}

.comment__action[aria-pressed="true"] {
  color: var(--brand);
}

.comment__action[aria-pressed="true"] svg {
  fill: currentColor;
}

.comment__replies {
  margin-top: 16px;
  padding-left: 16px;
  border-left: 2px solid var(--line);
}

.comment__replies .comment {
  padding: 12px 0;
  border-bottom: 0;
}

/* 13. Footer ============================================================= */

.site-footer {
  margin-top: 56px;
  border-top: 1px solid var(--line);
  background: var(--surface);
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.6fr repeat(3, minmax(0, 1fr));
  gap: 34px;
  padding-block: 44px 34px;
}

.footer-brand {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.04em;
  color: var(--brand);
}

.footer-blurb {
  margin-top: 12px;
  font-size: 14px;
  line-height: 1.6;
  color: var(--muted);
  max-width: 38ch;
}

.footer-title {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted-2);
  margin-bottom: 14px;
}

.footer-links {
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 14px;
}

.footer-links a {
  color: var(--muted);
}

.footer-links a:hover {
  color: var(--brand);
}

.footer-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding-block: 18px 26px;
  border-top: 1px solid var(--line);
  font-size: 13px;
  color: var(--muted-2);
}

/* Inline icon base size. Component rules are more specific and win, so this
   only catches icons that would otherwise stretch to the container width. */
.ic {
  width: 16px;
  height: 16px;
  flex: none;
}

.embed--social .social-foot svg {
  width: 15px;
  height: 15px;
  flex: none;
  color: var(--muted-2);
}

.embed--social .social-foot span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

/* 14. Utilities ========================================================== */

.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;
}

.section + .section {
  margin-top: 44px;
}

.mt-0 {
  margin-top: 0;
}

.is-hidden {
  display: none !important;
}

.text-muted {
  color: var(--muted);
}

/* 15. Responsive ========================================================= */

@media (max-width: 1080px) {
  .layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 34px;
  }

  .sidebar {
    position: static;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    align-items: start;
  }

  .footer-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 900px) {
  /* Header: the search form gets its own row instead of being squeezed
     between the brand and the action buttons. Applies to tablets too. */
  :root {
    /* With a two row header, sticking it would eat a third of the screen and
       scroll-padding no longer needs to clear it. */
    --header-h: 16px;
  }

  /* relative, not static: the header is no longer sticky here, but z-index is
     ignored on a static box, which left the whole header underneath anything
     absolutely positioned further down the page. relative keeps the layout
     identical and makes the 50 count. */
  .site-header {
    position: relative;
  }

  .header-inner {
    flex-wrap: wrap;
    gap: 10px 12px;
    padding-block: 10px;
    min-height: 0;
  }

  .search {
    order: 3;
    flex: 1 0 100%;
    max-width: none;
  }

  .hero {
    grid-template-columns: minmax(0, 1fr);
    padding: 20px;
  }

  .hero__rail {
    border-left: 0;
    border-top: 1px solid var(--line);
    padding-left: 0;
    padding-top: 20px;
  }

  .hero__lead .card__title {
    font-size: 25px;
  }

  .profile {
    flex-direction: column;
    padding: 22px;
  }
}

@media (max-width: 720px) {
  :root {
    --gutter: 16px;
  }

  .header-inner {
    gap: 8px 12px;
  }

  .brand-word {
    font-size: 23px;
  }

  .header-actions {
    gap: 2px;
  }

  .icon-btn {
    width: 36px;
    height: 36px;
  }

  .search__submit span {
    display: none;
  }

  .search__submit {
    width: 32px;
    padding: 0;
    justify-content: center;
  }

  .feed {
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 22px 18px;
  }

  .card__title {
    font-size: 16.5px;
  }

  .src-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .footer-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 26px;
  }

  .article__body {
    font-size: 16.5px;
  }

  /* Like button drops below the share row instead of squeezing it. */
  .like-btn {
    margin-left: 0;
    width: 100%;
    justify-content: center;
  }
}

@media (max-width: 420px) {
  .card--compact .card__media {
    width: 92px;
  }

  .hero__lead .card__title {
    font-size: 22px;
  }

  .brand-tag {
    display: none;
  }

  .brand-word {
    font-size: 21px;
  }
}

@media (max-width: 360px) {
  .header-actions {
    display: none;
  }
}

/* 16. Account flow ======================================================== */

.auth-shell {
  max-width: 480px;
  margin: 0 auto;
  padding: 44px 0 20px;
}

.auth-shell--wide {
  max-width: 720px;
}

.auth-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg, 20px);
  padding: 30px;
  box-shadow: var(--shadow-md);
}

.auth-panel__title {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-strong);
  margin-bottom: 6px;
}

.auth-panel__sub {
  color: var(--muted);
  font-size: 14.5px;
  margin-bottom: 22px;
}

.auth-panel__foot {
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  font-size: 14px;
  color: var(--muted);
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.auth-panel__foot a {
  color: var(--brand);
  font-weight: 600;
}

.auth-steps {
  display: flex;
  gap: 8px;
  margin-bottom: 22px;
  flex-wrap: wrap;
}

.auth-steps span {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted-2);
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
}

.auth-steps span[data-on="true"] {
  background: var(--brand-soft);
  border-color: var(--brand);
  color: var(--brand);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.auth-form[data-step-body] {
  gap: 16px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field__label {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-strong);
}

.field__input,
.field textarea {
  width: 100%;
  min-height: 46px;
  padding: 11px 14px;
  font: inherit;
  font-size: 15px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  transition: border-color 0.16s var(--ease), box-shadow 0.16s var(--ease);
}

.field textarea {
  min-height: 110px;
  resize: vertical;
}

.field__input:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}

.field.has-error .field__input,
.field.has-error textarea {
  border-color: oklch(0.6 0.19 25);
}

.field__hint {
  font-size: 12.5px;
  color: var(--muted);
}

.field__error {
  font-size: 12.5px;
  color: oklch(0.58 0.2 25);
  min-height: 0;
}

.field__row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: var(--muted);
}

.form-note {
  font-size: 13.5px;
  min-height: 0;
}

.form-note--ok {
  color: var(--accent-good);
}

.form-note--error {
  color: oklch(0.58 0.2 25);
}

.strength {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
}

.strength[data-score="3"],
.strength[data-score="4"] {
  color: var(--accent-good);
}

.strength[data-score="1"] {
  color: oklch(0.66 0.15 55);
}

.acct-empty {
  text-align: center;
  padding: 42px 22px;
  background: var(--surface);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  color: var(--muted);
}

.acct-empty h3 {
  font-size: 19px;
  font-weight: 700;
  color: var(--text-strong);
  margin-bottom: 8px;
}

.acct-empty .btn {
  margin-top: 14px;
}

.account__avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-pill);
  color: oklch(1 0 0);
  font-size: 14px;
  font-weight: 700;
}

.acct-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  border-radius: var(--radius-pill);
  color: oklch(1 0 0);
  font-size: 22px;
  font-weight: 700;
  flex: none;
}

.acct-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 22px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.acct-header__name {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-strong);
}

.acct-header__meta {
  color: var(--muted);
  font-size: 14px;
}

.acct-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 22px;
  flex-wrap: wrap;
}

.acct-tabs a {
  padding: 9px 14px;
  font-size: 14.5px;
  font-weight: 600;
  color: var(--muted);
  border-bottom: 2px solid transparent;
}

.acct-tabs a[aria-current="page"],
.acct-tabs a:hover {
  color: var(--brand);
  border-bottom-color: var(--brand);
}

@media (max-width: 720px) {
  .auth-shell {
    padding-top: 24px;
  }

  .auth-panel {
    padding: 22px;
    border-radius: var(--radius);
  }
}

/* Motion & print ---------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
