/* /learn pages (built by scripts/build-learn.js). Loaded after style.css
   and kyha.css, so the tokens, text styles, buttons, article cards and
   footer are the landing page's. This file only lays out the /learn pages
   and styles long-form article text.

   Article text has no Figma style yet. "Reading" below (16/26) is a
   stand-in until there is one. */

/* style.css and kyha.css's .v3 rules strip paragraph margins and list
   bullets inside <main>; article text gets them back below. */

.learn-page {
  --learn-width: 960px;
  --reading-size: 16px;
  --reading-line: 26px;
}

/* ── HEADER ── */
.learn-header {
  padding: var(--space-32) var(--space-24) 0;
}

.learn-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: var(--learn-width);
  margin: 0 auto;
}

.learn-nav img {
  display: block;
}

.learn-draft-banner {
  width: min(var(--learn-width), 100% - 2 * var(--space-24));
  margin: var(--space-16) auto 0;
  padding: var(--space-8) var(--space-16);
  border-radius: var(--radius-8);
  background: var(--lavender-200);
  color: var(--text-ovulation);
  font-size: 14px;
  line-height: 21px;
  text-align: center;
}

/* ── LAYOUT ── */
.learn-main {
  max-width: calc(var(--learn-width) + 2 * var(--space-24));
  margin: 0 auto;
  padding: var(--space-40) var(--space-24) var(--space-48);
}

.learn-dek {
  color: var(--text-medium);
  text-wrap: pretty;
}

/* ── CARDS ──
   .v3-learn-card (kyha.css) is the landing page's card; here it sits in
   grids instead of a swipe row. */
.learn-cards {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-16);
  list-style: none;
}

/* An article without a photo: a brand panel */
.learn-media-fallback {
  position: absolute;
  inset: 0;
  background: var(--background-brand);
}

.learn-media-fallback.learn-tone-1 {
  background: var(--text-ovulation);
}

.learn-card-feature a {
  height: 420px;
  padding: var(--space-24);
}

.learn-card-feature .v3-learn-text {
  gap: var(--space-8);
  padding: var(--space-24);
  text-align: left;
}

.learn-card-feature .type-h2 {
  color: var(--text-dark);
  text-wrap: balance;
}

.learn-card-desc {
  color: var(--text-medium);
}

/* ── INDEX ──
   Open editorial cards (photo, date, title, excerpt, "Read more"):
   one column on phones, two from 767px, three from 960px. */
.learn-posts {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-40) var(--space-24);
  list-style: none;
}

.learn-post a {
  display: flex;
  flex-direction: column;
  gap: var(--space-8);
  color: inherit;
  text-decoration: none;
}

.learn-post-media {
  position: relative;
  display: block;
  aspect-ratio: 1;
  margin-bottom: var(--space-8);
  border-radius: var(--radius-16);
  overflow: hidden;
  background: var(--background-primary);
}

.learn-post-media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s var(--ease-out);
}

.learn-post a:hover .learn-post-media img {
  transform: scale(1.04);
}

.learn-post-date {
  color: var(--text-medium);
}

/* At most 3 lines, then … (the full title is on the article page) */
.learn-post-title {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  overflow: hidden;
  color: var(--text-brand);
  text-wrap: balance;
}

/* Three lines, then … */
.learn-post-excerpt {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  overflow: hidden;
  color: var(--text-dark);
}

.learn-post-more {
  align-self: flex-start;
  margin-top: var(--space-4);
  border-bottom: 1px solid currentColor;
  color: var(--text-dark);
}

.learn-post a:hover .learn-post-more {
  color: var(--text-brand);
}

.learn-post a:focus-visible {
  outline: 2px solid var(--actions-primary-normal);
  outline-offset: 4px;
  border-radius: var(--radius-16);
}

@media (prefers-reduced-motion: reduce) {
  .learn-post-media img {
    transition: none;
  }
}

.learn-index-intro {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-8);
  margin-bottom: var(--space-32);
  text-align: center;
}

.learn-index-intro h1 {
  color: var(--text-dark);
}

.learn-featured {
  display: flex;
  flex-direction: column;
  gap: var(--space-16);
}

.learn-featured-lead {
  list-style: none;
}

.learn-topic {
  margin-top: var(--space-48);
}

.learn-section-head {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  margin-bottom: var(--space-24);
}

.learn-section-head h2 {
  color: var(--text-dark);
}

.learn-section-head p {
  color: var(--text-medium);
}

/* ── ARTICLE ── */
.learn-article-layout {
  display: grid;
  gap: var(--space-48);
}

.learn-article {
  min-width: 0;
}

.learn-kicker {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-8);
  margin-bottom: var(--space-12);
  color: var(--text-brand);
}

.learn-kicker a {
  color: inherit;
  text-decoration: none;
}

.learn-kicker a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.learn-article h1 {
  color: var(--text-dark);
  text-wrap: balance;
}

.learn-article .learn-dek {
  margin-top: var(--space-12);
}

.learn-hero {
  position: relative;
  aspect-ratio: 16 / 9;
  margin: var(--space-24) 0 var(--space-16);
  border-radius: var(--radius-16);
  overflow: hidden;
}

.learn-hero img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.learn-byline {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4) var(--space-16);
  padding-bottom: var(--space-16);
  border-bottom: 0.5px solid var(--strokes-medium);
  color: var(--text-medium);
}

.learn-byline a {
  color: var(--text-brand);
}

/* Quick answer: a sand card, like the landing page's stage cards */
.learn-summary {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  margin-top: var(--space-24);
  padding: var(--space-24);
  border-radius: var(--radius-16);
  background: var(--background-primary);
  color: var(--text-dark);
}

.learn-summary-label {
  color: var(--text-brand);
}

/* ── ARTICLE TEXT ("Reading") ── */
.learn-body {
  margin-top: var(--space-32);
  font-size: var(--reading-size);
  line-height: var(--reading-line);
  letter-spacing: 0.01em;
  color: var(--text-dark);
}

.learn-body > * + * {
  margin-top: var(--space-16);
}

.learn-body p,
.learn-body li {
  font-size: inherit;
  line-height: inherit;
}

/* H2 style */
.learn-body h2 {
  margin-top: var(--space-48);
  font-size: var(--type-h2-size);
  font-weight: 400;
  line-height: var(--type-h2-line);
  color: var(--text-dark);
}

/* Pullout size, medium weight */
.learn-body h3 {
  margin-top: var(--space-32);
  font-size: 18px;
  font-weight: 500;
  line-height: 26px;
  color: var(--text-dark);
}

.learn-body h2 + *,
.learn-body h3 + * {
  margin-top: var(--space-8);
}

.learn-body ul,
.learn-body ol {
  padding-left: 1.25em;
}

/* .learn-page outranks kyha.css's ".v3 main ul { list-style: none }" */
.learn-page .learn-body ul {
  list-style: disc;
}

.learn-page .learn-body ol {
  list-style: decimal;
}

.learn-body li + li {
  margin-top: var(--space-8);
}

.learn-body li::marker {
  color: var(--text-brand);
}

.learn-body strong {
  font-weight: 500;
}

.learn-body a {
  color: var(--text-brand);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.learn-body a:hover {
  text-decoration-thickness: 2px;
}

.learn-body blockquote {
  padding-left: var(--space-16);
  border-left: 2px solid var(--background-mint);
  color: var(--text-medium);
}

.learn-figure {
  margin: var(--space-32) 0;
}

.learn-figure img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: var(--radius-16);
}

.learn-figure-narrow img {
  max-width: 360px;
  margin: 0 auto;
  border-radius: 28px;
}

/* Tables scroll sideways on phones instead of squashing */
.learn-body table {
  display: block;
  max-width: 100%;
  overflow-x: auto;
  border-collapse: collapse;
  font-size: 14px;
  line-height: 21px;
}

.learn-body th,
.learn-body td {
  padding: var(--space-8) var(--space-12);
  border-bottom: 0.5px solid var(--strokes-medium);
  text-align: left;
  vertical-align: top;
}

.learn-body th {
  background: var(--background-primary);
  font-weight: 500;
}

.learn-body td {
  background: var(--background-surface);
}

/* Mid-article download card (<!-- kyha-cta --> in the Markdown) */
.learn-cta {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-16);
  margin: var(--space-32) 0;
  padding: var(--space-24);
  border-radius: var(--radius-16);
  background: var(--background-brand);
}

.learn-body .learn-cta p {
  color: var(--text-light);
}

.learn-body .learn-cta a {
  color: var(--text-brand);
  text-decoration: none;
}

/* ── SOURCES, REVIEWER, DISCLAIMER ── */
.learn-sources {
  margin-top: var(--space-48);
  padding-top: var(--space-24);
  border-top: 0.5px solid var(--strokes-medium);
}

.learn-sources h2 {
  margin-bottom: var(--space-8);
  color: var(--text-brand);
}

.learn-page .learn-sources ol {
  padding-left: 1.25em;
  list-style: decimal;
  color: var(--text-medium);
}

.learn-sources li + li {
  margin-top: var(--space-4);
}

.learn-sources a {
  color: var(--text-dark);
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* Like the landing page's advisor cards: white, rounded */
.learn-reviewer {
  display: flex;
  gap: var(--space-16);
  margin-top: var(--space-32);
  padding: var(--space-16);
  border-radius: var(--radius-16);
  background: var(--background-surface);
}

.learn-reviewer img {
  flex: none;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  object-fit: cover;
}

.learn-reviewer div {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.learn-reviewer-label {
  color: var(--text-brand);
}

.learn-reviewer-name {
  color: var(--text-dark);
}

.learn-reviewer-bio,
.learn-reviewer-date {
  color: var(--text-medium);
}

.learn-disclaimer {
  margin-top: var(--space-32);
  color: var(--text-medium);
}

/* ── SIDEBAR ── */
.learn-sidebar {
  display: flex;
  flex-direction: column;
  gap: var(--space-24);
}

.learn-sidebar-recent h2 {
  margin-bottom: var(--space-8);
  color: var(--text-brand);
}

.learn-sidebar-recent ul {
  list-style: none;
}

.learn-sidebar-recent li {
  border-bottom: 0.5px solid var(--strokes-medium);
}

.learn-sidebar-recent a {
  display: block;
  padding: var(--space-12) 0;
  color: var(--text-dark);
  text-decoration: none;
}

.learn-sidebar-recent a:hover {
  color: var(--text-brand);
}

.learn-promo {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-16);
  padding: var(--space-24);
  border-radius: var(--radius-16);
  background: var(--background-brand);
}

.learn-promo-text {
  color: var(--text-light);
}

/* ── KEEP READING ── on a full-width sand band, like the landing page's
   Learn section */
.learn-related {
  display: flex;
  flex-direction: column;
  gap: var(--space-24);
  padding: var(--space-40) var(--space-24);
  background: var(--background-primary);
}

/* 1–3 cards, centered */
.learn-related .learn-cards {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  width: 100%;
  max-width: var(--learn-width);
  margin: 0 auto;
}

.learn-related .v3-learn-card {
  flex: 0 1 100%;
}

/* ── CLOSING CTA ── */
.learn-closing {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-8);
  padding: var(--space-48) var(--space-24);
  text-align: center;
}

.learn-closing-sub {
  margin-bottom: var(--space-16);
  color: var(--text-medium);
  text-wrap: balance;
}

/* ── WIDER SCREENS ── */
@media (min-width: 767px) {
  .learn-header {
    padding-inline: var(--page-gutter);
  }

  .learn-main {
    max-width: calc(var(--learn-width) + 2 * var(--page-gutter));
    padding-inline: var(--page-gutter);
  }

  .learn-cards,
  .learn-posts {
    grid-template-columns: repeat(2, 1fr);
  }

  /* Side by side, every title takes 3 lines' space, so the dates above
     and the excerpts below line up across a row */
  .learn-post-title {
    min-height: calc(3 * 34px);
  }

  .learn-related .v3-learn-card {
    flex-basis: calc((100% - var(--space-16)) / 2);
  }

  .learn-card-feature .v3-learn-text {
    max-width: 560px;
  }

  .learn-related {
    padding-inline: var(--page-gutter);
  }
}

@media (min-width: 960px) {
  .learn-cards,
  .learn-posts {
    grid-template-columns: repeat(3, 1fr);
  }

  .learn-related .v3-learn-card {
    flex-basis: calc((100% - 2 * var(--space-16)) / 3);
  }

  .learn-article-layout {
    grid-template-columns: minmax(0, 1fr) 280px;
    align-items: start;
  }

  /* Recent + promo stay in view while reading */
  .learn-sidebar {
    position: sticky;
    top: var(--space-24);
  }
}
