/* ============================================================
   Cobbelmoss Press — main stylesheet
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=UnifrakturMaguntia&display=swap');

/* --- Reset & base ------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --color-bg:          #0f0f0f;
  --color-surface:     #1a1a1a;
  --color-surface-2:   #242424;
  --color-border:      #2e2e2e;
  --color-text:        #e8e8e8;
  --color-text-muted:  #888;
  --color-accent:      #00e5a0;   /* tweak to brand colour */
  --color-link:        #e8e8e8;
  --color-link-hover:  #00e5a0;

  --font-sans:   'Inter', system-ui, -apple-system, sans-serif;
  --font-serif:  'Georgia', 'Times New Roman', serif;
  --font-magic:  'Almendra', 'Palatino Linotype', serif;

  --header-height: 56px;
  --feed-width:    340px;
  --max-content:   1280px;
  --gap:           1.5rem;
}

html { font-size: 16px; scroll-behavior: smooth; }

body {
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-sans);
  line-height: 1.6;
  min-height: 100vh;
}

a { color: var(--color-link); text-decoration: none; }
a:hover { color: var(--color-link-hover); }

img { display: block; max-width: 100%; height: auto; }

/* --- Masthead ---------------------------------------------- */
.site-masthead {
  position: relative;
  background: var(--color-bg);
  border-bottom: 3px double var(--color-border);
  padding: 1.25rem var(--gap) 0.75rem;
  text-align: center;
  margin-bottom: 0;
}

/* Ivy corner flourish — sits at the masthead rule line, left of the
   title, draping down the left gutter into the content area. */
.ivy-corner {
  position: absolute;
  top: 40px;          /* centers the leaf band on the rule line */
  left: 20px;
  width: 324px;       /* 175 × 1.85 */
  height: auto;
  pointer-events: none;
  user-select: none;
  z-index: 1;
}

/* Hanging ivy tendril — exported from the same 110×135 artboard as
   .ivy-corner, so an identical top/left/width lines its top up with the
   corner piece's lower-left. Sways from that join like a dangling vine. */
.ivy-hang {
  position: absolute;
  top: 40px;
  left: 20px;
  width: 324px;                   /* same 1.85 scale as .ivy-corner */
  height: auto;
  pointer-events: none;
  user-select: none;
  z-index: 1;
  transform-origin: 36px 135px;   /* top of the visible leaf cluster */
  animation: ivy-sway 5s ease-in-out infinite;
}

@keyframes ivy-sway {
  0%, 100% { transform: rotate(-2deg); }
  50%      { transform: rotate(2deg); }
}

@media (prefers-reduced-motion: reduce) {
  .ivy-hang { animation: none; }
}

/* Dateline and title stay above the leaves; the masthead rule lines are
   left below them, so the ivy covers the line instead of the line cutting
   across the leaves. */
.site-masthead__meta,
.site-masthead__title {
  position: relative;
  z-index: 2;
}

@media (max-width: 600px) {
  .ivy-corner,
  .ivy-hang { display: none; }
}


.site-masthead__meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: var(--max-content);
  margin: 0 auto 0.6rem;
  font-size: 0.6875rem;
  color: var(--color-text-muted);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.site-masthead__title-wrap {
  display: flex;
  align-items: center;
  gap: 1rem;
  max-width: var(--max-content);
  margin: 0 auto;
}

.site-masthead__rule {
  flex: 1;
  height: 1px;
  background: var(--color-border);
}

.site-masthead__title {
  font-family: 'UnifrakturMaguntia', 'Old English Text MT', serif;
  font-size: clamp(2rem, 5vw, 3.75rem);
  font-weight: 400;
  letter-spacing: 0.01em;
  color: var(--color-text);
  white-space: nowrap;
  line-height: 1.1;
}

.site-masthead__title:hover { color: var(--color-text); }

/* --- Section ribbon ---------------------------------------- */
.section-ribbon {
  border-bottom: 1px solid var(--color-border);
  border-top: 1px solid var(--color-border);
  margin-bottom: var(--gap);
}

.section-ribbon__list {
  display: flex;
  list-style: none;
  gap: 0;
}

.section-ribbon__item a {
  display: block;
  padding: 0.5rem 1rem;
  font-family: var(--font-magic);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-muted);
  transition: color 0.15s, background 0.15s;
}

.section-ribbon__item a:hover {
  color: var(--color-text);
  background: var(--color-surface);
}

.section-ribbon__item--active a {
  color: var(--color-accent);
  border-bottom: 2px solid var(--color-accent);
}

/* --- Masonry grid ------------------------------------------ */
.masonry-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-areas:
    "large large mid1"
    "large large mid2";
  gap: var(--gap);
}

[data-slot="large"]  { grid-area: large; }
[data-slot="mid-1"]  { grid-area: mid1; }
[data-slot="mid-2"]  { grid-area: mid2; }

[data-slot="mid-1"],
[data-slot="mid-2"] {
  border-left: 1px solid var(--color-border);
  padding-left: var(--gap);
}

/* --- Secondary grid (2-col horizontal cards) --------------- */
.secondary-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  border-top: 2px solid var(--color-border);
  margin-top: var(--gap);
}

.story--secondary {
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 0.75rem;
  align-items: start;
  padding: 0.875rem 0;
  border-bottom: 1px solid var(--color-border);
}

.secondary-grid .story--secondary:nth-child(odd) {
  padding-right: var(--gap);
}

.secondary-grid .story--secondary:nth-child(even) {
  padding-left: var(--gap);
  border-left: 1px solid var(--color-border);
}

.story--secondary .story__image-link { display: block; overflow: hidden; }

.story--secondary .story__image {
  width: 100px;
  height: 70px;
  object-fit: cover;
  flex-shrink: 0;
}

.story--secondary .story__body {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.story--secondary .story__title {
  font-family: var(--font-magic);
  font-size: 0.9375rem;
  font-weight: 700;
  line-height: 1.35;
}

.story--secondary .dummy__image {
  width: 100px;
  height: 70px;
  flex-shrink: 0;
}

/* --- Story cards ------------------------------------------- */
.story {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  height: 100%;
}

.story__image-link { display: block; overflow: hidden; }

/* Large hero — image fills slot, text overlaid at bottom */
.story--large {
  position: relative;
  min-height: 380px;
}

.story--large .story__image-link {
  position: absolute;
  inset: 0;
}

.story--large .story__image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.story--large:hover .story__image { transform: scale(1.02); }

.story--large .story__body {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 2rem 1.25rem 1.25rem;
  background: linear-gradient(to top, rgba(0,0,0,0.92) 0%, rgba(0,0,0,0.6) 55%, transparent 100%);
  z-index: 1;
}

/* Dummy large fills the slot without an image */
.story--large.dummy {
  background: var(--color-surface);
  border: 1px dashed var(--color-border);
}

.story--large.dummy .story__body {
  background: linear-gradient(to top, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0.4) 100%);
}

.story--mid .story__image {
  width: 100%;
  height: 140px;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.story--mid .story__image-link:hover .story__image { transform: scale(1.03); }

.story__body {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  flex: 1;
}

.story__tag {
  display: inline-block;
  font-size: 0.625rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--color-accent);
}

.story--large .story__tag { color: var(--color-accent); }

.story--large .story__title {
  font-family: var(--font-magic);
  font-size: clamp(1.4rem, 2.8vw, 2rem);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: 0.01em;
  color: #fff;
  text-shadow: 0 1px 4px rgba(0,0,0,0.5);
}

.story--mid .story__title {
  font-family: var(--font-magic);
  font-size: 1.0625rem;
  font-weight: 700;
  line-height: 1.3;
}

.story--small .story__title {
  font-family: var(--font-magic);
  font-size: 0.9375rem;
  font-weight: 700;
  line-height: 1.35;
}

.story__title a:hover { color: var(--color-accent); }
.story--large .story__title a { color: #fff; }
.story--large .story__title a:hover { color: var(--color-accent); }

.story--large .story__excerpt {
  font-size: 0.9375rem;
  color: rgba(255,255,255,0.82);
  line-height: 1.55;
  margin-top: 0.2rem;
}

.story__meta {
  display: flex;
  gap: 0.4rem;
  font-size: 0.6875rem;
  color: var(--color-text-muted);
  margin-top: auto;
  padding-top: 0.4rem;
  flex-wrap: wrap;
}

.story--large .story__meta { color: rgba(255,255,255,0.6); }

.story__meta a { color: var(--color-text-muted); font-weight: 600; }
.story__meta a:hover { color: var(--color-text); }
.story__meta time::before { content: "· "; }

/* --- Dummy post placeholders ------------------------------- */
.dummy__image {
  width: 100%;
  height: 280px;
  background: var(--color-surface);
  border: 1px dashed var(--color-border);
  border-radius: 2px;
}

.dummy__image--mid { height: 140px; }

.post-list-item .dummy__image {
  width: 80px;
  height: 60px;
  flex-shrink: 0;
}

.dummy-list { margin-top: var(--gap); }

.dummy__text { color: var(--color-text-muted); }
.dummy__text--title { color: var(--color-text); opacity: 0.55; }

.dummy .story__tag { opacity: 0.5; }
.dummy .story__meta { opacity: 0.45; }
.dummy .feed-entry__author { opacity: 0.7; }
.dummy .feed-entry__time { opacity: 0.5; }
.dummy.feed-entry { opacity: 0.8; }

.dummy__avatar { background: var(--color-surface-2); }

/* --- Twunkle header ---------------------------------------- */
.twunkle-header {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--color-border);
}

.twunkle-header__bird {
  font-size: 1rem;
  line-height: 1;
}

.twunkle-header__name {
  font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
  font-size: 1.125rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--color-text);
}

/* --- Homepage independent column scrolling ----------------- */
body.home-template {
  height: 100dvh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

body.home-template .site-main {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

body.home-template .homepage-layout {
  flex: 1;
  min-height: 0;
  padding-bottom: 0;
}

body.home-template .news-scroll-pane {
  overflow-y: auto;
  height: 100%;
  scrollbar-width: thin;
  scrollbar-color: var(--color-border) transparent;
  padding-right: 0.5rem;
}

body.home-template .news-scroll-pane::-webkit-scrollbar { width: 4px; }
body.home-template .news-scroll-pane::-webkit-scrollbar-track { background: transparent; }
body.home-template .news-scroll-pane::-webkit-scrollbar-thumb { background: var(--color-border); border-radius: 2px; }

/* --- Homepage split layout --------------------------------- */
.homepage-layout {
  max-width: var(--max-content);
  margin: 0 auto;
  padding: 0 var(--gap) var(--gap);
  display: grid;
  grid-template-columns: 1fr var(--feed-width);
  gap: var(--gap);
  align-items: start;
}

/* --- News column ------------------------------------------- */
.news-scroll-pane {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: calc(var(--gap) * 2);
}

/* Hero post */
.hero-post {
  display: grid;
  grid-template-rows: auto auto;
  gap: 0;
}

.hero-post__image-link { display: block; overflow: hidden; }

.hero-post__image {
  width: 100%;
  max-height: 480px;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.hero-post__image-link:hover .hero-post__image { transform: scale(1.02); }

.hero-post__body {
  padding: 1.25rem 0 0;
}

.hero-post__title {
  font-size: clamp(1.75rem, 3vw, 2.5rem);
  font-family: var(--font-serif);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin: 0.4rem 0 0.75rem;
}

.hero-post__title a:hover { color: var(--color-accent); }

.hero-post__excerpt {
  font-size: 1.0625rem;
  color: var(--color-text-muted);
  max-width: 65ch;
}

/* Post grid (secondary stories) */
.post-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--gap);
}

.post-card { display: flex; flex-direction: column; gap: 0.6rem; }

.post-card--wide {
  grid-column: span 2;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--gap);
  align-items: start;
}

.post-card--wide .post-card__image-link { height: 100%; }

.post-card--wide .post-card__image {
  width: 100%;
  height: 100%;
  max-height: 280px;
  object-fit: cover;
}

.post-card__image-link { display: block; overflow: hidden; }

.post-card__image {
  width: 100%;
  height: 160px;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.post-card__image-link:hover .post-card__image { transform: scale(1.03); }

.post-card__body { display: flex; flex-direction: column; gap: 0.3rem; }

.post-card__title {
  font-size: 1.0625rem;
  font-family: var(--font-serif);
  font-weight: 700;
  line-height: 1.3;
}

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

/* Post list (remaining stories) */
.post-list { display: flex; flex-direction: column; gap: 0; }

.post-list__heading {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--color-text-muted);
  border-top: 2px solid var(--color-accent);
  padding-top: 0.5rem;
  margin-bottom: 0.5rem;
}

.post-list-item {
  display: grid;
  grid-template-columns: 80px 1fr;
  gap: 0.75rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--color-border);
}

.post-list-item:last-child { border-bottom: none; }

.post-list-item__image-link { display: block; overflow: hidden; }

.post-list-item__image {
  width: 80px;
  height: 60px;
  object-fit: cover;
}

.post-list-item__title {
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1.35;
}

.post-list-item__title a:hover { color: var(--color-accent); }

.post-list-item__body { display: flex; flex-direction: column; gap: 0.2rem; }

/* --- Shared post meta & tags ------------------------------- */
.post-tag {
  display: inline-block;
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-accent);
}

.post-tag--small { font-size: 0.625rem; }

.post-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8125rem;
  color: var(--color-text-muted);
  flex-wrap: wrap;
}

.post-meta--small { font-size: 0.75rem; }

.post-meta__author { color: var(--color-text-muted); font-weight: 600; }
.post-meta__author:hover { color: var(--color-text); }

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

.post-meta .post-meta__author + time::before,
.post-meta .post-meta__author-group + time::before,
.post-meta time + time::before { content: "·"; }

.post-meta__author-group {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.post-meta__avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--color-surface-2);
  flex-shrink: 0;
}

.post-meta__avatar--placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.6875rem;
  font-weight: 700;
  color: var(--color-text-muted);
}

/* --- Feed column ------------------------------------------- */
.feed-column {
  position: static;
  display: flex;
  flex-direction: column;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 4px;
  overflow: hidden;
  height: 100%;
}

.feed-column__inner {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

.feed-column__heading {
  flex-shrink: 0;
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--color-text-muted);
  padding: 0.875rem 1rem 0.75rem;
  border-bottom: 1px solid var(--color-border);
}

.feed {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--color-border) transparent;
}

.feed::-webkit-scrollbar { width: 4px; }
.feed::-webkit-scrollbar-track { background: transparent; }
.feed::-webkit-scrollbar-thumb { background: var(--color-border); border-radius: 2px; }

/* Individual feed entry */
.feed-entry {
  padding: 1rem;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  transition: background 0.15s;
}

.feed-entry:last-child { border-bottom: none; }
.feed-entry:hover { background: var(--color-surface-2); }

.feed-entry__header {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
}

.feed-entry__avatar {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--color-border);
}

.feed-entry__avatar--placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--color-text-muted);
}

.feed-entry__byline {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
}

.feed-entry__author {
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--color-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.feed-entry__author:hover { color: var(--color-accent); }

.feed-entry__time {
  font-size: 0.6875rem;
  color: var(--color-text-muted);
}

.feed-entry__time time { font-size: inherit; }

.feed-entry__content {
  font-size: 0.875rem;
  line-height: 1.55;
  color: var(--color-text);
}

.feed-entry__title {
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.feed-entry__title a:hover { color: var(--color-accent); }

.feed-entry__image {
  width: 100%;
  max-height: 180px;
  object-fit: cover;
  border-radius: 2px;
}

.feed-entry__footer {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.feed-entry__tag {
  font-size: 0.6875rem;
  color: var(--color-text-muted);
}

.feed-entry__tag:hover { color: var(--color-accent); }

.feed-empty {
  padding: 2rem 1rem;
  font-size: 0.875rem;
  color: var(--color-text-muted);
  text-align: center;
}

/* --- Single post layout ------------------------------------ */
.post-layout {
  max-width: 720px;
  margin: 0 auto;
  padding: calc(var(--gap) * 2) var(--gap);
}

.post-full__header { margin-bottom: 2rem; }

.post-full__title {
  font-size: clamp(1.75rem, 4vw, 2.75rem);
  font-family: var(--font-serif);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin: 0.4rem 0 1rem;
}

.post-full__excerpt {
  font-size: 1.125rem;
  color: var(--color-text-muted);
  margin-bottom: 1rem;
}

.post-full__feature-image {
  margin: 0 0 2rem;
}

.post-full__feature-image img { width: 100%; border-radius: 2px; }

.post-full__feature-image figcaption {
  font-size: 0.8125rem;
  color: var(--color-text-muted);
  margin-top: 0.5rem;
  text-align: center;
}

/* Ghost Koenig card width classes (required by theme validator) */
.kg-width-wide {
  margin-left: -8vw;
  margin-right: -8vw;
}

.kg-width-full {
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
  width: 100vw;
}

.kg-width-wide img,
.kg-width-full img {
  width: 100%;
}

/* Ghost card/content styles */
.post-full__content {
  font-family: var(--font-serif);
  font-size: 1.0625rem;
  line-height: 1.75;
}

.gh-content h2,
.gh-content h3,
.gh-content h4 {
  font-family: var(--font-sans);
  margin: 2rem 0 0.75rem;
}

.gh-content p { margin: 0 0 1.25em; }

.gh-content a { color: var(--color-accent); text-decoration: underline; }

.gh-content blockquote {
  border-left: 3px solid var(--color-accent);
  margin: 1.5rem 0;
  padding: 0.5rem 0 0.5rem 1.25rem;
  color: var(--color-text-muted);
}

.gh-content figure { margin: 1.5rem 0; }

.gh-content figcaption {
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  color: var(--color-text-muted);
  margin-top: 0.5rem;
  text-align: center;
}

/* --- Author bio card (end of article) ----------------------- */
.author-card-list {
  margin-top: 3rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.author-card {
  display: flex;
  gap: 1.25rem;
  padding: 1.5rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 4px;
}

.author-card__avatar {
  flex-shrink: 0;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--color-surface-2);
}

.author-card__avatar--placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--color-text-muted);
}

.author-card__body {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  min-width: 0;
}

.author-card__name {
  font-family: var(--font-serif);
  font-size: 1.125rem;
  font-weight: 700;
}

.author-card__name a:hover { color: var(--color-accent); }

.author-card__bio {
  font-size: 0.9375rem;
  color: var(--color-text-muted);
  line-height: 1.6;
}

/* --- Archive layout ---------------------------------------- */
.archive-layout {
  max-width: 800px;
  margin: 0 auto;
  padding: calc(var(--gap) * 2) var(--gap);
}

.archive-header { margin-bottom: 2rem; }

.archive-header__title {
  font-size: 2rem;
  font-weight: 800;
  margin-bottom: 0.5rem;
}

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

/* --- Author (persona) beat page ----------------------------- */
.author-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.75rem;
}

.author-header__avatar {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--color-border);
}

/* --- Site footer ------------------------------------------- */
.site-footer {
  border-top: 1px solid var(--color-border);
  margin-top: 4rem;
  padding: 2rem var(--gap);
}

.site-footer__inner {
  max-width: var(--max-content);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.site-footer__copy {
  font-size: 0.8125rem;
  color: var(--color-text-muted);
}

/* --- Responsive -------------------------------------------- */
@media (max-width: 1024px) {
  :root { --feed-width: 300px; }
}

@media (max-width: 768px) {
  .homepage-layout {
    grid-template-columns: 1fr;
  }

  /* The scroll-pane wrapper only exists to give headlines + more-stories
     a shared independent-scroll region on desktop. On mobile it dissolves
     so its children become direct siblings of .feed-column and can be
     reordered with the rest via `order`: headlines, then Twunkle, then
     more-stories. */
  .news-scroll-pane {
    display: contents;
  }

  body.home-template .news-scroll-pane {
    overflow: visible;
    height: auto;
    padding-right: 0;
  }

  body.home-template {
    height: auto;
    overflow-x: hidden;
    overflow-y: visible;
    display: block;
  }

  body.home-template .site-main {
    flex: initial;
    overflow-x: hidden;
    overflow-y: visible;
    display: block;
  }

  body.home-template .homepage-layout {
    flex: initial;
  }

  .news-column   { order: 1; min-width: 0; }
  .feed-column   { order: 2; min-width: 0; }
  .more-stories-section { order: 3; min-width: 0; }

  /* Twunkle collapses to a compact horizontal-scrolling strip on mobile
     instead of a full vertical feed, so it doesn't dominate the layout. */
  .feed-column {
    position: static;
    height: auto;
  }

  .feed-column__inner {
    height: auto;
  }

  .feed {
    display: flex;
    flex-direction: row;
    overflow-x: auto;
    overflow-y: hidden;
    overscroll-behavior-x: contain;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
  }

  .feed-entry {
    flex: 0 0 220px;
    width: 220px;
    height: 190px;
    overflow: hidden;
    scroll-snap-align: start;
    border-bottom: none;
    border-right: 1px solid var(--color-border);
  }

  .feed-entry:last-child { border-right: none; }

  .feed-entry__image,
  .feed-entry__footer {
    display: none;
  }

  .feed-entry__content {
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .masonry-grid {
    grid-template-columns: 1fr 1fr;
    grid-template-areas:
      "large large"
      "mid1  mid2";
  }

  [data-slot="mid-1"],
  [data-slot="mid-2"] {
    border-left: none;
    padding-left: 0;
    border-top: 1px solid var(--color-border);
    padding-top: var(--gap);
  }

  [data-slot="mid-2"] {
    border-left: 1px solid var(--color-border);
    padding-left: var(--gap);
  }
}

@media (max-width: 480px) {
  :root { --gap: 1rem; }

  .masonry-grid {
    grid-template-columns: 1fr;
    grid-template-areas:
      "large"
      "mid1"
      "mid2";
  }

  [data-slot="mid-1"],
  [data-slot="mid-2"] {
    border-left: none;
    padding-left: 0;
    border-top: 1px solid var(--color-border);
    padding-top: var(--gap);
  }

  /* Keep the 4 secondary stories as a 2x2 tile grid on mobile instead
     of collapsing to a single stacked column. */
  .secondary-grid { grid-template-columns: 1fr 1fr; }

  .site-masthead__title { font-size: 2rem; }
  .site-masthead__meta .site-masthead__tagline { display: none; }
}
