/* Nav height variable for sticky offset */
:root { /* override this in your global CSS if your nav height differs */
  --nav-h: 64px;
}
/* ================================
   Content Page Styles (content.css)
   ================================ */

/* Ensure consistent typography hierarchy */
.content-page .content-title,
.content-page .content-subtitle,
.content-page h4,
.content-page .content-dek {
  font-family: var(--display-font, 'Literata', serif);
}

/* Root wrapper so we don’t clash with index styles */
.content-page {
  color: var(--ink);
  background: transparent;
}

/* ---- Head / Hero-ish text block ---- */
.content-page .content-head {
  max-width: 72ch;
  margin-left: auto;
  margin-right: auto;
  margin-top: 0; /* tighten top spacing to match index */
}

/* When the head lives inside the left bubble, align it with the prose instead of centering */
.content-page .content-main .content-head {
  max-width: none;   /* fill card width */
  margin-left: 0;    /* flush-left in the card */
  margin-right: 0;   /* no centering inside card */
}

/* Ensure prose block remains aligned to the same left edge */
.content-page .content-main .content-body { 
  max-width: none; 
  margin-left: 0; 
  margin-right: 0; 
}

/* On stacked / mid widths, let prose use full card width */
@media (max-width: 1024px) {
  .content-page .content-main .content-head,
  .content-page .content-main .content-body {
    max-width: none;
  }
}

/* Ensure the very first rail on content pages doesn’t add extra top gap */
.content-page .rail:first-of-type { margin-top: 0 !important; }
/* Prevent heading’s own margin from leaking upward */
.content-page .content-head > :first-child { margin-top: 0; }

.content-page .content-title {
  margin: 0 0 .25em 0;
  line-height: 1.1;
  font-weight: 700;
  font-size: clamp(2rem, 2.5vw + 1rem, 3rem);
  color: var(--ink);
}

/* Subtitle: confident, distinct tier between title and dek */
.content-page .content-subtitle,
.content-page h4 {
  margin: .3em 0 .5em 0;
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1.3;
  color: var(--ink);
  font-style: italic;
  border: 0;                                  /* no rule; keep it clean */
  padding: 0;                                 /* remove leftover padding */
}

.content-page .content-dek {
  font-size: 1.05rem;
  line-height: 1.6;
  color: color-mix(in srgb, var(--ink) 80%, var(--muted));
  font-style: italic;
  font-weight: 400;
}

/* ---- Main layout: 2/3 content bubble + 1/3 aside CTA ---- */
/* ---- Main layout: mobile-first single column ---- */
.content-page .content-layout {
  display: grid !important;
  grid-template-columns: 1fr; /* mobile: stack */
  grid-template-areas:
    "aside"
    "main";                /* CTA above content on mobile */
  gap: 24px;
  align-items: start;
  margin-top: 0;                           /* prevent collapse */
  padding-top: 0;/*calc(var(--nav-h) + 16px);  /* match sticky aside offset so tops align */
}

@media (min-width: 900px) {
  .content-page .content-layout {
    grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr);
    grid-template-areas: "main aside"; /* content left, CTA right */
  }
  .content-page .content-layout > .content-main { grid-column: 1; }
  .content-page .content-layout > .content-aside { grid-column: 2; }
}

.content-page .content-main,
.content-page .content-aside { min-width: 0; width: auto; }

.content-page .content-main { grid-area: main; }
.content-page .content-aside { grid-area: aside; }

.content-page .content-layout > * { max-width: none; }

/* The “bubble” card for prose */
.content-page .content-main.card {
  background: var(--card);
  border: 1px solid var(--ring);
  border-radius: 16px;
  box-shadow: 0 2px 4px var(--shadow), 0 12px 30px var(--shadow);
  padding: 22px;
}

/* Right rail (sticky CTA on desktop) */
.content-page .content-aside {
  position: sticky;
  top: calc(var(--nav-h) + 6px); /* clear fixed nav while scrolling */
}

/* ---- Body copy inside the bubble ---- */
.content-page .content-body {
  max-width: none; /* fill card width by default */
  font-size: 1.05rem;
  line-height: 1.65;
}

.content-page .content-body p + p { margin-top: 1rem; }

.content-page .content-body h2,
.content-page .content-body h3,
.content-page .content-h3 {
  margin: 2rem 0 .5rem 0;
  font-size: 1.15rem;
}

/* Links inside content should use site link style but not underline by default */
.content-page .content-body a {
  color: var(--link);
  text-decoration: none;
  border-bottom: 1px solid color-mix(in oklab, var(--link) 65%, transparent);
}
.content-page .content-body a:hover {
  border-bottom-color: var(--link);
}

/* ---- Figures & images ---- */
.content-page .content-figure {
  margin: 1.25rem 0;
}
.content-page .content-img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 10px;
  box-shadow: 0 1px 0 rgba(0,0,0,.03) inset;
  border: 1px solid var(--ring);
}
.content-page .caption {
  font-size: .9rem;
  color: var(--muted);
  margin-top: .4rem;
}

/* ---- Gallery (Grid) ---- */
.content-page .gallery.grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.content-page .gallery.grid {
  margin-bottom: 1.5rem;
}
.content-page .gallery.grid figure { margin: 0; }
.content-page .gallery.grid img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 10px;
  border: 1px solid var(--ring);
  box-shadow: 0 1px 0 rgba(0,0,0,.03) inset;
}
@media (min-width: 720px) {
  .content-page .gallery.grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (min-width: 1100px) {
  .content-page .gallery.grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* ---- Gallery (Grid, Square-Crop variant) ---- */
/* Usage: <div class="gallery grid grid-square"> ... */
/* Auto-fit columns so the row fills the container at any width */
.content-page .gallery.grid.grid-square {
  grid-template-columns: repeat(var(--cols, 2), minmax(0, 1fr));
}

/* Keep figure as a normal block (allows caption below) */
.content-page .gallery.grid.grid-square figure {
  position: relative;
  margin: 0;
  box-shadow: 0 1px 0 rgba(0,0,0,.03) inset;
  padding: 0;                    /* no extra padding */
}

/* Make the IMAGE itself a centered square and crop to fit */
.content-page .gallery.grid.grid-square figure > img {
  width: 100%;
  aspect-ratio: 1 / 1;          /* force square area */
  height: auto;                 /* let aspect-ratio control height */
  object-fit: cover;            /* center-crop */
  object-position: center;
  display: block;
  border-top-left-radius: 10px;
  border-top-right-radius: 10px;
}

/* Caption sits below the square image (and remains visible) */
.content-page .gallery.grid.grid-square figcaption,
.content-page .gallery.grid.grid-square .caption {
  position: static;
  margin-top: .4rem;
  font-size: .9rem;
  color: var(--muted);
}

/* ---- Gallery (Carousel) — CLEAN BASELINE ---- */
.content-page .carousel { position: relative; margin-bottom: 1.5rem; }

.content-page .carousel-viewport {
  overflow: hidden;
  border-radius: 12px;
  background: var(--card);
  border: 1px solid var(--ring);
}

/* one full slide per view, horizontally */
.content-page .carousel-track {
  display: flex;
  align-items: flex-start;
  transition: transform 300ms ease;
  will-change: transform;
}

/* stack image over caption; center image; no forced stretch */
.content-page .carousel-slide {
  flex: 0 0 auto;             /* width set by JS; no 100% basis conflict */
  width: 100%;                /* fallback before JS runs */
  box-sizing: border-box;
  display: flex;
  flex-direction: column;     /* image on top, caption below */
  align-items: center;        /* center image horizontally */
  justify-content: flex-start;
  margin: 0;
  background: var(--card);
}
.content-page .carousel-slide img {
  display: block;
  max-width: 100%;
  height: auto;
  object-fit: contain;
}
.content-page .carousel .caption {
  margin-top: 8px;
  padding: 0 10px 10px;
  font-size: .9rem;
  color: var(--muted);
}

/* nav buttons */
.content-page .carousel-btn {
  position: absolute;
  top: 50%; transform: translateY(-50%);
  inline-size: 40px; block-size: 40px;
  border-radius: 999px;
  border: 1px solid var(--ink);
  background: color-mix(in srgb, var(--card) 85%, transparent);
  color: var(--ink);
  display: grid; place-items: center;
  cursor: pointer; z-index: 10;
}
.content-page .carousel-btn.prev { left: 8px; }
.content-page .carousel-btn.next { right: 8px; }
.content-page .carousel-btn:disabled { opacity: .45; cursor: default; }

/* ---- CTA box / buttons (right rail) ---- */
.content-page .cta .cta-box,
.content-page .content-aside .cta-box {
  background: var(--card);
  border: 1px solid var(--ring);
  border-radius: 12px;
  box-shadow: 0 2px 4px var(--shadow), 0 12px 30px var(--shadow);
  padding: 16px;
}

.content-page .cta-title { margin: 0 0 .25rem 0; font-size:1.5rem !important}
.content-page .cta-text { margin: 0 0 .75rem 0; color: var(--muted); }

.content-page .cta-actions {
  display: flex;
  flex-direction: column; /* stack vertically */
  gap: 10px;
}

.content-page .btn {
  display: inline-block;
  padding: 10px 14px;
  border: 1px solid var(--link);
  border-radius: 8px;
  text-decoration: none;
  color: var(--link);
  background: transparent;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
  width: 80%;
  margin:0 auto;
  text-align: center;
}

.content-page .btn:hover {
  background: var(--link);
  color: var(--card);
}

.content-page .btn.primary {
  background: var(--link);
  color: var(--card);
  border-color: var(--link);
}

/* Hover + focus: slight lift */
.btn:hover,
.btn:focus-visible {
  transform: translateY(-1px);
  box-shadow: 0 3px 6px var(--shadow);
}

/* Primary variant */
.btn.primary {
  background: linear-gradient(180deg, var(--link), color-mix(in oklab, var(--link) 90%, white));
  color: #fff;
  border-color: color-mix(in oklab, var(--link) 80%, var(--ring));
}

/* Hover + focus for primary: deepen color + extra shadow */
.btn.primary:hover,
.btn.primary:focus-visible {
  background: color-mix(in oklab, var(--link) 75%, black 10%);
  box-shadow: 0 4px 10px var(--shadow-strong);
}

/* ---- Utilities / helpers ---- */
.content-page .muted { color: var(--muted); }
.content-page .rail { margin-top: 28px; }
.content-page .line-clamp {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ---- Global link style unification for content pages ---- */
.content-page a:not(.btn):not(.mascot) {
  color: var(--link);
  text-decoration: none;
  border-bottom: 1px solid color-mix(in oklab, var(--link) 65%, transparent);
  transition: border-bottom-color 0.2s ease, color 0.2s ease;
}

.content-page a:not(.btn):not(.mascot):hover {
  color: var(--link);
  border-bottom-color: var(--link);
}

/* Ensure mascot anchor never draws an underline */
.content-page a.mascot { border-bottom: none !important; text-decoration: none !important; }

/* Remove underline for buttons and CTAs */
.content-page .btn,
.content-page .cta a.btn {
  border-bottom: none;
  text-decoration: none;
}

/* ---- Responsive stacking for the layout ---- */
@media (max-width: 900px) {
  .content-page .content-layout {
    grid-template-columns: 1fr; /* stack */
  }
  .content-page .content-aside {
    position: static;
    margin-top: 16px;
  }
}

/* About page: place aside below main on mobile */
@media (max-width: 900px) {
  .content-page .content-layout:has(.about-aside) {
    grid-template-areas:
      "main"
      "aside";
  }
}

/* Corner mascot on content pages */
.content-page .content-main.card { position: relative; }
.content-page .mascot.in-card{
  position: absolute;
  top: -10px;         /* perch slightly outside the bubble */
  right: -10px;
  width: 72px;
  height: 72px;       /* fixed box so it’s visible even before image injects */
  z-index: 12;
  pointer-events: auto; /* so clicks trigger the bubble */
  background-size: contain;
  background-position: center;
  background-repeat: no-repeat;
}
@media (max-width: 900px){
  .content-page .mascot.in-card{ top: auto; bottom: -8px; right: -6px; width: 60px; }
}

/* Make locked-height carousels center content vertically by stretching slides to viewport height */
.content-page .carousel[data-lock-height] .carousel-slide,
.content-page .carousel[data-carousel-height="max"] .carousel-slide {
  justify-content: center;
}

/* Make slides match the viewport height when height is locked */
.content-page .carousel[data-lock-height] .carousel-viewport,
.content-page .carousel[data-carousel-height="max"] .carousel-viewport { position: relative; }

.content-page .carousel[data-lock-height] .carousel-track,
.content-page .carousel[data-carousel-height="max"] .carousel-track {
  height: 100%;                /* take on the viewport's height */
  align-items: stretch;        /* stretch slides to full height */
}

.content-page .carousel[data-lock-height] .carousel-slide,
.content-page .carousel[data-carousel-height="max"] .carousel-slide {
  height: 100%;                /* now justify-content centers within full height */
}

.video-wrapper {
  position: relative;
  width: 100%;
  padding-bottom: 56.25%; /* 16:9 aspect ratio; adjust if needed */
  height: 0;
  overflow: hidden;
  border-radius: 10px; /* optional, to match your site’s style */
}

.video-wrapper iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

/* ---- Footer anchored to bottom ---- */
html, body {
  height: 100%;
}

body {
  display: flex;
  flex-direction: column;
}

main {
  flex: 1 0 auto;
}

footer {
  flex-shrink: 0;
  margin-top: auto;
}

.notfound-sub {
  margin-bottom:1rem !important;
}

.notfound-promo {
  text-align: center;
}
.notfound-promo a img,
.notfound-promo img,
.notfound-promo a {
  border-bottom: none !important;
  text-decoration: none !important;
}

/* ============================
   Mobile Typography Enhancements
   ============================ */
@media (max-width: 720px) {
  .content-page .content-body {
    font-size: 1.15rem;      /* was 1.05rem */
    line-height: 1.75;
  }

  .content-page .content-title {
    font-size: clamp(2.2rem, 6vw, 3rem);
  }

  .content-page .content-subtitle {
    font-size: 1.35rem;
  }

  .content-page .content-dek {
    font-size: 1.15rem;
  }

  .content-page .content-body h2,
  .content-page .content-body h3 {
    font-size: 1.25rem;
  }
}