/* ============================================
   bada.studio — Styles
   Submerged Research Library
   ============================================ */

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

:root {
    --parchment-wash: #f2e8d5;
    --honey-spine: #c9a96e;
    --deep-bathyal: #1e2d35;
    --oceanic-charcoal: #3d4a4f;
    --kelp-green: #6b8f7a;
    --caustic-teal: #40a0ab;
    --amber-highlight: #d4a24e;
    --warm-parchment: #faf3e8;
    --glass-edge: rgba(64, 156, 171, 0.2);
    --sidebar-width: 280px;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Libre Baskerville', Georgia, serif;
    background-color: var(--parchment-wash);
    color: var(--oceanic-charcoal);
    overflow-x: hidden;
    line-height: 1.72;
    font-size: clamp(1rem, 1.2vw, 1.15rem);
}

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

/* --- Click Ripple --- */
#ripple-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
}

.click-ripple {
    position: absolute;
    border-radius: 50%;
    border: 1px solid rgba(64, 160, 171, 0.4);
    pointer-events: none;
    animation: rippleExpand 600ms ease-out forwards;
}

@keyframes rippleExpand {
    0% {
        width: 0;
        height: 0;
        opacity: 1;
    }
    100% {
        width: 400px;
        height: 400px;
        opacity: 0;
    }
}

/* --- Sidebar --- */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background-color: var(--honey-spine);
    z-index: 100;
    display: flex;
    flex-direction: column;
    padding: 2.5rem 1.5rem;
    overflow: hidden;
}

.sidebar-wave-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 280 40'%3E%3Cpath d='M0,20 C35,10 70,10 105,20 C140,30 175,30 210,20 C245,10 280,10 280,20' fill='none' stroke='rgba(61,74,79,0.06)' stroke-width='0.5'/%3E%3C/svg%3E");
    background-repeat: repeat-y;
    background-size: 100% 40px;
    pointer-events: none;
    opacity: 0.7;
}

.sidebar-wordmark {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 1.2rem;
    letter-spacing: 0.3em;
    color: var(--oceanic-charcoal);
    writing-mode: vertical-rl;
    text-orientation: mixed;
    text-shadow: 1px 1px 0 rgba(0,0,0,0.1), -1px -1px 0 rgba(255,255,255,0.3);
    margin-bottom: 3rem;
    align-self: center;
    user-select: none;
    height: 180px;
}

.sidebar-nav {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.sidebar-nav li {
    position: relative;
}

.sidebar-nav a {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.75rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--oceanic-charcoal);
    text-decoration: none;
    display: block;
    padding: 0.6rem 0;
    transition: transform 300ms ease-out, color 300ms ease-out;
    position: relative;
}

.sidebar-nav a::before {
    content: attr(data-code);
    display: block;
    font-size: 0.6rem;
    color: var(--kelp-green);
    opacity: 0.7;
    margin-bottom: 0.15rem;
    letter-spacing: 0.08em;
}

.sidebar-nav a:hover {
    transform: translateX(4px);
    color: var(--caustic-teal);
}

.sidebar-nav a.active {
    color: var(--amber-highlight);
}

/* --- Main Content --- */
.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
}

/* --- Plates (shared) --- */
.plate {
    position: relative;
    border: 1px solid var(--glass-edge);
    border-left: none;
    border-right: none;
}

.section-header {
    font-family: 'Bebas Neue', sans-serif;
    font-size: clamp(2rem, 5vw, 4.5rem);
    letter-spacing: 0.06em;
    line-height: 0.95;
    color: var(--oceanic-charcoal);
    text-transform: uppercase;
    margin-bottom: 3rem;
    position: relative;
    display: inline-block;
}

.section-header-light {
    color: var(--parchment-wash);
}

.ruled-line {
    display: block;
    width: 100%;
    height: 0.5px;
    background: var(--honey-spine);
    margin-top: 0.75rem;
}

.ruled-line-light {
    background: rgba(201, 169, 110, 0.4);
}

/* --- Wave Dividers --- */
.wave-divider {
    padding: clamp(3rem, 5vh, 6rem) 0;
    margin-left: var(--sidebar-width);
}

.wave-divider svg {
    width: 100%;
    height: 24px;
}

/* --- Plate I: Archive Entrance --- */
.plate-i {
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--parchment-wash);
    overflow: hidden;
}

.caustic-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: repeating-conic-gradient(
        from 0deg at 50% 50%,
        rgba(64, 160, 171, 0.04) 0deg,
        transparent 3deg,
        rgba(64, 160, 171, 0.02) 6deg,
        transparent 9deg
    );
    filter: url(#caustic-filter);
    opacity: 0.08;
    pointer-events: none;
    animation: causticShift 12s ease-in-out infinite;
}

.caustic-overlay-dark {
    opacity: 0.15;
    filter: url(#caustic-filter-dark);
    background: repeating-conic-gradient(
        from 0deg at 50% 50%,
        rgba(64, 160, 171, 0.08) 0deg,
        transparent 3deg,
        rgba(64, 160, 171, 0.04) 6deg,
        transparent 9deg
    );
}

@keyframes causticShift {
    0%, 100% { transform: scale(1) translate(0, 0); }
    25% { transform: scale(1.02) translate(5px, -3px); }
    50% { transform: scale(0.98) translate(-5px, 5px); }
    75% { transform: scale(1.01) translate(3px, 3px); }
}

.plate-i-content {
    text-align: center;
    position: relative;
    z-index: 2;
}

.hero-title {
    font-family: 'Bebas Neue', sans-serif;
    font-size: clamp(8rem, 20vw, 22rem);
    letter-spacing: 0.06em;
    line-height: 0.85;
    color: var(--oceanic-charcoal);
    opacity: 0;
    transform: translateY(30px);
    animation: heroFadeIn 1.2s ease-out 0.3s forwards;
}

.hero-subtitle {
    display: block;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 1rem;
    letter-spacing: 0.5em;
    color: var(--kelp-green);
    text-transform: uppercase;
    opacity: 0;
    transform: translateY(15px);
    animation: heroFadeIn 1s ease-out 0.7s forwards;
    margin-top: 0.5rem;
}

@keyframes heroFadeIn {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --- Plate II: The Collection --- */
.plate-ii {
    padding: clamp(4rem, 8vh, 8rem) clamp(2rem, 5vw, 6rem);
    background: var(--parchment-wash);
}

.collection-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 3rem;
    max-width: 900px;
}

.collection-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 500ms ease-out, transform 500ms ease-out;
}

.collection-item.revealed {
    opacity: 1;
    transform: translateY(0);
}

.iso-icon {
    width: 180px;
    height: 180px;
    margin-bottom: 1rem;
}

.icon-label {
    font-family: 'IBM Plex Mono', monospace;
    font-size: clamp(0.7rem, 0.85vw, 0.85rem);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--kelp-green);
}

/* --- Plate III: The Reading Room --- */
.plate-iii {
    min-height: 100vh;
    background: var(--deep-bathyal);
    padding: clamp(6rem, 10vh, 10rem) clamp(2rem, 5vw, 6rem);
    position: relative;
    overflow: hidden;
}

.reading-room-content {
    display: grid;
    grid-template-columns: 3fr 1fr;
    gap: 3rem;
    position: relative;
    z-index: 2;
    max-width: 1000px;
}

.manifesto-text {
    color: var(--parchment-wash);
}

.manifesto-text p {
    margin-bottom: 1.8rem;
    font-size: clamp(1rem, 1.2vw, 1.15rem);
    line-height: 1.72;
}

.margin-annotations {
    padding-top: 5rem;
}

.annotation {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.7rem;
    letter-spacing: 0.08em;
    color: var(--kelp-green);
    margin-bottom: 2.5rem;
    line-height: 1.6;
}

.annotation sup {
    color: var(--caustic-teal);
    font-size: 0.6rem;
    margin-right: 0.3rem;
}

/* --- Plate IV: The Specimens --- */
.plate-iv {
    padding: clamp(4rem, 8vh, 8rem) clamp(2rem, 5vw, 6rem);
    background: var(--parchment-wash);
}

.specimens-list {
    max-width: 900px;
}

.specimen-card {
    display: flex;
    align-items: flex-start;
    padding: 2rem 0;
    border-bottom: 1px solid rgba(201, 169, 110, 0.2);
    position: relative;
    transition: border-color 400ms ease;
}

.specimen-card:hover {
    border-bottom-color: rgba(201, 169, 110, 0.6);
}

.specimen-code {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.65rem;
    letter-spacing: 0.12em;
    color: var(--kelp-green);
    text-transform: uppercase;
    writing-mode: vertical-rl;
    text-orientation: mixed;
    margin-right: 1.5rem;
    padding-top: 0.5rem;
    opacity: 0.7;
    flex-shrink: 0;
}

.specimen-icon {
    width: 100px;
    height: 100px;
    flex-shrink: 0;
    margin-right: 2rem;
    transition: transform 400ms ease;
}

.specimen-icon svg {
    width: 100%;
    height: 100%;
}

.specimen-card:hover .specimen-icon {
    transform: rotate(3deg);
}

.specimen-text h3 {
    font-family: 'Bebas Neue', sans-serif;
    font-size: clamp(1.4rem, 2.5vw, 2rem);
    letter-spacing: 0.06em;
    color: var(--oceanic-charcoal);
    margin-bottom: 0.5rem;
    line-height: 1;
}

.specimen-text p {
    color: var(--oceanic-charcoal);
    font-size: clamp(0.9rem, 1vw, 1rem);
    line-height: 1.65;
    max-width: 550px;
}

/* --- Plate V: The Catalog Index --- */
.plate-v {
    padding: clamp(4rem, 8vh, 8rem) clamp(2rem, 5vw, 6rem);
    background: var(--parchment-wash);
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.plate-v .section-header {
    margin-bottom: 3rem;
}

.catalog-card {
    max-width: 600px;
    width: 100%;
    border: 1px solid var(--honey-spine);
    background: var(--warm-parchment);
    padding: 2.5rem;
    position: relative;
    background-image: repeating-linear-gradient(
        to bottom,
        transparent,
        transparent calc(2rem - 1px),
        rgba(201, 169, 110, 0.2) 2rem
    );
    background-position: 0 2.5rem;
}

.catalog-card-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--honey-spine);
}

.catalog-title {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 1.8rem;
    letter-spacing: 0.06em;
    color: var(--oceanic-charcoal);
}

.catalog-class {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.7rem;
    letter-spacing: 0.08em;
    color: var(--kelp-green);
}

.catalog-card-body {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.catalog-line {
    display: flex;
    gap: 1rem;
    padding: 0.45rem 0;
    line-height: 2rem;
    min-height: 2rem;
    align-items: baseline;
}

.catalog-field {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.7rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--kelp-green);
    flex-shrink: 0;
    width: 110px;
}

.catalog-value {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.8rem;
    color: var(--oceanic-charcoal);
    letter-spacing: 0.02em;
}

.catalog-card-footer {
    display: flex;
    justify-content: space-between;
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(201, 169, 110, 0.4);
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.6rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--kelp-green);
    opacity: 0.7;
}

/* --- Scroll Reveal Animations --- */
.plate-iii .manifesto-text,
.plate-iv .specimen-card,
.plate-v .catalog-card {
    opacity: 0;
    transform: translateY(25px);
    transition: opacity 800ms ease-out, transform 800ms ease-out;
}

.plate-iii .manifesto-text.revealed,
.plate-iv .specimen-card.revealed,
.plate-v .catalog-card.revealed {
    opacity: 1;
    transform: translateY(0);
}

.plate-iii .margin-annotations {
    opacity: 0;
    transform: translateX(15px);
    transition: opacity 1000ms ease-out 400ms, transform 1000ms ease-out 400ms;
}

.plate-iii .margin-annotations.revealed {
    opacity: 1;
    transform: translateX(0);
}

/* --- Mobile Responsive --- */
@media (max-width: 768px) {
    :root {
        --sidebar-width: 0px;
    }

    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 56px;
        flex-direction: row;
        align-items: center;
        padding: 0 1rem;
        z-index: 100;
    }

    .sidebar-wordmark {
        writing-mode: horizontal-tb;
        text-orientation: initial;
        font-size: 0.9rem;
        letter-spacing: 0.15em;
        height: auto;
        margin-bottom: 0;
        margin-right: 1.5rem;
        flex-shrink: 0;
    }

    .sidebar-nav {
        flex-direction: row;
        gap: 0;
        overflow-x: auto;
        white-space: nowrap;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .sidebar-nav::-webkit-scrollbar {
        display: none;
    }

    .sidebar-nav a {
        padding: 0.5rem 0.75rem;
        font-size: 0.65rem;
    }

    .sidebar-nav a::before {
        display: none;
    }

    .sidebar-nav a:hover {
        transform: none;
    }

    .main-content {
        margin-left: 0;
        margin-top: 56px;
    }

    .wave-divider {
        margin-left: 0;
    }

    .collection-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 2rem;
    }

    .iso-icon {
        width: 140px;
        height: 140px;
    }

    .reading-room-content {
        grid-template-columns: 1fr;
    }

    .margin-annotations {
        padding-top: 2rem;
    }

    .specimen-card {
        flex-wrap: wrap;
    }

    .specimen-code {
        writing-mode: horizontal-tb;
        text-orientation: initial;
        margin-right: 0;
        margin-bottom: 0.5rem;
        width: 100%;
    }

    .specimen-icon {
        width: 80px;
        height: 80px;
        margin-right: 1rem;
    }

    .hero-title {
        font-size: clamp(5rem, 18vw, 10rem);
    }

    .catalog-card {
        padding: 1.5rem;
    }

    .catalog-card-header {
        flex-direction: column;
        gap: 0.5rem;
    }

    .catalog-line {
        flex-direction: column;
        gap: 0.25rem;
    }

    .catalog-field {
        width: auto;
    }
}

@media (max-width: 480px) {
    .collection-grid {
        grid-template-columns: 1fr;
    }
}