:root{
    /* ALCOTEXA brand */
    --navy: #0d1f4c;
    --navy-2: #0a1838;
    --gold: #d4af37;
    --gold-bright: #e8cd7a;   /* luminous tint of the brand gold — accents & glow */
    --cream: #f5f1e4;
    --green: #2f6a3e;
    --blue: #2c6e8f;
    --parchment: #f5f1e4;

    /* per-chapter palettes — all re-derived from the brand system.
       Gold stays the shared accent (the fiber thread); only the mood shifts. */
    /* Ch.1 — Origin: brand navy */
    --c1-bg: #0a1838; --c1-bg2: #0d1f4c; --c1-text: #f5f1e4; --c1-sub: #bcc4da;
    /* Ch.2 — Growth: brand green */
    --c2-bg: #0d2318; --c2-bg2: #143120; --c2-text: #eef4ee; --c2-sub: #a6c6b2;
    /* Ch.3 — The Mills: navy + steel blue */
    --c3-bg: #081327; --c3-bg2: #102344; --c3-text: #eef1f9; --c3-sub: #a3b4d2;
    /* Ch.4 — Bloom: brand gold (light) */
    --c4-bg: #e0dbc9; --c4-bg2: #f6eccd; --c4-text: #0d1f4c; --c4-sub: #4f5878;
  }

  *{ box-sizing: border-box; }

  html{ scroll-behavior: smooth; }

  body{
    margin: 0;
    font-family: 'Poppins', sans-serif;
    color: var(--c1-text);
    overflow-x: hidden;
  }

  @media (prefers-reduced-motion: reduce){
    html{ scroll-behavior: auto; }
    *{ animation: none !important; transition: none !important; }
  }

  /* Fixed cinematic backdrop that morphs color per chapter */
  .backdrop{
    position: fixed;
    inset: 0;
    z-index: -2;
    overflow: hidden;
    background-color: var(--bg1, #0a1838);
    background-image: radial-gradient(120% 90% at 50% 0%, rgba(212,175,55,0.10), rgba(13,31,76,0) 55%);
    transition: background-color 1.4s ease;
  }
  /* Material textures: woven cotton + laid paper. soft-light lets one texture set
     read correctly over every chapter, dark or light. Kept very light. */
  .backdrop::before{
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background-image:
      url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='46' height='46'><g fill='none' stroke='%23f5f1e4' stroke-width='1'><path d='M0 11.5h46 M0 23h46 M0 34.5h46' opacity='0.35'/><path d='M11.5 0v46 M23 0v46 M34.5 0v46' opacity='0.2'/></g></svg>"),
      url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='320' height='320'><filter id='p'><feTurbulence type='fractalNoise' baseFrequency='0.02 0.14' numOctaves='3' seed='11' stitchTiles='stitch'/><feColorMatrix type='matrix' values='0 0 0 0 0.96 0 0 0 0 0.94 0 0 0 0 0.86 0 0 0 0.9 0'/></filter><rect width='100%25' height='100%25' filter='url(%23p)'/></svg>");
    background-size: 46px 46px, 320px 320px;
    background-repeat: repeat, repeat;
    mix-blend-mode: soft-light;
    opacity: 0.14;
  }

  /* subtle film grain / vignette for cinematic mood */
  .vignette{
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background: radial-gradient(120% 100% at 50% 50%, rgba(0,0,0,0) 45%, rgba(0,0,0,0.35) 100%);
  }
  .grain{
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    opacity: 0.05;
    mix-blend-mode: overlay;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='120' height='120'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
  }

  /* Top progress thread */
  .progress-bar{
    position: fixed;
    top: 0; left: 0;
    height: 3px;
    width: 0%;
    background: linear-gradient(90deg, var(--gold), var(--gold-bright));
    z-index: 50;
    transition: width 0.1s linear;
  }

  /* Vertical fiber thread (desktop signature element) */
  .fiber-rail{
    position: fixed;
    top: 0;
    left: 34px;
    width: 2px;
    height: 100%;
    z-index: 40;
    display: none;
  }
  .fiber-rail::before{
    content: "";
    position: absolute;
    inset: 0;
    background: rgba(245,241,228,0.14);
  }
  .fiber-fill{
    position: absolute;
    top: 0; left: 0;
    width: 100%;
    height: 0%;
    background: linear-gradient(180deg, var(--gold-bright), var(--gold));
    box-shadow: 0 0 10px rgba(212,175,55,0.6);
    transition: height 0.05s linear;
  }
  .fiber-node{
    position: absolute;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.7);
    width: 13px; height: 13px;
    border-radius: 50%;
    background: rgba(245,241,228,0.5);
    transition: transform 0.5s cubic-bezier(.22,.61,.36,1), background 0.5s ease, box-shadow 0.5s ease;
  }
  .fiber-node.active{
    background: var(--gold-bright);
    box-shadow: 0 0 0 6px rgba(232,205,122,0.18), 0 0 16px rgba(232,205,122,0.7);
    transform: translate(-50%, -50%) scale(1.15);
  }
  .fiber-node span{
    position: absolute;
    left: 22px;
    top: 50%;
    transform: translateY(-50%);
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.7rem;
    letter-spacing: 1px;
    white-space: nowrap;
    color: rgba(245,241,228,0.45);
    transition: color 0.5s ease;
  }
  .fiber-node.active span{ color: var(--gold-bright); }

  @media (min-width: 992px){
    .fiber-rail{ display: block; }
  }

  /* Chapter 4 (Bloom) is a light background — flip the fixed thread UI to navy ink
     so the rail, nodes and year labels stay legible. */
  body[data-chapter="4"] .fiber-rail::before{ background: rgba(13,31,76,0.18); }
  body[data-chapter="4"] .fiber-node{ background: rgba(13,31,76,0.4); }
  body[data-chapter="4"] .fiber-node span{ color: rgba(13,31,76,0.5); }
  body[data-chapter="4"] .fiber-node.active{
    background: var(--gold);
    box-shadow: 0 0 0 6px rgba(212,175,55,0.18), 0 0 16px rgba(212,175,55,0.55);
  }


  /* Intro */
  .intro{
        background-size: cover;
 background-image: url(/alcotexa/static/src/img/123.jpg);
 background-repeat: no-repeat;
    background-position: center;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 40px 20px;
    position: relative;
    overflow: hidden;
  }
  /* ===== Hero overlay (over the background image) ===== */
  .intro::before{
    content: "";
    position: absolute;
    inset: 0;
    z-index: 0;
    background: linear-gradient(180deg, rgba(10, 24, 56, 0.55) 0%, /* navy tint at top */ rgba(10, 24, 56, 0.35) 45%, rgb(31 22 15 / 76%) 100% /* darker at bottom for the scroll cue */);
    pointer-events: none;
  }
  /* keep all intro content above the overlay */
  .intro > *{
    position: relative;
    z-index: 1;
  }
  .intro-eyebrow{
    font-family: 'IBM Plex Mono', monospace;
    letter-spacing: 4px;
    font-size: 0.72rem;
    color: var(--gold-bright);
    text-transform: uppercase;
    margin-bottom: 22px;
    opacity: 0;
    animation: fadeUp 1s ease 0.2s forwards;
  }
  .intro-title{color: var(--cream);
    font-family: 'Playfair Display', serif;
    font-weight: 600;
    font-size: clamp(2.4rem, 7vw, 5rem);
    line-height: 1.08;
    margin: 0;
    max-width: 900px;
    opacity: 0;
    animation: fadeUp 1.1s ease 0.4s forwards;
  }
  .intro-title em{
    font-style: italic;
    color: var(--gold-bright);
  }
  .intro-sub{
    margin-top: 26px;
    max-width: 520px;
    color: var(--green);
    font-size: 1rem;
    line-height: 1.8;
    opacity: 0;
    animation: fadeUp 1.1s ease 0.65s forwards;
  }
  .intro-scroll{
    position: absolute;
    bottom: 36px;
    left: 50%;
    transform: translateX(-50%);
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.68rem;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: rgba(245,241,228,0.5);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    opacity: 0;
    animation: fadeUp 1s ease 1s forwards;
  }
  .intro-scroll::after{
    content: "";
    width: 1px;
    height: 34px;
    background: linear-gradient(180deg, var(--gold-bright), transparent);
    animation: threadPulse 2s ease-in-out infinite;
  }

  @keyframes fadeUp{
    from{ opacity: 0; transform: translateY(22px); }
    to{ opacity: 1; transform: translateY(0); }
  }
  @keyframes threadPulse{
    0%, 100%{ opacity: 0.4; }
    50%{ opacity: 1; }
  }

  /* Chapters */
  .chapter{
    min-height: 100vh;
    display: flex;
    align-items: center;
    padding: 110px 8vw 110px calc(8vw + 40px);
    position: relative;
  }
  @media (max-width: 991.98px){
    .chapter{ padding: 90px 7vw; }
  }

  .chapter-grid{
    display: grid;
    grid-template-columns: 1fr;
    gap: 50px;
    max-width: 1100px;
    margin: 0 auto;
    width: 100%;
  }
  .chapter.with-figure .chapter-grid{
    grid-template-columns: 0.85fr 1.15fr;
    align-items: center;
  }
  @media (max-width: 991.98px){
    .chapter.with-figure .chapter-grid{ grid-template-columns: 1fr; }
  }
  /* Chapter 4 has a short text, so its figure (the wide column) rendered oversized.
     Narrow that column and cap the height so it matches the other chapters. */
  @media (min-width: 992px){
    .chapter[data-theme="4"] .chapter-grid{ grid-template-columns: 1.15fr 0.8fr; }
    .chapter[data-theme="4"] .chapter-figure img{ max-height: 460px; object-fit: cover; }
  }

  .chapter-figure{
    position: relative;
    overflow: hidden;
    border-radius: 3px;
    box-shadow: 0 30px 70px rgba(0,0,0,0.45);
  }
  .chapter-figure img{
    display: block;
    width: 100%;
    height: auto;
    filter: sepia(0.28) saturate(0.95) contrast(1.05);
    transform: scale(1.08);
    animation: kenBurns 14s ease-in-out infinite alternate;
  }
  .chapter-figure::after{
    content: "";
    position: absolute; inset: 0;
    background: linear-gradient(180deg, rgba(0,0,0,0) 55%, rgba(0,0,0,0.35) 100%);
  }
  .chapter-figure-cap{
    position: absolute;
    bottom: 14px; left: 16px;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.65rem;
    letter-spacing: 1px;
    color: rgba(245,241,228,0.85);
    z-index: 2;
  }
  @keyframes kenBurns{
    from{ transform: scale(1.08) translate(0,0); }
    to{ transform: scale(1.16) translate(-1.5%, -1%); }
  }

  .chapter-stamp{
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.78rem;
    letter-spacing: 2px;
    padding: 7px 14px;
    border: 1px solid currentColor;
    color: var(--gold-bright);
    transform: rotate(-2deg);
    margin-bottom: 26px;
  }

  .chapter-title{
    font-family: 'Playfair Display', serif;
    font-weight: 600;
    font-size: clamp(1.9rem, 4.2vw, 3.1rem);
    line-height: 1.15;
    margin: 0 0 24px;
  }

  .chapter-text p{
    font-size: 1.02rem;
    line-height: 1.95;
    margin-bottom: 1.3rem;
    max-width: 620px;
  }
  .chapter-text p:last-child{ margin-bottom: 0; }

  .chapter-quote{
    font-family: 'Playfair Display', serif;
    font-style: italic;
    font-size: 1.2rem;
    line-height: 1.6;
    max-width: 560px;
    padding-left: 22px;
    border-left: 2px solid var(--gold-bright);
    margin: 30px 0 0;
  }

  /* Per-chapter text colors — keeps each section legible over its own backdrop */
  .chapter[data-theme="1"]{ color: var(--c1-text); }
  .chapter[data-theme="2"]{ color: var(--c2-text); }
  .chapter[data-theme="3"]{ color: var(--c3-text); }
  .chapter[data-theme="4"]{ color:var(--c4-text); }
  .finale[data-theme="4"]{ color: var(--c4-text); }

  /* On the light gold chapter, flip the gold stamp to navy so it stays readable */
  .chapter[data-theme="4"] .chapter-stamp{ color: #e8cd7a}

  /* ============ Reveal on scroll: base (used by intro + finale) ============ */
  .reveal{
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.9s cubic-bezier(.22,.61,.36,1), transform 0.9s cubic-bezier(.22,.61,.36,1);
  }
  .reveal.is-visible{ opacity: 1; transform: none; }
  .reveal-stagger > *{
    opacity: 0;
    transform: translateY(28px);
    transition: opacity 0.8s ease, transform 0.8s ease;
  }
  .reveal-stagger.is-visible > *{ opacity: 1; transform: none; }
  .reveal-stagger.is-visible > *:nth-child(1){ transition-delay: 0.05s; }
  .reveal-stagger.is-visible > *:nth-child(2){ transition-delay: 0.2s; }
  .reveal-stagger.is-visible > *:nth-child(3){ transition-delay: 0.35s; }
  .reveal-stagger.is-visible > *:nth-child(4){ transition-delay: 0.5s; }

  /* ============ Chapter One — "unfurl": a curtain draws back off the garden ============ */
  .chapter[data-theme="1"] .chapter-figure.reveal{
    transform: none;
    opacity: 1;
    /* clip-path: inset(0 100% 0 0); */
    transition: clip-path 1.3s cubic-bezier(.65,0,.2,1);
  }
  .chapter[data-theme="1"] .chapter-figure.reveal.is-visible{
    clip-path: inset(0 0% 0 0);
  }
  .chapter[data-theme="1"] .chapter-stamp.reveal{
    transform: rotate(-2deg) translateX(-26px);
    opacity: 0;
    transition: opacity 0.7s ease, transform 0.7s cubic-bezier(.22,.61,.36,1);
  }
  .chapter[data-theme="1"] .chapter-stamp.reveal.is-visible{
    transform: rotate(-2deg) translateX(0);
    opacity: 1;
  }
  .chapter[data-theme="1"] .chapter-title.reveal{
    opacity: 1;
    transform: none;
    /* clip-path: inset(0 100% 0 0); */
    transition: clip-path 1s cubic-bezier(.65,0,.2,1) 0.15s;
  }
  .chapter[data-theme="1"] .chapter-title.reveal.is-visible{
    /* clip-path: inset(0 0% 0 0); */
  }
  .chapter[data-theme="1"] .chapter-text.reveal-stagger > *{
    transform: translateY(0) translateX(-24px);
    filter: blur(3px);
  }
  .chapter[data-theme="1"] .chapter-text.reveal-stagger.is-visible > *{
    transform: none;
    filter: blur(0);
  }
  .chapter[data-theme="1"] .chapter-quote.reveal{
    transform: none;
    transform-origin: top left;
    clip-path: polygon(0 0, 0 0, 0 100%, 0 100%);
    transition: opacity 0.1s linear 0.4s, clip-path 0.9s cubic-bezier(.22,.61,.36,1) 0.4s;
  }
  .chapter[data-theme="1"] .chapter-quote.reveal.is-visible{
    clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%);
  }

  /* ============ Chapter Two — "growth": elements rise out of the ground like a crop ============ */
  .chapter[data-theme="2"] .chapter-stamp.reveal,
  .chapter[data-theme="2"] .chapter-title.reveal{
    transform-origin: bottom center;
    transform: scaleY(0.4) translateY(30px);
    opacity: 0;
    transition: opacity 0.7s ease, transform 0.9s cubic-bezier(.34,1.56,.64,1);
  }
  .chapter[data-theme="2"] .chapter-stamp.reveal.is-visible,
  .chapter[data-theme="2"] .chapter-title.reveal.is-visible{
    transform: scaleY(1) translateY(0);
    opacity: 1;
  }
  .chapter[data-theme="2"] .chapter-text.reveal-stagger > *{
    transform-origin: bottom center;
    transform: scaleY(0.3) translateY(24px);
    opacity: 0;
    transition: opacity 0.75s ease, transform 0.85s cubic-bezier(.3,1.4,.5,1);
  }
  .chapter[data-theme="2"] .chapter-text.reveal-stagger.is-visible > *{
    transform: scaleY(1) translateY(0);
    opacity: 1;
  }

  /* ============ Chapter Three — "the press": mechanical, alternating impact from left/right ============ */
  .chapter[data-theme="3"] .chapter-stamp.reveal{
    transform: translateX(-50px) rotate(-6deg) scale(1.15);
    opacity: 0;
    transition: opacity 0.4s ease, transform 0.55s cubic-bezier(.2,.9,.3,1.2);
  }
  .chapter[data-theme="3"] .chapter-stamp.reveal.is-visible{
    transform: translateX(0) rotate(-2deg) scale(1);
    opacity: 1;
  }
  .chapter[data-theme="3"] .chapter-title.reveal{
    transform: translateX(60px);
    opacity: 0;
    transition: opacity 0.5s ease, transform 0.6s cubic-bezier(.2,.9,.3,1.15);
  }
  .chapter[data-theme="3"] .chapter-title.reveal.is-visible{
    transform: translateX(0);
    opacity: 1;
  }
  .chapter[data-theme="3"] .chapter-text.reveal-stagger > *{
    opacity: 0;
    transition: opacity 0.45s ease, transform 0.55s cubic-bezier(.2,.9,.3,1.2);
  }
  .chapter[data-theme="3"] .chapter-text.reveal-stagger > *:nth-child(odd){
    transform: translateX(-46px) rotate(-1.5deg);
  }
  .chapter[data-theme="3"] .chapter-text.reveal-stagger > *:nth-child(even){
    transform: translateX(46px) rotate(1.5deg);
  }
  .chapter[data-theme="3"] .chapter-text.reveal-stagger.is-visible > *{
    transform: translateX(0) rotate(0);
    opacity: 1;
  }

  /* ============ Chapter Four — "bloom": a golden glow blooms open, unhurried ============ */
  .chapter[data-theme="4"] .chapter-stamp.reveal,
  .finale .reveal.reveal-zoom{
    transform: scale(0.6);
    opacity: 0;
    transition: opacity 1s ease, transform 1.2s cubic-bezier(.22,.61,.36,1);
  }
  .chapter[data-theme="4"] .chapter-stamp.reveal.is-visible,
  .finale .reveal.reveal-zoom.is-visible{
    transform: scale(1);
    opacity: 1;
  }
  .chapter[data-theme="4"] .chapter-title.reveal,
  .finale .finale-title.reveal{
    transform: scale(0.94);
    opacity: 0;
    letter-spacing: 3px;
    filter: blur(4px);
    transition: opacity 1.1s ease, transform 1.3s cubic-bezier(.22,.61,.36,1), letter-spacing 1.3s ease, filter 1.1s ease;
  }
  .chapter[data-theme="4"] .chapter-title.reveal.is-visible,
  .finale .finale-title.reveal.is-visible{
    transform: scale(1);
    opacity: 1;
    letter-spacing: normal;
    filter: blur(0);
    text-shadow: 0 0 26px rgba(255,238,197,0.35);
  }
  .chapter[data-theme="4"] .chapter-text.reveal-stagger > *{
    transform: translateY(18px) scale(0.97);
    opacity: 0;
    filter: blur(3px);
    transition: opacity 0.9s ease, transform 0.9s ease, filter 0.9s ease;
  }
  .chapter[data-theme="4"] .chapter-text.reveal-stagger.is-visible > *{
    transform: none;
    opacity: 1;
    filter: blur(0);
  }
  .finale-sub.reveal{
    transition: opacity 1.3s ease 0.3s, transform 1.3s ease 0.3s;
  }

  /* Finale */
  .finale{
    background: #fffcf2;
    min-height: 90vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 100px 8vw;
  }
  .finale-mark{
    width: 54px; height: 54px;
    border-radius: 50%;
    border: 1.5px solid var(--c4-text);
    display: flex; align-items: center; justify-content: center;
    font-family: 'Playfair Display', serif;
    font-style: italic;
    font-size: 1.3rem;
    margin-bottom: 30px;
  }
  .finale-title{
    font-family: 'Playfair Display', serif;
    font-weight: 600;
    font-size: clamp(1.8rem, 4vw, 2.6rem);
    max-width: 780px;
    line-height: 1.35;
    margin: 0 0 20px;
  }
  .finale-sub{
    font-family: 'IBM Plex Mono', monospace;
    letter-spacing: 2px;
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--c4-sub);
  }
