/* Motion layer — entrance, scroll reveal, page-to-page transition.
   Deliberately restrained: the template's own language is "fade + 10px rise".
   Everything here is opt-in via html[data-motion="on"], which only motion.js sets,
   so with JS disabled the site is fully visible and static. */

@media (prefers-reduced-motion: no-preference) {

  /* --- cross-document page transition (Chrome 126+), native and interruptible --- */
  @view-transition { navigation: auto; }

  ::view-transition-old(root) {
    animation: 130ms ease-out both fade-out;
  }
  ::view-transition-new(root) {
    animation: 240ms cubic-bezier(.22, .61, .36, 1) both fade-in;
  }

  /* --- hover feedback: the template colours on hover, it just snaps --- */
  a, button { transition: color .18s ease, background-color .18s ease, opacity .18s ease; }
  img { transition: opacity .3s ease; }

  html { scroll-behavior: smooth; }
}

@keyframes fade-out { to { opacity: 0; } }
@keyframes fade-in  { from { opacity: 0; } }

/* --- scroll reveal ------------------------------------------------------- */
html[data-motion="on"] [data-reveal] {
  opacity: 0;
  transform: translateY(12px);
  will-change: opacity, transform;
}

html[data-motion="on"] [data-reveal].is-in {
  opacity: 1;
  transform: none;
  transition:
    opacity  .55s cubic-bezier(.22, .61, .36, 1),
    transform .55s cubic-bezier(.22, .61, .36, 1);
  transition-delay: var(--reveal-delay, 0ms);
}

/* once revealed, stop reserving a compositor layer */
html[data-motion="on"] [data-reveal].is-done { will-change: auto; }

/* --- fallback page fade for browsers without View Transitions ------------ */
/* Short on purpose: the fade must finish before the new document paints, so a long
   one reads as a stall rather than a transition. */
html.is-leaving,
html.is-leaving body { opacity: 0; transition: opacity .09s ease-out; }

html.is-entering body { animation: page-in .22s cubic-bezier(.22, .61, .36, 1) both; }

@keyframes page-in { from { opacity: 0; } to { opacity: 1; } }

/* --- never animate for people who asked us not to ------------------------ */
@media (prefers-reduced-motion: reduce) {
  html[data-motion="on"] [data-reveal] {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }
  html.is-leaving, html.is-leaving body, html.is-entering body { opacity: 1; animation: none; transition: none; }
  html { scroll-behavior: auto; }
}

/* ---- archive category filter (assets/filter.js) ---------------------------- */
/* The chips are plain divs in the export; filter.js gives them role/tabindex and
   filters the cards below. Colour comes from the inherited text colour, so it reads
   the same in both themes. */
[data-cg-chip] { cursor: pointer; }
[data-cg-chip][aria-pressed="false"] { opacity: .58; }
[data-cg-chip][aria-pressed="true"] { opacity: 1; box-shadow: inset 0 0 0 1.5px currentColor; }
[data-cg-chip]:hover { opacity: 1; }
[data-cg-chip]:focus-visible { outline: 2px solid currentColor; outline-offset: 3px; }

[data-cg-unit] { transition: opacity .15s ease; }
[data-cg-unit].cg-out { opacity: 0; pointer-events: none; }
[data-cg-unit].cg-hide { display: none; }

@media (prefers-reduced-motion: reduce) {
  [data-cg-unit] { transition: none; }
}

/* current page in the nav: 2% colour shift alone is invisible (motion.js sets the attribute) */
a[aria-current="page"] {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 5px;
}

/* replaces the dead "Load More" on the feed, where the capture has no further posts */
.cg-all-posts {
  display: inline-block;
  margin-top: 28px;
  font-size: 14px;
  letter-spacing: 0.02em;
  text-decoration: underline;
  text-underline-offset: 4px;
  opacity: 0.75;
  transition: opacity 160ms ease;
}
.cg-all-posts:hover { opacity: 1; }

/* nav labels: bold on hover / keyboard focus, with the bold width reserved so the
   row never shifts (Inter 700 is 1–3px wider than 400 per label) */
a.cg-navlink { transition: color .15s ease; }
a.cg-navlink .cg-navw { display: inline-block; }
a.cg-navlink .cg-navw::after {
  content: attr(data-txt);
  display: block; height: 0; overflow: hidden; visibility: hidden;
  font-weight: 700;
}
a.cg-navlink:hover,
a.cg-navlink:focus-visible { font-weight: 700; }

/* the inner span carries the weight explicitly too: whatever a page's preset rules do to
   the anchor, the element that paints the glyphs is the one that must change */
a.cg-navlink:hover .cg-navw,
a.cg-navlink:focus-visible .cg-navw { font-weight: 700 !important; }

/* ---- nav: optical centring -------------------------------------------------
   The labels' ink sat 3px above the wordmark and the theme toggle (measured on the
   rendered pixels, not assumed). One nudge, inline elements accept relative offsets. */
a.cg-navlink { position: relative; top: 3px; }

/* ---- Dot Button (Framer Marketplace component by Zelo Studio) --------------
   Transparent pill (page background shows through), Playfair Display 400 label at the
   post-title size, one 8px dot at the trailing edge.
   On hover / keyboard focus / selected the dot grows into the pill's fill and the
   label flips to the paper colour — the "dot mask". Applied to the Archive filters
   and the Resources tabs. */
html { --cgd-pill: transparent; --cgd-ink: #0d0d0d; --cgd-paper: #fafafa; }
html[data-theme="dark"] { --cgd-pill: transparent; --cgd-ink: #fafafa; --cgd-paper: #0d0d0d; }

.cg-dot {
  position: relative !important;
  display: inline-flex !important;
  align-items: center; justify-content: center;
  height: 48px !important; min-height: 48px;
  padding: 0 34px 0 14px !important;
  border-radius: 999px !important;
  background: var(--cgd-pill) !important;
  color: var(--cgd-ink) !important;
  overflow: hidden;
  transition: color .3s ease, background-color .3s ease;
}
/* Framer top-aligns the label inside its own wrapper — centre it, or the text floats
   above the dot (measured: label ink 13px north of the dot on the Archive row) */
.cg-dot > div { display: flex !important; align-items: center !important; justify-content: center !important; height: 100% !important; }
/* the fill: a dot that grows into the pill */
.cg-dot::before {
  content: ""; position: absolute; z-index: 0;
  right: 16px; top: 50%; width: 8px; height: 8px; margin-top: -4px;
  border-radius: 999px; background: var(--cgd-ink);
  transition: width .42s cubic-bezier(.4, 0, .2, 1), height .42s cubic-bezier(.4, 0, .2, 1),
              right .42s cubic-bezier(.4, 0, .2, 1), top .42s cubic-bezier(.4, 0, .2, 1),
              margin-top .42s cubic-bezier(.4, 0, .2, 1);
}
/* Framer draws its hairline border on the same element's ::after — retire it */
.cg-dot::after { border-color: transparent !important; }
/* post-title voice, not a UI sans: Playfair Display at regular weight, no tracking */
.cg-dot p {
  position: relative; z-index: 1;
  font-family: "Playfair Display", "Playfair Display Placeholder", serif !important;
  font-weight: 400 !important; font-size: 17px !important;
  letter-spacing: 0 !important; line-height: 1.2 !important;
  color: inherit !important;
}
.cg-dotmark {
  position: absolute; z-index: 2; right: 16px; top: 50%;
  width: 8px; height: 8px; margin-top: -4px; border-radius: 999px;
  background: var(--cgd-ink);
  transition: background-color .3s ease;
  pointer-events: none;
}
.cg-dot:hover, .cg-dot:focus-visible, .cg-dot.is-active,
[data-cg-chip][aria-pressed="true"] .cg-dot { color: var(--cgd-paper) !important; }
.cg-dot:hover::before, .cg-dot:focus-visible::before, .cg-dot.is-active::before,
[data-cg-chip][aria-pressed="true"] .cg-dot::before {
  width: 100%; height: 100%; right: 0; top: 0; margin-top: 0;
}
.cg-dot:hover .cg-dotmark, .cg-dot:focus-visible .cg-dotmark, .cg-dot.is-active .cg-dotmark,
[data-cg-chip][aria-pressed="true"] .cg-dot .cg-dotmark { background: var(--cgd-paper); }
/* the Framer wrappers are pinned to 36px; a 48px pill needs them to breathe */
.cg-dotwrap, .cg-dotrow { height: auto !important; }
/* Framer marks the chosen chip with a 1.5px inset ring on the wrapper — the dot fill says
   it better, and a square ring around a pill is not the Dot Button look */
.cg-dotwrap { box-shadow: none !important; }
/* a pill never squeezes its label into a letter stack */
.cg-dotwrap, .cg-dot { flex: 0 0 auto !important; }
.cg-dot, .cg-dot p { white-space: nowrap !important; }
.cg-dotrow { flex-wrap: wrap !important; row-gap: 12px !important; }

@media (max-width: 640px) {
  .cg-dot { height: 44px !important; min-height: 44px; padding: 0 32px 0 12px !important; }
  .cg-dot p { font-size: 16px !important; }
  .cg-dotmark, .cg-dot::before { right: 14px; }
}
/* keyboard focus lands on the wrapper (it is the button), so mirror the hover state */
[data-cg-chip]:focus-visible { outline: 2px solid var(--cgd-ink); outline-offset: 3px; border-radius: 999px; }
[data-cg-chip]:focus-visible .cg-dot { color: var(--cgd-paper) !important; }
[data-cg-chip]:focus-visible .cg-dot::before { width: 100%; height: 100%; right: 0; top: 0; margin-top: 0; }
[data-cg-chip]:focus-visible .cg-dot .cg-dotmark { background: var(--cgd-paper); }

@media (prefers-reduced-motion: reduce) {
  .cg-dot, .cg-dot::before, .cg-dotmark { transition: none !important; }
}
