/* ═══════════════ Learn (Blog + Tutorial) ═══════════════ */

.learn-filter {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 28px;
}

.learn-chip {
  font-family: var(--font);
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.02em;
  padding: 9px 18px;
  border-radius: 999px;
  border: 1.5px solid var(--grey-border);
  background: var(--white);
  color: var(--grey);
  cursor: pointer;
  transition: var(--transition);
}
.learn-chip:hover {
  border-color: var(--orange);
  color: var(--navy);
}
.learn-chip.active {
  background: var(--orange);
  color: #fff;
  border-color: var(--orange);
  box-shadow: 0 4px 14px var(--orange-glow);
}

.learn-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
  gap: 28px;
}

.learn-card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  border: 1px solid var(--grey-border);
}
.learn-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--orange);
}

.learn-card-body {
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
}

.learn-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--grey);
  font-weight: 500;
  flex-wrap: wrap;
}
.learn-tag {
  background: var(--peach);
  color: var(--orange-deep);
  padding: 3px 10px;
  border-radius: 999px;
  font-weight: 700;
  letter-spacing: 0.02em;
  font-size: 11px;
  text-transform: uppercase;
}
.learn-dot { opacity: 0.5; }
.learn-duration { font-weight: 600; }

.learn-title {
  font-size: 19px;
  font-weight: 700;
  color: var(--navy);
  line-height: 1.35;
  margin: 0;
}
.learn-desc {
  font-size: 14px;
  color: var(--grey);
  line-height: 1.55;
  margin: 0;
}

/* ─── Video tile ─── */
.learn-video-frame {
  position: relative;
  width: 100%;
  padding-top: 56.25%; /* 16:9 */
  background: var(--navy-dark);
}
.learn-video-frame iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

/* ─── Post tile ─── */
.learn-post {
  text-decoration: none;
  color: inherit;
}
.learn-post-cover {
  width: 100%;
  padding-top: 56.25%;
  background-size: cover;
  background-position: center;
  background-color: var(--peach-deep);
}
.learn-readmore {
  margin-top: 8px;
  font-weight: 700;
  font-size: 14px;
  color: var(--orange);
  letter-spacing: 0.01em;
}

/* ─── Empty state ─── */
.learn-empty {
  text-align: center;
  padding: 80px 20px;
  color: var(--grey);
}
.learn-empty-icon {
  font-size: 56px;
  margin-bottom: 16px;
}
.learn-empty h3 {
  color: var(--navy);
  margin-bottom: 8px;
}

/* ─── Single post page ─── */
.post-layout {
  max-width: 1180px;
  margin: 0 auto;
  padding: 140px 24px 80px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 240px;
  gap: 56px;
  align-items: start;
}
@media (max-width: 960px) {
  .post-layout { grid-template-columns: 1fr; gap: 0; padding: 120px 20px 60px; }
}

.post-article {
  max-width: 720px;
  margin: 0 auto;
  width: 100%;
}
.post-back {
  display: inline-block;
  font-weight: 600;
  color: var(--orange);
  font-size: 14px;
  text-decoration: none;
  margin-bottom: 22px;
}
.post-back:hover { text-decoration: underline; }

.post-article .post-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--grey);
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.post-article h1 {
  font-size: clamp(28px, 4vw, 44px);
  line-height: 1.18;
  letter-spacing: -0.01em;
  color: var(--navy);
  margin: 4px 0 26px;
}

/* ── Branded cover image with MIPOS badge ── */
.post-cover-wrap {
  position: relative;
  margin: 0 0 32px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--peach-deep);
  box-shadow: 0 18px 40px -22px rgba(11, 23, 56, 0.35);
}
.post-cover-wrap .post-cover {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  margin: 0;
  border-radius: 0;
}
.post-cover-badge {
  position: absolute;
  top: 16px;
  right: 16px;
  display: flex;
  align-items: center;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.95);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  border-radius: 10px;
  box-shadow: 0 6px 18px rgba(11, 23, 56, 0.25);
  pointer-events: none;
}
.post-cover-badge img {
  display: block;
  height: 28px;
  width: auto;
}
@media (max-width: 600px) {
  .post-cover-badge { padding: 8px 11px; top: 12px; right: 12px; }
  .post-cover-badge img { height: 22px; }
}
.post-cover-fade {
  position: absolute;
  inset: auto 0 0 0;
  height: 38%;
  background: linear-gradient(to top, rgba(11, 23, 56, 0.55), transparent);
  pointer-events: none;
}

/* ── TL;DR summary card ── */
.post-tldr {
  position: relative;
  background: var(--peach);
  border-left: 4px solid var(--orange);
  border-radius: 12px;
  padding: 20px 24px 22px;
  margin: 0 0 36px;
}
.post-tldr-label {
  display: inline-block;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.18em;
  color: var(--orange);
  margin-bottom: 8px;
}
.post-tldr p {
  margin: 0;
  font-size: 17px;
  line-height: 1.6;
  color: var(--navy);
}

/* ── Body content typography ── */
.post-content {
  font-size: 17.5px;
  line-height: 1.75;
  color: var(--navy);
}
.post-content > p,
.post-content > ul,
.post-content > ol,
.post-content > blockquote {
  max-width: 65ch;
}
.post-content > p:first-child::first-line {
  font-weight: 600;
}
.post-content h2 {
  font-size: 26px;
  line-height: 1.25;
  margin: 44px 0 14px;
  color: var(--navy);
  letter-spacing: -0.005em;
  scroll-margin-top: 100px;
}
.post-content h2::before {
  content: "";
  display: block;
  width: 36px;
  height: 3px;
  background: var(--orange);
  border-radius: 2px;
  margin-bottom: 10px;
}
.post-content h3 { font-size: 20px; margin: 32px 0 10px; color: var(--navy); }
.post-content p  { margin: 0 0 20px; }
.post-content ul, .post-content ol { margin: 0 0 22px 22px; }
.post-content li { margin-bottom: 10px; }
.post-content strong { color: var(--navy); }
.post-content a  { color: var(--orange); font-weight: 600; }
.post-content a:hover { text-decoration: underline; }
.post-content blockquote {
  border-left: 4px solid var(--orange);
  background: var(--peach);
  padding: 18px 22px;
  margin: 24px 0;
  border-radius: 8px;
  font-style: italic;
  color: var(--navy);
}
.post-content img { border-radius: var(--radius); margin: 22px 0; max-width: 100%; }
.post-content pre {
  background: var(--navy-dark);
  color: #fff;
  padding: 18px 20px;
  border-radius: var(--radius);
  overflow-x: auto;
  font-size: 14px;
  margin: 22px 0;
}
.post-content code {
  background: var(--peach-deep);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.92em;
}
.post-content pre code { background: none; padding: 0; }

/* ── End-of-article CTA ── */
.post-end-cta {
  margin-top: 56px;
  padding: 32px 28px;
  background: linear-gradient(135deg, var(--peach) 0%, var(--peach-deep) 100%);
  border-radius: var(--radius-lg);
  text-align: center;
}
.post-end-cta h3 {
  font-size: 22px;
  color: var(--navy);
  margin: 0 0 8px;
}
.post-end-cta p {
  color: var(--grey);
  margin: 0 0 20px;
  font-size: 15px;
}
.post-end-cta-buttons {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}
.post-end-cta .btn-secondary {
  background: #fff;
  color: var(--navy);
  border: 1px solid rgba(11, 23, 56, 0.1);
}

/* ── On-this-page sidebar (TOC) ── */
.post-toc {
  position: sticky;
  top: 110px;
  align-self: start;
  padding: 22px 20px;
  background: #fff;
  border: 1px solid rgba(11, 23, 56, 0.08);
  border-radius: 14px;
  box-shadow: 0 4px 14px -8px rgba(11, 23, 56, 0.15);
  max-height: calc(100vh - 130px);
  overflow-y: auto;
}
@media (max-width: 960px) {
  .post-toc {
    position: static;
    margin: 0 0 28px;
    order: -1; /* show ABOVE article on mobile */
  }
}
.post-toc-label {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.18em;
  color: var(--orange);
  text-transform: uppercase;
  margin-bottom: 12px;
}
.post-toc-list {
  list-style: none;
  margin: 0;
  padding: 0;
  counter-reset: toc;
}
.post-toc-list li { margin: 0; }
.post-toc-list a {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 8px 0;
  font-size: 14px;
  line-height: 1.4;
  color: var(--grey);
  text-decoration: none;
  border-left: 2px solid transparent;
  padding-left: 12px;
  margin-left: -14px;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.post-toc-list a:hover {
  color: var(--navy);
  background: var(--peach);
  border-radius: 0 6px 6px 0;
}
.post-toc-list a.is-active {
  color: var(--orange);
  border-left-color: var(--orange);
  font-weight: 600;
}
.post-toc-num {
  font-size: 11px;
  font-weight: 700;
  color: rgba(11, 23, 56, 0.35);
  font-variant-numeric: tabular-nums;
}
.post-toc-list a.is-active .post-toc-num { color: var(--orange); }

/* ─── Dark mode (use existing site dark classes) ─── */
body.theme-dark .learn-card { background: #1a1f3a; border-color: rgba(255,255,255,0.08); }
body.theme-dark .learn-title { color: #fff; }
body.theme-dark .learn-desc  { color: rgba(255,255,255,0.7); }
body.theme-dark .learn-chip  { background: transparent; color: rgba(255,255,255,0.7); border-color: rgba(255,255,255,0.15); }
body.theme-dark .learn-chip.active { background: var(--orange); color: #fff; }

/* ─── Search bar ─── */
.learn-search-wrap {
  display: flex;
  justify-content: center;
  margin-top: 24px;
}
.learn-search {
  position: relative;
  width: 100%;
  max-width: 480px;
}
.learn-search-input {
  font-family: var(--font);
  font-size: 14px;
  width: 100%;
  padding: 12px 18px 12px 44px;
  border-radius: 999px;
  border: 1.5px solid var(--grey-border);
  background: var(--white);
  color: var(--navy);
  outline: none;
  transition: var(--transition);
}
.learn-search-input::placeholder { color: var(--grey); }
.learn-search-input:focus {
  border-color: var(--orange);
  box-shadow: 0 4px 14px var(--orange-glow);
}
.learn-search-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  color: var(--grey);
  font-size: 15px;
}
.learn-search-clear {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  color: var(--grey);
  font-size: 18px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  display: none;
}
.learn-search-clear:hover { background: var(--grey-bg); color: var(--navy); }
.learn-search.has-value .learn-search-clear { display: inline-flex; align-items: center; justify-content: center; }

.learn-title mark, .learn-desc mark {
  background: var(--orange-glow, rgba(255,140,66,0.25));
  color: inherit;
  padding: 0 2px;
  border-radius: 3px;
}
body.theme-dark .learn-title mark, body.theme-dark .learn-desc mark {
  background: rgba(255,140,66,0.3);
  color: #fff;
}

body.theme-dark .learn-search-input { background: #1a1f3a; color: #fff; border-color: rgba(255,255,255,0.15); }
body.theme-dark .learn-search-input::placeholder { color: rgba(255,255,255,0.5); }
body.theme-dark .learn-search-icon { color: rgba(255,255,255,0.5); }
body.theme-dark .learn-search-clear:hover { background: rgba(255,255,255,0.08); color: #fff; }

@media (max-width: 640px) {
  .learn-grid { grid-template-columns: 1fr; gap: 20px; }
  .learn-title { font-size: 17px; }
}

/* ═══════════════ Learn hero — theme-aware ═══════════════
   The theme system uses [data-theme] on <html>; base (no attribute) is the
   site's DARK mode. The learn hero must be dark navy in dark mode so it
   matches the navbar (the old peach band looked light/disconnected), and
   fall back to the peach look only in light mode. */
.learn-hero {
  background: linear-gradient(135deg, var(--navy-dark) 0%, var(--navy) 55%, var(--navy-light) 100%);
}
.learn-hero .section-header h2 { color: #fff; }
.learn-hero .section-header p  { color: rgba(255, 255, 255, 0.82); }
.learn-hero .learn-search-input { background: #1a1f3a; color: #fff; border-color: rgba(255, 255, 255, 0.15); }
.learn-hero .learn-search-input::placeholder { color: rgba(255, 255, 255, 0.5); }
.learn-hero .learn-search-icon { color: rgba(255, 255, 255, 0.5); }
.learn-hero .learn-search-clear:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }
.learn-hero .learn-chip { background: transparent; color: rgba(255, 255, 255, 0.75); border-color: rgba(255, 255, 255, 0.18); }
.learn-hero .learn-chip:hover { color: #fff; border-color: var(--orange); }
.learn-hero .learn-chip.active { background: var(--orange); color: #fff; border-color: var(--orange); }

/* Light mode — keep the original peach hero */
[data-theme="light"] .learn-hero {
  background: var(--peach);
}
[data-theme="light"] .learn-hero .section-header h2 { color: var(--navy); }
[data-theme="light"] .learn-hero .section-header p  { color: var(--grey); }
[data-theme="light"] .learn-hero .learn-search-input { background: #fff; color: var(--navy); border-color: var(--grey-border); }
[data-theme="light"] .learn-hero .learn-search-input::placeholder { color: var(--grey); }
[data-theme="light"] .learn-hero .learn-search-icon { color: var(--grey); }
[data-theme="light"] .learn-hero .learn-chip { background: #fff; color: var(--grey); border-color: var(--grey-border); }

/* ═══════════════ Language toggles ═══════════════
   Buttons themselves use .learn-chip so they match the site's chip language
   exactly (white pill, orange-on-active, orange glow shadow). These rules
   only handle positioning + the anchor-link variant used on post pages. */

a.learn-chip { text-decoration: none; display: inline-block; }
a.learn-chip.active { cursor: default; }

/* Blog listing — centered chip pair under the hero copy. */
.blog-lang-toggle {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 22px;
}

/* Blog post page — chip pair right-aligned next to the "← Back" link. */
.post-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 22px;
  flex-wrap: wrap;
}
.post-lang-toggle {
  display: flex;
  gap: 8px;
}
