/* ============================================================
   miris.dev - Isometric Greenhouse
   Color Palette:
     #0b0f14 Greenhouse Midnight (base)
     #131b24 Blueprint Slate (panels)
     #1e3a2a Fernstone (borders)
     #2a3a4a Wire Graphite (grid lines)
     #c8cfd8 Moth Wing (primary text)
     #7a8890 Pollen Dust (secondary text)
     #7fffd4 Nightbloom Teal (accent)
     #d4a574 Jasmine Ember (warm accent)
     #6b3a6b Orchid Shadow (tertiary)
     #1a4a2a Bioluminescent Green (gradient)
     #1a1a3e Midnight Indigo (gradient)
     #c44a4a Thorn Red (error)
   Fonts: Space Grotesk, DM Sans, JetBrains Mono
   ============================================================ */

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

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: 'DM Sans', sans-serif;
    font-weight: 400;
    font-size: clamp(0.95rem, 1.6vw, 1.1rem);
    line-height: 1.75;
    letter-spacing: 0.01em;
    color: #c8cfd8;
    background: #0b0f14;
}

/* --- Isometric Field (Base Layer) --- */
#isometric-field {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    background: linear-gradient(to top, #1a4a2a 0%, #0b0f14 60%);
}

#iso-grid,
#floral-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

#iso-grid {
    z-index: 1;
    opacity: 0;
    transition: opacity 1s ease;
}

#iso-grid.visible {
    opacity: 1;
}

#floral-layer {
    z-index: 2;
    opacity: 0;
    transition: opacity 1.5s ease 0.5s;
}

#floral-layer.visible {
    opacity: 1;
}

#particle-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 3;
    pointer-events: none;
}

.particle {
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
}

.particle.hex {
    border-radius: 0;
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
}

.particle.tri {
    border-radius: 0;
    clip-path: polygon(50% 0%, 100% 100%, 0% 100%);
}

/* --- Depth Fog (Vignette) --- */
#depth-fog {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 4;
    pointer-events: none;
    background: radial-gradient(ellipse at center, transparent 30%, rgba(11, 15, 20, 0.6) 100%);
}

/* --- Scan Lines --- */
#scan-lines {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 50;
    pointer-events: none;
    background: repeating-linear-gradient(
        to bottom,
        transparent 0px,
        transparent 3px,
        rgba(255, 255, 255, 0.02) 3px,
        rgba(255, 255, 255, 0.02) 4px
    );
}

/* --- HUD Panel Base --- */
.hud-panel {
    position: fixed;
    z-index: 30;
    padding: 16px;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.5s ease, transform 0.5s ease;
    background: transparent;
}

.hud-panel.visible {
    opacity: 1;
    transform: translateY(0);
}

.hud-panel:hover .corner-bracket {
    border-color: #7fffd4;
}

.hud-panel .panel-inner {
    position: relative;
    z-index: 2;
}

/* --- Corner Brackets --- */
.corner-bracket {
    position: absolute;
    width: 16px;
    height: 16px;
    border-color: #1e3a2a;
    border-style: solid;
    border-width: 0;
    transition: border-color 0.3s ease;
    z-index: 1;
}

.corner-bracket.top-left {
    top: 0;
    left: 0;
    border-top-width: 2px;
    border-left-width: 2px;
}

.corner-bracket.top-right {
    top: 0;
    right: 0;
    border-top-width: 2px;
    border-right-width: 2px;
}

.corner-bracket.bottom-left {
    bottom: 0;
    left: 0;
    border-bottom-width: 2px;
    border-left-width: 2px;
}

.corner-bracket.bottom-right {
    bottom: 0;
    right: 0;
    border-bottom-width: 2px;
    border-right-width: 2px;
}

/* --- Identity Panel (Top-Left) --- */
#identity-panel {
    top: 16px;
    left: 16px;
    min-width: 200px;
}

.identity-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.domain-name {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: clamp(1.4rem, 3vw, 2rem);
    letter-spacing: -0.02em;
    color: #c8cfd8;
}

.status-indicator {
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #7fffd4;
    animation: statusPulse 2s ease-in-out infinite;
}

@keyframes statusPulse {
    0%, 100% { opacity: 1; box-shadow: 0 0 4px #7fffd4; }
    50% { opacity: 0.4; box-shadow: 0 0 8px #7fffd4; }
}

.descriptor-cycle {
    position: relative;
    height: 20px;
    overflow: hidden;
}

.descriptor {
    position: absolute;
    top: 0;
    left: 0;
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 500;
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #7a8890;
    opacity: 0;
    transition: opacity 0.4s ease;
    white-space: nowrap;
}

.descriptor.active {
    opacity: 1;
}

/* --- Navigation Cluster (Top-Right) --- */
#nav-cluster {
    top: 16px;
    right: 16px;
    min-width: 160px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 0;
    text-decoration: none;
    color: #7a8890;
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 500;
    font-size: 0.9rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    position: relative;
    cursor: pointer;
    transition: color 0.2s ease;
}

.nav-item:hover,
.nav-item.active {
    color: #7fffd4;
}

.nav-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    color: inherit;
    transition: transform 0.25s ease;
}

.nav-item:hover .nav-icon {
    transform: rotate(15deg) skewX(-5deg);
}

.nav-label {
    position: relative;
}

.nav-underline {
    position: absolute;
    bottom: 2px;
    left: 26px;
    right: 0;
    height: 1px;
    background: #7fffd4;
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.3s ease-out;
}

.nav-item:hover .nav-underline,
.nav-item.active .nav-underline {
    transform: scaleX(1);
}

/* --- Context Panel (Bottom-Left) --- */
#context-panel {
    bottom: 16px;
    left: 16px;
    min-width: 180px;
}

.context-label {
    display: block;
    font-family: 'JetBrains Mono', monospace;
    font-weight: 400;
    font-size: 0.7rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #7a8890;
    margin-bottom: 4px;
}

.context-value {
    display: block;
    font-family: 'JetBrains Mono', monospace;
    font-weight: 400;
    font-size: 0.85rem;
    line-height: 1.5;
    letter-spacing: 0.03em;
    color: #7fffd4;
    margin-bottom: 4px;
    transition: color 0.2s ease;
}

.context-value.flash {
    color: #d4a574;
}

.context-timestamp {
    display: block;
    font-family: 'JetBrains Mono', monospace;
    font-weight: 400;
    font-size: 0.75rem;
    color: #7a8890;
    margin-bottom: 8px;
}

.progress-bar-container {
    width: 100%;
    height: 2px;
    background: #1e3a2a;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    width: 25%;
    background: linear-gradient(90deg, #7fffd4 0%, #d4a574 100%);
    transition: width 0.4s ease;
}

/* --- Botanical Index (Bottom-Right) --- */
#botanical-index {
    bottom: 16px;
    right: 16px;
    width: 152px;
    height: 152px;
}

#botanical-svg {
    width: 120px;
    height: 120px;
}

.botanical-flower path,
.botanical-flower circle {
    stroke-dasharray: 200;
    stroke-dashoffset: 200;
}

.botanical-flower.animate path,
.botanical-flower.animate circle {
    animation: drawFloral 3s ease forwards;
}

.flower-stem {
    animation-duration: 2s !important;
}

.flower-petal.p1 { animation-delay: 1s !important; }
.flower-petal.p2 { animation-delay: 1.3s !important; }
.flower-petal.p3 { animation-delay: 1.6s !important; }
.flower-petal.p4 { animation-delay: 1.9s !important; }
.flower-petal.p5 { animation-delay: 2.2s !important; }
.flower-petal.p6 { animation-delay: 2.5s !important; }
.flower-petal.p7 { animation-delay: 2.8s !important; }
.flower-petal.p8 { animation-delay: 3.1s !important; }

.flower-center {
    animation-delay: 2.5s !important;
}

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

#botanical-index:hover .botanical-flower.animate path,
#botanical-index:hover .botanical-flower.animate circle {
    animation-duration: 1.5s;
}

/* --- Isometric Waypoints --- */
#waypoints-layer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 5;
    pointer-events: none;
}

.waypoint {
    position: absolute;
    width: 12px;
    height: 12px;
    transform: rotate(45deg);
    background: transparent;
    border: 1px solid #7fffd4;
    opacity: 0.4;
    animation: waypointPulse 3s ease-in-out infinite;
}

@keyframes waypointPulse {
    0%, 100% {
        box-shadow: 0 0 0px rgba(127, 255, 212, 0.3);
        opacity: 0.4;
    }
    50% {
        box-shadow: 0 0 8px rgba(127, 255, 212, 0.5);
        opacity: 0.7;
    }
}

/* --- Content Well (Center Stage) --- */
#content-well {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: clamp(320px, 60vw, 880px);
    max-height: 70vh;
    z-index: 20;
    background: rgba(11, 15, 20, 0);
    backdrop-filter: blur(0px);
    -webkit-backdrop-filter: blur(0px);
    border: 1px solid transparent;
    padding: 48px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #1e3a2a #0b0f14;
    opacity: 0;
    transition: background 0.4s ease, backdrop-filter 0.4s ease, -webkit-backdrop-filter 0.4s ease, border-color 0.4s ease, opacity 0.4s ease;
}

#content-well.visible {
    background: linear-gradient(135deg, rgba(26, 26, 62, 0.85) 0%, rgba(19, 27, 36, 0.85) 50%, rgba(30, 58, 42, 0.85) 100%);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-color: #1e3a2a;
    opacity: 1;
}

#content-well::-webkit-scrollbar {
    width: 4px;
}

#content-well::-webkit-scrollbar-track {
    background: #0b0f14;
}

#content-well::-webkit-scrollbar-thumb {
    background: #1e3a2a;
}

#content-well > .corner-bracket {
    position: absolute;
    z-index: 10;
}

/* --- Content Sections --- */
.content-section {
    display: none;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.content-section.active {
    display: block;
}

.content-section.fade-in {
    opacity: 1;
    transform: translateY(0);
}

/* --- Typography --- */
h1 {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: clamp(2.2rem, 5.5vw, 4.2rem);
    letter-spacing: -0.02em;
    color: #c8cfd8;
    margin-bottom: 16px;
    line-height: 1.1;
}

h2 {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: clamp(1.4rem, 3vw, 2.4rem);
    letter-spacing: -0.02em;
    color: #c8cfd8;
    margin-bottom: 12px;
    line-height: 1.2;
}

h3 {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: clamp(1.1rem, 2vw, 1.6rem);
    letter-spacing: -0.02em;
    color: #c8cfd8;
    margin-bottom: 8px;
    line-height: 1.3;
}

.section-subtitle {
    font-family: 'DM Sans', sans-serif;
    font-weight: 500;
    font-size: 1rem;
    color: #7a8890;
    margin-bottom: 24px;
    font-style: italic;
}

.section-body p {
    margin-bottom: 16px;
    color: #c8cfd8;
}

/* --- Typewriter Heading --- */
.typewriter-heading {
    overflow: hidden;
    white-space: nowrap;
    max-width: 0;
    animation: typeReveal 1.5s steps(9, end) forwards;
    animation-delay: 3.2s;
    border-right: 2px solid #7fffd4;
}

.typewriter-heading.typed {
    animation: typeReveal 1.5s steps(9, end) forwards, blinkCaret 0.8s step-end 3;
    border-right-color: transparent;
}

@keyframes typeReveal {
    from { max-width: 0; }
    to { max-width: 100%; }
}

@keyframes blinkCaret {
    0%, 100% { border-right-color: transparent; }
    50% { border-right-color: #7fffd4; }
}

/* --- Section Accent Divider --- */
.section-accent {
    margin: 32px 0 16px;
    text-align: center;
}

.inline-motif {
    width: 200px;
    height: 40px;
}

/* --- Tech Metadata Tags --- */
.tech-metadata {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 16px;
}

.meta-tag {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    color: #7fffd4;
    padding: 4px 10px;
    border: 1px solid #1e3a2a;
    letter-spacing: 0.03em;
    transition: border-color 0.2s ease, color 0.2s ease;
}

.meta-tag:hover {
    border-color: #7fffd4;
    color: #d4a574;
}

/* --- Project Grid --- */
.project-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
    margin-top: 24px;
}

.project-item {
    position: relative;
    padding: 20px;
    border: 1px solid #1e3a2a;
    transition: border-color 0.3s ease;
}

.project-item::before,
.project-item::after {
    content: '';
    position: absolute;
    width: 12px;
    height: 12px;
    border-color: #1e3a2a;
    border-style: solid;
    transition: border-color 0.3s ease;
}

.project-item::before {
    top: -1px;
    left: -1px;
    border-width: 2px 0 0 2px;
}

.project-item::after {
    bottom: -1px;
    right: -1px;
    border-width: 0 2px 2px 0;
}

.project-item:hover {
    border-color: #7fffd4;
}

.project-item:hover::before,
.project-item:hover::after {
    border-color: #7fffd4;
}

.project-item h3 {
    margin-bottom: 8px;
}

.project-item p {
    font-size: 0.9rem;
    color: #7a8890;
    margin-bottom: 12px;
}

.project-status {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    color: #7fffd4;
    letter-spacing: 0.03em;
}

.project-status::before {
    content: '>';
    margin-right: 6px;
    color: #d4a574;
}

/* --- Contact Block --- */
.contact-block {
    margin-top: 24px;
    padding: 20px;
    border: 1px solid #1e3a2a;
}

.contact-row {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 8px 0;
    border-bottom: 1px solid rgba(30, 58, 42, 0.3);
}

.contact-row:last-child {
    border-bottom: none;
}

.contact-label {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    color: #7a8890;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    min-width: 80px;
}

.contact-link {
    font-family: 'DM Sans', sans-serif;
    font-size: 0.95rem;
    color: #7fffd4;
    text-decoration: none;
    transition: color 0.2s ease;
    position: relative;
}

.contact-link::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 100%;
    height: 1px;
    background: #7fffd4;
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.3s ease-out;
}

.contact-link:hover {
    color: #d4a574;
}

.contact-link:hover::after {
    transform: scaleX(1);
    background: #d4a574;
}

/* --- Root Signature --- */
.root-signature {
    margin-top: 32px;
    text-align: center;
}

.root-motif {
    width: 300px;
    height: 60px;
    opacity: 0.6;
}

/* --- Links General --- */
a {
    color: #7fffd4;
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: #d4a574;
}

a:visited {
    color: #6b3a6b;
}

/* --- Entry Animation Classes --- */
body.loading #content-well,
body.loading .hud-panel {
    opacity: 0;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    #content-well {
        width: calc(100% - 32px);
        max-height: 60vh;
        padding: 24px;
        top: 50%;
    }

    #identity-panel {
        top: 8px;
        left: 8px;
        padding: 10px;
    }

    #nav-cluster {
        top: 8px;
        right: 8px;
        padding: 10px;
    }

    #context-panel {
        bottom: 8px;
        left: 8px;
        padding: 10px;
    }

    #botanical-index {
        bottom: 8px;
        right: 8px;
        width: 100px;
        height: 100px;
        padding: 8px;
    }

    #botanical-svg {
        width: 80px;
        height: 80px;
    }

    .domain-name {
        font-size: 1.2rem;
    }

    .nav-item {
        font-size: 0.75rem;
        padding: 4px 0;
    }

    .project-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    #botanical-index {
        display: none;
    }

    #context-panel {
        display: none;
    }

    #content-well {
        max-height: 70vh;
        padding: 20px;
    }
}
