/* ==========================================================================
   Learn index (/learn) — Pen redesign. Loaded after editorial.css and only on
   this page; every rule is scoped to .ed-learn. The old .learn-* rules in
   resources/css/app.css are left untouched; this page only keeps the hooks
   resources/js/learn.js needs (.learn-search-form, .learn-enhanced-hint) and
   .learn-search-field, which app.css hides below 768px as before.
   ========================================================================== */

.ed-learn__hero { padding-bottom: 64px; }

/* ── Hero head ───────────────────────────────────────────────────────────── */
.ed-learn__head { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 520px); gap: 56px; align-items: end; margin-top: 40px; }
.ed-learn__title { font-size: clamp(80px, 13.9vw, 220px); line-height: 0.82; }
.ed-learn__side { display: flex; flex-direction: column; gap: 28px; padding-bottom: 24px; }
.ed-learn__intro { margin: 0; font-size: clamp(19px, 1.67vw, 24px); font-weight: 500; line-height: 1.35; letter-spacing: -0.015em; }
.ed-learn__controls { display: flex; flex-wrap: wrap; gap: 12px; }
.ed-learn__search { display: flex; flex: 1 1 340px; align-items: center; gap: 12px; min-width: 0; height: 56px; padding: 0 6px 0 20px; border: 1px solid var(--ed-ink); border-radius: 100px; background: var(--ed-paper); }
.ed-learn__search > svg { flex-shrink: 0; }
.ed-learn__search input { flex: 1; min-width: 0; height: 100%; padding: 0; border: 0; background: transparent; color: var(--ed-ink); font-family: var(--ed-sans); font-size: 16px; }
.ed-learn__search input::placeholder { color: var(--ed-muted); opacity: 1; }
.ed-learn__search input:focus { outline: none; }
.ed-learn__search:focus-within { box-shadow: 0 0 0 1px var(--ed-ink); }
.ed-learn__search button { flex-shrink: 0; height: 44px; padding: 0 18px; border: 0; border-radius: 100px; background: var(--ed-ink); color: var(--ed-paper); font-family: var(--ed-sans); font-size: 15px; font-weight: 700; cursor: pointer; }
.ed-learn__search button:hover { background: #2A2A2E; }
.ed-learn__sort { position: relative; flex-shrink: 0; }
.ed-learn__sort select { appearance: none; -webkit-appearance: none; height: 56px; padding: 0 44px 0 20px; border: 0; border-radius: 100px; background: var(--ed-paper-2); color: var(--ed-ink); font-family: var(--ed-sans); font-size: 15px; font-weight: 500; cursor: pointer; }
.ed-learn__sort svg { position: absolute; right: 20px; top: 50%; transform: translateY(-50%); pointer-events: none; }

/* ── Topics ──────────────────────────────────────────────────────────────── */
.ed-learn__topics { margin: 40px 0 0; padding: 24px 0 0; border: 0; border-top: 1px solid var(--ed-line); min-width: 0; }
.ed-learn__topics legend { float: left; margin-right: 22px; padding: 11px 0; color: var(--ed-ink); }
.ed-learn__topic-options { display: flex; flex-wrap: wrap; gap: 10px; }
.ed-learn__topic { position: relative; cursor: pointer; }
.ed-learn__topic > input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.ed-learn__topic > span { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 10px 14px 10px 16px; border: 1px solid var(--ed-line); border-radius: 100px; font-size: 14px; font-weight: 500; line-height: 1.2; transition: border-color .2s var(--ed-ease), background-color .2s var(--ed-ease); }
.ed-learn__topic:hover > span { border-color: var(--ed-ink); }
.ed-learn__topic-count { color: var(--ed-muted); font-size: 11px; letter-spacing: 0.04em; }
.ed-learn__topic input:checked + span { background: var(--ed-ink); border-color: var(--ed-ink); color: var(--ed-paper); font-weight: 700; }
.ed-learn__topic input:checked + span .ed-learn__topic-count { color: rgba(251, 250, 248, 0.75); }
.ed-learn__topic input:focus-visible + span { outline: 2px solid var(--ed-ink); outline-offset: 3px; }
.ed-learn__hint { clear: both; margin: 16px 0 0; color: var(--ed-muted); font-size: 14px; line-height: 1.5; }

/* ── Featured guide ──────────────────────────────────────────────────────── */
.ed-learn__featured-wrap { padding-bottom: 96px; }
.ed .ed-learn__featured { display: flex; justify-content: space-between; align-items: flex-end; gap: 56px; padding: 56px; border-radius: 4px; background: var(--ed-ink); color: var(--ed-paper); }
.ed-learn__featured-text { display: flex; flex-direction: column; gap: 24px; max-width: 1010px; min-width: 0; }
.ed-learn__featured-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; color: rgba(251, 250, 248, 0.65); }
/* Ink on brand red: white mono at 11px would be 3.4:1. */
.ed-learn__latest { padding: 6px 12px; border-radius: 100px; background: var(--ed-red); color: var(--ed-ink); font-size: 11px; }
.ed-learn__featured-title { margin: 0; font-family: var(--ed-display-text); font-weight: 700; font-size: clamp(40px, 5vw, 72px); line-height: 0.95; text-transform: uppercase; }
.ed-learn__featured-desc { margin: 0; max-width: 640px; color: rgba(251, 250, 248, 0.65); font-size: clamp(17px, 1.32vw, 19px); line-height: 1.5; }
.ed-learn__featured-btn { display: inline-flex; flex-shrink: 0; align-items: center; gap: 10px; padding: 18px 28px; border-radius: 100px; background: var(--ed-paper); color: var(--ed-ink); font-size: 16px; font-weight: 700; white-space: nowrap; }
.ed-learn__featured-btn svg, .ed-learn__card-read svg { transition: transform .25s var(--ed-ease); }
.ed-learn__featured:hover .ed-learn__featured-btn svg, .ed-learn__card:hover .ed-learn__card-read svg { transform: translateX(3px); }
.ed-learn__featured:focus-visible { outline-offset: 4px; }

/* ── Results ─────────────────────────────────────────────────────────────── */
.ed-learn__results { padding-bottom: 120px; }
.ed-learn__results-head h2 { margin: 0; font: inherit; letter-spacing: inherit; text-transform: inherit; color: inherit; }
.ed-learn__results-head h2:focus { outline: none; }
.ed-learn__filters { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 24px; padding-top: 20px; }
.ed-learn__query { margin: 0; color: var(--ed-muted); overflow-wrap: anywhere; }
.ed .ed-learn__clear { font-weight: 700; text-decoration: underline; text-underline-offset: 4px; }
.ed .ed-learn__clear:hover { color: var(--ed-red); }
.ed-learn__grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); column-gap: 48px; margin: 0; padding: 0; list-style: none; }
.ed-learn__grid > li { display: flex; }
.ed-learn__card { display: flex; flex-direction: column; gap: 16px; width: 100%; padding: 28px 0 32px; border-bottom: 1px solid var(--ed-line); }
.ed-learn__card-meta { display: flex; justify-content: space-between; align-items: center; gap: 12px; color: var(--ed-muted); }
.ed-learn__card-tag { color: var(--ed-ink); }
.ed-learn__card-title { margin: 0; font-size: clamp(24px, 2.08vw, 30px); font-weight: 500; line-height: 1.12; letter-spacing: -0.02em; overflow-wrap: anywhere; transition: color .2s var(--ed-ease); }
.ed-learn__card-desc { margin: 0; color: var(--ed-muted); font-size: 16px; line-height: 1.55; }
.ed-learn__card-read { display: inline-flex; align-items: center; gap: 8px; margin-top: auto; padding-top: 4px; font-size: 15px; font-weight: 700; }
.ed-learn__card:hover .ed-learn__card-title { color: var(--ed-red); }
.ed-learn__empty { grid-column: 1 / -1; display: flex; flex-direction: column; align-items: flex-start; gap: 16px; padding: 56px 0; }
.ed-learn__empty h3 { margin: 0; font-family: var(--ed-display-text); font-weight: 700; font-size: clamp(32px, 3.33vw, 48px); line-height: 0.95; text-transform: uppercase; }
.ed-learn__empty p { margin: 0; max-width: 55ch; color: var(--ed-muted); font-size: 17px; line-height: 1.55; }
.ed-learn__reset { padding: 14px 24px; font-size: 16px; }

/* Below 1280px the title and side panel stack, so long localized titles never collide. */
@media (max-width: 1279px) {
    .ed-learn__head { grid-template-columns: minmax(0, 1fr); gap: 28px; }
    .ed-learn__title { font-size: clamp(72px, 15.3vw, 180px); }
    .ed-learn__side { padding-bottom: 0; max-width: 640px; }
}

/* ── Tablet ──────────────────────────────────────────────────────────────── */
@media (max-width: 1023px) {
    .ed-learn__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 32px; }
    .ed .ed-learn__featured { flex-direction: column; align-items: flex-start; gap: 32px; padding: 40px; }
}

/* ── Mobile ──────────────────────────────────────────────────────────────── */
/* ── Phones (Pen "Learn — Mobile (390)") ──────────────────────────────────── */
@media (max-width: 760px) {
    .ed-learn__hero { padding-bottom: 28px; }
    .ed-learn__head { margin-top: 20px; gap: 20px; }
    .ed-learn__title { font-size: 24.6vw; }
    .ed-learn__intro { font-size: 18px; }
    /* Search and sort on one row (app.css hides .learn-search-field on phones; the redesign shows it). */
    .ed-learn__controls { flex-wrap: nowrap; gap: 8px; }
    .ed-learn .learn-search-field.ed-learn__search { display: flex; flex: 1 1 auto; height: 50px; padding-left: 16px; }
    .ed-learn__search button { display: none; }
    .ed-learn__search input { font-size: 16px; }
    .ed-learn__sort { flex: 0 0 auto; }
    .ed-learn__sort select { height: 50px; padding: 0 36px 0 16px; }
    .ed-learn__sort svg { right: 14px; }

    /* Topics: one swipeable row of chips. */
    .ed-learn__topics { margin-top: 20px; padding-top: 0; border-top: 0; }
    .ed-learn__topics legend { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
    .ed-learn__topic-options { position: relative; flex-wrap: nowrap; gap: 8px; margin-inline: calc(var(--bk-edge, 20px) * -1); padding-inline: var(--bk-edge, 20px); overflow-x: auto; scrollbar-width: none; }
    .ed-learn__topic-options::-webkit-scrollbar { display: none; }
    .ed-learn__topic { flex-shrink: 0; }
    .ed-learn__topic > span { white-space: nowrap; }
    .ed-learn__hint { position: absolute; width: 1px; height: 1px; margin: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; } /* kept for screen readers (aria-describedby) */

    /* Featured */
    .ed-learn__featured-wrap { padding-bottom: 40px; }
    .ed .ed-learn__featured { gap: 16px; padding: 24px; }
    .ed-learn__featured-title { font-size: 36px; }
    .ed-learn__featured-desc { display: none; }
    .ed-learn__featured-btn { padding: 0; background: transparent; color: var(--ed-paper); }

    /* Guides: compact rows (meta, title, arrow). */
    .ed-learn__results { padding-bottom: 56px; }
    .ed-learn__grid { grid-template-columns: minmax(0, 1fr); }
    .ed-learn__card { display: grid; grid-template-columns: minmax(0, 1fr) 18px; align-items: center; column-gap: 14px; row-gap: 6px; padding: 18px 0; }
    .ed-learn__card-meta { grid-column: 1; justify-content: flex-start; gap: 8px; font-size: 10px; }
    .ed-learn__card-meta time::before { content: "·"; margin-right: 8px; }
    .ed-learn__card-title { grid-column: 1; font-size: 19px; line-height: 1.2; }
    .ed-learn__card-desc { display: none; }
    .ed-learn__card-read { grid-column: 2; grid-row: 1 / span 2; margin: 0; padding: 0; font-size: 0; }
    .ed-learn__card-read svg { width: 18px; height: 18px; }
}
