/* Markdown.dev - Celestial/Rhythmic Fusion */

@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,700;0,900;1,700&display=swap');

:root {
    --md-blue-deep: #0e1133;
    --md-blue-bg: #1a1e4d;
    --md-cream: #fafaf5;
    --md-accent-blue: #3d46b0;
    --md-glass-light: rgba(250, 250, 245, 0.1);
}

#markdown-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--md-blue-deep);
    color: var(--md-cream);
    z-index: 10000;
    display: none;
    flex-direction: column;
    overflow-y: auto;
    opacity: 0;
    transition: opacity 0.6s cubic-bezier(0.23, 1, 0.32, 1);
    font-family: 'Inter', sans-serif;
}

#markdown-modal.active {
    display: flex;
    opacity: 1;
}

/* Grainy Texture Overlay */
.md-grain {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0.15;
    pointer-events: none;
    background: url("data:image/svg+xml,%3Csvg viewBox='0 0 400 400' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.6' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
    z-index: 9999;
}

/* Celestial Elements */
.md-celestial-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}

.md-radial-lines {
    position: absolute;
    top: 0%;
    left: 50%;
    transform: translateX(-50%);
    width: 200vw;
    height: 200vh;
    background: repeating-conic-gradient(from 0deg, transparent 0deg, transparent 1deg, rgba(251, 251, 245, 0.05) 1.1deg, transparent 1.2deg);
    opacity: 0.5;
}

/* Header */
.md-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 2rem 5%;
    position: sticky;
    top: 0;
    background: transparent;
    z-index: 100;
}

.md-modal-logo {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-weight: 500;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    font-size: 0.7rem;
}

.md-modal-logo-icon {
    width: 32px;
    height: 48px;
    border: 1px solid var(--md-cream);
    border-radius: 99px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.md-modal-logo-icon::after {
    content: '';
    width: 10px;
    height: 10px;
    background: var(--md-cream);
    border-radius: 50%;
    box-shadow: 0 0 15px var(--md-cream);
}

.md-close {
    background: var(--md-cream);
    color: var(--md-blue-deep);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.2rem;
    transition: all 0.3s ease;
}

.md-close:hover {
    transform: rotate(90deg);
}

/* Project Selection Grid */
.project-entrance-section {
    padding: 6rem 0;
}

@media (max-width: 768px) {
    .project-grid {
        grid-template-columns: 1fr !important;
        gap: 2rem !important;
    }

    .project-card-btn {
        border-left: none !important;
        border-bottom: 1px solid rgba(14, 17, 51, 0.05);
        padding-bottom: 2rem;
    }
}

/* Main Hero */
.md-hero-celestial {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: 0 5%;
    z-index: 1;
}

.md-hero-grid {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 4rem;
    align-items: center;
    width: 100%;
}

.md-hero-content {
    max-width: 600px;
}

.md-hero-tag {
    font-family: 'Playfair Display', serif;
    font-size: clamp(3rem, 8vw, 6rem);
    line-height: 1;
    margin-bottom: 3rem;
    font-weight: 900;
}

.md-hero-tag span {
    display: block;
    font-style: italic;
    font-weight: 400;
}

.md-hero-desc {
    font-size: 1.15rem;
    line-height: 1.7;
    opacity: 0.7;
    max-width: 420px;
    margin-bottom: 3rem;
}

/* CTA Buttons */
.md-cta-group {
    display: flex;
    gap: 1.5rem;
    align-items: center;
}

.md-btn-download {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: var(--md-cream);
    color: var(--md-blue-deep);
    padding: 1rem 2rem;
    border-radius: 99px;
    text-decoration: none;
    font-weight: 700;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    transition: all 0.4s cubic-bezier(0.23, 1, 0.32, 1);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.md-btn-download:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.3);
    background: white;
}

.md-btn-online {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    background: transparent;
    color: var(--md-cream);
    padding: 1rem 2rem;
    border: 1px solid rgba(250, 250, 245, 0.3);
    border-radius: 99px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    transition: all 0.4s ease;
    position: relative;
    overflow: hidden;
}

.md-btn-online:hover {
    background: rgba(250, 250, 245, 0.1);
    border-color: var(--md-cream);
}

.md-btn-pulse {
    width: 8px;
    height: 8px;
    background: #4caf50;
    border-radius: 50%;
    position: relative;
    box-shadow: 0 0 10px #4caf50;
}

.md-btn-pulse::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 1px solid #4caf50;
    animation: pulse-ring 2s infinite;
}

@keyframes pulse-ring {
    0% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }

    100% {
        transform: translate(-50%, -50%) scale(3);
        opacity: 0;
    }
}

/* Textured Circle Component */
.md-textured-circle-container {
    display: flex;
    justify-content: flex-end;
}

.md-textured-circle {
    width: clamp(320px, 45vw, 550px);
    height: clamp(320px, 45vw, 550px);
    border-radius: 50%;
    border: 1px solid rgba(250, 250, 245, 0.15);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: floating 12s infinite ease-in-out;
}

@keyframes floating {

    0%,
    100% {
        transform: translateY(0) rotate(0deg);
    }

    50% {
        transform: translateY(-30px) rotate(2deg);
    }
}

.md-circle-inner {
    width: 88%;
    height: 88%;
    border-radius: 50%;
    background: var(--md-blue-bg);
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.md-circle-pattern {
    position: absolute;
    width: 150%;
    height: 150%;
    background: url('https://www.transparenttextures.com/patterns/p6.png');
    opacity: 0.3;
    animation: slow-spin 60s infinite linear;
}

@keyframes slow-spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.md-circle-time {
    font-family: 'Playfair Display', serif;
    font-size: clamp(5rem, 15vw, 10rem);
    z-index: 2;
    font-weight: 500;
}

/* Sections */
.md-celestial-section {
    padding: 10rem 5%;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
    z-index: 1;
}

.md-section-num {
    width: 44px;
    height: 44px;
    border: 1px solid rgba(250, 250, 245, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    margin-bottom: 5rem;
    opacity: 0.6;
}

.md-rhythm-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6rem;
    align-items: start;
}

.md-rhythm-title {
    font-family: 'Playfair Display', serif;
    font-size: clamp(2.5rem, 5vw, 4rem);
    margin-bottom: 2rem;
    font-weight: 700;
}

.md-rhythm-desc {
    opacity: 0.6;
    font-size: 1.1rem;
    line-height: 1.8;
}

/* Narrative Visual Elements */
.md-alt-bg {
    background: #fbfbf5;
    color: #1a1e4d;
}

.md-alt-bg .md-section-num {
    border-color: rgba(26, 30, 77, 0.2);
}

.md-alt-bg .md-rhythm-title,
.md-alt-bg .md-rhythm-desc {
    color: #1a1e4d;
}

.md-drift-line {
    position: absolute;
    width: 200px;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--md-cream), transparent);
    transform: rotate(-15deg);
    animation: drift 4s infinite ease-in-out;
}

@keyframes drift {

    0%,
    100% {
        transform: rotate(-15deg) translateX(-20px);
        opacity: 0.2;
    }

    50% {
        transform: rotate(-10deg) translateX(20px);
        opacity: 0.6;
    }
}

.md-guardrail-rect {
    width: 150px;
    height: 200px;
    border: 1px solid rgba(250, 250, 245, 0.3);
    position: absolute;
    border-radius: 4px;
}

.md-synthesis-circle {
    width: 150px;
    height: 150px;
    border: 1px dashed rgba(250, 250, 245, 0.3);
    border-radius: 50%;
    animation: pulse-rotate 10s linear infinite;
}

@keyframes pulse-rotate {
    from {
        transform: rotate(0deg) scale(1);
    }

    to {
        transform: rotate(360deg) scale(1.1);
    }
}

.md-immutable-lock {
    width: 100px;
    height: 100px;
    border: 2px solid var(--md-cream);
    position: absolute;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.05);
}

/* Footer Rhythm */
.md-footer-rhythm {
    display: flex;
    justify-content: space-between;
    padding: 3rem 5%;
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.25em;
    opacity: 0.4;
    border-top: 1px solid rgba(250, 250, 245, 0.05);
}

/* Markdown Entrance Icon Adjustments */
.md-icon-celestial {
    width: 48px;
    height: 48px;
    border: 1.5px solid var(--md-blue-deep);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.md-icon-celestial::after {
    content: '';
    width: 12px;
    height: 12px;
    background: var(--md-blue-deep);
    border-radius: 50%;
}

@media (max-width: 900px) {
    .md-hero-grid {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .md-hero-desc {
        margin: 0 auto;
    }

    .md-textured-circle-container {
        justify-content: center;
    }

    .md-rhythm-grid {
        grid-template-columns: 1fr;
    }
}
@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Markdown.Dev Workspace (Online Edition) */
.md-workspace {
    display: none;
    flex: 1;
    height: calc(100vh - 80px);
    grid-template-columns: 350px 1fr 300px;
    gap: 1.5rem;
    padding: 1.5rem;
    box-sizing: border-box;
    position: relative;
    z-index: 5;
}

.md-workspace.active {
    display: grid;
}

.md-panel {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    backdrop-filter: blur(20px);
}

.md-panel-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.5);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Architect Chat */
.md-chat-feed {
    flex: 1;
    padding: 1.5rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.md-msg {
    max-width: 85%;
    font-size: 0.9rem;
    line-height: 1.5;
    padding: 0.8rem 1rem;
    border-radius: 8px;
}

.md-msg.ai {
    background: rgba(255, 255, 255, 0.05);
    align-self: flex-start;
    border-bottom-left-radius: 0;
}

.md-msg.user {
    background: var(--md-accent-blue);
    align-self: flex-end;
    border-bottom-right-radius: 0;
}

.md-chat-input-container {
    padding: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.md-chat-input {
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    padding: 0.8rem 1rem;
    color: white;
    font-family: inherit;
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.3s;
}

.md-chat-input:focus {
    border-color: var(--md-accent-blue);
}

/* Markdown Editor */
.md-editor-container {
    position: relative;
    flex: 1;
}

.md-editor-textarea {
    width: 100%;
    height: 100%;
    background: transparent;
    border: none;
    color: #a9b7c6;
    font-family: 'Courier New', Courier, monospace;
    font-size: 1rem;
    padding: 1.5rem;
    resize: none;
    outline: none;
    line-height: 1.6;
}

/* DNA Visualizer */
.md-dna-list {
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.md-dna-item {
    background: rgba(255, 255, 255, 0.02);
    padding: 1rem;
    border-radius: 6px;
    border-left: 3px solid var(--md-accent-blue);
}

.md-dna-label {
    font-size: 0.6rem;
    text-transform: uppercase;
    opacity: 0.5;
    margin-bottom: 0.4rem;
}

.md-dna-value {
    font-family: 'Playfair Display', serif;
    font-size: 1.1rem;
    font-weight: 700;
}

.md-dna-color {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    display: inline-block;
    vertical-align: middle;
    margin-right: 0.5rem;
}

@media (max-width: 1024px) {
    .md-workspace {
        grid-template-columns: 1fr;
        grid-template-rows: 300px 400px 1fr;
    }
}
