/* ============================================
   layer-2.id — Styles
   Editorial Blockchain Identity Document
   ============================================ */

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

:root {
    --bg-muted: #e8e4de;
    --hex-fill: #f5f2ec;
    --hex-stroke: #8a8578;
    --connection: rgba(138, 133, 120, 0.6);
    --text-primary: #1e1e1a;
    --text-secondary: #5c584e;
    --accent-blue: #3b5998;
    --notary-green: #2d6a4f;
    --font-mono: 'Space Mono', monospace;
    --font-serif: 'Source Serif 4', serif;
    --font-plex: 'IBM Plex Mono', monospace;
}

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--bg-muted);
    color: var(--text-primary);
    font-family: var(--font-serif);
    font-size: clamp(16px, 1.6vw, 19px);
    line-height: 1.7;
    overflow-x: hidden;
}

/* --- Section Title --- */
.section-title {
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: clamp(24px, 4vw, 48px);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-primary);
    text-align: center;
    margin-bottom: 80px;
}

/* ============================================
   SECTION 1: Hero
   ============================================ */
.hero-section {
    position: relative;
    width: 100%;
    height: 100vh;
    min-height: 600px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--bg-muted);
    overflow: hidden;
}

.hero-hex-svg {
    position: absolute;
    width: 50vmin;
    max-width: 500px;
    height: auto;
    z-index: 1;
}

.hero-hex-border {
    stroke-dasharray: 1800;
    stroke-dashoffset: 1800;
}

.hero-hex-border.animate {
    animation: drawHex 900ms linear forwards;
}

@keyframes drawHex {
    to {
        stroke-dashoffset: 0;
    }
}

.connection-line {
    stroke: var(--connection);
    stroke-width: 1;
    stroke-dasharray: 300;
    stroke-dashoffset: 300;
}

.connection-line.animate {
    animation: drawLine 600ms ease-out forwards;
}

@keyframes drawLine {
    to {
        stroke-dashoffset: 0;
    }
}

.hero-text {
    position: absolute;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hero-layer {
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: clamp(32px, 6vw, 72px);
    letter-spacing: 0.06em;
    color: var(--text-primary);
    text-transform: uppercase;
}

.hero-layer::after {
    content: '';
    display: inline-block;
    width: 3px;
    height: 1em;
    background-color: var(--text-primary);
    margin-left: 4px;
    vertical-align: text-bottom;
    animation: blink 600ms steps(2) infinite;
}

.hero-layer.done::after {
    display: none;
}

@keyframes blink {
    0% { opacity: 1; }
    100% { opacity: 0; }
}

.hero-id {
    position: absolute;
    z-index: 2;
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: clamp(20px, 3.5vw, 42px);
    color: var(--accent-blue);
    opacity: 0;
    /* Positioned at hexagon's bottom-right vertex area */
    transform: translate(12vmin, 16vmin);
}

.hero-id.animate {
    animation: fadeInId 300ms ease-out forwards;
}

@keyframes fadeInId {
    to {
        opacity: 1;
    }
}

.hero-glow {
    position: absolute;
    z-index: 0;
    width: 52vmin;
    max-width: 520px;
    height: 52vmin;
    max-height: 520px;
    border-radius: 50%;
    opacity: 0;
    pointer-events: none;
    box-shadow: 0 0 60px rgba(59, 89, 152, 0.2);
}

.hero-glow.animate {
    animation: glowPulse 800ms ease-in-out forwards;
}

@keyframes glowPulse {
    0% { opacity: 0; }
    50% { opacity: 1; }
    100% { opacity: 0; }
}

/* ============================================
   SECTION 2: The Protocol (Honeycomb Grid)
   ============================================ */
.protocol-section {
    position: relative;
    padding: 120px 24px;
    background-color: var(--bg-muted);
}

.honeycomb-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 4px;
    max-width: 960px;
    margin: 0 auto;
    position: relative;
}

.hex-cell {
    position: relative;
    width: 100%;
    padding-bottom: 115.47%; /* Height ratio for hexagon */
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    background-color: var(--hex-fill);
    opacity: 0;
    transform: scale(0.85);
    transition: opacity 300ms ease-out, transform 300ms ease-out, background-color 300ms ease;
}

.hex-cell.revealed {
    opacity: 1;
    transform: scale(1);
}

.hex-cell:hover {
    background-color: #edeae4;
}

/* Offset every other row for tessellation */
.hex-cell:nth-child(3n+1):nth-child(n+4) {
    /* Rows 2+ odd columns offset handled by grid */
}

/* Second row offset */
.honeycomb-grid .hex-cell:nth-child(4),
.honeycomb-grid .hex-cell:nth-child(5),
.honeycomb-grid .hex-cell:nth-child(6) {
    margin-top: -7%;
    margin-left: 16.666%;
    margin-right: -16.666%;
}

/* Third row same as first */
.honeycomb-grid .hex-cell:nth-child(7),
.honeycomb-grid .hex-cell:nth-child(8),
.honeycomb-grid .hex-cell:nth-child(9) {
    margin-top: -7%;
}

.hex-inner {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20%;
    text-align: center;
}

.hex-icon {
    width: 48px;
    height: 48px;
    margin-bottom: 12px;
    flex-shrink: 0;
}

.hex-title {
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: 14px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-primary);
    margin-bottom: 8px;
    line-height: 1.3;
}

.hex-desc {
    font-family: var(--font-serif);
    font-size: 13px;
    line-height: 1.5;
    color: var(--text-secondary);
}

.connection-lines-svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.connection-lines-svg line {
    stroke: var(--connection);
    stroke-width: 1;
    stroke-dasharray: 200;
    stroke-dashoffset: 200;
    transition: stroke-dashoffset 400ms ease-out;
}

.connection-lines-svg line.drawn {
    stroke-dashoffset: 0;
}

/* ============================================
   SECTION 3: Identity Stack (Editorial)
   ============================================ */
.identity-stack-section {
    padding: 120px 24px;
    background-color: var(--bg-muted);
}

.editorial-content {
    max-width: 40em;
    margin: 0 auto;
    position: relative;
}

.editorial-block {
    position: relative;
    margin-bottom: 120px;
}

.editorial-block:last-child {
    margin-bottom: 0;
}

.editorial-heading {
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: clamp(20px, 3vw, 32px);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-primary);
    margin-bottom: 32px;
}

.editorial-text p {
    margin-bottom: 28px;
    color: var(--text-primary);
}

.editorial-text p:last-of-type {
    margin-bottom: 0;
}

.pull-quote {
    border-left: 3px solid var(--accent-blue);
    padding: 16px 0 16px 24px;
    margin: 40px 0;
    font-family: var(--font-serif);
    font-weight: 600;
    font-size: clamp(18px, 2vw, 24px);
    line-height: 1.5;
    color: var(--text-primary);
    font-style: italic;
}

.margin-note {
    position: absolute;
    right: -220px;
    top: 40px;
    width: 180px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    opacity: 0;
    transition: opacity 200ms ease-out;
}

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

.note-label {
    font-family: var(--font-plex);
    font-weight: 400;
    font-size: 11px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--accent-blue);
}

.note-value {
    font-family: var(--font-plex);
    font-weight: 400;
    font-size: 12px;
    letter-spacing: 0.03em;
    color: var(--hex-stroke);
}

.note-hash {
    font-family: var(--font-plex);
    font-weight: 400;
    font-size: 12px;
    letter-spacing: 0.03em;
    color: var(--hex-stroke);
    opacity: 0.6;
}

/* ============================================
   SECTION 4: Verification Footer
   ============================================ */
.verification-section {
    position: relative;
    width: 100%;
    min-height: 80vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--bg-muted);
    overflow: hidden;
    padding: 80px 24px;
}

.verification-hex-svg {
    position: absolute;
    width: 40vmin;
    max-width: 420px;
    height: auto;
    z-index: 1;
}

.verification-hex-border {
    stroke-dasharray: 1600;
    stroke-dashoffset: 1600;
}

.verification-hex-border.animate {
    animation: drawVerifyHex 1200ms linear forwards;
}

@keyframes drawVerifyHex {
    to {
        stroke-dashoffset: 0;
    }
}

.verification-content {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.verified-text {
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: clamp(28px, 5vw, 56px);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--notary-green);
}

.verified-hash {
    font-family: var(--font-plex);
    font-weight: 400;
    font-size: 14px;
    letter-spacing: 0.03em;
    color: var(--hex-stroke);
    min-height: 1.4em;
}

.verified-cursor {
    display: inline-block;
    width: 2px;
    height: 18px;
    background-color: var(--text-primary);
    animation: blink 600ms steps(2) infinite;
    margin-top: -4px;
}

.verified-cursor.hidden {
    display: none;
}

/* ============================================
   Responsive
   ============================================ */

/* Tablet */
@media (max-width: 900px) {
    .honeycomb-grid {
        grid-template-columns: repeat(2, 1fr);
        max-width: 600px;
    }

    .honeycomb-grid .hex-cell:nth-child(4),
    .honeycomb-grid .hex-cell:nth-child(5),
    .honeycomb-grid .hex-cell:nth-child(6) {
        margin-top: 0;
        margin-left: 0;
        margin-right: 0;
    }

    .honeycomb-grid .hex-cell:nth-child(7),
    .honeycomb-grid .hex-cell:nth-child(8),
    .honeycomb-grid .hex-cell:nth-child(9) {
        margin-top: 0;
    }

    /* Offset even rows for 2-column tessellation */
    .honeycomb-grid .hex-cell:nth-child(3),
    .honeycomb-grid .hex-cell:nth-child(4) {
        margin-top: -7%;
        margin-left: 25%;
        margin-right: -25%;
    }

    .margin-note {
        position: relative;
        right: auto;
        top: auto;
        width: 100%;
        margin-top: 24px;
        padding-top: 16px;
        border-top: 1px solid rgba(138, 133, 120, 0.3);
        flex-direction: row;
        gap: 16px;
        opacity: 1;
    }
}

/* Mobile */
@media (max-width: 600px) {
    .honeycomb-grid {
        grid-template-columns: 1fr;
        max-width: 320px;
    }

    .honeycomb-grid .hex-cell:nth-child(n) {
        margin-top: 0 !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
    }

    .hex-inner {
        padding: 18%;
    }

    .hex-desc {
        font-size: 12px;
    }

    .section-title {
        margin-bottom: 48px;
    }

    .editorial-block {
        margin-bottom: 80px;
    }

    .hero-hex-svg {
        width: 70vmin;
    }

    .hero-id {
        transform: translate(16vmin, 22vmin);
    }

    .verification-hex-svg {
        width: 60vmin;
    }
}
