/* ==========================================================================
   rironbusou.com — Logical Armament
   Evolved-Minimal / Full-Bleed / Terracotta-Warm / Watercolor / Tech Motifs
   ========================================================================== */

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

:root {
    --terracotta-clay: #c2703e;
    --charred-umber: #2c1b0e;
    --deep-inkstone: #3d2e1f;
    --aged-vellum: #f5efe6;
    --warm-parchment: #ebe3d5;
    --burnt-sienna-mist: #d4845040;
    --faded-signal: #a08060;
    --oxidized-iron: #6b3a20;
    --radar-amber: #e8a04580;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Source Serif 4', 'Georgia', serif;
    background-color: var(--aged-vellum);
    color: var(--deep-inkstone);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Paper grain texture via CSS noise */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
    opacity: 0.03;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
    background-repeat: repeat;
    background-size: 200px 200px;
}

/* --- Progress Bar --- */
#progress-bar {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 3px;
    background-color: var(--terracotta-clay);
    z-index: 10000;
    transition: width 0.1s linear;
}

/* --- Fixed Brand --- */
#site-brand {
    position: fixed;
    top: 1.5rem;
    left: 1.5rem;
    font-family: 'Archivo Black', sans-serif;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.3em;
    color: var(--charred-umber);
    opacity: 0.6;
    z-index: 100;
    writing-mode: horizontal-tb;
}

@media (min-width: 1024px) {
    #site-brand {
        writing-mode: vertical-rl;
    }
}

/* --- Hero Section --- */
#hero {
    width: 100vw;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    background-color: var(--aged-vellum);
}

.hero-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
}

.hero-line {
    width: 60vw;
    height: 1px;
    background-color: var(--terracotta-clay);
    opacity: 0.25;
    transform: scaleX(0);
    transform-origin: center;
    order: 2;
}

.hero-line.animate {
    animation: drawLine 800ms ease-out forwards;
}

@keyframes drawLine {
    from { transform: scaleX(0); }
    to { transform: scaleX(1); }
}

.hero-title {
    font-family: 'Archivo Black', sans-serif;
    font-size: clamp(2.5rem, 7vw, 5rem);
    color: var(--charred-umber);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    opacity: 0;
    transform: translateY(12px);
    order: 1;
    margin-bottom: 1.5rem;
}

.hero-title.animate {
    animation: fadeUp 600ms ease-out forwards;
}

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

.hero-subtitle {
    font-family: 'Source Serif 4', serif;
    font-style: italic;
    font-size: 1rem;
    color: var(--faded-signal);
    opacity: 0;
    transform: translateY(12px);
    order: 3;
    margin-top: 1.5rem;
}

.hero-subtitle.animate {
    animation: fadeUp 600ms ease-out forwards;
}

.hero-chevron {
    position: absolute;
    bottom: -30vh;
    left: 50%;
    transform: translateX(-50%);
    opacity: 0;
}

.hero-chevron.animate {
    opacity: 1;
    animation: pulseChevron 1.5s ease-in-out infinite;
}

@keyframes pulseChevron {
    0%, 100% { transform: translateX(-50%) translateY(0); }
    50% { transform: translateX(-50%) translateY(8px); }
}

/* --- Transition Zones --- */
.transition-zone {
    width: 100vw;
    height: 100vh;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.transition-wash {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.transition-wash--center {
    background: radial-gradient(ellipse 60% 40% at 50% 50%, #d4845040 0%, #d4845020 35%, transparent 70%);
}

.transition-wash--left {
    background: radial-gradient(ellipse 55% 45% at 30% 50%, #d4845040 0%, #d4845020 35%, transparent 70%);
}

.transition-wash--right {
    background: radial-gradient(ellipse 65% 35% at 70% 50%, #d4845040 0%, #d4845020 35%, transparent 70%);
}

.transition-rule {
    width: 70vw;
    height: 1px;
    background-color: var(--terracotta-clay);
    opacity: 0.25;
    position: relative;
}

.transition-rule::before,
.transition-rule::after {
    content: '';
    position: absolute;
    top: -2px;
    width: 1px;
    height: 5px;
    background-color: var(--terracotta-clay);
    opacity: 0.25;
}

.transition-rule::before {
    left: 0;
}

.transition-rule::after {
    right: 0;
}

/* --- Content Sections --- */
.content-section {
    width: 100vw;
    position: relative;
    padding: 6rem 0;
}

.section-grid {
    display: grid;
    grid-template-columns: [bleed-start] minmax(1.5rem, 1fr) [content-start] minmax(0, 52rem) [content-end] minmax(1.5rem, 1fr) [bleed-end];
    position: relative;
}

@media (min-width: 1200px) {
    .section-grid {
        grid-template-columns: [bleed-start] 1fr [content-start] minmax(0, 44rem) [margin-start] 12rem [content-end] 1fr [bleed-end];
    }
}

/* Section Number Watermark */
.section-number {
    grid-column: content-start / content-end;
    font-family: 'Bebas Neue', sans-serif;
    font-size: clamp(5rem, 12vw, 10rem);
    color: var(--terracotta-clay);
    opacity: 0;
    line-height: 1;
    pointer-events: none;
    position: relative;
    z-index: 1;
}

.section-number.revealed {
    opacity: 0.15;
    transition: opacity 500ms ease-out;
}

@media (max-width: 767px) {
    .section-number {
        font-size: clamp(3rem, 10vw, 5rem);
    }
}

/* Grid Coordinates */
.section-coords {
    grid-column: content-start / content-end;
    justify-self: end;
    font-family: 'Bebas Neue', sans-serif;
    font-size: 0.6rem;
    color: var(--faded-signal);
    opacity: 0.4;
    letter-spacing: 0.2em;
    position: absolute;
    top: 0;
    right: 2rem;
    z-index: 2;
}

/* Edge Bleeds */
.edge-bleed {
    grid-column: bleed-start / bleed-end;
    position: absolute;
    top: 0;
    height: 100%;
    pointer-events: none;
}

.edge-bleed--left {
    left: 0;
    width: 5vw;
    background: linear-gradient(180deg, transparent 0%, #c2703e10 20%, #c2703e18 50%, #c2703e10 80%, transparent 100%);
}

.edge-bleed--right {
    right: 0;
    width: 4vw;
    background: linear-gradient(180deg, transparent 0%, #c2703e10 25%, #c2703e15 55%, #c2703e10 85%, transparent 100%);
}

@media (max-width: 767px) {
    .edge-bleed {
        display: none;
    }
}

/* Signal Flow Diagrams */
.signal-flow {
    position: absolute;
    pointer-events: none;
    z-index: 0;
}

.signal-flow--01 {
    left: 2vw;
    top: 10%;
}

.signal-flow--02 {
    right: 2vw;
    top: 5%;
}

.signal-flow--03 {
    left: 1vw;
    top: 15%;
}

.signal-flow--04 {
    right: 3vw;
    top: 8%;
}

@media (max-width: 767px) {
    .signal-flow svg {
        width: 100px;
        height: 200px;
    }
}

/* Heading Wash */
.heading-wash {
    grid-column: content-start / content-end;
    position: absolute;
    top: 4rem;
    left: 0;
    width: 100%;
    height: 8rem;
    background: radial-gradient(ellipse 80% 60% at 20% 60%, #d4845020 0%, transparent 60%);
    pointer-events: none;
    z-index: 0;
}

/* Section Heading */
.section-heading {
    grid-column: content-start / content-end;
    font-family: 'Archivo Black', sans-serif;
    font-size: clamp(2rem, 5vw, 3.8rem);
    color: var(--charred-umber);
    text-transform: uppercase;
    letter-spacing: -0.02em;
    margin-top: -1.5rem;
    position: relative;
    z-index: 3;
    opacity: 0;
    transform: translateY(20px);
}

.section-heading.revealed {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 400ms ease-out, transform 400ms ease-out;
}

/* Watercolor hover effect container */
.section-heading::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0%;
    height: 0%;
    background: radial-gradient(ellipse at center, #d4845030 0%, transparent 70%);
    transform: translate(-50%, -50%);
    transition: width 400ms ease-out, height 400ms ease-out;
    pointer-events: none;
    z-index: -1;
}

.section-heading:hover::before {
    width: 200%;
    height: 150%;
}

/* Section Body */
.section-body {
    grid-column: content-start / content-end;
    margin-top: 2rem;
    position: relative;
    z-index: 3;
}

@media (min-width: 1200px) {
    .section-body {
        grid-column: content-start / margin-start;
    }
}

.section-body p {
    font-family: 'Source Serif 4', serif;
    font-size: clamp(1rem, 1.8vw, 1.2rem);
    line-height: 1.75;
    color: var(--deep-inkstone);
    max-width: 44rem;
    margin-bottom: 1.5rem;
    opacity: 0;
    transform: translateY(10px);
}

.section-body p.revealed {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 300ms ease-out, transform 300ms ease-out;
}

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

/* Marginalia */
.section-marginalia {
    display: none;
    grid-column: margin-start / content-end;
    margin-top: 2rem;
    position: relative;
    z-index: 3;
    padding-left: 1.5rem;
    border-left: 1px solid rgba(194, 112, 62, 0.15);
}

@media (min-width: 1200px) {
    .section-marginalia {
        display: block;
        opacity: 0;
    }

    .section-marginalia.revealed {
        opacity: 1;
        transition: opacity 400ms ease-out;
    }
}

/* Mobile marginalia as blockquote */
@media (max-width: 1199px) {
    .section-marginalia {
        display: block;
        grid-column: content-start / content-end;
        margin-top: 1.5rem;
        padding-left: 1rem;
        border-left: 2px solid rgba(194, 112, 62, 0.4);
        opacity: 0;
    }

    .section-marginalia.revealed {
        opacity: 1;
        transition: opacity 400ms ease-out;
    }
}

.margin-note {
    font-family: 'Source Serif 4', serif;
    font-style: italic;
    font-size: 0.8rem;
    line-height: 1.6;
    color: var(--faded-signal);
}

/* Pulse Nodes */
.pulse-node {
    position: absolute;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background-color: var(--terracotta-clay);
    opacity: 0.2;
    animation: pulseNode 3s ease-in-out infinite;
    z-index: 2;
}

@keyframes pulseNode {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.4); }
}

.pulse-node--1 {
    top: 30%;
    left: 8vw;
}

.pulse-node--2 {
    bottom: 20%;
    right: 6vw;
}

.pulse-node--3 {
    top: 45%;
    right: 4vw;
}

.pulse-node--4 {
    top: 25%;
    left: 5vw;
}

.pulse-node--5 {
    bottom: 15%;
    left: 10vw;
}

.pulse-node--6 {
    bottom: 30%;
    right: 8vw;
}

/* --- Horizontal Rule Marks (composite dividers) --- */
.footer-rule {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    width: 70vw;
    max-width: 52rem;
    margin: 0 auto 2rem;
}

.rule-tick {
    display: block;
    width: 1px;
    height: 4px;
    background-color: var(--terracotta-clay);
    opacity: 0.25;
}

.rule-line {
    flex: 1;
    height: 1px;
    background-color: var(--terracotta-clay);
    opacity: 0.25;
}

/* --- Footer --- */
#site-footer {
    width: 100vw;
    padding: 4rem 0 6rem;
    text-align: center;
    position: relative;
}

.footer-text {
    font-family: 'Archivo Black', sans-serif;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.3em;
    color: var(--charred-umber);
    opacity: 0.5;
    margin-bottom: 0.5rem;
}

.footer-meta {
    font-family: 'Source Serif 4', serif;
    font-style: italic;
    font-size: 0.75rem;
    color: var(--faded-signal);
    opacity: 0.6;
}

/* --- Shake Animation --- */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    15%, 45%, 75% { transform: translateX(-6px); }
    30%, 60%, 90% { transform: translateX(6px); }
}

.shake {
    animation: shake 400ms ease-in-out;
}

.shake-short {
    animation: shake 200ms ease-in-out;
}

/* Radar amber glow for shake feedback */
.shake-glow {
    box-shadow: 0 0 12px var(--radar-amber);
    transition: box-shadow 600ms ease-out;
}

.shake-glow-fade {
    box-shadow: 0 0 0px transparent;
}

/* Progress bar flash */
#progress-bar.flash {
    background-color: #e8a045;
    transition: background-color 100ms;
}

#progress-bar.flash-fade {
    background-color: var(--terracotta-clay);
    transition: background-color 500ms;
}

/* --- Responsive Grid Simplification --- */
@media (max-width: 767px) {
    .section-grid {
        grid-template-columns: 1rem 1fr 1rem;
    }

    .section-number,
    .section-heading,
    .section-body,
    .section-marginalia,
    .section-coords,
    .heading-wash {
        grid-column: 2 / 3;
    }

    .section-coords {
        position: relative;
        right: auto;
        top: auto;
        justify-self: end;
        margin-bottom: 0.5rem;
    }

    #site-brand {
        writing-mode: horizontal-tb;
    }

    .transition-zone {
        height: 50vh;
    }
}

/* --- Dead-end link style --- */
a[data-disabled] {
    cursor: default;
    color: var(--faded-signal);
    text-decoration: none;
}

a[data-disabled].shake {
    color: var(--oxidized-iron);
    transition: color 300ms;
}

/* --- Selection color --- */
::selection {
    background-color: #d4845040;
    color: var(--charred-umber);
}
