/* ToolTapGo magazine-style blog pages. Kept separate from the shared site system. */
body[data-page="blog"] main {
  overflow: clip;
}

/* ---------- Index page header ----------
   Deliberately quiet: the featured guide below is the page's focal point. */
.blog-hero {
  position: relative;
  padding: 26px 0 22px;
  background: none;
}

.blog-hero::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--line), transparent);
}

.blog-hero__inner {
  position: relative;
}

.blog-hero .kicker {
  font-size: .66rem;
  letter-spacing: .13em;
}

.blog-hero .kicker i {
  width: 22px;
  height: 22px;
  border-radius: 7px;
  font-size: .8rem;
}

.blog-hero h1 {
  margin: 7px 0 0;
  font-size: clamp(1.45rem, 2.2vw, 1.85rem);
  line-height: 1.2;
  letter-spacing: -.03em;
}

.blog-hero p {
  max-width: 620px;
  margin: 5px 0 0;
  color: var(--muted);
  font-size: .85rem;
  line-height: 1.55;
}

.blog-list-section {
  padding: 30px 0 88px;
}

/* ---------- Shared image frame ---------- */
.blog-thumb {
  position: relative;
  display: block;
  overflow: hidden;
  background: linear-gradient(145deg, var(--teal-soft), var(--brand-soft));
}

.blog-thumb img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  transition: transform .5s ease;
}

.blog-thumb__placeholder {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, var(--teal-soft), var(--brand-soft));
  color: color-mix(in srgb, var(--teal) 55%, transparent);
  font-size: 2.6rem;
}

/* Branded fallback artwork, tinted per topic so an image-less feed still reads as a grid. */
.blog-thumb__placeholder::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: .5;
  background-image: radial-gradient(circle at 1px 1px, color-mix(in srgb, var(--ink) 14%, transparent) 1px, transparent 0);
  background-size: 18px 18px;
  mask-image: linear-gradient(135deg, black, transparent 72%);
}

.blog-thumb__placeholder i {
  position: relative;
  z-index: 1;
}

.blog-thumb__placeholder--v1 {
  background: linear-gradient(145deg, var(--teal-soft), color-mix(in srgb, var(--surface) 70%, var(--teal-soft)));
  color: color-mix(in srgb, var(--teal) 52%, transparent);
}

.blog-thumb__placeholder--v2 {
  background: linear-gradient(145deg, var(--brand-soft), color-mix(in srgb, var(--surface) 70%, var(--brand-soft)));
  color: color-mix(in srgb, var(--brand) 52%, transparent);
}

.blog-thumb__placeholder--v3 {
  background: linear-gradient(145deg, color-mix(in srgb, var(--gold) 22%, var(--surface)), color-mix(in srgb, var(--surface) 80%, var(--gold)));
  color: color-mix(in srgb, var(--gold) 62%, transparent);
}

.blog-featured__media .blog-thumb__placeholder {
  font-size: 4.4rem;
}

/* ---------- Split featured guide ---------- */
.blog-featured {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(300px, 5fr);
  overflow: hidden;
  margin-bottom: 54px;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.blog-featured__body {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 15px;
  padding: clamp(26px, 4vw, 48px);
}

.blog-featured__label {
  align-self: flex-start;
  padding: 6px 13px;
  border: 1px solid color-mix(in srgb, var(--brand) 22%, transparent);
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand);
  font-size: .68rem;
  font-weight: 850;
  letter-spacing: .11em;
  text-transform: uppercase;
}

.blog-featured h2 {
  margin: 0;
  max-width: 680px;
  font-size: clamp(1.7rem, 2.9vw, 2.6rem);
  line-height: 1.12;
  letter-spacing: -.045em;
}

.blog-featured h2 a {
  color: var(--ink);
}

.blog-featured h2 a:hover {
  color: var(--brand);
}

.blog-featured p {
  max-width: 640px;
  margin: 0;
  color: var(--muted);
  font-size: .97rem;
  line-height: 1.7;
}

.blog-featured .blog-meta {
  margin-top: 2px;
}

.blog-featured__cta {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 48px;
  margin-top: 6px;
  padding: 0 22px;
  border-radius: 14px;
  background: var(--teal);
  color: #fff;
  font-size: .87rem;
  font-weight: 800;
  box-shadow: 0 12px 26px color-mix(in srgb, var(--teal) 26%, transparent);
  transition: transform .18s ease, background .18s ease;
}

.blog-featured__cta:hover {
  transform: translateY(-1px);
  background: var(--teal-strong);
  color: #fff;
}

.blog-featured__media {
  min-height: 300px;
}

.blog-featured__media::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(0deg, rgba(7, 18, 17, .62) 0%, rgba(7, 18, 17, .12) 42%, transparent 70%);
  pointer-events: none;
}

.blog-featured:hover .blog-featured__media img {
  transform: scale(1.045);
}

.blog-featured__caption {
  position: absolute;
  z-index: 2;
  inset: auto 16px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 15px;
  border: 1px solid rgba(255, 255, 255, .16);
  border-radius: 14px;
  background: rgba(7, 18, 17, .58);
  color: #fff;
  font-size: .74rem;
  font-weight: 800;
  letter-spacing: .02em;
  backdrop-filter: blur(12px);
}

/* ---------- Latest guides grid ---------- */
.blog-section-head {
  align-items: end;
  margin-bottom: 25px;
}

.blog-section-head h2 {
  margin: 5px 0 4px;
}

.blog-section-head p {
  margin: 0;
  color: var(--muted);
  font-size: .88rem;
}

.blog-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 22px;
}

.blog-post-card {
  position: relative;
  display: flex;
  min-width: 0;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--surface);
  box-shadow: var(--shadow-xs);
  transition: transform .22s ease, border-color .22s ease, box-shadow .22s ease;
}

.blog-post-card:hover {
  transform: translateY(-4px);
  border-color: color-mix(in srgb, var(--brand) 34%, var(--line));
  box-shadow: var(--shadow-sm);
}

.blog-post-card__media {
  aspect-ratio: 16 / 9;
}

.blog-post-card:hover .blog-post-card__media img {
  transform: scale(1.04);
}

.blog-post-card__tag {
  position: absolute;
  z-index: 2;
  top: 12px;
  left: 12px;
  max-width: calc(100% - 24px);
  overflow: hidden;
  padding: 5px 10px;
  border: 1px solid;
  border-radius: 10px;
  font-size: .62rem;
  font-weight: 850;
  letter-spacing: .08em;
  text-transform: uppercase;
  text-overflow: ellipsis;
  white-space: nowrap;
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow-xs);
}

.blog-tag--v1 {
  border-color: color-mix(in srgb, var(--teal) 30%, transparent);
  background: color-mix(in srgb, var(--surface) 82%, var(--teal-soft));
  color: var(--teal);
}

.blog-tag--v2 {
  border-color: color-mix(in srgb, var(--brand) 30%, transparent);
  background: color-mix(in srgb, var(--surface) 82%, var(--brand-soft));
  color: var(--brand);
}

.blog-tag--v3 {
  border-color: color-mix(in srgb, var(--gold) 34%, transparent);
  background: color-mix(in srgb, var(--surface) 84%, var(--gold));
  color: color-mix(in srgb, var(--gold) 78%, var(--ink));
}

.blog-post-card__body {
  flex: 1;
  padding: 19px 20px 16px;
}

.blog-post-card__body h3 {
  margin: 0 0 9px;
  font-size: 1.08rem;
  line-height: 1.34;
  letter-spacing: -.03em;
}

.blog-post-card__body h3 a {
  color: var(--ink);
}

.blog-post-card__body h3 a::after {
  content: "";
  position: absolute;
  inset: 0;
}

.blog-post-card:hover .blog-post-card__body h3 a {
  color: var(--brand);
}

.blog-post-card__body p {
  display: -webkit-box;
  overflow: hidden;
  margin: 0;
  color: var(--muted);
  font-size: .82rem;
  line-height: 1.65;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.blog-post-card__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: auto;
  padding: 14px 20px 16px;
  border-top: 1px solid var(--line);
}

.blog-post-card__foot .blog-meta {
  gap: 10px;
  font-size: .68rem;
}

.blog-post-card__more {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--teal);
  font-size: .73rem;
  font-weight: 850;
  white-space: nowrap;
}

.blog-post-card:hover .blog-post-card__more i {
  transform: translateX(3px);
}

.blog-post-card__more i {
  transition: transform .2s ease;
}

.blog-meta {
  gap: 12px;
}

.blog-meta span,
.blog-meta time {
  white-space: nowrap;
}

.blog-pagination {
  margin-top: 34px;
}

/* ---------- Single article ---------- */
.blog-article {
  padding: 42px 0 96px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.blog-back-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 42px;
  margin-bottom: 16px;
  color: var(--teal);
  font-size: .78rem;
  font-weight: 800;
}

.blog-back-link:hover {
  color: var(--brand);
}

.blog-article-hero {
  position: relative;
  display: flex;
  min-height: clamp(300px, 33vw, 410px);
  align-items: flex-end;
  overflow: hidden;
  padding: clamp(22px, 3vw, 38px);
  border: 1px solid color-mix(in srgb, #fff 16%, var(--line));
  border-radius: 30px;
  background: #102421;
  box-shadow: var(--shadow);
  color: #fff;
}

.blog-article-hero__image,
.blog-article-hero__placeholder,
.blog-article-hero__overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.blog-article-hero__image {
  object-fit: cover;
}

.blog-article-hero__placeholder {
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #143d37, #5c342b);
  color: rgba(255,255,255,.14);
  font-size: 6rem;
}

.blog-article-hero__overlay {
  background: linear-gradient(180deg, rgba(7,18,17,.22) 0%, rgba(7,18,17,.52) 44%, rgba(7,18,17,.96) 100%);
}

.blog-article-hero__content {
  position: relative;
  z-index: 2;
  max-width: 930px;
}

.blog-article-hero .kicker {
  border-color: rgba(255,255,255,.18);
  background: var(--brand);
  color: #fff;
  padding: 7px 14px;
  border-radius: 999px;
}

.blog-article-hero .kicker i {
  width: auto;
  height: auto;
  border-radius: 0;
  background: transparent;
}

.blog-article-hero h1 {
  margin: 13px 0 10px;
  color: #fff;
  font-size: clamp(1.75rem, 3.1vw, 2.85rem);
  line-height: 1.08;
  letter-spacing: -.042em;
  text-wrap: balance;
}

.blog-article-hero .blog-standfirst {
  max-width: 720px;
  margin: 0;
  color: rgba(255,255,255,.82);
  font-size: clamp(.9rem, 1.1vw, 1rem);
  line-height: 1.6;
}

.blog-article-hero .blog-meta {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid rgba(255,255,255,.2);
  color: rgba(255,255,255,.82);
}

.blog-article-hero .blog-meta span,
.blog-article-hero .blog-meta time {
  min-height: 34px;
  padding: 7px 11px;
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 9px;
  background: rgba(255,255,255,.09);
  backdrop-filter: blur(12px);
}

.blog-article-hero .blog-meta i {
  color: #ff9b80;
}

.blog-article-hero__badge {
  position: absolute;
  z-index: 2;
  top: 24px;
  right: 24px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 999px;
  background: rgba(7,18,17,.6);
  color: rgba(255,255,255,.9);
  font-size: .7rem;
  font-weight: 750;
  backdrop-filter: blur(12px);
}

.blog-article-hero__badge span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #58d6b7;
  box-shadow: 0 0 0 5px rgba(88,214,183,.14);
  animation: blogPulse 2.4s ease-in-out infinite;
}

@keyframes blogPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .35; }
}

@media (prefers-reduced-motion: reduce) {
  .blog-article-hero__badge span {
    animation: none;
  }
}

/* site.css places these in row 3 of the older article shell, which would leave
   two empty rows (and their gaps) above the reading column in this layout. */
.blog-article-layout > .blog-article-content {
  grid-column: 1;
  grid-row: 1;
}

.blog-article-layout > .blog-sidebar {
  grid-column: 2;
  grid-row: 1;
}

/* Reading column spans the same width as the cover hero above it. */
.blog-article-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 38px;
  align-items: start;
  margin: 18px 0 0;
}

.blog-article-content {
  min-width: 0;
  max-width: none;
  padding: clamp(22px, 2.4vw, 28px) clamp(24px, 4vw, 42px) clamp(26px, 4vw, 42px);
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--surface);
  box-shadow: var(--shadow-xs);
  color: var(--ink-2);
  font-size: 1rem;
  line-height: 1.82;
}

.blog-article-content > :first-child {
  margin-top: 0;
}

.blog-article-content h2 {
  margin: 40px 0 13px;
  color: var(--ink);
  font-size: 1.58rem;
  line-height: 1.3;
  letter-spacing: -.035em;
}

.blog-article-content h3 {
  margin: 29px 0 10px;
  color: var(--ink);
  font-size: 1.2rem;
}

.blog-article-content p,
.blog-article-content li {
  color: var(--ink-2);
}

.blog-article-content ul,
.blog-article-content ol {
  margin: 16px 0;
  padding-left: 22px;
}

.blog-article-content li {
  margin: 7px 0;
}

.blog-article-content li::marker {
  color: var(--brand);
  font-weight: 800;
}

.blog-article-content a:not(.button) {
  color: var(--teal);
  font-weight: 750;
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--teal) 35%, transparent);
  text-underline-offset: 3px;
}

.blog-article-content img {
  max-width: 100%;
  height: auto;
  border-radius: 16px;
}

.blog-article-content figure {
  margin: 28px 0;
}

.blog-article-content figure img {
  width: 100%;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-xs);
}

.blog-article-content figcaption {
  margin-top: 10px;
  color: var(--muted);
  font-size: .78rem;
  font-style: italic;
  text-align: center;
}

.blog-quick-summary {
  margin: 0 0 32px;
  padding: 18px 20px;
  border-left: 4px solid var(--teal);
  border-radius: 0 14px 14px 0;
  background: var(--teal-soft);
  color: var(--ink-2);
}

.blog-quick-summary strong {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--teal);
  font-size: .82rem;
}

.blog-quick-summary p {
  margin: 7px 0 0;
  font-size: .88rem;
  line-height: 1.65;
}

.blog-sidebar {
  position: sticky;
  top: calc(var(--header-height) + 20px);
}

.blog-sidebar .related {
  padding: 23px;
  border: 1px solid var(--line);
  border-radius: 21px;
  background: var(--surface);
  box-shadow: var(--shadow-xs);
}

.blog-sidebar__eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--brand);
  font-size: .69rem;
  font-weight: 850;
  letter-spacing: .09em;
  text-transform: uppercase;
}

.blog-sidebar .related h2 {
  margin: 10px 0 7px;
  font-size: 1.22rem;
  line-height: 1.32;
}

.blog-sidebar .related > p {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: .78rem;
  line-height: 1.55;
}

.blog-next-steps {
  display: grid;
  gap: 9px;
}

.blog-sidebar .related .blog-next-steps a {
  min-height: 50px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: color-mix(in srgb, var(--surface-2) 60%, var(--surface));
  color: var(--ink-2);
  font-size: .8rem;
  font-weight: 800;
  transition: border-color .18s ease, background .18s ease, color .18s ease;
}

.blog-sidebar .related .blog-next-steps a:hover {
  border-color: color-mix(in srgb, var(--brand) 34%, var(--line));
  background: var(--brand-soft);
  color: var(--brand);
}

.blog-sidebar .related .blog-next-steps a span {
  gap: 10px;
}

.blog-sidebar .related .blog-next-steps a span i {
  color: var(--teal);
  font-size: 1rem;
}

.article-cta {
  margin-top: 42px;
  padding: 25px;
  border-color: color-mix(in srgb, var(--brand) 22%, var(--line));
  border-radius: 19px;
  background: linear-gradient(135deg, var(--brand-soft), var(--surface));
}

.article-cta h2 {
  margin: 0 0 7px;
}

.article-cta p {
  margin: 0;
}

/* ---------- Responsive ---------- */
@media (max-width: 1020px) {
  .blog-featured {
    grid-template-columns: minmax(0, 1fr);
  }

  .blog-featured__media {
    order: -1;
    min-height: 0;
    aspect-ratio: 16 / 9;
  }

  .blog-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .blog-article-layout {
    grid-template-columns: 1fr;
  }

  .blog-article-layout > .blog-article-content,
  .blog-article-layout > .blog-sidebar {
    grid-column: 1;
    grid-row: auto;
  }

  .blog-sidebar {
    position: static;
  }
}

@media (max-width: 760px) {
  .blog-hero {
    padding: 22px 0 18px;
  }

  .blog-list-section {
    padding: 36px 0 66px;
  }

  .blog-featured {
    margin-bottom: 40px;
    border-radius: 24px;
  }

  .blog-section-head {
    align-items: flex-start;
  }

  .blog-article {
    padding: 26px 0 72px;
  }

  .blog-article-hero {
    min-height: 330px;
    border-radius: 24px;
  }

  .blog-article-hero__badge {
    display: none;
  }

  .blog-article-hero h1 {
    font-size: clamp(1.6rem, 6.4vw, 2.1rem);
  }

  .blog-article-layout {
    gap: 20px;
    margin-top: 16px;
  }
}

@media (max-width: 650px) {
  .blog-grid {
    grid-template-columns: 1fr;
  }

  .blog-featured__body {
    gap: 13px;
    padding: 22px;
  }

  .blog-featured__caption {
    inset: auto 12px 12px;
    padding: 10px 13px;
    font-size: .7rem;
  }

  .blog-article-hero {
    min-height: 310px;
    padding: 22px;
  }

  .blog-article-hero .blog-meta {
    gap: 8px;
  }

  .blog-article-hero .blog-meta span,
  .blog-article-hero .blog-meta time {
    min-height: 31px;
    padding: 6px 9px;
  }

  .blog-article-content {
    padding: 22px;
    border-radius: 20px;
  }

  .blog-pagination {
    display: flex;
    justify-content: space-between;
  }
}

@media (max-width: 390px) {
  .blog-hero h1 {
    font-size: 1.42rem;
  }

  .blog-featured h2 {
    font-size: 1.62rem;
  }

  .blog-featured__cta {
    width: 100%;
    justify-content: center;
  }

  .blog-post-card__foot {
    flex-direction: column;
    align-items: flex-start;
    gap: 9px;
  }

  .blog-article-hero {
    min-height: 300px;
    padding: 18px;
  }

  .blog-article-hero h1 {
    font-size: 1.55rem;
  }

  .blog-article-hero .blog-meta {
    align-items: flex-start;
  }
}

/* ---------- Dark theme ---------- */
[data-theme="dark"] .blog-featured,
[data-theme="dark"] .blog-post-card,
[data-theme="dark"] .blog-article-content,
[data-theme="dark"] .blog-sidebar .related {
  border-color: var(--line);
  background-color: var(--surface);
}

[data-theme="dark"] .blog-post-card__tag {
  background-color: rgba(16, 24, 23, .72);
}

[data-theme="dark"] .blog-featured__cta {
  color: #0e1a19;
}

[data-theme="dark"] .blog-article-hero {
  border-color: rgba(255,255,255,.14);
}

[data-theme="dark"] .article-cta {
  background: linear-gradient(135deg, color-mix(in srgb, var(--brand) 12%, var(--surface)), var(--surface));
}

/* ---------- Advertisement placements ---------- */
.blog-ad {
  margin: 30px auto;
}

.blog-article-content > .blog-ad {
  margin: 34px 0 0;
}

.blog-sidebar .blog-ad {
  margin: 18px 0 0;
}

.blog-ad.hidden,
.blog-ad[aria-hidden="true"]:empty {
  display: none;
}

/* The article template wraps the cover photo in <figure class="blog-article-hero__media">.
   The hero is a flex container, so that figure became a flex item with no in-flow
   content (its <img> is absolutely positioned) and collapsed to zero width, hiding
   the photo. Take the figure out of flow so it covers the hero like the image did. */
.blog-article-hero .blog-article-hero__media {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  min-height: 0;
  margin: 0;
  background: none;
}

.blog-article-hero .blog-article-hero__media img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* The hero already carries the title, standfirst and metadata, so the caption
   chip would sit on top of them. The alt text stays on the image. */
.blog-article-hero .blog-article-hero__media figcaption {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* The template no longer emits a separate overlay element, so the hero paints its
   own scrim. It sits above the cover photo and below the title block (z-index 2). */
.blog-article-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(180deg, rgba(7, 18, 17, .25) 0%, rgba(7, 18, 17, .55) 45%, rgba(7, 18, 17, .94) 100%);
  pointer-events: none;
}
