/* ============================================
   continu.st — Styles
   Inflated-3D marble aesthetic
   ============================================ */

/* --- CSS Custom Properties --- */
:root {
    --marble-light: #f0e6d6;
    --marble-mid: #e0d4c0;
    --marble-deep: #2d2d3a;
    --marble-muted: #e8e0d4;
    --marble-surface: #d0c8b8;
    --marble-base: #c4b8a8;
    --vein-gold: #c4923a;
    --retro-teal: #5a8a8a;
    --blush-stone: #c4a0a0;
    --thread-silver: #b8b0a8;
    --deep-umber: #1a1a14;
    --text-dark: #2d2d3a;
    --text-body: #4a4a5a;
    --text-light: #c8c0b4;
    --text-light-heading: #e8e0d4;

    /* Fibonacci spacing */
    --sp-1: 8px;
    --sp-2: 13px;
    --sp-3: 21px;
    --sp-4: 34px;
    --sp-5: 55px;
    --sp-6: 89px;
}

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

html {
    scroll-behavior: smooth;
    overflow-x: hidden;
}

body {
    font-family: 'Quicksand', sans-serif;
    font-weight: 400;
    font-size: 17px;
    line-height: 1.72;
    color: var(--text-body);
    background-color: var(--marble-light);
    overflow-x: hidden;
    position: relative;

    /* Marble base texture for the whole page */
    background-image:
        radial-gradient(ellipse at 30% 40%, #f0e6d6 0%, #e0d4c0 40%, #d0c8b8 70%, #c4b8a8 100%),
        radial-gradient(ellipse at 70% 20%, rgba(196, 146, 58, 0.06) 0%, transparent 50%),
        radial-gradient(ellipse at 20% 80%, rgba(196, 146, 58, 0.04) 0%, transparent 40%);
}

/* --- The Membrane (Opening Viewport) --- */
.membrane {
    position: relative;
    width: 100%;
    height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    z-index: 2;

    /* Marble background with vein patterns */
    background:
        radial-gradient(ellipse at 25% 35%, rgba(196, 146, 58, 0.1) 0%, transparent 40%),
        radial-gradient(ellipse at 75% 65%, rgba(196, 146, 58, 0.07) 0%, transparent 35%),
        radial-gradient(ellipse at 50% 50%, rgba(196, 160, 160, 0.05) 0%, transparent 50%),
        linear-gradient(137deg, rgba(196, 146, 58, 0.04) 0%, transparent 30%, rgba(196, 146, 58, 0.03) 60%, transparent 100%),
        radial-gradient(ellipse at 30% 40%, #f0e6d6 0%, #e0d4c0 40%, #d0c8b8 70%, #c4b8a8 100%);
}

/* --- Torus Form --- */
.torus-form {
    position: relative;
    width: clamp(280px, 60vw, 600px);
    height: clamp(280px, 60vw, 600px);
    animation: torusRotate 60s linear infinite;
    z-index: 1;
}

.torus-layer {
    position: absolute;
    border-radius: 50%;
}

.torus-layer-1 {
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    background:
        radial-gradient(ellipse at 40% 35%, #f0e6d6 0%, #e0d4c0 30%, #d0c8b8 55%, #c4b8a8 80%, #b8b0a8 100%);
    box-shadow:
        inset 0 -30px 60px rgba(45, 45, 58, 0.08),
        inset 0 20px 40px rgba(240, 230, 214, 0.6),
        0 30px 80px rgba(45, 45, 58, 0.12),
        0 10px 30px rgba(45, 45, 58, 0.06);
    opacity: 0.85;
}

.torus-layer-2 {
    width: 75%;
    height: 75%;
    top: 12.5%;
    left: 12.5%;
    background:
        radial-gradient(ellipse at 55% 45%, #f0e6d6 0%, #e8e0d4 25%, #d0c8b8 60%, #c4b8a8 100%);
    box-shadow:
        inset 0 -20px 50px rgba(45, 45, 58, 0.1),
        inset 0 15px 35px rgba(240, 230, 214, 0.5),
        0 15px 50px rgba(45, 45, 58, 0.08);
    opacity: 0.9;
}

.torus-layer-3 {
    width: 48%;
    height: 48%;
    top: 26%;
    left: 26%;
    background:
        radial-gradient(ellipse at 45% 40%, #e0d4c0 0%, #d0c8b8 40%, #c4b8a8 70%, #b8b0a8 100%);
    box-shadow:
        inset 0 8px 25px rgba(240, 230, 214, 0.6),
        inset 0 -12px 30px rgba(45, 45, 58, 0.12),
        0 10px 30px rgba(45, 45, 58, 0.06);
    border-radius: 50%;
    opacity: 0.7;
}

.torus-layer-4 {
    width: 22%;
    height: 22%;
    top: 39%;
    left: 39%;
    background:
        radial-gradient(ellipse at 50% 50%, var(--marble-light) 0%, var(--marble-mid) 60%, var(--marble-surface) 100%);
    box-shadow:
        inset 0 5px 15px rgba(45, 45, 58, 0.15),
        inset 0 -5px 10px rgba(240, 230, 214, 0.4);
    opacity: 0.5;
}

/* Vein overlay on torus layers */
.torus-layer-1::after,
.torus-layer-2::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background:
        linear-gradient(137deg, rgba(196, 146, 58, 0.08) 0%, transparent 25%, rgba(196, 146, 58, 0.05) 50%, transparent 75%),
        linear-gradient(47deg, transparent 20%, rgba(196, 146, 58, 0.06) 40%, transparent 60%);
    pointer-events: none;
}

@keyframes torusRotate {
    0% { transform: rotate(0deg) scale(1); }
    25% { transform: rotate(90deg) scale(1.02); }
    50% { transform: rotate(180deg) scale(1); }
    75% { transform: rotate(270deg) scale(0.98); }
    100% { transform: rotate(360deg) scale(1); }
}

/* --- Site Title (bas-relief) --- */
.site-title {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-family: 'Nunito', sans-serif;
    font-weight: 900;
    font-size: clamp(3.5rem, 8vw, 7rem);
    letter-spacing: -0.02em;
    color: var(--text-dark);
    z-index: 3;
    text-shadow:
        0 1px 0 #d0c8b8,
        0 2px 0 #c4b8a8,
        0 3px 0 #c4b8a8,
        0 4px 0 #b8b0a8,
        0 5px 0 #b8b0a8,
        0 6px 0 #b8b0a8,
        0 8px 15px rgba(45, 45, 58, 0.15),
        0 12px 30px rgba(45, 45, 58, 0.08);
    white-space: nowrap;
    user-select: none;
}

/* --- Scroll Hint --- */
.scroll-hint {
    position: absolute;
    bottom: var(--sp-5);
    left: 50%;
    transform: translateX(-50%);
    width: 24px;
    height: 40px;
    border: 2px solid var(--thread-silver);
    border-radius: 12px;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 6px;
    opacity: 0.6;
    z-index: 3;
}

.scroll-hint-dot {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--vein-gold);
    animation: scrollPulse 2s ease-in-out infinite;
}

@keyframes scrollPulse {
    0%, 100% { transform: translateY(0); opacity: 1; }
    50% { transform: translateY(16px); opacity: 0.3; }
}

/* --- Sticky Mini Torus --- */
.sticky-torus {
    position: fixed;
    top: var(--sp-3);
    right: var(--sp-3);
    width: 80px;
    height: 80px;
    z-index: 100;
    opacity: 0;
    transform: scale(0.3);
    transition: opacity 0.8s ease, transform 0.8s ease;
    pointer-events: none;
}

.sticky-torus.visible {
    opacity: 0.7;
    transform: scale(1);
}

.sticky-torus .torus-layer-1 {
    width: 100%;
    height: 100%;
    animation: miniTorusRotate 30s linear infinite;
}

.sticky-torus .torus-layer-2 {
    width: 65%;
    height: 65%;
    top: 17.5%;
    left: 17.5%;
    animation: miniTorusRotate 25s linear infinite reverse;
}

@keyframes miniTorusRotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* --- SVG Thread --- */
.thread-svg {
    position: absolute;
    top: 100vh;
    left: 0;
    width: 100%;
    height: 300vh;
    z-index: 0;
    pointer-events: none;
}

.thread-path {
    stroke-dasharray: 5000;
    stroke-dashoffset: 5000;
    transition: stroke-dashoffset 0.05s linear;
}

/* --- Tropical Fish --- */
.fish {
    position: absolute;
    z-index: 10;
    width: 60px;
    height: auto;
    cursor: default;
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    filter: drop-shadow(0 4px 8px rgba(196, 160, 160, 0.4));
    pointer-events: none;
}

.fish svg {
    width: 100%;
    height: auto;
    display: block;
}

.fish-1 {
    top: 130vh;
    left: 8%;
    width: 65px;
    animation: fishFloat1 8s ease-in-out infinite;
}

.fish-2 {
    top: 200vh;
    right: 6%;
    left: auto;
    width: 55px;
    animation: fishFloat2 10s ease-in-out infinite;
}

.fish-3 {
    top: 280vh;
    left: 5%;
    width: 70px;
    animation: fishFloat3 7s ease-in-out infinite;
}

.fish-4 {
    top: 340vh;
    right: 10%;
    left: auto;
    width: 50px;
    animation: fishFloat4 9s ease-in-out infinite;
}

@keyframes fishFloat1 {
    0%, 100% { transform: translate(0, 0) scaleX(1); }
    30% { transform: translate(12px, -6px) scaleX(1); }
    70% { transform: translate(-8px, 5px) scaleX(1); }
}

@keyframes fishFloat2 {
    0%, 100% { transform: translate(0, 0) scaleX(-1); }
    40% { transform: translate(-15px, 8px) scaleX(-1); }
    60% { transform: translate(10px, -4px) scaleX(-1); }
}

@keyframes fishFloat3 {
    0%, 100% { transform: translate(0, 0) scaleX(1); }
    25% { transform: translate(10px, -8px) scaleX(1); }
    75% { transform: translate(-12px, 6px) scaleX(1); }
}

@keyframes fishFloat4 {
    0%, 100% { transform: translate(0, 0) scaleX(-1); }
    35% { transform: translate(-10px, -5px) scaleX(-1); }
    65% { transform: translate(8px, 7px) scaleX(-1); }
}

/* --- Topological Shapes --- */
.topo-shape {
    position: relative;
    width: 140px;
    height: 140px;
    margin: var(--sp-5) auto;
    z-index: 1;
}

.topo-shape .topo-inner {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background:
        radial-gradient(ellipse at 40% 35%, #f0e6d6 0%, #e0d4c0 35%, #d0c8b8 65%, #c4b8a8 100%);
    box-shadow:
        inset 0 -10px 25px rgba(45, 45, 58, 0.08),
        inset 0 8px 20px rgba(240, 230, 214, 0.5),
        0 12px 35px rgba(45, 45, 58, 0.1),
        0 4px 12px rgba(45, 45, 58, 0.05);
}

.topo-shape .topo-inner::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background:
        linear-gradient(137deg, rgba(196, 146, 58, 0.08) 0%, transparent 40%),
        linear-gradient(317deg, rgba(196, 160, 160, 0.06) 0%, transparent 40%);
    pointer-events: none;
}

.topo-shape-1 {
    animation: topoSpin 25s linear infinite;
}

.topo-shape-1 .topo-inner {
    border-radius: 42% 58% 55% 45% / 52% 48% 52% 48%;
}

.topo-shape-2 {
    width: 120px;
    height: 120px;
    animation: topoSpin 35s linear infinite reverse;
}

.topo-shape-2 .topo-inner {
    border-radius: 55% 45% 48% 52% / 45% 55% 50% 50%;
}

.topo-shape-3 {
    width: 160px;
    height: 160px;
    animation: topoSpin 28s linear infinite;
}

.topo-shape-3 .topo-inner {
    border-radius: 48% 52% 42% 58% / 55% 45% 52% 48%;
    /* Torus hole effect */
    box-shadow:
        inset 0 -10px 25px rgba(45, 45, 58, 0.08),
        inset 0 8px 20px rgba(240, 230, 214, 0.5),
        inset 0 0 30px 10px rgba(45, 45, 58, 0.04),
        0 12px 35px rgba(45, 45, 58, 0.1),
        0 4px 12px rgba(45, 45, 58, 0.05);
}

@keyframes topoSpin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* --- Flow Corridor --- */
.flow-corridor {
    position: relative;
    z-index: 2;
    padding: var(--sp-6) 0;
    padding-top: calc(var(--sp-6) + 55px);
}

/* --- Tablets --- */
.tablet {
    position: relative;
    width: clamp(320px, 75vw, 900px);
    margin: var(--sp-6) auto;
    padding: var(--sp-5) clamp(var(--sp-4), 5vw, var(--sp-6));
    border-radius: 50px;
    background:
        radial-gradient(ellipse at 35% 30%, rgba(196, 146, 58, 0.06) 0%, transparent 50%),
        radial-gradient(ellipse at 65% 70%, rgba(196, 146, 58, 0.04) 0%, transparent 40%),
        radial-gradient(ellipse at 30% 40%, #f0e6d6 0%, #e0d4c0 40%, #d0c8b8 70%, #c4b8a8 100%);
    box-shadow:
        0 20px 60px rgba(45, 45, 58, 0.08),
        0 8px 20px rgba(45, 45, 58, 0.04);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    z-index: 2;
}

/* Vein overlay on tablets */
.tablet::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background:
        linear-gradient(127deg, rgba(196, 146, 58, 0.07) 0%, transparent 30%, rgba(196, 146, 58, 0.04) 55%, transparent 80%),
        linear-gradient(307deg, transparent 20%, rgba(196, 160, 160, 0.04) 50%, transparent 80%);
    pointer-events: none;
    z-index: 0;
}

.tablet > * {
    position: relative;
    z-index: 1;
}

.tablet-1 {
    /* Unique marble vein for each tablet */
    background:
        radial-gradient(ellipse at 25% 20%, rgba(196, 146, 58, 0.08) 0%, transparent 45%),
        radial-gradient(ellipse at 75% 80%, rgba(196, 160, 160, 0.05) 0%, transparent 40%),
        radial-gradient(ellipse at 30% 40%, #f0e6d6 0%, #e0d4c0 40%, #d0c8b8 70%, #c4b8a8 100%);
}

.tablet-2 {
    background:
        radial-gradient(ellipse at 60% 25%, rgba(196, 146, 58, 0.07) 0%, transparent 50%),
        radial-gradient(ellipse at 30% 75%, rgba(196, 146, 58, 0.05) 0%, transparent 35%),
        radial-gradient(ellipse at 40% 45%, #f0e6d6 0%, #e0d4c0 35%, #d0c8b8 65%, #c4b8a8 100%);
}

.tablet-3 {
    background:
        radial-gradient(ellipse at 45% 15%, rgba(196, 146, 58, 0.09) 0%, transparent 40%),
        radial-gradient(ellipse at 55% 85%, rgba(196, 160, 160, 0.06) 0%, transparent 45%),
        radial-gradient(ellipse at 35% 50%, #f0e6d6 0%, #e0d4c0 38%, #d0c8b8 68%, #c4b8a8 100%);
}

.tablet-label {
    display: inline-block;
    font-family: 'Nunito', sans-serif;
    font-weight: 600;
    font-size: 13px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--vein-gold);
    margin-bottom: var(--sp-2);
}

.tablet-title {
    font-family: 'Nunito', sans-serif;
    font-weight: 800;
    font-size: clamp(1.8rem, 4vw, 2.8rem);
    letter-spacing: -0.02em;
    color: var(--text-dark);
    margin-bottom: var(--sp-3);
    text-shadow:
        0 1px 0 #d0c8b8,
        0 2px 0 #c4b8a8,
        0 3px 0 #c4b8a8,
        0 5px 10px rgba(45, 45, 58, 0.08);
}

.tablet-body {
    font-family: 'Quicksand', sans-serif;
    font-weight: 400;
    font-size: 17px;
    line-height: 1.72;
    color: var(--text-body);
    max-width: 65ch;
}

/* Scroll reveal animation */
.scroll-reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s cubic-bezier(0.34, 1.56, 0.64, 1),
                transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.scroll-reveal.revealed {
    opacity: 1;
    transform: translateY(0);
}

/* --- The Convergence --- */
.convergence {
    position: relative;
    width: 100%;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 2;
    background:
        radial-gradient(ellipse at 50% 60%, rgba(196, 146, 58, 0.05) 0%, transparent 40%),
        linear-gradient(to bottom, var(--marble-mid) 0%, var(--marble-deep) 60%, var(--marble-deep) 100%);
}

.convergence-ellipsis {
    font-family: 'Nunito', sans-serif;
    font-weight: 900;
    font-size: 48px;
    color: var(--text-light-heading);
    letter-spacing: 0.3em;
    margin-bottom: var(--sp-6);
    opacity: 0.8;
    text-shadow:
        0 1px 0 rgba(45, 45, 58, 0.2),
        0 2px 8px rgba(45, 45, 58, 0.15);
}

.convergence-point {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--vein-gold);
    box-shadow:
        0 0 20px var(--vein-gold),
        0 0 40px rgba(196, 146, 58, 0.3);
    animation: convergePulse 3s ease-in-out infinite;
}

@keyframes convergePulse {
    0%, 100% {
        box-shadow:
            0 0 20px var(--vein-gold),
            0 0 40px rgba(196, 146, 58, 0.3);
        transform: scale(1);
    }
    50% {
        box-shadow:
            0 0 30px var(--vein-gold),
            0 0 60px rgba(196, 146, 58, 0.4),
            0 0 80px rgba(196, 146, 58, 0.15);
        transform: scale(1.5);
    }
}

/* --- Responsive Adjustments --- */
@media (max-width: 768px) {
    .tablet {
        width: 90vw;
        border-radius: 34px;
        padding: var(--sp-4) var(--sp-3);
    }

    .torus-form {
        width: 80vw;
        height: 80vw;
    }

    .fish-1 { left: 3%; }
    .fish-2 { right: 3%; }
    .fish-3 { left: 2%; }
    .fish-4 { right: 5%; }

    .topo-shape {
        width: 100px;
        height: 100px;
    }

    .topo-shape-3 {
        width: 120px;
        height: 120px;
    }

    .sticky-torus {
        width: 55px;
        height: 55px;
        top: var(--sp-2);
        right: var(--sp-2);
    }

    .convergence-ellipsis {
        font-size: 36px;
    }
}

@media (max-width: 480px) {
    .site-title {
        font-size: clamp(2.5rem, 12vw, 4rem);
    }

    .tablet {
        border-radius: 28px;
        margin-left: 0 !important;
        margin-right: 0 !important;
        width: 92vw;
    }

    .tablet-title {
        font-size: clamp(1.4rem, 5vw, 2rem);
    }

    .fish {
        width: 40px;
    }
}
