/* ============================================================
   ethica.dev - Styles
   HUD-Overlay Paradigm / Cool Gray Monochrome / Isometric Icons
   ============================================================ */

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

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

body {
    background: linear-gradient(135deg, #18181b, #1e1e22);
    color: #a1a1aa;
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 400;
    font-size: clamp(0.95rem, 1.1vw, 1.125rem);
    line-height: 1.7;
    letter-spacing: 0.01em;
    overflow: hidden;
    width: 100vw;
    height: 100vh;
}

/* --- Layer 0: Isometric Grid (Canvas) --- */
/* Grid drawn via canvas at #2a2a2e 15% opacity */
.layer-0 {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 0;
    pointer-events: none;
    opacity: 0;
    transition: opacity 800ms ease;
    background-color: transparent; /* grid lines in #2a2a2e via canvas */
}

.layer-0.visible {
    opacity: 1;
}

/* --- Layer 1: Deep Structure Typography --- */
.layer-1 {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 1;
    pointer-events: none;
    overflow: hidden;
}

.deep-text {
    position: absolute;
    font-family: 'Bebas Neue', cursive;
    font-size: 20vw;
    color: #71717a;
    opacity: 0.08;
    white-space: nowrap;
    will-change: transform;
    line-height: 0.95;
    letter-spacing: 0.15em;
}

.deep-text-1 {
    top: 5%;
    left: -5%;
    animation: deep-rotate-1 120s linear infinite;
}

.deep-text-2 {
    top: 30%;
    left: 10%;
    animation: deep-rotate-2 150s linear infinite;
}

.deep-text-3 {
    top: 55%;
    left: -2%;
    animation: deep-rotate-3 100s linear infinite;
}

.deep-text-4 {
    top: 75%;
    left: 20%;
    animation: deep-rotate-4 130s linear infinite;
}

.deep-text-5 {
    top: 15%;
    left: 50%;
    animation: deep-rotate-5 140s linear infinite;
}

@keyframes deep-rotate-1 {
    from { transform: rotate3d(0.1, 1, 0, 0deg); }
    to { transform: rotate3d(0.1, 1, 0, 360deg); }
}

@keyframes deep-rotate-2 {
    from { transform: rotate3d(0.2, 0.8, 0.1, 0deg); }
    to { transform: rotate3d(0.2, 0.8, 0.1, 360deg); }
}

@keyframes deep-rotate-3 {
    from { transform: rotate3d(0, 1, 0.2, 0deg); }
    to { transform: rotate3d(0, 1, 0.2, 360deg); }
}

@keyframes deep-rotate-4 {
    from { transform: rotate3d(0.15, 0.9, 0, 0deg); }
    to { transform: rotate3d(0.15, 0.9, 0, 360deg); }
}

@keyframes deep-rotate-5 {
    from { transform: rotate3d(0.1, 1, 0.1, 0deg); }
    to { transform: rotate3d(0.1, 1, 0.1, 360deg); }
}

/* --- Layer 3: HUD Overlay --- */
.hud-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 100;
    pointer-events: none;
}

/* Corner Registration Marks */
.hud-corner {
    position: absolute;
    opacity: 0;
    transition: opacity 400ms ease;
}

.hud-corner.visible {
    opacity: 1;
}

.hud-corner line {
    stroke-dasharray: 40;
    stroke-dashoffset: 40;
    transition: stroke-dashoffset 400ms ease;
}

.hud-corner.visible line {
    stroke-dashoffset: 0;
}

.hud-corner-tl { top: 16px; left: 16px; }
.hud-corner-tr { top: 16px; right: 16px; }
.hud-corner-bl { bottom: 16px; left: 16px; }
.hud-corner-br { bottom: 16px; right: 16px; }

/* Compass Bar */
.compass-bar {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 32px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: width 600ms cubic-bezier(0.16, 1, 0.3, 1);
    overflow: hidden;
    pointer-events: auto;
}

.compass-bar.visible {
    width: 80vw;
}

.compass-line {
    width: 100%;
    height: 1px;
    background: #3f3f46;
    position: absolute;
    top: 31px;
}

.compass-labels {
    display: flex;
    gap: 40px;
    justify-content: center;
    align-items: center;
    height: 100%;
    position: relative;
}

.compass-label {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 11px;
    font-weight: 400;
    letter-spacing: 0.25em;
    color: #52525b;
    text-transform: uppercase;
    white-space: nowrap;
    transition: color 300ms ease;
    cursor: default;
}

.compass-label.active {
    color: #7dd3fc;
}

.compass-indicator {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 2px;
    width: 80px;
    background: #7dd3fc;
    transition: transform 400ms cubic-bezier(0.16, 1, 0.3, 1);
}

/* Telemetry Readout */
.telemetry {
    position: absolute;
    bottom: 24px;
    left: 24px;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 11px;
    font-weight: 400;
    letter-spacing: 0.08em;
    color: #52525b;
    text-transform: uppercase;
    font-variant-numeric: tabular-nums;
    line-height: 1.8;
    pointer-events: none;
}

.telemetry span {
    color: #7dd3fc;
}

/* Section Counter */
.section-counter {
    position: absolute;
    bottom: 24px;
    right: 24px;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.08em;
    color: #52525b;
    text-transform: uppercase;
    font-variant-numeric: tabular-nums;
    pointer-events: none;
}

.section-counter span {
    color: #7dd3fc;
}

/* --- Radial Navigation --- */
.nav-trigger {
    position: fixed;
    top: 48px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 200;
    cursor: pointer;
    width: 24px;
    height: 24px;
    opacity: 0;
    transition: opacity 300ms ease;
}

.nav-trigger.visible {
    opacity: 1;
}

.nav-trigger:hover svg g {
    stroke: #7dd3fc;
}

.nav-trigger svg {
    transition: transform 300ms ease;
}

.nav-trigger.open svg {
    transform: rotate(30deg);
}

.radial-menu {
    position: fixed;
    top: 48px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 199;
    width: 300px;
    height: 300px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 300ms ease;
}

.radial-menu.open {
    opacity: 1;
    pointer-events: auto;
}

.radial-backdrop {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 280px;
    height: 280px;
    border-radius: 50%;
    background: rgba(24, 24, 27, 0.9);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}

.radial-arm {
    position: absolute;
    font-family: 'Bebas Neue', cursive;
    font-size: 14px;
    letter-spacing: 0.25em;
    color: #d4d4d8;
    text-decoration: none;
    white-space: nowrap;
    transition: color 300ms ease, transform 300ms cubic-bezier(0.16, 1, 0.3, 1);
    transform: translate(-50%, -50%) scale(0);
    pointer-events: auto;
}

.radial-menu.open .radial-arm {
    transform: translate(-50%, -50%) scale(1);
}

.radial-arm:hover {
    color: #7dd3fc;
}

/* Position radial arms in hexagonal pattern */
.radial-arm[data-angle="0"]   { top: -20px;  left: 50%; }
.radial-arm[data-angle="60"]  { top: 30%;  left: 100%; }
.radial-arm[data-angle="120"] { top: 75%;  left: 100%; }
.radial-arm[data-angle="180"] { top: 105%; left: 50%; }
.radial-arm[data-angle="240"] { top: 75%;  left: 0%; }
.radial-arm[data-angle="300"] { top: 30%;  left: 0%; }

/* --- Layer 2: Primary Content --- */
.content-scroll {
    position: relative;
    z-index: 10;
    width: 100vw;
    height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
    scroll-snap-type: y mandatory;
    scroll-behavior: smooth;
}

.snap-section {
    min-height: 100vh;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    scroll-snap-align: start;
    position: relative;
    padding: 80px 40px;
}

/* --- Hero Section --- */
.hero-content {
    text-align: center;
    opacity: 0;
}

.hero-content.visible {
    opacity: 1;
}

.hero-title {
    font-family: 'Bebas Neue', cursive;
    font-size: clamp(3rem, 12vw, 10rem);
    color: #18181b;
    letter-spacing: 0.15em;
    line-height: 0.95;
    margin-bottom: 16px;
}

/* Signal White for maximum emphasis words */
.signal-white {
    color: #fafafa;
}

.hero-title.revealed span {
    transition: color 60ms ease;
}

.hero-subtitle {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 300;
    font-size: clamp(0.8rem, 1.2vw, 1rem);
    letter-spacing: 0.35em;
    color: #71717a;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 500ms ease 300ms, transform 500ms ease 300ms;
}

.hero-subtitle.visible {
    opacity: 1;
    transform: translateY(0);
}

/* --- Section Inner Layout --- */
.section-inner {
    display: grid;
    grid-template-columns: 1fr 400px 1fr;
    grid-template-rows: auto;
    gap: 24px;
    max-width: 1400px;
    width: 100%;
    align-items: center;
    position: relative;
}

.icon-container {
    display: flex;
    align-items: center;
    justify-content: center;
}

.icon-center {
    grid-column: 2;
    grid-row: 1;
}

/* --- Content Panels --- */
.panel {
    background: rgba(39, 39, 42, 0.85); /* #27272a at 85% opacity */
    border: 1px solid #3f3f46;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 32px;
    border-radius: 2px;
    opacity: 0;
    transition: opacity 600ms cubic-bezier(0.16, 1, 0.3, 1), transform 600ms cubic-bezier(0.16, 1, 0.3, 1);
}

.panel:hover {
    border-color: #27272a;
}

.panel-primary {
    max-width: 680px;
}

.panel-secondary {
    max-width: 320px;
}

.panel-left {
    grid-column: 1;
    grid-row: 1;
    transform: translateX(-80px);
    justify-self: end;
}

.panel-right {
    grid-column: 3;
    grid-row: 1;
    transform: translateX(80px);
    justify-self: start;
}

.panel.visible {
    opacity: 1;
    transform: translateX(0);
}

.panel-heading {
    font-family: 'Bebas Neue', cursive;
    font-size: clamp(1.5rem, 3vw, 2.5rem);
    color: #d4d4d8;
    letter-spacing: 0.15em;
    line-height: 0.95;
    margin-bottom: 20px;
}

/* Clip-path reveal animation */
.clip-reveal {
    clip-path: inset(0 100% 0 0);
    transition: clip-path 800ms cubic-bezier(0.16, 1, 0.3, 1), transform 800ms cubic-bezier(0.16, 1, 0.3, 1);
    transform: translateY(8px);
}

.clip-reveal.revealed {
    clip-path: inset(0 0 0 0);
    transform: translateY(0);
}

.panel-body {
    color: #a1a1aa;
    margin-bottom: 16px;
    line-height: 1.7;
}

.panel-body:last-child {
    margin-bottom: 0;
}

.panel-annotation {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 300;
    font-size: clamp(0.75rem, 0.9vw, 0.85rem);
    color: #71717a;
    letter-spacing: 0.04em;
    line-height: 1.6;
    margin-bottom: 12px;
}

.panel-annotation:last-child {
    margin-bottom: 0;
}

/* Greek Key Border Pattern */
.panel-border-pattern {
    height: 16px;
    margin-bottom: 20px;
    background-repeat: repeat-x;
    background-size: 32px 16px;
}

.greek-key {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='16'%3E%3Cpath d='M0 8h8v-8h16v8h8v8h-8v-4h-4v4h-8v-4h-4v4h-8z' fill='none' stroke='%233f3f46' stroke-width='0.75'/%3E%3C/svg%3E");
}

/* Enso Separator */
.enso-separator {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    opacity: 0;
    transition: opacity 400ms ease 600ms;
}

.enso-separator.visible {
    opacity: 0.6;
}

.enso-path {
    stroke-dasharray: 320;
    stroke-dashoffset: 320;
    transition: stroke-dashoffset 1.2s ease;
}

.enso-separator.visible .enso-path {
    stroke-dashoffset: 0;
}

/* --- Isometric Icons --- */
.iso-icon {
    max-width: 100%;
    height: auto;
    transition: stroke 300ms ease;
}

.iso-icon:hover line,
.iso-icon:hover path,
.iso-icon:hover polygon,
.iso-icon:hover rect,
.iso-icon:hover ellipse,
.iso-icon:hover circle {
    stroke: #7dd3fc;
    transition: stroke 300ms ease;
}

/* Scale rocking animation */
.scale-icon {
    animation: scale-rock 4s ease-in-out infinite;
    transform-origin: center 40px;
}

@keyframes scale-rock {
    0%, 100% { transform: rotate(-2deg); }
    50% { transform: rotate(2deg); }
}

/* Panopticon sight-line rotation */
.panopticon-icon .sight-line {
    animation: sight-rotate 60s linear infinite;
    transform-origin: 100px 100px;
}

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

/* Cave shadow flickering */
.cave-shadow {
    animation: shadow-flicker 2s ease-in-out infinite alternate;
}

@keyframes shadow-flicker {
    0% { opacity: 0.7; }
    100% { opacity: 1; }
}

/* Ship plank removal pulse */
.removing-plank {
    animation: plank-pulse 2s ease-in-out infinite;
}

@keyframes plank-pulse {
    0%, 100% { stroke-opacity: 1; transform: translateX(0); }
    50% { stroke-opacity: 0.5; transform: translateX(3px); }
}

/* Observer glow */
.observer-glow {
    animation: glow-pulse 3s ease-in-out infinite;
}

@keyframes glow-pulse {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}

/* SVG draw-in animation */
.iso-icon.draw-in line,
.iso-icon.draw-in path,
.iso-icon.draw-in polygon,
.iso-icon.draw-in rect,
.iso-icon.draw-in ellipse,
.iso-icon.draw-in circle {
    stroke-dasharray: 600;
    stroke-dashoffset: 600;
    animation: svg-draw 1.2s ease forwards;
}

@keyframes svg-draw {
    to { stroke-dashoffset: 0; }
}

/* --- Tooltip --- */
.icon-tooltip {
    position: fixed;
    z-index: 150;
    background: rgba(24, 24, 27, 0.95);
    border: 1px solid rgba(125, 211, 252, 0.4);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    padding: 12px 16px;
    max-width: 280px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 300ms ease;
    border-radius: 2px;
}

.icon-tooltip.visible {
    opacity: 1;
}

.tooltip-text {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 11px;
    color: #a1a1aa;
    letter-spacing: 0.04em;
    line-height: 1.6;
}

/* --- Scrollbar --- */
.content-scroll::-webkit-scrollbar {
    width: 2px;
}

.content-scroll::-webkit-scrollbar-track {
    background: #18181b;
}

.content-scroll::-webkit-scrollbar-thumb {
    background: #3f3f46;
}

/* --- Responsive adjustments --- */
@media (max-width: 1200px) {
    .section-inner {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto auto;
        gap: 24px;
        padding: 0 24px;
    }

    .icon-center {
        grid-column: 1;
        grid-row: 1;
    }

    .panel-left {
        grid-column: 1;
        grid-row: 2;
        justify-self: center;
        transform: translateY(40px);
    }

    .panel-right {
        grid-column: 1;
        grid-row: 3;
        justify-self: center;
        transform: translateY(40px);
    }

    .panel-primary,
    .panel-secondary {
        max-width: 680px;
        width: 100%;
    }

    .panel.visible {
        transform: translateY(0);
    }

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

    .snap-section {
        min-height: auto;
        padding: 60px 20px;
    }

    .content-scroll {
        scroll-snap-type: none;
    }
}

@media (max-width: 768px) {
    .compass-labels {
        gap: 16px;
    }

    .compass-label {
        font-size: 9px;
        letter-spacing: 0.15em;
    }

    .telemetry {
        font-size: 9px;
    }

    .section-counter {
        font-size: 9px;
    }

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

    .deep-text {
        font-size: 30vw;
    }

    .snap-section {
        padding: 40px 16px;
    }
}
