/* Origin Story: a dark, scroll-driven storyteller page.
   Loaded only on the "Ashwickers Origin Story" template, after theme.css. */

body.page-template-page-origin-story {
  --os-bg: #0e0c15;
  --os-bg-raised: #181427;
  --os-ink: #f3ebdd;
  --os-ink-soft: rgb(243 235 221 / 78%);
  --os-muted: #a79e8e;
  --os-gold: #e8c268;
  --os-gold-soft: rgb(232 194 104 / 32%);
  --os-terracotta: #c9705d;
  --os-teal: #7fb3ae;
  --os-line: rgb(243 235 221 / 14%);
  --os-ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --os-gutter: clamp(64px, 6vw, 96px);
  --os-chapter-pad: clamp(56px, 10vh, 120px);

  --color-background: var(--os-bg);
  --color-foreground: var(--os-ink);
  --color-muted: var(--os-muted);
  --color-divider: var(--os-line);
  --color-palette-4: var(--os-bg-raised);
  --header-background: rgb(14 12 21 / 86%);
  --header-foreground: var(--os-ink);

  color: var(--os-ink);
  background: var(--os-bg);
}

/* Drawers and dialogs inherit the dark palette through the variables above.
   They sit on the page as frosted glass: the page's own dark, a faint white
   tint and a backdrop blur, so they never read as a different colour. */
.page-template-page-origin-story .drawer,
.page-template-page-origin-story .modal__panel {
  --color-background: transparent;
  --color-palette-4: rgb(255 255 255 / 10%);

  background: linear-gradient(rgb(255 255 255 / 2%), rgb(255 255 255 / 2%)), rgb(14 12 21 / 88%);
  box-shadow: 0 30px 80px -30px rgb(0 0 0 / 90%), 0 0 0 1px rgb(255 255 255 / 6%);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
}

.page-template-page-origin-story .mobile-menu-drawer__footer {
  border-top: 1px solid rgb(255 255 255 / 6%);
  background: rgb(255 255 255 / 2%);
}

.page-template-page-origin-story .site-overlay {
  background: rgb(5 4 10 / 60%);
}

.page-template-page-origin-story .site-header {
  border-bottom: 1px solid var(--os-line);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
}

/* The header's own blur ends at its edge, so the panel below it is the
   page's solid dark instead of an unblurred glass layer over the story. */
.page-template-page-origin-story .mega-menu {
  background: var(--os-bg);
}

.page-template-page-origin-story .mega-menu::after {
  background: rgb(5 4 10 / 45%);
}

.page-template-page-origin-story .site-footer {
  position: relative;
  z-index: 1;
}

.origin-story {
  position: relative;
  z-index: 1;
  overflow: clip;
}

.origin-story__stars {
  position: fixed;
  z-index: 0;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.os-hero,
.os-story,
.os-finale,
.os-products,
.origin-story > .entry-content {
  position: relative;
  z-index: 1;
}

/* Shared pieces */

.os-eyebrow {
  display: inline-flex;
  margin: 0 0 20px;
  gap: 14px;
  align-items: center;
  color: var(--os-gold);
  font-family: var(--font-body-family);
  font-size: 13px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
}

.os-eyebrow::before,
.os-eyebrow::after {
  width: 28px;
  height: 1px;
  background: currentColor;
  content: "";
  opacity: 0.6;
}

/* Hero */

.os-hero {
  min-height: calc(100svh - var(--header-height));
  padding-top: clamp(56px, 9vh, 120px);
}

.os-hero::before {
  position: absolute;
  inset: -30% 0 0;
  background:
    radial-gradient(55% 45% at 18% 12%, rgb(201 112 93 / 18%), transparent 65%),
    radial-gradient(45% 40% at 82% 4%, rgb(127 179 174 / 12%), transparent 65%);
  content: "";
  pointer-events: none;
}

.os-hero__inner {
  position: relative;
  max-width: 1040px;
  text-align: center;
}

.os-hero__eyebrow {
  opacity: 0;
  animation: os-fade-up 1s var(--os-ease) 100ms forwards;
}

.os-hero__title {
  margin: 0;
  font-family: var(--font-heading-family);
  font-size: clamp(2.4rem, 5.4vw, 4.5rem);
  font-weight: 400;
  letter-spacing: -0.01em;
  line-height: 1.08;
  text-wrap: balance;
}

.os-word {
  display: inline-block;
  opacity: 0;
  filter: blur(6px);
  transform: translateY(0.45em);
  animation: os-word-rise 1.1s var(--os-ease) forwards;
  animation-delay: calc(var(--i, 0) * 55ms + 200ms);
}

.os-hero__intro {
  max-width: 640px;
  margin: 28px auto 0;
  color: var(--os-ink-soft);
  font-size: clamp(1.05rem, 1.4vw, 1.25rem);
  line-height: 1.65;
  opacity: 0;
  animation: os-fade-up 1.2s var(--os-ease) 1000ms forwards;
}

.os-hero__cue {
  display: inline-flex;
  margin-top: 40px;
  flex-direction: column;
  gap: 10px;
  align-items: center;
  color: var(--os-muted);
  font-size: 12px;
  letter-spacing: 0.22em;
  text-decoration: none;
  text-transform: uppercase;
  opacity: 0;
  animation: os-fade-up 1s var(--os-ease) 1500ms forwards;
  transition: color var(--transition);
}

.os-hero__cue:hover,
.os-hero__cue:focus-visible {
  color: var(--os-gold);
}

.os-hero__cue svg {
  animation: os-cue-bob 2.2s ease-in-out infinite;
}

.os-hero__art {
  position: relative;
  width: min(100% - 2 * var(--page-margin), 1180px);
  margin: clamp(40px, 6vh, 72px) auto 0;
  aspect-ratio: 1920 / 980;
  overflow: hidden;
  border-radius: 24px 24px 0 0;
  opacity: 0;
  animation: os-art-in 2s var(--os-ease) 700ms forwards;
  -webkit-mask-image: linear-gradient(to bottom, #000 50%, transparent 100%);
  mask-image: linear-gradient(to bottom, #000 50%, transparent 100%);
}

.os-hero__art::before {
  position: absolute;
  z-index: 1;
  inset: 0;
  border: 1px solid rgb(232 194 104 / 35%);
  border-bottom: 0;
  border-radius: inherit;
  content: "";
  pointer-events: none;
}

.os-hero__art::after {
  position: absolute;
  z-index: 1;
  inset: 0;
  background:
    radial-gradient(120% 90% at 50% 20%, transparent 55%, rgb(14 12 21 / 70%) 100%);
  content: "";
  pointer-events: none;
}

.os-hero__art img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 42%;
  filter: saturate(0.9) brightness(0.9);
  transform: translate3d(0, calc(var(--os-scroll, 0) * 0.12px), 0) scale(1.06);
  will-change: transform;
}

/* Story thread and chapters */

.os-story {
  padding-block: clamp(32px, 6vh, 80px) 0;
}

.os-thread {
  position: absolute;
  top: 0;
  bottom: 0;
  left: calc(var(--page-margin) + 22px);
  width: 2px;
}

.os-thread svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.os-thread__track {
  stroke: var(--os-line);
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
}

.os-thread__line {
  stroke: var(--os-gold);
  stroke-width: 2;
  stroke-dasharray: 1;
  stroke-dashoffset: var(--os-thread, 1);
  vector-effect: non-scaling-stroke;
  filter: drop-shadow(0 0 6px var(--os-gold-soft));
}

.os-chapters {
  margin: 0;
  padding: 0 0 0 var(--os-gutter);
  list-style: none;
}

.os-chapter {
  position: relative;
  display: grid;
  padding-block: var(--os-chapter-pad);
  grid-template-columns: minmax(0, 0.92fr) minmax(0, 1.08fr);
  gap: clamp(40px, 7vw, 120px);
  align-items: start;
}

.os-chapter__marker {
  position: absolute;
  top: calc(var(--os-chapter-pad) + 4px);
  left: calc(-1 * var(--os-gutter));
  display: grid;
  width: 44px;
  height: 44px;
  border: 1px solid var(--os-line);
  border-radius: 50%;
  color: var(--os-muted);
  background: var(--os-bg);
  font-family: var(--font-heading-family);
  font-size: 15px;
  place-items: center;
  transition: color 500ms ease, border-color 500ms ease, box-shadow 500ms ease;
}

.os-chapter.is-active .os-chapter__marker {
  border-color: var(--os-gold);
  color: var(--os-gold);
  box-shadow: 0 0 0 6px rgb(232 194 104 / 10%), 0 0 26px var(--os-gold-soft);
}

.os-chapter__visual {
  position: sticky;
  top: calc(var(--header-height) + 32px);
}

.os-chapter:nth-child(even) .os-chapter__visual {
  order: 2;
}

.os-figure {
  position: relative;
  margin: 0;
  padding: 10px;
  border: 1px solid rgb(232 194 104 / 22%);
  border-radius: 20px;
  background: linear-gradient(160deg, rgb(243 235 221 / 5%), rgb(243 235 221 / 1%));
  box-shadow: 0 30px 80px -40px rgb(0 0 0 / 85%), 0 0 90px -40px var(--os-gold-soft);
}

.os-figure img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 12px;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  filter: saturate(0.92);
}

.os-figure--southwest img {
  object-position: 24% 62%;
}

.os-figure--square img {
  aspect-ratio: 1;
}

.os-figure--landscape img {
  aspect-ratio: 4 / 3;
}

.os-figure figcaption {
  padding: 14px 6px 4px;
  color: var(--os-muted);
  font-size: 13px;
  letter-spacing: 0.04em;
  text-align: center;
}

.os-figure--art {
  padding: 0;
  border: 0;
  background: none;
  box-shadow: none;
}

.os-art {
  display: block;
  width: 100%;
  height: auto;
}

.os-art :is(path, circle):not(.os-art__sparks *) {
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  transition: stroke-dashoffset 2.2s var(--os-ease) var(--d, 0s);
}

.os-art path.os-art__arc {
  transition: stroke-dashoffset 2.2s var(--os-ease) var(--d, 0s), stroke-dasharray 0s linear calc(var(--d, 0s) + 2.2s);
}

.os-art.is-drawn :is(path, circle):not(.os-art__sparks *) {
  stroke-dashoffset: 0;
}

.os-art.is-drawn .os-art__arc {
  stroke-dasharray: 0.012 0.012;
}

.os-art__sparks {
  opacity: 0;
  transition: opacity 1.2s ease 2.4s;
}

.os-art.is-drawn .os-art__sparks {
  opacity: 1;
  animation: os-twinkle 3.2s ease-in-out 3.6s infinite alternate;
}

.os-chapter__body {
  max-width: 580px;
}

.os-chapter__meta {
  display: flex;
  margin: 0 0 18px;
  flex-wrap: wrap;
  gap: 8px 14px;
  align-items: baseline;
  color: var(--os-muted);
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.os-chapter__number {
  color: var(--os-gold);
  font-family: var(--font-heading-family);
  font-size: 1.5rem;
  letter-spacing: 0;
  text-transform: none;
}

.os-chapter__time::before {
  margin-right: 14px;
  content: "·";
  opacity: 0.6;
}

.os-chapter__title {
  margin: 0 0 24px;
  font-family: var(--font-heading-family);
  font-size: clamp(1.9rem, 3.2vw, 2.75rem);
  font-weight: 400;
  line-height: 1.12;
  text-wrap: balance;
}

.os-chapter__text {
  margin: 0 0 1.1em;
  color: var(--os-ink-soft);
  font-size: clamp(1.05rem, 1.25vw, 1.2rem);
  line-height: 1.7;
}

.os-chapter__title + .os-chapter__text::first-letter {
  float: left;
  padding: 0.1em 0.14em 0 0;
  color: var(--os-gold);
  font-family: var(--font-heading-family);
  font-size: 3.4em;
  font-weight: 400;
  line-height: 0.82;
}

.os-pull {
  margin: 36px 0 0;
  padding: 4px 0 4px 28px;
  border-left: 1px solid var(--os-gold);
}

.os-pull p {
  margin: 0;
  color: var(--os-gold);
  font-family: var(--font-heading-family);
  font-size: clamp(1.35rem, 2vw, 1.7rem);
  font-weight: 400;
  line-height: 1.35;
  text-shadow: 0 0 30px var(--os-gold-soft);
  text-wrap: balance;
}

.os-ritual {
  display: flex;
  margin: 28px 0 0;
  padding: 20px 0;
  flex-wrap: wrap;
  gap: 12px 0;
  border-top: 1px solid var(--os-line);
  border-bottom: 1px solid var(--os-line);
  list-style: none;
}

.os-ritual li {
  display: flex;
  flex: 1 1 33%;
  gap: 10px;
  align-items: center;
  color: var(--os-ink-soft);
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.os-ritual li::before {
  width: 9px;
  height: 9px;
  flex: none;
  border: 1px solid var(--os-gold);
  border-radius: 50%;
  background: radial-gradient(circle, var(--os-gold) 0 30%, transparent 34%);
  content: "";
}

/* Reveal on scroll (only once the script is present, so nothing stays hidden without it). */

.os-js [data-reveal] {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 1s var(--os-ease), transform 1s var(--os-ease);
  transition-delay: calc(var(--i, 0) * 110ms);
}

.os-js [data-reveal].is-visible {
  opacity: 1;
  transform: none;
}

.os-js .os-ritual li {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 800ms var(--os-ease), transform 800ms var(--os-ease);
  transition-delay: calc(var(--i, 0) * 120ms + 250ms);
}

.os-js .os-ritual.is-visible li {
  opacity: 1;
  transform: none;
}

/* Finale */

.os-finale {
  padding-block: clamp(72px, 12vh, 150px) clamp(64px, 10vh, 120px);
  text-align: center;
}

.os-finale__inner {
  max-width: 900px;
  margin-inline: auto;
}

.os-finale__spiral {
  width: min(100%, 460px);
  margin: 0 auto 28px;
}

.os-finale__spiral svg {
  display: block;
  width: 100%;
  height: auto;
  filter: drop-shadow(0 0 14px rgb(232 194 104 / 25%));
}

.os-finale__path {
  stroke-dasharray: 1;
  stroke-dashoffset: calc(1 - var(--os-spiral, 0));
}

.os-finale__labels {
  display: flex;
  margin: 0 0 40px;
  gap: 18px;
  justify-content: center;
  align-items: center;
  color: var(--os-muted);
  font-size: 12px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.os-finale__labels span:first-child {
  color: var(--os-terracotta);
}

.os-finale__labels span:last-child {
  color: var(--os-teal);
}

.os-finale__labels i {
  width: clamp(40px, 8vw, 96px);
  height: 1px;
  background: linear-gradient(to right, var(--os-terracotta), var(--os-gold), var(--os-teal));
}

.os-finale__title {
  max-width: 820px;
  margin: 0 auto;
  font-family: var(--font-heading-family);
  font-size: clamp(1.8rem, 3.6vw, 3rem);
  font-weight: 400;
  line-height: 1.15;
  text-wrap: balance;
}

/* Products */

.os-products {
  padding-block: clamp(56px, 8vh, 96px) clamp(72px, 10vh, 120px);
  border-top: 1px solid var(--os-line);
}

.os-products__header {
  margin-bottom: 40px;
  text-align: center;
}

.os-products__header h2 {
  margin: 0;
  font-family: var(--font-heading-family);
  font-size: clamp(1.8rem, 3vw, 2.5rem);
  font-weight: 400;
}

.os-products .product-card__media {
  box-shadow: 0 20px 50px -30px rgb(0 0 0 / 85%);
}

.os-products__more {
  margin: 44px 0 0;
  text-align: center;
}

.os-products .button {
  border: 1px solid var(--os-gold);
  color: var(--os-gold);
  background: transparent;
}

.os-products .button:hover,
.os-products .button:focus-visible {
  color: var(--os-bg);
  background: var(--os-gold);
}

/* Motion */

@keyframes os-word-rise {
  to {
    opacity: 1;
    filter: blur(0);
    transform: none;
  }
}

@keyframes os-fade-up {
  from {
    opacity: 0;
    transform: translateY(18px);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes os-art-in {
  from {
    opacity: 0;
    transform: translateY(40px) scale(0.98);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes os-cue-bob {
  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(6px);
  }
}

@keyframes os-twinkle {
  from {
    opacity: 0.45;
  }

  to {
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .os-hero__eyebrow,
  .os-word,
  .os-hero__intro,
  .os-hero__cue,
  .os-hero__art {
    opacity: 1;
    filter: none;
    transform: none;
    animation: none;
  }

  .os-hero__cue svg,
  .os-art.is-drawn .os-art__sparks {
    animation: none;
  }

  .os-hero__art img {
    transform: none;
  }

  .os-js [data-reveal],
  .os-js .os-ritual li {
    opacity: 1;
    transform: none;
    transition: none;
  }

  .os-art :is(path, circle):not(.os-art__sparks *),
  .os-finale__path {
    stroke-dashoffset: 0;
    transition: none;
  }

  .os-art .os-art__arc {
    stroke-dasharray: 0.012 0.012;
  }

  .os-art__sparks {
    opacity: 1;
  }
}

/* Layout */

@media (max-width: 1024px) {
  .os-chapter {
    gap: clamp(32px, 5vw, 64px);
  }
}

@media (max-width: 900px) {
  .os-thread,
  .os-chapter__marker {
    display: none;
  }

  .os-chapters {
    padding-left: 0;
  }

  .os-chapter {
    padding-block: clamp(48px, 8vh, 80px);
    grid-template-columns: 1fr;
    gap: 32px;
  }

  .os-chapter:nth-child(even) .os-chapter__visual {
    order: 0;
  }

  .os-chapter__visual {
    position: static;
    width: min(100%, 560px);
    margin-inline: auto;
  }

  .os-chapter__body {
    max-width: 640px;
    margin-inline: auto;
  }

  .os-hero__art {
    aspect-ratio: 4 / 3;
    border-radius: 16px 16px 0 0;
  }

  .os-ritual li {
    flex-basis: 100%;
  }
}

@media (max-width: 600px) {
  .os-hero {
    padding-top: 40px;
  }

  .os-hero__title {
    font-size: clamp(2.1rem, 9.5vw, 2.6rem);
  }

  .os-figure img {
    aspect-ratio: 4 / 4.6;
  }

  .os-figure--landscape img {
    aspect-ratio: 4 / 3;
  }

  .os-finale__labels {
    flex-direction: column;
    gap: 10px;
  }

  .os-finale__labels i {
    width: 1px;
    height: 28px;
    background: linear-gradient(to bottom, var(--os-terracotta), var(--os-gold), var(--os-teal));
  }
}
