/* ============================================
   monopole.ai — Styles
   Swiss International Typographic Style
   Hexagonal Honeycomb Grid
   ============================================ */

/* --- CSS Custom Properties --- */
:root {
    --primary: #2B3A67;
    --teal: #1B6B7D;
    --sage: #7DB8A5;
    --bone: #F4F1EC;
    --parchment: #E8E2D8;
    --text-primary: #2D3748;
    --text-secondary: #7E8A9A;
    --slate: #4A5568;
    --frost: #C8D6D0;
    --green-bg: #D4DDD7;

    --hex-size: 260px;
    --hex-gap: 8px;
    --hex-ratio: 1.155;
}

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

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

body {
    font-family: 'Commissioner', sans-serif;
    font-weight: 300;
    font-variation-settings: 'FLAR' 0, 'VOLM' 0;
    font-size: clamp(0.95rem, 1.2vw, 1.15rem);
    letter-spacing: 0.005em;
    line-height: 1.7;
    color: var(--text-primary);
    background-color: var(--bone);
    transition: background-color 1500ms ease;
}

/* --- Dot Matrix Background --- */
#dot-matrix {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    opacity: 0.5;
}

/* --- Wordmark --- */
#wordmark {
    position: fixed;
    top: 32px;
    left: 36px;
    font-family: 'Commissioner', sans-serif;
    font-weight: 400;
    font-feature-settings: 'tnum' 1;
    font-size: 1.1rem;
    letter-spacing: 0.02em;
    color: var(--primary);
    z-index: 100;
}

#wordmark .dot-ai {
    color: var(--teal);
}

/* --- Field Navigation --- */
#field-nav {
    position: fixed;
    top: 36px;
    right: 36px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    z-index: 100;
}

.nav-dot {
    width: 18px;
    height: 20px;
    background: var(--frost);
    border: 1.5px solid var(--frost);
    clip-path: polygon(25% 0%, 75% 0%, 100% 50%, 75% 100%, 25% 100%, 0% 50%);
    cursor: pointer;
    transition: background 300ms ease, border-color 300ms ease;
}

.nav-dot:hover,
.nav-dot.active {
    background: var(--teal);
    border-color: var(--teal);
}

/* --- Fields --- */
.field {
    position: relative;
    min-height: 250vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 10vh 5vw;
    z-index: 1;
}

.field-sentinel {
    position: absolute;
    top: 20%;
    width: 1px;
    height: 1px;
    pointer-events: none;
}

.field-label {
    position: absolute;
    top: 8vh;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.75rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.field-label span {
    display: block;
    margin-bottom: 4px;
    color: var(--frost);
    font-size: 0.65rem;
}

/* --- Snowflake --- */
#snowflake {
    position: absolute;
    width: clamp(300px, 50vw, 600px);
    height: clamp(300px, 50vw, 600px);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 0;
}

#snowflake line,
#snowflake circle {
    stroke-dasharray: 200;
    stroke-dashoffset: 200;
    transition: stroke-dashoffset 2s ease-out;
}

#snowflake.drawn line,
#snowflake.drawn circle {
    stroke-dashoffset: 0;
}

/* --- Honeycomb Grid --- */
.honeycomb {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    position: relative;
    z-index: 2;
}

.hex-row {
    display: flex;
    gap: var(--hex-gap);
    justify-content: center;
}

.hex-row--offset {
    margin-top: calc(var(--hex-size) * -0.29);
    transform: translateX(calc(var(--hex-size) / 2 + var(--hex-gap) / 2));
}

/* --- Hexagonal Cell --- */
.hex-cell {
    width: var(--hex-size);
    height: calc(var(--hex-size) * var(--hex-ratio));
    clip-path: polygon(25% 0%, 75% 0%, 100% 50%, 75% 100%, 25% 100%, 0% 50%);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: transform 300ms ease-out, opacity 500ms ease;
    opacity: 0;
    transform: translateY(20px);
}

.hex-cell.visible {
    opacity: 1;
    transform: translateY(0);
}

.hex-cell--ghost {
    background: transparent;
    border: none;
    box-shadow: inset 0 0 0 1.5px var(--frost);
    background-color: rgba(200, 214, 208, 0.08);
}

.hex-cell--ghost.visible {
    opacity: 0.4;
}

.hex-cell--filled {
    cursor: default;
}

.hex-cell--filled[data-color="primary"] {
    background-color: var(--primary);
}

.hex-cell--filled[data-color="primary"] .hex-content {
    color: var(--bone);
}

.hex-cell--filled[data-color="teal"] {
    background-color: var(--teal);
}

.hex-cell--filled[data-color="teal"] .hex-content {
    color: var(--bone);
}

.hex-cell--filled[data-color="sage"] {
    background-color: var(--sage);
}

.hex-cell--filled[data-color="sage"] .hex-content {
    color: var(--primary);
}

.hex-cell--filled[data-color="parchment"] {
    background-color: var(--parchment);
}

.hex-cell--filled[data-color="parchment"] .hex-content {
    color: var(--text-primary);
}

.hex-cell--large {
    width: calc(var(--hex-size) * 1.5);
    height: calc(var(--hex-size) * 1.5 * var(--hex-ratio));
}

/* Hover effect */
.hex-cell--filled:hover {
    transform: scale(1.06);
    z-index: 10;
}

.hex-cell--filled .hex-content {
    opacity: 0.8;
    transition: opacity 300ms ease;
}

.hex-cell--filled:hover .hex-content {
    opacity: 1;
}

/* Ripple pseudo-element */
.hex-cell--filled::after {
    content: '';
    position: absolute;
    inset: 0;
    clip-path: polygon(25% 0%, 75% 0%, 100% 50%, 75% 100%, 25% 100%, 0% 50%);
    background: rgba(255, 255, 255, 0.3);
    transform: scale(0);
    opacity: 0;
    pointer-events: none;
}

.hex-cell--filled.ripple::after {
    animation: hexRipple 500ms ease-out forwards;
}

@keyframes hexRipple {
    0% { transform: scale(0); opacity: 0.6; }
    100% { transform: scale(2); opacity: 0; }
}

/* --- Hex Content --- */
.hex-content {
    padding: 15%;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

/* --- Typography --- */
.headline {
    font-family: 'Commissioner', sans-serif;
    font-weight: 700;
    font-variation-settings: 'FLAR' 50, 'VOLM' 50;
    font-size: clamp(1.4rem, 3vw, 2.8rem);
    letter-spacing: -0.02em;
    line-height: 1.05;
    transition: letter-spacing 800ms ease-out;
}

.headline.focusing {
    letter-spacing: -0.02em;
}

.headline.unfocused {
    letter-spacing: 0.1em;
}

.body-text {
    font-weight: 300;
    font-variation-settings: 'FLAR' 0, 'VOLM' 0;
    font-size: clamp(0.8rem, 1vw, 1rem);
    line-height: 1.6;
    color: #4A5568;
}

.caption {
    font-weight: 500;
    font-size: 0.75rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: inherit;
    opacity: 0.85;
    line-height: 1.6;
}

/* --- SVG Elements --- */
.fern-svg,
.honeycomb-detail,
.shell-svg {
    width: 70%;
    height: auto;
}

.fern-svg .fern-path path {
    stroke-dasharray: 200;
    stroke-dashoffset: 200;
    transition: stroke-dashoffset 2s ease-in-out;
}

.fern-svg.drawn .fern-path path {
    stroke-dashoffset: 0;
}

/* --- Basalt Band --- */
#basalt-band {
    width: 100%;
    overflow: hidden;
    margin: 4vh 0;
    opacity: 0.6;
}

#basalt-band svg {
    width: 100%;
    height: auto;
    display: block;
}

/* --- Arc Decorations --- */
.arc-decoration {
    position: fixed;
    pointer-events: none;
    z-index: 0;
    border: 2px solid var(--teal);
    opacity: 0.08;
    border-radius: 50%;
}

.arc-1 {
    width: 400px;
    height: 400px;
    top: -100px;
    left: -100px;
    border-right-color: transparent;
    border-bottom-color: transparent;
}

.arc-2 {
    width: 300px;
    height: 300px;
    bottom: 20%;
    right: -80px;
    border-left-color: transparent;
    border-top-color: transparent;
}

.arc-3 {
    width: 500px;
    height: 500px;
    top: 50%;
    left: 30%;
    transform: translate(-50%, -50%);
    border-top-color: transparent;
    border-right-color: transparent;
}

/* --- Ruled Lines --- */
.hex-row::after {
    content: '';
    position: absolute;
    left: 5%;
    right: 5%;
    bottom: 0;
    height: 1px;
    background: var(--frost);
    opacity: 0.3;
    pointer-events: none;
}

.hex-row {
    position: relative;
}

/* --- Responsive --- */
@media (max-width: 1200px) {
    :root {
        --hex-size: 200px;
    }
}

@media (max-width: 900px) {
    :root {
        --hex-size: 160px;
    }

    .hex-cell--large {
        width: calc(var(--hex-size) * 1.3);
        height: calc(var(--hex-size) * 1.3 * var(--hex-ratio));
    }
}

@media (max-width: 640px) {
    :root {
        --hex-size: 260px;
    }

    .hex-row {
        flex-direction: column;
        align-items: center;
        gap: 8px;
    }

    .hex-row--offset {
        transform: none;
        margin-top: 0;
    }

    .hex-cell {
        clip-path: none;
        border-radius: 16px;
        width: 90vw;
        height: auto;
        min-height: 160px;
    }

    .hex-cell--large {
        width: 90vw;
        height: auto;
        min-height: 200px;
    }

    .hex-cell--ghost {
        display: none;
    }

    #snowflake {
        width: 80vw;
        height: 80vw;
    }

    #wordmark {
        top: 16px;
        left: 20px;
    }

    #field-nav {
        top: 16px;
        right: 20px;
        flex-direction: row;
    }

    .field {
        min-height: auto;
        padding: 15vh 4vw;
    }

    .arc-decoration {
        display: none;
    }
}
