@font-face {
  font-family: Castor Poppins;
  src: url("https://www.digest.andymarshall.co/assets/fonts/poppins-latin-400.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: Castor Poppins;
  src: url("https://www.digest.andymarshall.co/assets/fonts/poppins-latin-500.woff2") format("woff2");
  font-weight: 500;
  font-display: swap;
}

body:has(#castor-story) :is(.global-main, .loci-ghost-shell) {
  width: 100%;
  max-width: none;
  padding: 0;
  margin: 0;
}

body:has(#castor-story) #gld-lens-ribbon-global { display: none !important; }

#castor-story {
  --gold: #f1d681;
  --sunlit: #d9ac3b;
  --paper: #f5f0e7;
  --ink: #292a2e;
  --ochre: #b88432;
  --wine: #7d3942;
  --burnt: #a94e20;
  --warm-white: #fff9eb;
  --gutter: clamp(18px, 4.5vw, 68px);
  --inner: min(100% - 2 * var(--gutter), 1420px);
  margin: 0;
  width: 100%;
  color: var(--ink);
  background: var(--paper);
  font: 400 16px/1.55 "Castor Poppins", Arial, sans-serif;
  text-align: left;
  letter-spacing: normal;
  word-break: normal;
}

#castor-story *,
#castor-story *::before,
#castor-story *::after {
  box-sizing: border-box;
}

#castor-story [hidden] { display: none !important; }

#castor-story :is(h1, h2, p, figure, figcaption, blockquote, ol) {
  width: auto;
  max-width: none;
  margin: 0;
  padding: 0;
  font: inherit;
  color: inherit;
  text-align: inherit;
  letter-spacing: inherit;
}

#castor-story :is(a, button) {
  box-shadow: none;
  font: 500 16px/1.2 "Castor Poppins", Arial, sans-serif;
  text-transform: none;
  letter-spacing: normal;
}

#castor-story :focus-visible {
  outline: 3px solid #ffdc89;
  outline-offset: 4px;
}

#castor-story .castor-hero {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  color: var(--warm-white);
  background:
    radial-gradient(ellipse at 87% 71%, #e0ac4d 0%, #b2602b 24%, transparent 53%),
    radial-gradient(ellipse at 58% 100%, #8f3f48 3%, transparent 60%),
    linear-gradient(116deg, #17131c 0%, #271826 39%, #4c222e 73%, #632d34);
  border-bottom: 1px solid var(--sunlit);
}

#castor-story .castor-hero__inner {
  --arch: 50% 50% 0 0 / 48% 48% 0 0;
  display: grid;
  grid-template-columns: minmax(0, .88fr) minmax(0, 1.32fr);
  align-items: center;
  isolation: isolate;
  width: var(--inner);
  min-height: clamp(590px, 78svh, 860px);
  margin: auto;
  padding: clamp(28px, 5.8svh, 70px) 0;
  gap: clamp(22px, 3vw, 60px);
}

#castor-story .castor-portal {
  grid-column: 2;
  grid-row: 1;
  position: relative;
  min-width: 0;
  height: 100%;
  min-height: 470px;
  padding: clamp(8px, 1.2vw, 16px);
  border: 1px solid #f1d681dc;
  border-radius: var(--arch);
  background: linear-gradient(130deg, #ffd98c4d, #c05f4c46 68%, #ffc6666e);
  box-shadow: 0 16px 48px #170c18a6, inset 0 0 22px #ffbb4272;
}

#castor-story .castor-portal::before {
  content: "";
  position: absolute;
  pointer-events: none;
  inset: -8px -8px 7px;
  border: 1px solid #ffda9052;
  border-bottom: 0;
  border-radius: var(--arch);
}

#castor-story .castor-portal::after {
  content: "";
  position: absolute;
  pointer-events: none;
  left: -12px;
  right: -12px;
  bottom: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, #e4ab50 20%, #ffe6aa 66%, transparent);
}

#castor-story .castor-portal picture {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  overflow: hidden;
  border: 1px solid #f7ce83;
  border-radius: var(--arch);
  background: #51343d;
}

#castor-story .castor-hero__image {
  display: block;
  width: 100%;
  max-width: none;
  height: 100%;
  object-fit: cover;
  object-position: 54% 48%;
  transition: transform .65s ease;
}

#castor-story .castor-hero:has(.castor-enter:is(:hover, :focus-visible)) .castor-hero__image {
  transform: scale(1.035);
}

#castor-story .castor-hero__type {
  grid-column: 1;
  grid-row: 1;
  position: relative;
  width: 100%;
  padding-block: 24px;
}

#castor-story .castor-hero__type > p {
  color: #ffde9e;
  margin-bottom: clamp(12px, 2.5vh, 26px);
  font-weight: 500;
}

#castor-story .castor-hero h1 {
  display: block;
  color: var(--gold);
  font: 400 clamp(72px, 10vw, 156px)/.9 "Castor Poppins", Arial, sans-serif;
  letter-spacing: -.075em;
}

#castor-story .castor-hero__subtitle {
  display: block;
  max-width: 13ch;
  margin-top: .36em;
  font-size: .39em;
  letter-spacing: -.042em;
  line-height: 1.04;
  text-wrap: balance;
}

#castor-story .castor-hero__marked { white-space: nowrap; }

#castor-story .castor-hero__marked img {
  display: inline-block;
  width: auto;
  height: .75em;
  height: 1cap;
  vertical-align: baseline;
  margin-inline-start: .09em;
}

#castor-story .castor-hero__quote {
  margin: clamp(24px, 5vh, 50px) 0 25px;
  padding: 0;
  border: 0;
  color: var(--warm-white);
  background: transparent;
  font-size: clamp(17px, 1.6vw, 23px);
}

#castor-story :is(.castor-enter, .castor-support__link) {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 11px 20px;
  border: 1px solid #dfa65b;
  border-radius: 40px;
  background: var(--burnt);
  color: #fffdfa;
  text-decoration: none;
  cursor: pointer;
}

#castor-story :is(.castor-enter, .castor-support__link):hover { background: #883c17; }

#castor-story #castor-viewer {
  --surround: #271b22;
  --bloom: #6d392b;
  --edge: #bb884d;
  --highlight: #f5d990;
  --picture-min: min(40svh, 410px);
  display: grid;
  grid-template-rows: auto minmax(min-content, 1fr) auto auto;
  width: 100%;
  padding: clamp(16px, 2.6vh, 34px) max(var(--gutter), calc((100% - 1420px) / 2));
  color: var(--warm-white);
  background-color: var(--surround);
  background-image: radial-gradient(ellipse at 24% 3%, var(--bloom), transparent 69%);
  scroll-margin: 16px;
}

#castor-story #castor-viewer[data-tone="clay"] { --surround: #351c26; --bloom: #79412c; --edge: #bd805b; --highlight: #ffda9e; }
#castor-story #castor-viewer[data-tone="wine"] { --surround: #2c172a; --bloom: #713847; --edge: #bf7985; --highlight: #ffe1c7; }
#castor-story #castor-viewer[data-tone="teal"] { --surround: #1a2b2e; --bloom: #3f5b4b; --edge: #89a589; --highlight: #f8df94; }
#castor-story #castor-viewer[data-tone="blue"] { --surround: #171e34; --bloom: #403e64; --edge: #9292ad; --highlight: #f8df94; }

#castor-story .castor-viewer__heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

#castor-story :is(.castor-viewer__heading h2, .castor-chapters) {
  color: var(--highlight);
  font-weight: 400;
  font-size: clamp(19px, 2.2vw, 31px);
  letter-spacing: -.035em;
  line-height: 1.15;
}

#castor-story .castor-chapters {
  flex: 0 1 auto;
  min-height: 44px;
  min-width: 0;
  max-width: 100%;
  padding: 0 6px 0 0;
  border: 0;
  border-radius: 3px;
  background: transparent;
  font-family: "Castor Poppins", Arial, sans-serif;
  color-scheme: dark;
  cursor: pointer;
}

#castor-story .castor-chapters option {
  color: var(--warm-white);
  background: var(--surround);
  font-size: 16px;
}

#castor-story .castor-figure {
  display: grid;
  grid-template-rows: auto minmax(var(--picture-min), 1fr);
  min-width: 0;
}

#castor-story .castor-caption {
  grid-row: 1;
  padding: 6px 0 clamp(14px, 2.4vh, 24px);
  color: var(--highlight);
  text-wrap: pretty;
}

#castor-story .castor-caption blockquote {
  max-width: 75ch;
  margin-inline: auto;
  border: 0;
  border-inline-start: 2px solid var(--edge);
  padding-inline-start: clamp(13px, 1.7vw, 23px);
  color: inherit;
  background: transparent;
  font-size: clamp(17px, 1.6vw, 23px);
  font-style: normal;
  line-height: 1.5;
}

#castor-story .castor-stage {
  grid-row: 2;
  position: relative;
  min-width: 0;
  overflow: hidden;
  background: #100d13;
  background-image: radial-gradient(ellipse at 50% 42%, #261923, transparent 70%);
  border: 1px solid var(--edge);
  box-shadow: 0 14px 35px #100a1859;
  touch-action: pan-y pinch-zoom;
}

#castor-story .castor-stage picture { position: absolute; inset: 0; display: block; }

#castor-story .castor-stage img {
  display: block;
  max-width: none;
  width: 100%;
  height: 100%;
  object-fit: contain;
  user-select: none;
}

#castor-story .castor-stage[data-loading] { cursor: progress; }

#castor-story .castor-stage__problem {
  position: absolute;
  inset: 0;
  display: grid;
  justify-items: center;
  align-content: center;
  text-align: center;
  gap: 12px;
  padding: 16px;
  background: #181419;
}

#castor-story .castor-navigation {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: clamp(6px, 1.2vw, 15px);
  margin-top: 17px;
}

#castor-story .castor-control {
  margin: 0;
  border: 1px solid var(--edge);
  border-radius: 50px;
  min-height: 44px;
  min-width: 44px;
  padding: 7px 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  color: var(--warm-white);
  background: #261928a1;
  cursor: pointer;
}

#castor-story .castor-control svg { display: block; flex: 0 0 auto; }

#castor-story .castor-control:hover,
#castor-story .castor-control:focus-visible {
  border-color: var(--highlight);
  color: var(--highlight);
  background: #2f1d2b;
}

#castor-story .castor-control[aria-disabled="true"] { opacity: .57; cursor: default; }

#castor-story .castor-counter {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  text-align: center;
  padding-inline: 3px;
}

#castor-story .castor-play { margin-left: auto; }

#castor-story .castor-thumbs {
  position: relative;
  display: flex;
  min-width: 0;
  justify-content: start;
  gap: 7px;
  margin-top: 13px;
  padding: 7px 5px 10px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  list-style: none;
  scrollbar-width: thin;
  scrollbar-color: var(--edge) transparent;
}

#castor-story .castor-thumbs li { margin: 0; padding: 0; flex: 0 0 auto; }

#castor-story .castor-thumb {
  display: grid;
  width: 76px;
  height: 55px;
  padding: 2px;
  border: 1px solid var(--edge);
  border-radius: 3px;
  overflow: hidden;
  background: #181419;
}

#castor-story .castor-thumb[aria-current="true"],
#castor-story .castor-thumb:hover { border-color: var(--highlight); }

#castor-story .castor-thumb[aria-current="true"] { box-shadow: 0 0 0 1px var(--highlight); }

#castor-story .castor-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 0;
  object-fit: cover;
}

#castor-story .castor-dialog {
  position: fixed;
  inset: 0;
  max-width: none;
  max-height: none;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  color: inherit;
  background: #171419;
  overscroll-behavior: contain;
  overflow: auto;
}

#castor-story .castor-dialog:not([open]) { display: none; }
#castor-story .castor-dialog::backdrop { background: #171419; }

#castor-story .castor-dialog[open] {
  display: grid;
  grid-template-rows: minmax(min-content, 1fr) auto;
  animation: castor-threshold .52s cubic-bezier(.18, .65, .23, 1) both;
}

#castor-story .castor-support {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 26px;
  padding: 14px max(var(--gutter), calc((100% - 1420px) / 2));
  border-top: 1px solid var(--ochre);
  color: var(--warm-white);
  background: #261925;
}

#castor-story .castor-support p {
  flex: 1 1 290px;
  max-width: 63ch;
}

#castor-story .castor-support__link {
  max-width: 100%;
  min-height: 44px;
  justify-content: center;
  text-align: center;
}

@keyframes castor-threshold {
  from {
    clip-path: inset(13% 12% 4% round 38% 38% 0 0);
    opacity: .25;
  }
  to {
    clip-path: inset(0 round 0);
    opacity: 1;
  }
}

#castor-story .castor-visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

@media (max-width: 760px) {
  #castor-story .castor-hero {
    background:
      radial-gradient(ellipse at 84% 20%, #b87235, transparent 48%),
      radial-gradient(ellipse at 82% 57%, #713447, transparent 60%),
      linear-gradient(171deg, #291923, #271c2d 55%, #1c1724);
  }

  #castor-story .castor-hero__inner {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
    padding: 24px 0 32px;
    min-height: auto;
  }

  #castor-story .castor-portal {
    grid-column: 1;
    grid-row: 1;
    height: auto;
    min-height: 0;
    aspect-ratio: 1.31;
  }

  #castor-story .castor-hero__image { object-position: 51% 47%; }

  #castor-story .castor-hero__type {
    grid-row: 2;
    padding: 23px 1px 0;
  }

  #castor-story .castor-hero__type > p { margin-bottom: 11px; }

  #castor-story .castor-hero h1 { font-size: clamp(56px, 13vw, 96px); }

  #castor-story .castor-hero__subtitle {
    max-width: none;
    font-size: .47em;
    margin-top: .36em;
  }

  #castor-story .castor-hero__quote { margin: 16px 0 18px; }

  #castor-story #castor-viewer { --picture-min: min(37svh, 340px); }

  #castor-story .castor-caption { padding: 5px 0 15px; }
  #castor-story .castor-thumb { width: 60px; height: 49px; }
  #castor-story .castor-support { align-content: start; }
  #castor-story .castor-support__link { padding-inline: 14px; }
  #castor-story .castor-navigation { margin-top: 12px; }
  #castor-story .castor-thumbs { margin-top: 9px; }
}

@media (max-width: 380px) {
  #castor-story .castor-control { padding-inline: 8px; gap: 3px; font-size: 15px; }
  #castor-story .castor-control svg { width: 16px; height: 16px; }
}

@media (max-width: 340px) {
  #castor-story .castor-navigation { gap: 4px; }
  #castor-story .castor-control { padding-inline: 6px; }
  #castor-story .castor-counter { font-size: 15px; padding: 0; }
  #castor-story .castor-chapters { font-size: 17px; }
}

@media (prefers-reduced-motion: reduce) {
  #castor-story .castor-dialog[open] { animation: none; }
  #castor-story .castor-hero__image { transition: none; }
  #castor-story .castor-hero:has(.castor-enter:is(:hover, :focus-visible)) .castor-hero__image { transform: none; }
}
