/* ============================================================
   scriptswirl.com -- seapunk scripting studio
   Aesthetic: seapunk | Layout: split-screen | Type: eclectic-hybrid
   Palette: creamy-pastel | Patterns: glitch | Imagery: icon-heavy
   Motifs: city-urban | Tone: dreamy-ethereal
   ============================================================ */

:root {
    --c-cream-base: #FFF8F4;
    --c-lavender:   #E8E0F0;
    --c-aqua-soft:  #D0F0F0;
    --c-aqua-deep:  #0D9488;
    --c-violet:     #8B5CF6;
    --c-coral:      #FDB5B5;
    --c-ink:        #4A4A5A;

    --f-archivo: 'Archivo', 'Inter', sans-serif;
    --f-caveat:  'Caveat', 'Comic Sans MS', cursive;
    --f-body:    'DM Sans', 'Inter', sans-serif;
    --f-mono:    'Fira Code', 'Menlo', monospace;
}

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

html, body { width: 100%; }
html { scroll-behavior: smooth; }

body {
    font-family: var(--f-body);
    font-weight: 400;
    font-size: clamp(16px, 1.5vw, 18px);
    line-height: 1.75;
    color: var(--c-ink);
    background: var(--c-cream-base);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* ============================================================
   TYPE PRIMITIVES (eclectic-hybrid wordmarks)
   ============================================================ */
.wm-archivo {
    font-family: var(--f-archivo);
    font-weight: 700;
    letter-spacing: -0.02em;
}
.wm-caveat {
    font-family: var(--f-caveat);
    font-weight: 700;
    color: var(--c-violet);
    letter-spacing: 0.01em;
    transform: translateY(0.04em) rotate(-2deg);
    display: inline-block;
}
.mono { font-family: var(--f-mono); font-size: 13px; }

.dn-label {
    font-family: var(--f-mono);
    font-size: 12px;
    color: var(--c-aqua-deep);
    text-transform: lowercase;
    letter-spacing: 0.06em;
    display: inline-block;
    margin-bottom: 14px;
    padding: 4px 10px;
    background: rgba(13, 148, 136, 0.08);
    border-radius: 100px;
}

/* ============================================================
   SECTION 1 — THE WHIRLPOOL (split-screen hero, 100vh)
   ============================================================ */
.whirlpool {
    display: grid;
    grid-template-columns: 1fr 1fr;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--c-lavender) 0%, var(--c-aqua-soft) 100%);
    position: relative;
    overflow: hidden;
}

.whirlpool-left {
    position: relative;
    overflow: hidden;
}

.swirl-spiral {
    position: absolute;
    width: 140vmax;
    height: 140vmax;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    background: conic-gradient(
        from 0deg at 50% 50%,
        rgba(232, 224, 240, 0.0) 0deg,
        rgba(139, 92, 246, 0.18) 45deg,
        rgba(208, 240, 240, 0.05) 90deg,
        rgba(13, 148, 136, 0.16) 180deg,
        rgba(253, 181, 181, 0.10) 270deg,
        rgba(232, 224, 240, 0.0) 360deg
    );
    animation: rotate-swirl 20s linear infinite;
    pointer-events: none;
    filter: blur(2px);
    opacity: 0.85;
}

.swirl-spiral::after {
    content: '';
    position: absolute;
    inset: 25%;
    border-radius: 50%;
    background: radial-gradient(circle,
        rgba(255, 248, 244, 0.55) 0%,
        rgba(255, 248, 244, 0.1) 50%,
        transparent 75%);
    filter: blur(20px);
}

@keyframes rotate-swirl {
    from { transform: translate(-50%, -50%) rotate(0deg); }
    to   { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Glitch flicker at the swirl center */
.glitch-center {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 86px;
    height: 86px;
    display: grid;
    place-items: center;
    pointer-events: none;
    z-index: 5;
}

.glitch-layer {
    position: absolute;
    font-family: var(--f-mono);
    font-size: 56px;
    font-weight: 500;
    mix-blend-mode: multiply;
    opacity: 0;
    will-change: transform, opacity;
}

.glitch-r { color: var(--c-coral);  animation: glitch-r 5s infinite steps(1); }
.glitch-g { color: var(--c-aqua-deep);  animation: glitch-g 5s infinite steps(1); }
.glitch-b { color: var(--c-violet); animation: glitch-b 5s infinite steps(1); }

@keyframes glitch-r {
    0%, 96% { opacity: 0; transform: translate(0,0); }
    97%     { opacity: 0.85; transform: translate(2px, -1px); }
    98%     { opacity: 0; }
    99%     { opacity: 0.7; transform: translate(-3px, 1px); }
    100%    { opacity: 0; }
}
@keyframes glitch-g {
    0%, 96% { opacity: 0; transform: translate(0,0); }
    97%     { opacity: 0.9; transform: translate(-2px, 1px); }
    98%     { opacity: 0; }
    99%     { opacity: 0.6; transform: translate(2px, -2px); }
    100%    { opacity: 0; }
}
@keyframes glitch-b {
    0%, 95% { opacity: 0.65; transform: translate(0,0); }
    96%     { opacity: 0.4; transform: translate(1px, 1px); }
    100%    { opacity: 0.65; }
}

/* Orbit system around the swirl center */
.orbit-system {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 0;
    height: 0;
    pointer-events: none;
    z-index: 4;
}

.orbit-icon {
    position: absolute;
    left: 0;
    top: 0;
    transform-origin: 0 0;
    font-family: var(--f-mono);
    font-size: 14px;
    font-weight: 500;
    will-change: transform;
    user-select: none;
    --radius: 120px;
    --duration: 12s;
    --start: 0deg;
    animation: orbit var(--duration) linear infinite;
    animation-delay: var(--delay, 0s);
}

@keyframes orbit {
    from {
        transform: rotate(var(--start)) translateX(var(--radius)) rotate(calc(-1 * var(--start)));
    }
    to {
        transform: rotate(calc(var(--start) + 360deg)) translateX(var(--radius)) rotate(calc(-1 * var(--start) - 360deg));
    }
}

/* Background icon noise (scattered at low opacity) */
.icon-noise {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 1;
}
.noise-icon {
    position: absolute;
    font-family: var(--f-mono);
    color: var(--c-violet);
    user-select: none;
    will-change: transform;
}

/* Right column — wordmark + lede */
.whirlpool-right {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: clamp(30px, 5vw, 80px);
    position: relative;
    z-index: 2;
}

.wordmark-block {
    max-width: 540px;
    opacity: 0;
    transform: translateY(8px);
    animation: fade-in 0.8s ease 0.4s forwards;
}

@keyframes fade-in {
    to { opacity: 1; transform: translateY(0); }
}

.wordmark {
    font-size: clamp(40px, 6vw, 84px);
    line-height: 1;
    margin-bottom: 18px;
}
.wordmark .wm-archivo { color: var(--c-ink); }

.kicker {
    font-family: var(--f-mono);
    font-size: 13px;
    color: var(--c-aqua-deep);
    margin-bottom: 28px;
    letter-spacing: 0.04em;
}

.lede {
    font-size: clamp(16px, 1.4vw, 19px);
    color: var(--c-ink);
    margin-bottom: 36px;
    max-width: 480px;
}

.meta-row {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
}

.meta-tag {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--c-cream-base);
    border: 1px solid rgba(74, 74, 90, 0.12);
    border-radius: 100px;
    padding: 7px 14px;
    font-family: var(--f-mono);
    font-size: 12px;
    color: var(--c-ink);
}

.meta-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--c-aqua-deep);
    box-shadow: 0 0 8px var(--c-aqua-deep);
    animation: pulse-dot 2.4s ease-in-out infinite;
}
.meta-dot-coral { background: var(--c-coral); box-shadow: 0 0 8px var(--c-coral); animation-delay: 1s; }

@keyframes pulse-dot {
    0%, 100% { transform: scale(1); opacity: 1; }
    50%      { transform: scale(0.6); opacity: 0.55; }
}

/* ============================================================
   SECTION 2 — DUAL NATURE (chaos.flows / order.crystallizes)
   ============================================================ */
.dual-nature {
    display: grid;
    grid-template-columns: 1fr 1fr;
    min-height: 100vh;
    background: var(--c-cream-base);
    position: relative;
}

.dn-side {
    position: relative;
    padding: clamp(40px, 6vw, 90px);
    display: flex;
    align-items: center;
    overflow: hidden;
}

.dn-content {
    position: relative;
    z-index: 3;
    max-width: 520px;
}

.dn-title {
    font-size: clamp(32px, 4vw, 56px);
    line-height: 1.05;
    margin-bottom: 22px;
    color: var(--c-ink);
}

.dn-body {
    font-size: clamp(15px, 1.3vw, 17px);
    margin-bottom: 28px;
    max-width: 460px;
}

/* Swirl side */
.dn-swirl {
    background: linear-gradient(135deg, var(--c-lavender) 0%, rgba(208, 240, 240, 0.4) 100%);
}

.dn-mini-swirl {
    position: absolute;
    width: 80vmin;
    height: 80vmin;
    right: -30vmin;
    top: 50%;
    transform: translateY(-50%);
    background: conic-gradient(
        from 0deg,
        transparent 0deg,
        rgba(139, 92, 246, 0.2) 60deg,
        transparent 120deg,
        rgba(13, 148, 136, 0.18) 200deg,
        transparent 260deg,
        rgba(253, 181, 181, 0.18) 340deg,
        transparent 360deg
    );
    border-radius: 50%;
    animation: rotate-swirl-2 28s linear infinite;
    filter: blur(3px);
    z-index: 1;
}
@keyframes rotate-swirl-2 {
    from { transform: translateY(-50%) rotate(0deg); }
    to   { transform: translateY(-50%) rotate(-360deg); }
}

.dn-icon-cloud {
    position: absolute;
    inset: 0;
    z-index: 2;
    pointer-events: none;
}

.cloud-icon {
    position: absolute;
    font-family: var(--f-mono);
    color: var(--c-violet);
    user-select: none;
    will-change: transform;
    animation: drift 14s ease-in-out infinite;
}

@keyframes drift {
    0%, 100% { transform: translate(0,0) rotate(0deg); }
    25%      { transform: translate(8px, -10px) rotate(8deg); }
    50%      { transform: translate(-6px, 6px) rotate(-6deg); }
    75%      { transform: translate(10px, 4px) rotate(4deg); }
}

/* Structure side */
.dn-structure {
    background: var(--c-cream-base);
    border-left: 1px dashed rgba(74, 74, 90, 0.18);
}

.dn-list {
    list-style: none;
    counter-reset: dn-counter;
    border-left: 2px solid var(--c-aqua-deep);
    padding-left: 22px;
    margin-top: 6px;
}

.dn-list li {
    counter-increment: dn-counter;
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 16px;
    align-items: baseline;
    padding: 14px 0;
    border-bottom: 1px solid rgba(74, 74, 90, 0.08);
    position: relative;
    opacity: 0;
    transform: translateX(-12px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}
.dn-list li:last-child { border-bottom: none; }

.dn-list li::before {
    content: '0' counter(dn-counter);
    position: absolute;
    left: -42px;
    top: 16px;
    font-family: var(--f-mono);
    font-size: 11px;
    color: var(--c-violet);
    background: var(--c-cream-base);
    padding: 2px 6px;
}

.dn-list li code {
    color: var(--c-aqua-deep);
    background: rgba(13, 148, 136, 0.08);
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 13px;
}

.dn-list.is-revealed li {
    opacity: 1;
    transform: translateX(0);
}
.dn-list.is-revealed li:nth-child(1) { transition-delay: 0.05s; }
.dn-list.is-revealed li:nth-child(2) { transition-delay: 0.18s; }
.dn-list.is-revealed li:nth-child(3) { transition-delay: 0.32s; }

/* ============================================================
   SECTION 3 — SUNKEN CITY
   ============================================================ */
.sunken-city {
    background: linear-gradient(180deg,
        var(--c-aqua-soft) 0%,
        var(--c-lavender) 60%,
        rgba(232, 224, 240, 0.85) 100%);
    padding: clamp(60px, 8vw, 120px) clamp(20px, 4vw, 60px) 0;
    position: relative;
    overflow: hidden;
}

.sc-header {
    max-width: 720px;
    margin: 0 auto 70px;
    text-align: center;
}

.sc-title {
    font-size: clamp(32px, 5vw, 64px);
    line-height: 1.05;
    margin: 14px 0 22px;
    color: var(--c-ink);
}

.sc-lede {
    font-size: clamp(15px, 1.4vw, 18px);
    color: var(--c-ink);
    max-width: 580px;
    margin: 0 auto;
}

.sc-skyline {
    position: relative;
    width: 100%;
    height: 380px;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 0;
    padding: 0 2vw;
}

.building {
    flex: 1 1 0;
    max-width: 96px;
    margin: 0 4px;
    background: linear-gradient(180deg,
        var(--c-aqua-deep) 0%,
        rgba(13, 148, 136, 0.85) 70%,
        rgba(74, 74, 90, 0.95) 100%);
    border-radius: 4px 4px 0 0;
    position: relative;
    overflow: hidden;
    color: rgba(255, 248, 244, 0.5);
    font-family: var(--f-mono);
    font-size: 11px;
    line-height: 1.2;
    text-align: center;
    padding-top: 8px;
    box-shadow: 0 0 24px rgba(13, 148, 136, 0.3) inset;
    animation: building-rise 0.9s cubic-bezier(0.2, 0.7, 0.2, 1) backwards;
}

.building::before {
    content: attr(data-glyph) attr(data-glyph) ' ' attr(data-glyph) attr(data-glyph)
             attr(data-glyph) attr(data-glyph) ' ' attr(data-glyph) attr(data-glyph)
             attr(data-glyph) attr(data-glyph) ' ' attr(data-glyph) attr(data-glyph)
             attr(data-glyph) attr(data-glyph) ' ' attr(data-glyph) attr(data-glyph);
    display: block;
    word-break: break-all;
    letter-spacing: 0.18em;
    opacity: 0.75;
    padding: 0 4px;
}

.building::after {
    /* flickering window row */
    content: '';
    position: absolute;
    left: 22%;
    right: 22%;
    bottom: 18%;
    height: 8px;
    background: linear-gradient(90deg,
        var(--c-coral) 0%,
        transparent 50%,
        var(--c-violet) 100%);
    opacity: 0.55;
    animation: window-flicker 3.4s ease-in-out infinite;
}

@keyframes building-rise {
    from { transform: translateY(40px); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
}

@keyframes window-flicker {
    0%, 100% { opacity: 0.45; }
    35%      { opacity: 0.85; }
    50%      { opacity: 0.2; }
    65%      { opacity: 0.7; }
}

/* per-building heights and animation delays */
.b1  { height: 60%; animation-delay: 0.05s; }
.b2  { height: 88%; animation-delay: 0.10s; }
.b3  { height: 72%; animation-delay: 0.15s; }
.b4  { height: 95%; animation-delay: 0.20s; }
.b5  { height: 50%; animation-delay: 0.25s; }
.b6  { height: 78%; animation-delay: 0.30s; }
.b7  { height: 100%; animation-delay: 0.35s; }
.b8  { height: 65%; animation-delay: 0.40s; }
.b9  { height: 82%; animation-delay: 0.45s; }
.b10 { height: 70%; animation-delay: 0.50s; }
.b11 { height: 92%; animation-delay: 0.55s; }
.b12 { height: 58%; animation-delay: 0.60s; }

/* Bubbles rising through the city */
.bubbles {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 5;
}

.bubble {
    position: absolute;
    bottom: -10px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%,
        rgba(255, 248, 244, 0.9),
        rgba(208, 240, 240, 0.4) 60%,
        transparent 100%);
    border: 1px solid rgba(255, 248, 244, 0.6);
    animation: bubble-rise var(--duration, 7s) linear infinite;
    animation-delay: var(--delay, 0s);
    will-change: transform, opacity;
    opacity: 0;
}

@keyframes bubble-rise {
    0%   { transform: translateY(0)     translateX(0); opacity: 0; }
    8%   { opacity: 0.85; }
    50%  { transform: translateY(-200px) translateX(8px); }
    100% { transform: translateY(-420px) translateX(-8px); opacity: 0; }
}

/* Caustic light wash at the top of the city */
.caustic {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 80px;
    background: linear-gradient(180deg,
        rgba(255, 248, 244, 0.55) 0%,
        rgba(208, 240, 240, 0.2) 60%,
        transparent 100%);
    filter: blur(6px);
    pointer-events: none;
}

/* ============================================================
   SECTION 4 — SEAFOAM FOOTER
   ============================================================ */
.seafoam-footer {
    background: linear-gradient(180deg,
        rgba(232, 224, 240, 0.85) 0%,
        var(--c-cream-base) 100%);
    padding: clamp(60px, 7vw, 110px) clamp(20px, 4vw, 60px) 36px;
    position: relative;
    overflow: hidden;
}

.sand-icons {
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
}
.sand-icon {
    position: absolute;
    font-family: var(--f-mono);
    color: var(--c-aqua-deep);
    opacity: 0.18;
    user-select: none;
    transition: transform 0.6s ease;
}

.footer-grid {
    display: grid;
    grid-template-columns: 1.2fr 1fr 1fr;
    gap: 50px;
    max-width: 1100px;
    margin: 0 auto;
    position: relative;
    z-index: 2;
}

.footer-col { min-width: 0; }

.footer-wordmark {
    font-size: clamp(28px, 3vw, 40px);
    margin: 12px 0 12px;
    line-height: 1;
}
.footer-wordmark .wm-archivo { color: var(--c-ink); }

.footer-note {
    font-size: 14px;
    color: var(--c-ink);
    opacity: 0.8;
}

.footer-list {
    list-style: none;
    margin-top: 8px;
}
.footer-list li {
    display: grid;
    grid-template-columns: 80px 1fr;
    gap: 12px;
    padding: 8px 0;
    border-bottom: 1px dashed rgba(74, 74, 90, 0.15);
    align-items: baseline;
    font-size: 14px;
}
.footer-list li:last-child { border-bottom: none; }
.footer-list .mono { color: var(--c-violet); }

.footer-mono {
    color: var(--c-aqua-deep);
    background: rgba(13, 148, 136, 0.08);
    padding: 10px 14px;
    border-radius: 6px;
    margin-top: 8px;
    border: 1px dashed rgba(13, 148, 136, 0.3);
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.footer-tiny {
    margin-top: 14px;
    font-family: var(--f-mono);
    font-size: 11px;
    color: var(--c-ink);
    opacity: 0.55;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 880px) {
    .whirlpool,
    .dual-nature {
        grid-template-columns: 1fr;
    }
    .whirlpool {
        min-height: auto;
    }
    .whirlpool-left {
        height: 60vh;
        min-height: 380px;
    }
    .whirlpool-right {
        padding: 50px 28px 70px;
    }
    .dn-structure { border-left: none; border-top: 1px dashed rgba(74,74,90,0.18); }
    .footer-grid {
        grid-template-columns: 1fr;
        gap: 32px;
    }
    .sc-skyline {
        height: 280px;
    }
    .building { margin: 0 2px; }
}

@media (max-width: 520px) {
    .wordmark { font-size: clamp(34px, 9vw, 56px); }
    .glitch-layer { font-size: 40px; }
    .sc-skyline { height: 220px; }
    .building { font-size: 9px; padding-top: 4px; }
}
