/* yamato.quest - Terracotta Glitch Design System */
/* Colors:
   Obsidian Forge (primary bg): #1A1208
   Terracotta Flame (primary accent): #C4521A
   Amber Signal (highlight/hover): #E8871A
   Sand Dust (secondary bg): #2E2018
   Clay Pale (text on dark): #F0DEC4
   Rust Deep (inactive/muted): #6B3A1F
   Warm Ash (secondary text): #9C7858
   Glitch Teal (corruption accent): #1AFFD4
*/

/* === RESET & BASE === */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    font-family: 'Fira Code', monospace;
    background-color: #1A1208;
    color: #F0DEC4;
    line-height: 1.6;
    overflow-x: hidden;
    position: relative;
    min-height: 100vh;
}

/* === TYPOGRAPHY === */
h1, h2, h3, h4, h5, h6 {
    font-family: 'Barlow Condensed', sans-serif;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.vt323-text {
    font-family: 'VT323', monospace;
}

.section-label {
    font-family: 'Barlow Condensed', sans-serif;
    font-size: 3rem;
    font-weight: 700;
    color: #C4521A;
    letter-spacing: 0.15em;
    margin-bottom: 1.5rem;
    position: relative;
}

.section-label::after {
    content: '';
    display: block;
    width: 60px;
    height: 3px;
    background: #E8871A;
    margin-top: 0.5rem;
}

/* === CIRCUIT TRACES === */
.circuit-traces {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    opacity: 0.1;
}

.trace-path {
    fill: none;
    stroke: #1AFFD4;
    stroke-width: 1.5;
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
    animation: drawTrace 2s ease-out forwards;
}

.trace-path:nth-child(2) { animation-delay: 0.3s; }
.trace-path:nth-child(3) { animation-delay: 0.6s; }
.trace-path:nth-child(4) { animation-delay: 0.9s; }
.trace-path:nth-child(5) { animation-delay: 1.2s; }
.trace-path:nth-child(6) { animation-delay: 1.5s; }
.trace-path:nth-child(7) { animation-delay: 1.8s; }
.trace-path:nth-child(8) { animation-delay: 2.1s; }

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

/* === GLITCH BANDS === */
#glitch-bands {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 100;
}

.glitch-band {
    position: absolute;
    left: 0;
    width: 100%;
    background: #C4521A;
    opacity: 0.6;
    animation: glitchSlide var(--glitch-duration) steps(4) infinite;
    clip-path: inset(0 var(--clip-right) 0 var(--clip-left));
}

@keyframes glitchSlide {
    0% { transform: translateX(0); }
    15% { transform: translateX(var(--glitch-shift)); }
    30% { transform: translateX(calc(var(--glitch-shift) * -0.5)); }
    45% { transform: translateX(0); }
    100% { transform: translateX(0); }
}

/* === TERMINAL NAVIGATION === */
#terminal-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 50;
    background: #1A1208;
    border-bottom: 1px solid #2E2018;
    padding: 0.75rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-family: 'Fira Code', monospace;
    font-size: 0.85rem;
    backdrop-filter: blur(8px);
    background: rgba(26, 18, 8, 0.95);
}

.nav-prompt {
    display: flex;
    align-items: center;
    gap: 0;
}

.nav-user { color: #C4521A; font-weight: 600; }
.nav-at { color: #9C7858; }
.nav-host { color: #E8871A; font-weight: 600; }
.nav-colon { color: #9C7858; margin-right: 0.5rem; }
.nav-page { color: #F0DEC4; }

.nav-links {
    display: flex;
    gap: 1.5rem;
}

.nav-flag {
    color: #9C7858;
    text-decoration: none;
    transition: color 0.12s;
    position: relative;
}

.nav-flag:hover {
    color: #E8871A;
}

.nav-flag::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 100%;
    height: 1px;
    background: #E8871A;
    transform: scaleX(0);
    transition: transform 0.2s;
}

.nav-flag:hover::after {
    transform: scaleX(1);
}

/* === MAIN GRID === */
.modular-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 2px;
    padding-top: 50px;
    max-width: 1400px;
    margin: 0 auto;
    position: relative;
    z-index: 2;
}

/* === MODULE BASE === */
.module {
    position: relative;
    background: #1A1208;
    overflow: hidden;
    border: 1px solid rgba(46, 32, 24, 0.6);
}

.module-inner {
    padding: 2.5rem;
    position: relative;
    z-index: 2;
}

/* === SCAN LINES OVERLAY === */
.scan-lines {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(26, 18, 8, 0.04) 2px,
        rgba(26, 18, 8, 0.04) 3px
    );
    pointer-events: none;
    z-index: 3;
}

/* === HERO MODULE === */
.module-hero {
    grid-column: 1 / -1;
    min-height: 70vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(170deg, #1A1208 0%, #2E2018 50%, #1A1208 100%);
}

.module-hero .module-inner {
    text-align: center;
}

.hero-title {
    font-family: 'Barlow Condensed', sans-serif;
    font-size: clamp(4rem, 12vw, 10rem);
    font-weight: 700;
    letter-spacing: 0.1em;
    line-height: 1;
    margin-bottom: 1.5rem;
}

.hero-dot {
    color: #C4521A;
}

.glitch-text {
    position: relative;
    display: inline-block;
    color: #F0DEC4;
}

.glitch-text::before,
.glitch-text::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
}

.glitch-text::before {
    color: #1AFFD4;
    z-index: -1;
}

.glitch-text::after {
    color: #C4521A;
    z-index: -1;
}

.glitch-text.glitching::before {
    animation: glitchBefore 0.3s steps(2) forwards;
    opacity: 0.8;
}

.glitch-text.glitching::after {
    animation: glitchAfter 0.3s steps(2) forwards;
    opacity: 0.8;
}

@keyframes glitchBefore {
    0% { transform: translate(0); clip-path: inset(0 0 60% 0); }
    25% { transform: translate(-3px, 2px); clip-path: inset(20% 0 40% 0); }
    50% { transform: translate(2px, -1px); clip-path: inset(40% 0 20% 0); }
    75% { transform: translate(-1px, 1px); clip-path: inset(60% 0 0 0); }
    100% { transform: translate(0); opacity: 0; }
}

@keyframes glitchAfter {
    0% { transform: translate(0); clip-path: inset(60% 0 0 0); }
    25% { transform: translate(3px, -2px); clip-path: inset(40% 0 20% 0); }
    50% { transform: translate(-2px, 1px); clip-path: inset(20% 0 40% 0); }
    75% { transform: translate(1px, -1px); clip-path: inset(0 0 60% 0); }
    100% { transform: translate(0); opacity: 0; }
}

.hero-subtitle {
    font-family: 'Fira Code', monospace;
    font-size: 1rem;
    color: #9C7858;
    margin-bottom: 2rem;
    letter-spacing: 0.05em;
}

.hero-terminal {
    font-family: 'Fira Code', monospace;
    font-size: 0.9rem;
    color: #E8871A;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
}

.terminal-cursor {
    animation: cursorBlink 1s steps(1) infinite;
    color: #E8871A;
}

@keyframes cursorBlink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

/* === ABOUT MODULE === */
.module-about {
    grid-column: 1 / 9;
    background: #2E2018;
}

.module-about .module-content p {
    font-size: 0.95rem;
    line-height: 1.8;
    margin-bottom: 1rem;
    color: #F0DEC4;
}

/* === STATS MODULE === */
.module-stats {
    grid-column: 9 / -1;
    background: #1A1208;
    display: flex;
    align-items: center;
    justify-content: center;
    border-left: 2px solid #C4521A;
}

.module-stats .module-inner {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    text-align: center;
}

.stat-value {
    font-size: 3rem;
    color: #E8871A;
    display: block;
    line-height: 1;
}

.stat-label {
    font-family: 'Fira Code', monospace;
    font-size: 0.75rem;
    color: #9C7858;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

/* === EXPLORE MODULE === */
.module-explore {
    grid-column: 1 / -1;
    background: #1A1208;
}

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

.explore-card {
    background: #2E2018;
    padding: 2rem;
    position: relative;
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: pointer;
}

.explore-card:hover {
    transform: translateY(-2px) rotate(-0.5deg);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    z-index: 5;
}

.card-number {
    font-size: 3rem;
    color: #6B3A1F;
    line-height: 1;
    margin-bottom: 0.5rem;
}

.explore-card h3 {
    font-family: 'Barlow Condensed', sans-serif;
    font-size: 1.5rem;
    color: #C4521A;
    margin-bottom: 0.75rem;
}

.explore-card p {
    font-size: 0.85rem;
    color: #9C7858;
    margin-bottom: 1.5rem;
    line-height: 1.7;
}

.card-link {
    font-family: 'Fira Code', monospace;
    font-size: 0.8rem;
    color: #E8871A;
}

.cursor-blink {
    animation: cursorBlink 1s steps(1) infinite;
}

/* === IMAGE MODULES === */
.module-image {
    overflow: hidden;
}

.module-image-1 {
    grid-column: 1 / 5;
}

.module-image-2 {
    grid-column: 1 / 7;
}

.image-duotone {
    width: 100%;
    height: 100%;
    filter: sepia(0.6) hue-rotate(10deg) contrast(1.2);
    position: relative;
}

.image-placeholder {
    width: 100%;
    height: 100%;
}

.image-placeholder svg {
    width: 100%;
    height: 100%;
    display: block;
}

/* === QUOTE MODULE === */
.module-quote {
    grid-column: 5 / -1;
    background: #2E2018;
    display: flex;
    align-items: center;
}

.module-quote blockquote {
    position: relative;
}

.quote-glyph {
    font-size: 1.5rem;
    color: #C4521A;
    display: block;
    margin-bottom: 1rem;
}

.module-quote blockquote p {
    font-family: 'Barlow Condensed', sans-serif;
    font-size: 1.75rem;
    font-weight: 300;
    color: #F0DEC4;
    line-height: 1.5;
    font-style: italic;
    margin-bottom: 1rem;
}

.module-quote blockquote cite {
    font-family: 'Fira Code', monospace;
    font-size: 0.8rem;
    color: #6B3A1F;
    font-style: normal;
}

/* === GALLERY MODULE === */
.module-gallery {
    grid-column: 1 / -1;
    background: #1A1208;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 2px;
}

.gallery-item {
    cursor: pointer;
    transition: transform 0.2s;
    background: #2E2018;
    overflow: hidden;
}

.gallery-item:hover {
    transform: scale(1.02) rotate(0.5deg);
    z-index: 5;
}

.gallery-image {
    position: relative;
    overflow: hidden;
}

.gallery-image svg {
    width: 100%;
    display: block;
}

.gallery-image::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(26, 18, 8, 0.08) 2px,
        rgba(26, 18, 8, 0.08) 3px
    );
    z-index: 1;
    pointer-events: none;
}

.gallery-label {
    display: block;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    color: #9C7858;
    background: #1A1208;
}

/* === JOURNAL MODULE === */
.module-journal {
    grid-column: 1 / -1;
    background: #2E2018;
}

.journal-entries {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2px;
}

.journal-entry {
    background: #1A1208;
    padding: 2rem;
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: pointer;
    position: relative;
}

.journal-entry:hover {
    transform: translateY(-3px) rotate(-0.3deg);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
    z-index: 5;
}

.entry-date {
    font-size: 1.2rem;
    color: #6B3A1F;
    margin-bottom: 0.5rem;
}

.journal-entry h3 {
    font-family: 'Barlow Condensed', sans-serif;
    font-size: 1.3rem;
    color: #E8871A;
    margin-bottom: 0.75rem;
}

.journal-entry p {
    font-size: 0.85rem;
    color: #9C7858;
    line-height: 1.7;
    margin-bottom: 1.5rem;
}

.entry-link {
    font-family: 'Fira Code', monospace;
    font-size: 0.8rem;
    color: #C4521A;
}

/* === ERROR MODULE === */
.module-error {
    grid-column: 7 / -1;
    background: #1A1208;
    border-left: 3px solid #C4521A;
}

.error-content {
    font-size: 1.1rem;
    line-height: 2;
    color: #6B3A1F;
}

.error-content p {
    margin-bottom: 0.25rem;
}

.error-highlight {
    color: #E8871A;
}

.error-dots {
    color: #2E2018;
    overflow: hidden;
    animation: dotsReveal 3s steps(30) infinite;
}

@keyframes dotsReveal {
    from { width: 0; }
    to { width: 100%; }
}

/* === CONTACT MODULE === */
.module-contact {
    grid-column: 1 / -1;
    background: #2E2018;
}

.contact-content > p {
    font-size: 0.95rem;
    color: #9C7858;
    margin-bottom: 2rem;
}

.contact-form {
    max-width: 600px;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    font-family: 'Fira Code', monospace;
    font-size: 0.8rem;
    color: #C4521A;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    display: block;
    margin-bottom: 0.5rem;
}

.form-input {
    width: 100%;
    background: #1A1208;
    border: 1px solid #6B3A1F;
    color: #F0DEC4;
    font-family: 'Fira Code', monospace;
    font-size: 0.9rem;
    padding: 0.75rem 1rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-input::placeholder {
    color: #6B3A1F;
}

.form-input:focus {
    outline: none;
    border-color: #E8871A;
    box-shadow: 0 0 0 1px #E8871A;
}

.form-textarea {
    min-height: 120px;
    resize: vertical;
}

.form-submit {
    background: #C4521A;
    color: #F0DEC4;
    border: none;
    font-family: 'Fira Code', monospace;
    font-size: 0.9rem;
    padding: 0.75rem 2rem;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: background 0.2s;
}

.form-submit:hover {
    background: #E8871A;
}

.submit-glitch {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #C4521A;
    opacity: 0;
    font-size: 1.2rem;
    transition: opacity 0.1s;
}

.form-submit.sending .submit-glitch {
    opacity: 1;
    animation: submitGlitch 0.8s steps(3) forwards;
}

@keyframes submitGlitch {
    0% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    50% { transform: translateX(3px); }
    75% { transform: translateX(-2px); }
    100% { transform: translateX(0); opacity: 0; }
}

/* === FOOTER MODULE === */
.module-footer {
    grid-column: 1 / -1;
    background: #1A1208;
    border-top: 2px solid #2E2018;
}

.footer-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
}

.footer-prompt {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
}

.footer-links {
    display: flex;
    gap: 1.5rem;
}

.footer-link {
    color: #6B3A1F;
    text-decoration: none;
    font-size: 0.8rem;
    transition: color 0.15s;
}

.footer-link:hover {
    color: #E8871A;
}

.footer-copy {
    font-size: 0.9rem;
    color: #6B3A1F;
}

/* === HOVER GLITCH EFFECT === */
.interactive-element {
    position: relative;
}

.interactive-element.hover-glitch {
    text-shadow: 2px 0 #1AFFD4, -2px 0 #C4521A;
    letter-spacing: 0.5px;
}

.interactive-element.hover-glitch * {
    text-shadow: 2px 0 #1AFFD4, -2px 0 #C4521A;
}

/* === LAYERED DEPTH === */
.module-about {
    z-index: 3;
    box-shadow: 4px 4px 16px rgba(0, 0, 0, 0.3);
    transform: rotate(-0.3deg);
}

.module-stats {
    z-index: 2;
}

.module-quote {
    z-index: 4;
    box-shadow: -4px 6px 20px rgba(0, 0, 0, 0.4);
    transform: rotate(0.4deg);
}

.module-error {
    z-index: 2;
    transform: rotate(0.2deg);
}

/* === RESPONSIVE === */
@media (max-width: 1024px) {
    .modular-grid {
        grid-template-columns: repeat(6, 1fr);
    }

    .module-hero {
        grid-column: 1 / -1;
    }

    .module-about {
        grid-column: 1 / -1;
        transform: none;
    }

    .module-stats {
        grid-column: 1 / -1;
        border-left: none;
        border-top: 2px solid #C4521A;
    }

    .module-stats .module-inner {
        flex-direction: row;
        justify-content: space-around;
    }

    .module-explore {
        grid-column: 1 / -1;
    }

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

    .module-image-1 {
        grid-column: 1 / 4;
    }

    .module-quote {
        grid-column: 4 / -1;
        transform: none;
    }

    .module-gallery {
        grid-column: 1 / -1;
    }

    .gallery-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .module-journal {
        grid-column: 1 / -1;
    }

    .journal-entries {
        grid-template-columns: 1fr;
    }

    .module-image-2 {
        grid-column: 1 / -1;
    }

    .module-error {
        grid-column: 1 / -1;
        transform: none;
    }

    .module-contact {
        grid-column: 1 / -1;
    }

    .module-footer {
        grid-column: 1 / -1;
    }
}

@media (max-width: 768px) {
    .modular-grid {
        grid-template-columns: 1fr;
    }

    #terminal-nav {
        flex-direction: column;
        gap: 0.5rem;
        padding: 0.5rem 1rem;
    }

    .nav-links {
        gap: 0.75rem;
        font-size: 0.75rem;
        flex-wrap: wrap;
    }

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

    .module-inner {
        padding: 1.5rem;
    }

    .section-label {
        font-size: 2rem;
    }

    .module-image-1,
    .module-image-2,
    .module-quote,
    .module-error {
        grid-column: 1 / -1;
    }

    .gallery-grid {
        grid-template-columns: repeat(2, 1fr);
    }

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

    .journal-entries {
        grid-template-columns: 1fr;
    }

    .footer-content {
        flex-direction: column;
        text-align: center;
    }

    .module-stats .module-inner {
        flex-direction: column;
    }
}

/* === GLITCH TEXT PERIODIC ANIMATION === */
@keyframes periodicGlitch {
    0%, 95% {
        text-shadow: none;
        transform: translate(0);
    }
    96% {
        text-shadow: 2px 0 #1AFFD4, -2px 0 #C4521A;
        transform: translate(-2px, 1px);
    }
    97% {
        text-shadow: -2px 0 #1AFFD4, 2px 0 #C4521A;
        transform: translate(2px, -1px);
    }
    98% {
        text-shadow: 1px 0 #1AFFD4, -1px 0 #C4521A;
        transform: translate(-1px, 0);
    }
    99% {
        text-shadow: none;
        transform: translate(0);
    }
}

.error-content {
    animation: periodicGlitch 8s steps(2) infinite;
}
