/* transactology.dev - Deep-sea developer engineering spec */

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

:root {
    --abyss: #0A1828;
    --deep-current: #122838;
    --tidal: #1A3848;
    --kelp: #3A6878;
    --bio-teal: #40B0A0;
    --phosphor: #60D0B0;
    --coral-signal: #E07868;
    --foam-white: #E0ECF0;
}

body {
    font-family: 'DM Sans', sans-serif;
    font-weight: 400;
    font-size: clamp(0.9375rem, 1.5vw, 1.0625rem);
    line-height: 1.75;
    color: var(--foam-white);
    background-color: var(--abyss);
    overflow-x: hidden;
}

/* === Navigation === */
.top-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    background-color: var(--abyss);
    border-bottom: 1px solid var(--kelp);
    z-index: 100;
}

.nav-brand {
    font-family: 'DM Sans', sans-serif;
    font-weight: 700;
    font-size: 0.9375rem;
    color: var(--bio-teal);
}

.nav-links {
    display: flex;
    gap: 24px;
}

.nav-link {
    font-family: 'DM Sans', sans-serif;
    font-weight: 500;
    font-size: 0.8125rem;
    color: var(--kelp);
    text-decoration: none;
    position: relative;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    transition: color 0.3s ease;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 1px;
    background-color: var(--bio-teal);
    transition: width 0.3s ease;
}

.nav-link.active {
    color: var(--foam-white);
}

.nav-link.active::after {
    width: 100%;
}

/* === Header Section === */
.header-section {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    padding-top: 52px;
}

.sonar-pulse {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
}

.pulse-ring {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: 1px solid var(--bio-teal);
    opacity: 0;
}

.ring-1 { animation: sonarPulse 3s 0s ease-out infinite; }
.ring-2 { animation: sonarPulse 3s 0.4s ease-out infinite; }
.ring-3 { animation: sonarPulse 3s 0.8s ease-out infinite; }

@keyframes sonarPulse {
    0% { transform: translate(-50%, -50%) scale(0); opacity: 0.4; }
    100% { transform: translate(-50%, -50%) scale(4); opacity: 0; }
}

.iso-cube-bg {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 200px;
    height: 200px;
    transform: translate(-50%, -50%) rotateY(0deg);
    border: 1px solid var(--kelp);
    opacity: 0.08;
    animation: rotateCube 30s linear infinite;
}

@keyframes rotateCube {
    to { transform: translate(-50%, -50%) rotateY(360deg); }
}

.header-title {
    font-family: 'DM Sans', sans-serif;
    font-weight: 700;
    font-size: clamp(2rem, 4.5vw, 3rem);
    color: var(--foam-white);
    letter-spacing: -0.01em;
    position: relative;
    z-index: 10;
    opacity: 0;
    animation: fadeIn 1s 1s ease forwards;
}

.header-subtitle {
    font-family: 'DM Sans', sans-serif;
    font-weight: 400;
    font-size: clamp(0.9375rem, 1.5vw, 1.125rem);
    color: var(--kelp);
    margin-top: 12px;
    position: relative;
    z-index: 10;
    opacity: 0;
    animation: fadeIn 0.8s 1.5s ease forwards;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* === Retro Pattern Bands === */
.retro-band {
    height: 40px;
    width: 100%;
}

.retro-chevron {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='40'%3E%3Cpath d='M0 20 L12 10 L24 20 L12 30 Z' stroke='%233A6878' stroke-width='0.5' fill='none'/%3E%3C/svg%3E");
    background-size: 24px 40px;
}

.retro-crosshatch {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16'%3E%3Cline x1='0' y1='0' x2='16' y2='16' stroke='%233A6878' stroke-width='0.5'/%3E%3Cline x1='16' y1='0' x2='0' y2='16' stroke='%233A6878' stroke-width='0.5'/%3E%3C/svg%3E");
    background-size: 16px 16px;
}

.retro-sonar {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='40'%3E%3Ccircle cx='20' cy='40' r='10' stroke='%233A6878' stroke-width='0.5' fill='none'/%3E%3Ccircle cx='20' cy='40' r='18' stroke='%233A6878' stroke-width='0.5' fill='none'/%3E%3C/svg%3E");
    background-size: 40px 40px;
}

.retro-zigzag {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='40'%3E%3Cpath d='M0 20 L10 10 L20 20 L30 10 L40 20' stroke='%233A6878' stroke-width='0.5' fill='none'/%3E%3C/svg%3E");
    background-size: 40px 40px;
}

/* === Spec Sections === */
.spec-section {
    display: flex;
    padding: 80px 48px;
    gap: 48px;
    max-width: 1100px;
    margin: 0 auto;
    align-items: flex-start;
    opacity: 0;
    transform: translateX(-24px);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.spec-section.visible {
    opacity: 1;
    transform: translateX(0);
}

.spec-content {
    flex: 0 0 60%;
}

.spec-header {
    font-family: 'DM Sans', sans-serif;
    font-weight: 700;
    font-size: clamp(1.75rem, 4vw, 3rem);
    color: var(--foam-white);
    letter-spacing: -0.01em;
    margin-bottom: 20px;
}

.spec-body {
    font-family: 'DM Sans', sans-serif;
    font-weight: 400;
    font-size: clamp(0.9375rem, 1.5vw, 1.0625rem);
    line-height: 1.75;
    color: var(--foam-white);
    margin-bottom: 24px;
    max-width: 60ch;
}

.code-block {
    background-color: #0D2030;
    padding: 16px 24px;
    border-left: 3px solid var(--bio-teal);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.875rem;
    line-height: 1.7;
    color: var(--foam-white);
}

.code-block code {
    font-family: inherit;
}

.spec-illustration {
    flex: 0 0 35%;
}

.iso-diagram {
    width: 100%;
    max-width: 300px;
}

.iso-group {
    opacity: 0;
    transition: opacity 0.15s ease;
}

.spec-section.visible .iso-group {
    opacity: 1;
}

.spec-section.visible .iso-g0 { transition-delay: 0s; }
.spec-section.visible .iso-g1 { transition-delay: 0.1s; }
.spec-section.visible .iso-g2 { transition-delay: 0.2s; }
.spec-section.visible .iso-g3 { transition-delay: 0.3s; }
.spec-section.visible .iso-g4 { transition-delay: 0.4s; }
.spec-section.visible .iso-g5 { transition-delay: 0.5s; }
.spec-section.visible .iso-g6 { transition-delay: 0.6s; }

/* === API Section === */
.api-section {
    padding: 80px 48px;
    max-width: 960px;
    margin: 0 auto;
}

.api-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.api-card {
    background-color: var(--deep-current);
    border: 1px solid var(--kelp);
    padding: 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    transition: border-color 0.3s ease, background-color 0.3s ease;
    position: relative;
}

.api-card:hover {
    border-color: var(--bio-teal);
    background-color: var(--tidal);
}

.api-icon {
    width: 48px;
    height: 48px;
    margin-bottom: 12px;
}

.api-label {
    font-family: 'DM Sans', sans-serif;
    font-weight: 500;
    font-size: 0.6875rem;
    color: var(--bio-teal);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

/* === Depth Section === */
.depth-section {
    min-height: 60vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(to bottom, var(--abyss), #000A14);
    padding: 80px 24px;
}

.depth-text {
    font-family: 'DM Sans', sans-serif;
    font-weight: 300;
    font-size: clamp(1.25rem, 2.5vw, 1.75rem);
    color: var(--foam-white);
    margin-bottom: 16px;
}

.depth-chevron {
    margin-bottom: 48px;
    animation: bobDown 2s ease-in-out infinite;
}

.depth-chevron svg {
    width: 24px;
    height: 14px;
}

@keyframes bobDown {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(6px); }
}

.pipeline-diagram {
    width: 100%;
    max-width: 800px;
    height: 120px;
}

.data-packet {
    animation: movePacket 4s linear infinite;
}

@keyframes movePacket {
    0% { cx: 0; }
    100% { cx: 800; }
}

/* === Reduced Motion === */
@media (prefers-reduced-motion: reduce) {
    .pulse-ring { animation: none; }
    .iso-cube-bg { animation: none; }
    .header-title, .header-subtitle { opacity: 1; animation: none; }
    .spec-section { opacity: 1; transform: none; transition: none; }
    .iso-group { opacity: 1; transition: none; }
    .data-packet { animation: none; }
    .depth-chevron { animation: none; }
}

/* === Responsive === */
@media (max-width: 768px) {
    .spec-section {
        flex-direction: column;
        padding: 40px 16px;
    }
    .spec-content { flex: 1; }
    .spec-illustration { flex: 1; width: 100%; }
    .api-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .nav-links {
        gap: 12px;
        overflow-x: auto;
    }
}
