/* ==========================================================
   HHUDDL.com — Styles
   Palette:
     Parchment Warm     #f5f0e8
     Fireside Charcoal  #2b2520
     Ember Orange       #c8613a
     Hearthstone Teal   #3d7a6e
     Candle Gold         #d4a843
     Wool Gray           #a89e91
     Manuscript Brown    #3e3329
     Huddle Red          #8b3a3a
   Fonts:
     Playfair Display, Source Serif 4, Caveat, DM Mono
   ========================================================== */

/* --- Reset & Base --- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    font-size: 18px;
    background-color: #f5f0e8;
}

body {
    font-family: 'Source Serif 4', Georgia, serif;
    color: #3e3329;
    background-color: #f5f0e8;
    line-height: 1.7;
    overflow-x: hidden;
    position: relative;
}

/* Hidden SVG filters */
.svg-filters {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
}

/* --- Paper Texture Overlay --- */
.paper-texture {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    opacity: 0.04;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='300' height='300' filter='url(%23n)' opacity='1'/%3E%3C/svg%3E");
    background-repeat: repeat;
}

/* --- Vignette Overlay --- */
.vignette-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 2;
    opacity: 0;
    transition: opacity 0.6s ease;
    background: radial-gradient(
        ellipse at var(--vignette-x, 50%) var(--vignette-y, 50%),
        transparent 35%,
        rgba(43, 37, 32, 0.3) 100%
    );
}

.vignette-overlay.visible {
    opacity: 1;
}

/* --- Typography --- */
h1, h2, h3 {
    font-family: 'Playfair Display', 'Georgia', serif;
    letter-spacing: -0.02em;
    color: #2b2520;
}

.section-title {
    font-size: 2.8rem;
    font-weight: 700;
    margin-bottom: 0.3em;
}

.annotation {
    font-family: 'Caveat', cursive;
    color: #3d7a6e;
    font-size: 1rem;
    display: inline-block;
}

/* --- Sections (shared) --- */
.section {
    position: relative;
    min-height: 100vh;
    width: 100%;
    overflow: hidden;
}

/* ==========================================================
   Section 1: The Gathering (Hero)
   ========================================================== */
.section--gathering {
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #f5f0e8;
    padding: 2rem;
}

.gathering-canvas {
    position: relative;
    width: 100%;
    max-width: 700px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* Huddle circle SVG */
.huddle-circle {
    width: 420px;
    height: 420px;
    position: relative;
    z-index: 3;
}

.huddle-line {
    stroke-dasharray: 250;
    stroke-dashoffset: 250;
    opacity: 0;
    transition: stroke 0.3s ease;
}

.huddle-line.animate {
    opacity: 1;
    animation: drawLine 1.2s ease-out forwards;
}

@keyframes drawLine {
    0% { stroke-dashoffset: 250; }
    100% { stroke-dashoffset: 0; }
}

.huddle-node {
    transform: scale(0);
    transform-origin: center;
    opacity: 0;
}

.huddle-node.animate {
    animation: nodeAppear 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes nodeAppear {
    0% { transform: scale(0); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

.huddle-center {
    opacity: 0;
}

.huddle-center.animate {
    animation: centerPulse 0.6s ease-out forwards;
}

@keyframes centerPulse {
    0% { opacity: 0; transform: scale(0); }
    60% { opacity: 1; transform: scale(1.4); }
    100% { opacity: 1; transform: scale(1); }
}

/* Gathering headline */
.gathering-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    z-index: 4;
    pointer-events: none;
}

.gathering-headline {
    font-size: 3.2rem;
    line-height: 1.15;
    color: #2b2520;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.gathering-headline.visible {
    opacity: 1;
    transform: translateY(0);
}

.gathering-annotation {
    position: absolute;
    top: -1.8rem;
    right: -5rem;
    font-size: 1.1rem;
    color: #3d7a6e;
    opacity: 0;
    transform: rotate(-4deg);
    transition: opacity 0.5s ease 0.3s;
}

.gathering-annotation.visible {
    opacity: 1;
}

/* Scroll-driven dispersal of huddle nodes */
.huddle-circle.dispersing .huddle-node:nth-child(1) { transition: transform 0.8s ease; transform: translate(0, -40px); }
.huddle-circle.dispersing .huddle-node:nth-child(2) { transition: transform 0.8s ease; transform: translate(30px, -30px); }
.huddle-circle.dispersing .huddle-node:nth-child(3) { transition: transform 0.8s ease; transform: translate(40px, 0); }
.huddle-circle.dispersing .huddle-node:nth-child(4) { transition: transform 0.8s ease; transform: translate(30px, 30px); }
.huddle-circle.dispersing .huddle-node:nth-child(5) { transition: transform 0.8s ease; transform: translate(0, 40px); }
.huddle-circle.dispersing .huddle-node:nth-child(6) { transition: transform 0.8s ease; transform: translate(-30px, 30px); }
.huddle-circle.dispersing .huddle-node:nth-child(7) { transition: transform 0.8s ease; transform: translate(-40px, 0); }
.huddle-circle.dispersing .huddle-node:nth-child(8) { transition: transform 0.8s ease; transform: translate(-30px, -30px); }


/* ==========================================================
   Section 2: The Plan (Strategy)
   ========================================================== */
.section--plan {
    background-color: #f2ece2;
    padding: 6rem 2rem;
    position: relative;
}

.plan-header {
    text-align: center;
    margin-bottom: 4rem;
    position: relative;
    z-index: 5;
}

.plan-annotation {
    display: block;
    margin-top: 0.3rem;
    font-size: 1.15rem;
    color: #3d7a6e;
    transform: rotate(-2deg);
}

/* String board SVG behind cards */
.string-board {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 3;
}

.string-line {
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
    opacity: 0.6;
    transition: stroke 0.4s ease, stroke-dashoffset 0.8s ease;
}

.string-line.drawn {
    stroke-dashoffset: 0;
}

.pin-marker {
    opacity: 0;
    transition: opacity 0.3s ease;
}

.pin-marker.visible {
    opacity: 1;
}

/* Plan cards */
.plan-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2.5rem;
    max-width: 1100px;
    margin: 0 auto;
    position: relative;
    z-index: 5;
}

.plan-card {
    background: rgba(245, 240, 232, 0.85);
    border: 1.5px solid #a89e91;
    border-radius: 4px;
    padding: 2rem 1.8rem;
    position: relative;
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.5s ease, transform 0.5s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}

.plan-card.visible {
    opacity: 1;
    transform: translateY(0);
}

.plan-card:hover {
    box-shadow: 0 4px 20px rgba(43, 37, 32, 0.12);
    border-color: #d4a843;
}

.plan-card__icon {
    width: 40px;
    height: 40px;
    margin-bottom: 1rem;
}

.plan-card__icon svg {
    width: 100%;
    height: 100%;
}

.plan-card__title {
    font-family: 'Playfair Display', serif;
    font-size: 1.35rem;
    color: #2b2520;
    margin-bottom: 0.7rem;
}

.plan-card__text {
    font-family: 'Source Serif 4', serif;
    font-size: 0.95rem;
    line-height: 1.65;
    color: #3e3329;
    margin-bottom: 1rem;
}

.plan-card__note {
    font-size: 0.9rem;
    color: #a89e91;
    transform: rotate(-1deg);
}

/* Margin annotations */
.margin-annotations {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 4;
}

.margin-note {
    position: absolute;
    opacity: 0;
    transition: opacity 0.5s ease;
    font-size: 0.95rem;
}

.margin-note.visible {
    opacity: 0.7;
}

/* Plan margin notes */
.margin-note--1 {
    top: 25%;
    left: 3%;
    transform: rotate(-3deg);
}

.margin-note--2 {
    top: 55%;
    right: 3%;
    left: auto;
    transform: rotate(2deg);
    color: #8b3a3a;
}

.margin-note--3 {
    bottom: 15%;
    left: 6%;
    transform: rotate(-1deg);
}

/* ==========================================================
   Section 3: The Whisper (Details)
   ========================================================== */
.section--whisper {
    background-color: #f5f0e8;
    padding: 6rem 2rem;
    position: relative;
}

.whisper-content {
    max-width: 640px;
    margin: 0 auto;
    position: relative;
    z-index: 5;
}

.whisper-annotation {
    display: block;
    margin-top: 0.2rem;
    margin-bottom: 2.5rem;
    font-size: 1.15rem;
    color: #3d7a6e;
    transform: rotate(-1.5deg);
}

.whisper-body p {
    font-family: 'Source Serif 4', serif;
    font-size: 1.05rem;
    line-height: 1.75;
    color: #3e3329;
    margin-bottom: 1.5rem;
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.whisper-body p.visible {
    opacity: 1;
    transform: translateY(0);
}

.whisper-body strong {
    color: #2b2520;
    font-weight: 600;
}

.whisper-body em {
    font-style: italic;
    color: #8b3a3a;
}

/* Blockquote */
.whisper-quote {
    position: relative;
    margin: 2.5rem 0;
    padding: 1.5rem 2rem;
    border-left: 3px solid #d4a843;
    background: rgba(212, 168, 67, 0.06);
    font-family: 'Playfair Display', serif;
    font-size: 1.2rem;
    font-style: italic;
    line-height: 1.6;
    color: #2b2520;
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.whisper-quote.visible {
    opacity: 1;
    transform: translateY(0);
}

.whisper-quote__mark {
    font-family: 'Playfair Display', serif;
    font-size: 2rem;
    color: #d4a843;
    line-height: 1;
    vertical-align: -0.15em;
}

/* Whisper margin annotations */
.margin-annotations--whisper {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.margin-note--w1 {
    top: 20%;
    right: 5%;
    left: auto;
    transform: rotate(3deg);
    color: #d4a843;
    font-size: 1.1rem;
}

.margin-note--w2 {
    top: 42%;
    left: 3%;
    transform: rotate(-2deg);
    color: #c8613a;
}

.margin-note--w3 {
    top: 62%;
    right: 4%;
    left: auto;
    transform: rotate(1deg);
    color: #8b3a3a;
}

.margin-note--w4 {
    bottom: 20%;
    left: 4%;
    transform: rotate(-3deg);
    color: #3d7a6e;
    font-size: 1.3rem;
}


/* ==========================================================
   Section 4: The Break (Action / Dispersal)
   ========================================================== */
.section--break {
    background-color: #ede7db;
    padding: 6rem 2rem;
    position: relative;
}

.break-header {
    text-align: center;
    margin-bottom: 4rem;
    position: relative;
    z-index: 5;
}

.break-annotation {
    display: block;
    margin-top: 0.3rem;
    font-size: 1.15rem;
    color: #8b3a3a;
    transform: rotate(-2deg);
}

/* Break cards — scatter layout */
.break-cards {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 3rem;
    max-width: 1000px;
    margin: 0 auto 5rem;
    position: relative;
    z-index: 5;
}

.break-card {
    background: rgba(245, 240, 232, 0.9);
    border: 1.5px solid #a89e91;
    border-radius: 4px;
    padding: 2.2rem 2rem;
    width: 280px;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease, transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s ease;
}

.break-card.visible {
    opacity: 1;
    transform: translateY(0);
}

.break-card.scatter {
    transition: transform 1.2s cubic-bezier(0.22, 1, 0.36, 1);
}

.break-card:hover {
    box-shadow: 0 6px 24px rgba(43, 37, 32, 0.14);
}

.break-card__number {
    font-family: 'DM Mono', monospace;
    font-size: 0.8rem;
    color: #a89e91;
    display: block;
    margin-bottom: 0.7rem;
    letter-spacing: 0.05em;
}

.break-card__title {
    font-family: 'Playfair Display', serif;
    font-size: 1.3rem;
    color: #2b2520;
    margin-bottom: 0.7rem;
}

.break-card__text {
    font-family: 'Source Serif 4', serif;
    font-size: 0.95rem;
    line-height: 1.65;
    color: #3e3329;
}

/* Footer huddle */
.footer-huddle {
    text-align: center;
    padding-top: 3rem;
    position: relative;
    z-index: 5;
}

.footer-huddle__svg {
    width: 200px;
    height: 200px;
    margin: 0 auto 1.5rem;
    display: block;
    opacity: 0;
    transition: opacity 0.8s ease;
}

.footer-huddle__svg.visible {
    opacity: 1;
}

.footer-node {
    opacity: 0;
    transform-origin: center;
}

.footer-node.animate {
    animation: nodeAppear 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.footer-huddle__text {
    font-size: 1.15rem;
    color: #3d7a6e;
    margin-bottom: 0.5rem;
    transform: rotate(-1deg);
}

.footer-huddle__domain {
    font-family: 'DM Mono', monospace;
    font-size: 0.85rem;
    color: #a89e91;
    letter-spacing: 0.1em;
    padding-bottom: 2rem;
}

/* ==========================================================
   Navigation: Floating Huddle Circles
   ========================================================== */
.nav-huddle {
    position: fixed;
    bottom: 2rem;
    left: 2rem;
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    align-items: flex-start;
}

.nav-circle {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background-color: #a89e91;
    cursor: pointer;
    position: relative;
    transition: background-color 0.3s ease, transform 0.3s ease, width 0.3s ease, height 0.3s ease;
}

.nav-circle--active {
    background-color: #c8613a;
    width: 18px;
    height: 18px;
}

.nav-circle:hover {
    background-color: #d4a843;
    transform: scale(1.3);
}

.nav-label {
    font-family: 'Caveat', cursive;
    font-size: 0.9rem;
    color: #3e3329;
    position: absolute;
    left: calc(100% + 0.7rem);
    top: 50%;
    transform: translateY(-50%);
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.nav-circle:hover .nav-label {
    opacity: 1;
}

/* ==========================================================
   Wobble Animation for hand-drawn elements
   ========================================================== */
@keyframes wobble {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(0.5deg); }
    75% { transform: rotate(-0.5deg); }
}

.margin-note,
.plan-card__note,
.gathering-annotation,
.whisper-annotation,
.break-annotation,
.footer-huddle__text {
    animation: wobble 3.5s ease-in-out infinite;
}

/* Stagger wobble start for variety */
.plan-card__note { animation-delay: 0.2s; }
.gathering-annotation { animation-delay: 0.5s; }
.whisper-annotation { animation-delay: 0.8s; }
.break-annotation { animation-delay: 1.1s; }
.margin-note--1 { animation-delay: 0.3s; }
.margin-note--2 { animation-delay: 0.7s; }
.margin-note--3 { animation-delay: 1.0s; }
.margin-note--w1 { animation-delay: 0.4s; }
.margin-note--w2 { animation-delay: 0.9s; }
.margin-note--w3 { animation-delay: 1.3s; }
.margin-note--w4 { animation-delay: 0.6s; }

/* ==========================================================
   Responsive
   ========================================================== */
@media (max-width: 768px) {
    html {
        font-size: 16px;
    }

    .gathering-headline {
        font-size: 2.2rem;
    }

    .section-title {
        font-size: 2rem;
    }

    .huddle-circle {
        width: 300px;
        height: 300px;
    }

    .gathering-annotation {
        right: -2rem;
        font-size: 0.95rem;
    }

    .plan-cards {
        grid-template-columns: 1fr;
        gap: 1.5rem;
        padding: 0 1rem;
    }

    .break-cards {
        flex-direction: column;
        align-items: center;
        gap: 1.5rem;
    }

    .break-card {
        width: 100%;
        max-width: 340px;
    }

    .whisper-content {
        padding: 0 0.5rem;
    }

    .nav-huddle {
        bottom: 1rem;
        left: 1rem;
    }

    .margin-annotations {
        display: none;
    }
}

@media (max-width: 480px) {
    .gathering-headline {
        font-size: 1.8rem;
    }

    .huddle-circle {
        width: 240px;
        height: 240px;
    }

    .gathering-annotation {
        display: none;
    }

    .section--gathering {
        padding: 1rem;
    }

    .section--plan,
    .section--whisper,
    .section--break {
        padding: 4rem 1rem;
    }
}

/* ==========================================================
   Selection styling
   ========================================================== */
::selection {
    background: rgba(212, 168, 67, 0.3);
    color: #2b2520;
}

/* ==========================================================
   Smooth scroll offset for sections
   ========================================================== */
.section {
    scroll-margin-top: 0;
}
