/**!
 * @file blog/css/blog.css
 * @desc Samraworld reader-view styles. Green Samraworld palette + travel-blog
 *       typography (Fraunces display / Source Sans 3 body). Public, English-only.
 * @version v7 2026-08-29 - Initial version.
 * @version v7 2026-10-18 - Larger header logo (42→60px, 48px on phones) and site name (24→28px). Base text
 *          up a step (body 17→18px, phones 16→17; story prose 18→19.5; card/feature/nav text +1px). Card and
 *          feature titles use text-wrap: pretty instead of balance — balance split long titles into
 *          equal-length lines, so they wrapped well before the edge of the card.
 * @version v7 2026-10-18 - Titles: text-wrap: wrap first (Firefox has no "pretty", so it ignored that line and
 *          kept balance). Base text up another step: body 19px (phones 18), prose 20.5px, cards/feature/nav +1px.
 * @version v7 2026-10-18 - Story photo captions (.story-fig figcaption): centered, muted, italic, under the photo.
 * @version v7 2026-10-18 - .sw-eigo: small pill under the story byline linking to the lesson on Eigo Hanasou.
 * @version v7 2026-10-18 - .sw-moved: home page "English learning has moved to Eigo Hanasou" notice card.
 * @version v7 2026-10-18 - Masthead: the Samraworld site's header gradient (#138a40 → #084a22) instead of flat
 *          #0b5528, which read darker than the site people know.
 * @version v7 2026-10-18 - Footer logo (.sw-foot__logo, 64px) above the Samraworld name.
 * @version v7 2026-10-18 - Footer brand = logo + name/tagline lockup (like the header); Eigo Hanasou link with the
 *          wordmark on a white chip (its dark text can't sit on the green).
 * @version v7 2026-10-18 - Footer background: same Samraworld gradient as the masthead (was flat dark green).
 * @version v7 2026-10-18 - Content-to-footer gap 124px → 48px (main bottom padding 60 → 48; footer margin-top 64 → 0).
 * @version v7 2026-10-18 - A page's first heading (theme/series/stories/themes/search titles) drops its 34px top margin:
 *          header-to-title gap 62px → 28px. Section headings further down keep it.
 * @version v7 2026-10-19 - Phones (≤600px): the home hero and the "moved" card are hidden so the stories come
 *          first; an Eigo Hanasou wordmark chip (.sw-nav__eigo) sits at the end of the nav row instead,
 *          and the header-to-first-heading gap is 16px (was 28). Larger screens unchanged.
 * @version v7 2026-10-19 - .sw-listen: story page "Listen to this story" toggle button (pill; filled green while playing),
 *          on one row with the Eigo Hanasou pill (.sw-story__links) and showing the recording length (.sw-listen__len).
 * @version v7 2026-10-19 - Story hero photo is display:block (no inline gap under it); on phones its bottom
 *          margin is 14px (was 26), so the intro sits closer to the photo.
 * @version v7 2026-10-19 - Story paragraph gap 1.1em → .85em.
 * @version v7 2026-10-19 - Phones (≤520px, one card per row): story cards use the feature card's text sizes
 *          (title 24px, summary 19px), so search/archive cards match the home page's top stories.
 * @version v7 2026-10-22 - .sw-moved: 12px gap before the Japanese paragraph (was 4px, so the paragraph break
 *          looked like an ordinary line break). The title stays 4px above its text. Line spacing inside the card
 *          1.65 → 1.45, so the lines of a paragraph sit closer together than the paragraphs do.
 * @version v7 2026-10-22 - Intros use the same tighter line spacing (1.45): series/theme intro (.sw-collection-intro,
 *          was 1.65), story intro (.sw-story__intro, was 1.6), card and feature excerpts (were 1.65). Story body
 *          text (.sw-prose, 1.75) is unchanged.
 * @version v7 2026-10-22 - Masthead auto-hides (.sw-mast.is-hidden, script in inc/footer.php) instead of
 *          staying pinned: hidden on scroll-down, back on scroll-up, at every screen size; no slide with
 *          prefers-reduced-motion.
 * @version v7 2026-10-22 - Home hero: top padding 22 → 0 (the gap under the masthead was 50px, now .sw-main's
 *          28px); hero show animations (.sw-hero.is-show / is-shimmer / is-sizzle / is-fizzle / is-collapsing,
 *          .sw-hero__ch letters, .sw-hero__spark twinkles); reduced motion turns them off.
 * @version v7 2026-10-22 - Hero animations moved to css/hero-fx.css (effects library, js/heroFx.js).
 * @version v7 2026-10-22 - Home hero title in the site green (var(--sw-green)) instead of ink.
 * @version v7 2026-10-22 - The Eigo Hanasou nav pill (.sw-nav__eigo) shows at every size (was phones only),
 *          except beside the home page's one-time moved card on tablets/computers (body.has-moved-card).
 * @version v7 2026-10-22 - .sw-sec-head--first (no top margin): the home page's Latest Stories heading when
 *          the moved card isn't shown.
 */
:root {
  --sw-green: #18823e;
  --sw-green-dark: #0b5528;
  --sw-green-soft: #eef6f0;
  --sw-ink: #1e2a24;
  --sw-muted: #5c6b62;
  --sw-line: #e0e9e3;
  --sw-paper: #fbfdfb;
  --sw-card: #ffffff;
  --sw-maxw: 1080px;
  --sw-read: 720px;
  --sw-shadow: 0 1px 2px rgba(11,85,40,.05), 0 10px 30px rgba(11,85,40,.06);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--sw-paper); color: var(--sw-ink);
  font-family: "Source Sans 3", system-ui, -apple-system, sans-serif;
  font-size: 19px; line-height: 1.65;
}
a { color: var(--sw-green-dark); }
img { max-width: 100%; height: auto; }
h1, h2, h3, .sw-brand__name { font-family: "Fraunces", Georgia, serif; line-height: 1.15; text-wrap: balance; }
/* Long left-aligned titles: fill the line, only avoid a lone last word (balance makes them wrap early). */
.sw-card__title, .sw-feature__title { text-wrap: wrap; text-wrap: pretty; }

/* ---------- masthead ---------- */
.sw-mast { background: linear-gradient(135deg, #138a40 0%, #084a22 100%);   /* same as the Samraworld learning-site header */
   position: sticky; top: 0; z-index: 10; box-shadow: 0 1px 0 rgba(255,255,255,.08), 0 2px 10px rgba(11,85,40,.15);
   transition: transform .28s ease, box-shadow .28s ease; will-change: transform; }
/* Auto-hiding header (site rule, same as Eigo Hanasou): hidden on scroll-down, back on scroll-up (inc/footer.php). */
.sw-mast.is-hidden { transform: translateY(-100%); box-shadow: none; }
@media (prefers-reduced-motion: reduce) { .sw-mast { transition: none; } }
.sw-mast__inner { max-width: var(--sw-maxw); margin: 0 auto; padding: 14px 20px; display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.sw-brand { text-decoration: none; color: #fff; display: flex; flex-direction: row; align-items: center; gap: 12px; margin-right: auto; }
.sw-brand__logo { width: 60px; height: 60px; display: block; flex: none; }
.sw-brand__text { display: flex; flex-direction: column; line-height: 1.05; }
.sw-brand__name { font-size: 28px; font-weight: 700; color: #fff; letter-spacing: -.3px; }
.sw-brand__tag { font-size: 13px; color: #FFD479; letter-spacing: .5px; text-transform: uppercase; }
.sw-nav { display: flex; gap: 20px; align-items: center; }
.sw-nav a { text-decoration: none; color: #eaf6ee; font-weight: 600; font-size: 17px; padding: 4px 0; border-bottom: 2px solid transparent; }
.sw-nav a:hover { color: #fff; border-bottom-color: #a9d3ba; }
.sw-search input {
  border: 1px solid rgba(255,255,255,.35); border-radius: 999px; padding: 8px 16px; font-size: 15px;
  background: rgba(255,255,255,.92); color: var(--sw-ink); width: 180px; max-width: 42vw;
}
.sw-nav a.sw-nav__eigo { display: inline-flex; padding: 4px 9px; background: #fff; border-radius: 999px;
  border-bottom: 0; transition: box-shadow .15s ease; }   /* Eigo Hanasou pill, every page and size */
.sw-nav a.sw-nav__eigo:hover, .sw-nav a.sw-nav__eigo:focus-visible { box-shadow: 0 0 0 3px rgba(255,255,255,.35); border-bottom: 0; }
/* The home page's one-time "moved" card (index.php, cookie sw_moved_seen) already links there: no pill
   beside it on tablets/computers. Phones never show the card, so they keep the pill. */
@media (min-width: 601px) { body.has-moved-card .sw-nav a.sw-nav__eigo { display: none; } }
.sw-nav__eigo img { height: 22px; width: auto; display: block; }
.sw-search input::placeholder { color: var(--sw-muted); opacity: 1; }
.sw-search input:focus { outline: 2px solid #a9d3ba; outline-offset: 1px; background: #fff; }

.sw-main { max-width: var(--sw-maxw); margin: 0 auto; padding: 28px 20px 48px; }

/* ---------- home hero ---------- */
.sw-hero { position: relative; text-align: center; padding: 0 0 30px; }   /* top 22 → 0: .sw-main's 28px is the gap */
.sw-hero h1 { font-size: clamp(30px, 6vw, 46px); font-weight: 700; margin: 0 0 8px; color: var(--sw-green); }   /* site green, not ink */
.sw-hero p { color: var(--sw-muted); font-size: 20px; margin: 0 auto; max-width: 60ch; }

/* Hero effects (letters, waves, neon, …) live in css/hero-fx.css, loaded on the home page only. */
.sw-moved { display: flex; align-items: center; gap: 18px 22px; flex-wrap: wrap; margin: 0 0 34px; padding: 18px 22px;
  background: var(--sw-card); border: 1px solid var(--sw-line); border-radius: 16px; box-shadow: var(--sw-shadow); }
.sw-moved__logo { flex: none; display: block; }
.sw-moved__logo img { height: 44px; width: auto; display: block; }
.sw-moved__text { flex: 1 1 320px; min-width: 0; }
.sw-moved__text p { margin: 0; font-size: 17px; line-height: 1.45; color: var(--sw-ink); }   /* tighter than body text (1.65): short notice, not reading text */
.sw-moved__title { font-weight: 700; margin-bottom: 4px !important; }
.sw-moved__jp { color: var(--sw-muted) !important; font-size: 15px !important; margin-top: 12px !important; }   /* a real paragraph gap; the title stays snug (4px) above its text */
.sw-moved__btn { flex: none; display: inline-flex; align-items: center; gap: 6px; padding: 10px 18px; border-radius: 999px;
  background: var(--sw-green); color: #fff; font-weight: 700; font-size: 16px; text-decoration: none; white-space: nowrap; }
.sw-moved__btn:hover, .sw-moved__btn:focus-visible { background: var(--sw-green-dark); color: #fff; }
@media (max-width: 600px) { .sw-moved { padding: 16px; } .sw-moved__btn { width: 100%; justify-content: center; } }

.sw-sec-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 34px 0 16px; }
/* The page's own title heading (first thing in <main>) sits right under the header, not 34px further down. */
.sw-main > .sw-sec-head:first-child { margin-top: 0; }
.sw-sec-head--first { margin-top: 0; }   /* home without the moved card: Latest Stories is the first heading (the hero, while shown, brings its own 30px) */
.sw-sec-head h2 { font-size: 24px; margin: 0; color: var(--sw-ink); }
.sw-sec-head a { font-weight: 600; font-size: 14px; text-decoration: none; color: var(--sw-green); }
.sw-eyebrow { font-size: 12px; font-weight: 700; letter-spacing: 1.2px; text-transform: uppercase; color: var(--sw-green); }

/* ---------- story cards grid (3 abreast, responsive) ---------- */
.sw-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
@media (max-width: 840px) { .sw-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 520px) {
  .sw-grid { grid-template-columns: 1fr; }
  /* One card per row: same text sizes as the home page's feature cards (see .sw-feature at 600px). */
  .sw-card__title { font-size: 24px; }
  .sw-card__excerpt { font-size: 19px; }
}
.sw-card {
  background: var(--sw-card); border: 1px solid var(--sw-line); border-radius: 14px; overflow: hidden;
  box-shadow: var(--sw-shadow); text-decoration: none; color: inherit; display: flex; flex-direction: column;
  transition: transform .15s ease, box-shadow .15s ease;
}
.sw-card:hover { transform: translateY(-3px); box-shadow: 0 6px 14px rgba(11,85,40,.10), 0 18px 40px rgba(11,85,40,.10); }
.sw-card__img { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; background: var(--sw-green-soft); display: block; }
.sw-card__body { padding: 16px 18px 18px; display: flex; flex-direction: column; gap: 6px; }
.sw-card__series { font-size: 11px; font-weight: 700; letter-spacing: .8px; text-transform: uppercase; color: var(--sw-green); }
.sw-card__title { font-size: 22px; font-weight: 600; margin: 0; }
.sw-card__excerpt { color: var(--sw-muted); font-size: 17px; line-height: 1.45; margin: 2px 0 0; }
.sw-card__date { color: var(--sw-muted); font-size: 14px; margin-top: 8px; }
.sw-card__imglink { display: block; }
.sw-card__titlelink { display: block; text-decoration: none; color: inherit; }
.sw-card__titlelink:hover .sw-card__title { color: var(--sw-green-dark); }
a.sw-card__series--link { text-decoration: none; }
a.sw-card__series--link:hover { text-decoration: underline; }

/* ---------- full-width feature stories ---------- */
.sw-features { display: flex; flex-direction: column; gap: 22px; }
.sw-grid--after-features { margin-top: 22px; }
.sw-feature {
  display: block; background: var(--sw-card); border: 1px solid var(--sw-line); border-radius: 16px;
  overflow: hidden; box-shadow: var(--sw-shadow); text-decoration: none; color: inherit;
  transition: transform .15s ease, box-shadow .15s ease;
}
.sw-feature:hover { transform: translateY(-3px); box-shadow: 0 6px 14px rgba(11,85,40,.10), 0 20px 44px rgba(11,85,40,.10); }
.sw-feature__img { width: 100%; height: 320px; object-fit: cover; background: var(--sw-green-soft); display: block; }
.sw-feature__body { padding: 22px 26px 24px; }
.sw-feature__title { font-size: 30px; font-weight: 700; margin: 6px 0 8px; line-height: 1.15; }
.sw-feature__excerpt { color: var(--sw-muted); font-size: 19px; line-height: 1.45; margin: 0; }
.sw-feature__imglink { display: block; }
.sw-feature__titlelink { display: block; text-decoration: none; color: inherit; }
.sw-feature__titlelink:hover .sw-feature__title { color: var(--sw-green-dark); }
@media (max-width: 600px) {
  .sw-feature__img { height: 200px; }
  .sw-feature__title { font-size: 24px; }
  .sw-feature__body { padding: 18px 18px 20px; }
}

/* ---------- collection (series/theme) intro ---------- */
.sw-collection-intro { color: var(--sw-muted); font-size: 18.5px; line-height: 1.45; margin: 0 0 22px; }
.sw-collection-intro p { margin: 0 0 .8em; }
.sw-collection-intro p:last-child { margin-bottom: 0; }

/* ---------- theme cards ---------- */
.sw-theme { position: relative; }
.sw-theme__count { color: var(--sw-muted); font-size: 13px; }

/* ---------- single story ---------- */
.sw-story { max-width: var(--sw-read); margin: 0 auto; }
.sw-story__series { text-align: center; }
.sw-story__serieslink { color: inherit; text-decoration: none; }
.sw-story__serieslink:hover { text-decoration: underline; }
.sw-story__title { font-size: clamp(28px, 5vw, 42px); font-weight: 700; text-align: center; margin: 6px 0 10px; }
.sw-story__meta { text-align: center; color: var(--sw-muted); font-size: 15px; margin-bottom: 22px; }
.sw-eigo { display: flex; width: max-content; max-width: 100%; margin: 0; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: center;
  padding: 5px 12px 5px 14px; border: 1px solid var(--sw-line); border-radius: 999px; background: var(--sw-card);
  color: var(--sw-muted); font-size: 14px; text-decoration: none; transition: border-color .15s ease, box-shadow .15s ease; }
.sw-eigo:hover, .sw-eigo:focus-visible { border-color: var(--sw-green); box-shadow: var(--sw-shadow); color: var(--sw-ink); }
.sw-eigo__logo { height: 29px; width: auto; display: block; }
.sw-story__links { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 10px 12px; margin: -10px auto 22px; }
.sw-listen { display: flex; }
.sw-listen__btn { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 7px 18px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--sw-green); background: var(--sw-card); color: var(--sw-green-dark);
  font: 600 15px/1.2 "Source Sans 3", system-ui, sans-serif; transition: background .15s ease, color .15s ease, box-shadow .15s ease; }
.sw-listen__btn:hover, .sw-listen__btn:focus-visible { box-shadow: var(--sw-shadow); }
.sw-listen__btn:focus-visible { outline: 2px solid var(--sw-green); outline-offset: 2px; }
.sw-listen__btn.is-playing { background: var(--sw-green); color: #fff; }
.sw-listen__btn:disabled { cursor: default; opacity: .6; box-shadow: none; }
.sw-listen__icon { width: 1.2em; text-align: center; }
.sw-listen__len { font-weight: 400; opacity: .8; }
.sw-story__hero { display: block; width: 100%; max-height: 460px; object-fit: cover; border-radius: 16px; margin-bottom: 26px; box-shadow: var(--sw-shadow); }
.sw-story__intro { font-size: 22px; line-height: 1.45; color: var(--sw-ink); font-family: "Fraunces", Georgia, serif; font-weight: 500; margin: 0 0 24px; }
.sw-prose { font-size: 20.5px; line-height: 1.75; }
.sw-prose p { margin: 0 0 .85em; }
.sw-prose h2, .sw-prose h3 { margin: 1.6em 0 .5em; }
.sw-prose .story-fig { margin: 26px 0; }
.sw-prose .story-fig img { width: 100%; border-radius: 12px; box-shadow: var(--sw-shadow); }
.sw-prose .story-fig figcaption { margin-top: 10px; text-align: center; color: var(--sw-muted); font-size: 16px; line-height: 1.45; font-style: italic; }
.sw-back { display: inline-block; margin: 30px 0 0; color: var(--sw-green); font-weight: 600; text-decoration: none; }

/* ---------- comments ---------- */
.sw-comments { max-width: var(--sw-read); margin: 44px auto 0; border-top: 1px solid var(--sw-line); padding-top: 26px; }
.sw-comments h2 { font-size: 22px; margin: 0 0 18px; }
.sw-comment { padding: 14px 0; border-bottom: 1px solid var(--sw-line); }
.sw-comment__head { display: flex; gap: 10px; align-items: baseline; }
.sw-comment__name { font-weight: 700; }
.sw-comment__date { color: var(--sw-muted); font-size: 13px; }
.sw-comment__body { margin: 4px 0 0; }
.sw-cform { margin-top: 22px; background: var(--sw-card); border: 1px solid var(--sw-line); border-radius: 14px; padding: 18px; box-shadow: var(--sw-shadow); }
.sw-cform label { display: block; font-size: 13px; font-weight: 700; color: var(--sw-muted); text-transform: uppercase; letter-spacing: .5px; margin: 0 0 5px; }
.sw-cform input, .sw-cform textarea {
  width: 100%; border: 1px solid var(--sw-line); border-radius: 10px; padding: 11px 13px;
  font-size: 16px; font-family: inherit; color: var(--sw-ink); background: var(--sw-paper); margin-bottom: 12px;
}
.sw-cform textarea { min-height: 110px; resize: vertical; }
.sw-cform button { background: var(--sw-green); color: #fff; border: none; border-radius: 10px; padding: 11px 22px; font-size: 15px; font-weight: 700; cursor: pointer; }
.sw-cform button:hover { background: var(--sw-green-dark); }
.sw-note { padding: 12px 14px; border-radius: 10px; font-size: 14px; margin-bottom: 16px; }
.sw-note--ok { background: var(--sw-green-soft); color: var(--sw-green-dark); }
.sw-note--err { background: #fdeaea; color: #b32020; }

/* ---------- pagination + empty ---------- */
.sw-pager { display: flex; justify-content: center; gap: 12px; margin-top: 34px; }
.sw-pager a, .sw-pager span {
  padding: 9px 16px; border-radius: 999px; border: 1px solid var(--sw-line); text-decoration: none;
  color: var(--sw-ink); font-weight: 600; font-size: 14px; background: var(--sw-card);
}
.sw-pager .is-disabled { color: var(--sw-muted); opacity: .5; }
.sw-empty { text-align: center; color: var(--sw-muted); padding: 60px 20px; font-size: 18px; }

/* ---------- footer ---------- */
.sw-foot { background: linear-gradient(135deg, #138a40 0%, #084a22 100%);   /* matches the masthead */
  color: #d7ece0; margin-top: 0; }
.sw-foot__inner { max-width: var(--sw-maxw); margin: 0 auto; padding: 40px 20px 34px; text-align: center; }
.sw-foot__lockup { display: inline-flex; align-items: center; gap: 14px; text-decoration: none; margin-bottom: 22px; text-align: left; }
.sw-foot__logo { width: 52px; height: 52px; display: block; flex: none; }
.sw-foot__text { display: flex; flex-direction: column; line-height: 1.1; }
.sw-foot__brand { font-family: "Fraunces", Georgia, serif; font-size: 26px; font-weight: 700; color: #fff; }
.sw-foot__tag { color: #a9d3ba; font-size: 15px; margin-top: 4px; }
.sw-foot__nav { display: flex; justify-content: center; flex-wrap: wrap; gap: 22px; margin-bottom: 20px; }
.sw-foot__nav a { color: #eaf6ee; text-decoration: none; font-weight: 600; font-size: 15px; padding-bottom: 2px; border-bottom: 2px solid transparent; }
.sw-foot__nav a:hover { border-bottom-color: #a9d3ba; }
.sw-foot__eigo { display: inline-flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: center;
  margin: 0 0 22px; color: #eaf6ee; font-size: 15px; text-decoration: none; }
.sw-foot__eigo-chip { display: inline-flex; padding: 5px 10px; background: #fff; border-radius: 999px; transition: box-shadow .15s ease; }
.sw-foot__eigo-chip img { height: 25px; width: auto; display: block; }
.sw-foot__eigo:hover .sw-foot__eigo-chip, .sw-foot__eigo:focus-visible .sw-foot__eigo-chip { box-shadow: 0 0 0 3px rgba(255,255,255,.35); }
.sw-foot__eigo:hover > span:first-child { text-decoration: underline; }
.sw-foot__copy { color: #8fc0a2; font-size: 13px; border-top: 1px solid rgba(255,255,255,.12); padding-top: 18px; }

@media (max-width: 600px) {
  .sw-mast__inner { gap: 12px; }
  .sw-nav { order: 3; width: 100%; gap: 16px; }
  .sw-search { order: 2; }
  .sw-search input { width: 130px; }
  body { font-size: 18px; }
  .sw-brand__logo { width: 48px; height: 48px; }
  .sw-brand__name { font-size: 24px; }
  /* Stories first on phones: no hero or "moved" card; the nav row carries an Eigo Hanasou link instead. */
  .sw-hero, .sw-moved { display: none; }
  .sw-moved + .sw-sec-head { margin-top: 0; }   /* the home page's first heading, now at the top */
  .sw-main { padding-top: 16px; }   /* header-to-first-heading gap 28 → 16px on phones */
  .sw-story__hero { margin-bottom: 14px; }   /* story photo-to-intro gap 26 → 14px on phones */
  .sw-nav { align-items: center; flex-wrap: wrap; }
  .sw-nav a.sw-nav__eigo { margin-left: auto; }   /* phones: pushed to the end of the nav row */
}
