/* =============================================================
   Magic Weather — blog (hub + articles)
   Sits on top of style.css and docs.css: same paper, same type.
   ============================================================= */

.blog .doc-shell { padding-top: 124px; }
.blog .nav-links a[aria-current="page"] { opacity: 1; color: var(--ember-2); }

/* breadcrumb */
.crumbs {
  max-width: 820px;
  margin: 0 auto 22px;
  text-align: center;
  font-family: var(--t-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #88806a;
}
.crumbs a { color: #5a543f; transition: color .2s; }
.crumbs a:hover { color: var(--ember-2); }
.crumbs span { margin: 0 9px; opacity: .6; }

/* article header */
.post-hero { max-width: 840px; margin-bottom: 52px; }
.post-title {
  font-size: clamp(34px, 5.2vw, 58px);
  line-height: 1.06;
  text-wrap: balance;
}
.post-hero .doc-lede { text-wrap: pretty; }
.post-meta {
  margin: 20px 0 0;
  font-family: var(--t-mono);
  font-size: 12px;
  letter-spacing: 0.04em;
  color: #88806a;
}

/* the contents rail: open beside the article on wide screens, a tap-to-open row on phones */
.toc-fold > summary { list-style: none; }
.toc-fold > summary::-webkit-details-marker { display: none; }
@media (min-width: 1081px) {
  .toc-fold > summary { pointer-events: none; }
}
.blog .doc-toc .toc-cta a.btn {
  display: inline-flex;
  padding: 12px 20px;
  margin-left: 0;
  border-left: none;
  font-size: 14px;
}

/* article body */
.post-body h2 {
  margin: 54px 0 18px;
  font-size: clamp(26px, 3vw, 34px);
  line-height: 1.14;
  scroll-margin-top: 96px;
  text-wrap: balance;
}
.post-body > h2:first-child { margin-top: 0; }
.post-body h3 { scroll-margin-top: 96px; }
.post-body p, .post-body li { text-wrap: pretty; }
.post-body a.btn,
.post-body a.post-card { border-bottom: none; }

/* the short answer */
.tldr {
  margin: 0 0 34px;
  padding: 22px 26px 24px;
  background: #fff;
  border: 1px solid var(--line-p);
  border-radius: 18px;
  box-shadow: var(--shadow-paper);
}
.tldr-label {
  font-family: var(--t-mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ember-2);
  margin-bottom: 10px;
}
.tldr p {
  margin: 0;
  font-family: var(--t-display);
  font-size: 20px;
  line-height: 1.45;
  color: var(--ink-text);
  font-variation-settings: 'opsz' 36, 'SOFT' 100;
}

/* pictures */
figure.shot { margin: 34px auto; text-align: center; }
figure.shot img {
  display: block;
  margin: 0 auto;
  max-width: 100%;
  height: auto;
  border-radius: 14px;
  box-shadow: var(--shadow-paper);
}
figure.shot.is-phone img { width: min(300px, 78%); border-radius: 34px; }
figure.shot.is-watch img { width: min(220px, 60%); border-radius: 38px; }
figure.shot.is-square img { width: min(380px, 90%); border-radius: 30px; box-shadow: none; }
figure.shot.is-wide img { width: 100%; }
figure.shot.is-plain img { box-shadow: none; border-radius: 0; }
figure.shot figcaption,
.shots figcaption {
  margin-top: 14px;
  font-size: 14px;
  line-height: 1.5;
  color: #88806a;
}
.shots {
  display: grid;
  grid-template-columns: repeat(var(--cols, 2), minmax(0, 1fr));
  gap: 18px;
  margin: 34px 0;
}
.shots figure { margin: 0; text-align: center; }
.shots img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 26px;
  box-shadow: var(--shadow-paper);
}
.shots.is-flat img { border-radius: 18px; box-shadow: none; }
.shots figcaption { margin-top: 10px; font-size: 13px; }

/* diagrams drawn in the page */
figure.diagram {
  margin: 34px 0;
  padding: 22px 22px 18px;
  background: #fff;
  border: 1px solid var(--line-p);
  border-radius: 18px;
}
figure.diagram svg { display: block; width: 100%; height: auto; }
figure.diagram figcaption { margin-top: 12px; font-size: 14px; line-height: 1.5; color: #88806a; text-align: center; }

/* tables */
.table-wrap {
  margin: 24px 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  background: #fff;
  border: 1px solid var(--line-p);
  border-radius: 16px;
}
.post-body table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
  line-height: 1.45;
}
.post-body th {
  text-align: left;
  font-family: var(--t-mono);
  font-weight: 500;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #88806a;
  padding: 14px 16px 12px;
  border-bottom: 1px solid var(--line-p);
  white-space: nowrap;
}
.post-body td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--line-p);
  vertical-align: top;
}
.post-body tr:last-child td { border-bottom: none; }
.post-body td:first-child { font-weight: 600; color: var(--ink-text); white-space: nowrap; }
.post-body td .dot {
  display: inline-block;
  width: 10px; height: 10px;
  margin-right: 8px;
  border-radius: 50%;
  background: var(--c, #ccc);
}

/* a scale: coloured steps with a value and a word */
.scale {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
  gap: 8px;
  margin: 24px 0;
}
.scale-step {
  padding: 12px 12px 13px;
  background: #fff;
  border: 1px solid var(--line-p);
  border-top: 6px solid var(--c, var(--ember));
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.35;
  color: #5a543f;
}
.scale-step b {
  display: block;
  margin-bottom: 3px;
  font-family: var(--t-display);
  font-weight: 500;
  font-size: 19px;
  color: var(--ink-text);
  font-variation-settings: 'opsz' 36, 'SOFT' 100;
}

/* numbered steps for how-tos */
.post-body ol.steps {
  list-style: none;
  counter-reset: step;
  padding: 0;
  margin: 22px 0;
}
.post-body ol.steps > li {
  counter-increment: step;
  position: relative;
  margin: 0;
  padding: 0 0 18px 48px;
}
.post-body ol.steps > li::before {
  content: counter(step);
  position: absolute;
  left: 0; top: -2px;
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--t-mono);
  font-size: 13px;
  font-weight: 500;
  color: var(--ember-2);
  background: rgba(217,122,71,0.10);
  border: 1px solid rgba(184,97,46,0.30);
  border-radius: 50%;
}
.post-body ol.steps > li:last-child { padding-bottom: 0; }

/* the app box at the end of an article */
.app-box {
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 22px;
  margin: 56px 0 0;
  padding: 30px;
  background: linear-gradient(180deg, #fff 0%, #fbf6ee 100%);
  border: 1px solid var(--line-p);
  border-radius: 22px;
  box-shadow: var(--shadow-paper);
}
.app-box > img, .blog-cta > img { border-radius: 15px; box-shadow: 0 6px 16px rgba(20,24,40,0.18); }
.app-box-label {
  font-family: var(--t-mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ember-2);
  margin-bottom: 8px;
}
.app-box-title {
  margin: 0 0 8px !important;
  font-family: var(--t-display);
  font-weight: 500;
  font-size: 24px;
  line-height: 1.2;
  letter-spacing: -0.01em;
  color: var(--ink-text);
  font-variation-settings: 'opsz' 48, 'SOFT' 100;
}
.app-box p { font-size: 16px; color: #4a4536; }
.app-box p.app-box-title, .blog-cta p.app-box-title { font-size: 24px; color: var(--ink-text); }
.app-box-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px 22px;
  margin-top: 18px;
}
.app-box-more { font-size: 15px; font-weight: 600; }
.app-box-note {
  margin: 14px 0 0 !important;
  font-family: var(--t-mono);
  font-size: 11px !important;
  letter-spacing: 0.06em;
  color: #88806a !important;
}

/* cards */
.post-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 22px;
}
.post-card {
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid var(--line-p);
  border-radius: 20px;
  overflow: hidden;
  color: var(--ink-text);
  transition: transform .25s ease, box-shadow .25s ease, border-color .25s ease;
}
.post-card:hover {
  transform: translateY(-3px);
  border-color: rgba(184,97,46,0.35);
  box-shadow: var(--shadow-paper);
}
.post-card-thumb {
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: var(--paper-deep);
  border-bottom: 1px solid var(--line-p);
}
.post-card-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.post-card-thumb.is-poster {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 18px;
  background:
    radial-gradient(120% 140% at 85% 0%, rgba(217,122,71,0.34) 0%, rgba(217,122,71,0) 58%),
    radial-gradient(120% 140% at 0% 100%, rgba(90,159,230,0.30) 0%, rgba(90,159,230,0) 60%),
    #11152a;
}
.post-card-thumb.is-poster span {
  font-family: var(--t-display);
  font-style: italic;
  font-weight: 300;
  font-size: clamp(34px, 3.4vw, 50px);
  line-height: 1;
  letter-spacing: -0.02em;
  color: #f6efe6;
  white-space: nowrap;
  font-variation-settings: 'opsz' 144, 'SOFT' 100;
}
.post-card:nth-child(3n+2) .post-card-thumb.is-poster {
  background:
    radial-gradient(120% 140% at 10% 0%, rgba(72,102,86,0.55) 0%, rgba(72,102,86,0) 60%),
    radial-gradient(120% 140% at 100% 100%, rgba(240,168,123,0.30) 0%, rgba(240,168,123,0) 60%),
    #11152a;
}
.post-card:nth-child(3n) .post-card-thumb.is-poster {
  background:
    radial-gradient(120% 140% at 50% -10%, rgba(90,159,230,0.42) 0%, rgba(90,159,230,0) 62%),
    radial-gradient(120% 140% at 100% 110%, rgba(184,97,46,0.36) 0%, rgba(184,97,46,0) 58%),
    #11152a;
}
.post-card-body { padding: 20px 22px 24px; }
.post-card-kicker {
  font-family: var(--t-mono);
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ember-2);
  margin-bottom: 10px;
}
.post-card h3 {
  margin: 0 0 8px;
  font-family: var(--t-display);
  font-weight: 500;
  font-size: 21px;
  line-height: 1.2;
  letter-spacing: -0.01em;
  color: var(--ink-text);
  text-wrap: balance;
  font-variation-settings: 'opsz' 36, 'SOFT' 100;
}
.post-card p {
  margin: 0;
  font-size: 14.5px;
  line-height: 1.5;
  color: #5a543f;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* keep reading */
.related { margin-top: 56px; padding-top: 34px; border-top: 1px solid var(--line-p); }
.related-label {
  font-family: var(--t-mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #88806a;
  margin-bottom: 18px;
}
.post-grid.is-related { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.post-grid.is-related .post-card-thumb { display: none; }
.post-grid.is-related .post-card-body { padding: 18px 18px 20px; }
.post-grid.is-related h3 { font-size: 17px; }
.post-grid.is-related p { display: none; }

/* the hub */
.blog-shell .doc-hero { margin-bottom: 64px; }
.blog-tabs {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 30px;
}
.blog-tabs a {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-text);
  background: #fff;
  border: 1px solid var(--line-p);
  border-radius: 999px;
  transition: border-color .2s, color .2s;
}
.blog-tabs a:hover { color: var(--ember-2); border-color: rgba(184,97,46,0.40); }
.blog-tabs span {
  font-family: var(--t-mono);
  font-size: 11px;
  font-weight: 500;
  color: #88806a;
}
.blog-section { margin-bottom: 76px; scroll-margin-top: 96px; }
.blog-section-head { max-width: 640px; margin-bottom: 28px; }
.blog-section-head h2 {
  margin: 0 0 10px;
  font-family: var(--t-display);
  font-weight: 500;
  font-size: clamp(30px, 3.6vw, 42px);
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: var(--ink-text);
  font-variation-settings: 'opsz' 96, 'SOFT' 100;
}
.blog-section-head p { margin: 0; color: #5a543f; }
.blog-cta {
  display: grid;
  grid-template-columns: 72px 1fr auto;
  align-items: center;
  gap: 24px;
  padding: 30px 34px;
  background: linear-gradient(180deg, #fff 0%, #fbf6ee 100%);
  border: 1px solid var(--line-p);
  border-radius: 24px;
  box-shadow: var(--shadow-paper);
}
.blog-cta p { margin: 0; color: #4a4536; }

@media (max-width: 1080px) {
  .blog .doc-toc { padding: 0; }
  .blog .doc-toc .toc-cta { display: none; }
  .toc-fold > summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 0;
    padding: 16px 18px;
    cursor: pointer;
  }
  .toc-fold > summary::after {
    content: '';
    width: 8px; height: 8px;
    margin-right: 4px;
    border-right: 1.5px solid currentColor;
    border-bottom: 1.5px solid currentColor;
    transform: rotate(45deg) translateY(-2px);
    transition: transform .2s;
  }
  .toc-fold[open] > summary::after { transform: rotate(-135deg) translateY(-2px); }
  .toc-fold ol { margin: 0; padding: 0 18px 12px; }
  .post-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .post-grid.is-related { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
  .blog .doc-shell { padding-top: 104px; }
  .post-hero { margin-bottom: 36px; }
  .post-body h2 { margin-top: 44px; font-size: 26px; }
  .tldr { padding: 18px 20px 20px; }
  .tldr p { font-size: 18px; }
  .post-grid, .post-grid.is-related { grid-template-columns: 1fr; }
  .shots { gap: 12px; }
  .shots.is-three { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .app-box { grid-template-columns: 1fr; gap: 16px; padding: 22px; }
  .blog-cta { grid-template-columns: 1fr; padding: 24px; text-align: left; }
  .post-body th, .post-body td { padding-left: 12px; padding-right: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  .post-card { transition: none; }
  .post-card:hover { transform: none; }
}
