/* ==========================================================
   historygrapher.com — Dark-Academia Diagonal-Sections
   ========================================================== */

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

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

body {
    background: #1A1410;
    color: #E8D8C0;
    font-family: 'Libre Baskerville', Georgia, serif;
    font-weight: 400;
    line-height: 1.85;
    font-size: clamp(15px, 1.05vw, 17px);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* ---- TYPOGRAPHY ---- */
.logotype {
    font-family: 'Libre Baskerville', Georgia, serif;
    font-weight: 700;
    font-size: clamp(28px, 4.5vw, 56px);
    letter-spacing: 0.03em;
    color: #E8D8C0;
    opacity: 0;
    transform: translateY(5px);
    animation: logotype-emerge 800ms ease-out 1000ms forwards;
}

.logotype-dot {
    color: #D4A040;
}

.section-title {
    font-family: 'Libre Baskerville', Georgia, serif;
    font-weight: 700;
    font-size: clamp(22px, 3vw, 40px);
    letter-spacing: 0.02em;
    color: #E8D8C0;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.tagline {
    font-family: 'Libre Baskerville', Georgia, serif;
    font-weight: 400;
    font-style: italic;
    font-size: clamp(14px, 1.2vw, 18px);
    color: #A0907A;
    max-width: 540px;
    margin-top: 1rem;
    opacity: 0;
    animation: fade-in 800ms ease-out 1800ms forwards;
}

/* ---- ANIMATIONS ---- */
@keyframes logotype-emerge {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fade-in {
    to {
        opacity: 1;
    }
}

@keyframes candle-glow-in {
    from { opacity: 0; }
    to { opacity: 0.15; }
}

@keyframes flame-flicker {
    0%, 100% {
        transform: scaleY(1) skewX(0deg);
    }
    25% {
        transform: scaleY(1.08) skewX(-2deg);
    }
    50% {
        transform: scaleY(0.92) skewX(1deg);
    }
    75% {
        transform: scaleY(1.05) skewX(-3deg);
    }
}

@keyframes glow-pulse {
    0%, 100% { opacity: 0.1; }
    50% { opacity: 0.2; }
}

@keyframes glitch-burst {
    0% {
        text-shadow: none;
        transform: translate(0, 0);
    }
    20% {
        text-shadow: 2px 0 #40C080, -2px 0 #D4A040;
        transform: translate(-2px, 0);
    }
    40% {
        text-shadow: -2px 0 #40C080, 2px 0 #D4A040;
        transform: translate(2px, 0);
    }
    60% {
        text-shadow: 1px 0 #40C080, -1px 0 #D4A040;
        transform: translate(-1px, 0);
    }
    80% {
        text-shadow: -1px 0 #40C080, 1px 0 #D4A040;
        transform: translate(1px, 0);
    }
    100% {
        text-shadow: none;
        transform: translate(0, 0);
    }
}

@keyframes media-slide-left {
    from {
        opacity: 0;
        transform: rotate(-3deg) translateX(-60px);
    }
    to {
        opacity: 1;
        transform: rotate(-3deg) translateX(0);
    }
}

@keyframes media-slide-right {
    from {
        opacity: 0;
        transform: rotate(2deg) translateX(60px);
    }
    to {
        opacity: 1;
        transform: rotate(2deg) translateX(0);
    }
}

@keyframes media-slide-up {
    from {
        opacity: 0;
        transform: rotate(4deg) translateY(40px);
    }
    to {
        opacity: 1;
        transform: rotate(4deg) translateY(0);
    }
}

@keyframes stagger-in-left {
    from {
        opacity: 0;
        transform: translateX(-40px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes stagger-in-right {
    from {
        opacity: 0;
        transform: translateX(40px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ---- SECTIONS (shared) ---- */
.section {
    position: relative;
    overflow: hidden;
}

/* ---- CANDLE GLOW ---- */
.candle-glow {
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
    z-index: 0;
}

.candle-glow--hero {
    width: 500px;
    height: 500px;
    top: 20%;
    left: 35%;
    background: radial-gradient(circle, #3A2A18 0%, transparent 70%);
    opacity: 0;
    animation: candle-glow-in 1000ms ease-in 200ms forwards;
}

.candle-glow--tools-left {
    width: 200px;
    height: 200px;
    top: 20%;
    left: 10%;
    background: radial-gradient(circle, rgba(212, 160, 64, 0.15) 0%, transparent 70%);
    animation: glow-pulse 4s ease-in-out infinite;
}

.candle-glow--tools-right {
    width: 160px;
    height: 160px;
    top: 40%;
    right: 15%;
    background: radial-gradient(circle, rgba(212, 160, 64, 0.12) 0%, transparent 70%);
    animation: glow-pulse 4s ease-in-out infinite 2s;
}

.candle-glow--gallery {
    width: 300px;
    height: 300px;
    top: 30%;
    left: 50%;
    transform: translateX(-50%);
    background: radial-gradient(circle, rgba(212, 160, 64, 0.1) 0%, transparent 70%);
    animation: glow-pulse 4s ease-in-out infinite 1s;
}

.candle-glow--demo {
    width: 400px;
    height: 400px;
    top: 20%;
    left: 40%;
    background: radial-gradient(circle, rgba(212, 160, 64, 0.1) 0%, transparent 70%);
    animation: glow-pulse 4s ease-in-out infinite;
}

/* ---- DIAGONAL CUTS ---- */
.diagonal-cut {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 120px;
    z-index: 2;
}

.diagonal-cut--hero {
    background: #2A2018;
    clip-path: polygon(0 100%, 100% 40%, 100% 100%);
}

.diagonal-cut--tools {
    background: #3A2A18;
    clip-path: polygon(0 40%, 100% 100%, 0 100%);
}

.diagonal-cut--gallery {
    background: #1A1410;
    clip-path: polygon(0 100%, 100% 50%, 100% 100%);
}

/* ============================================
   SECTION 1: HERO
   ============================================ */
.section--hero {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 6rem 8vw 10rem;
    background: #1A1410;
    background-image: radial-gradient(ellipse at 40% 40%, #3A2A18 0%, transparent 60%);
}

.hero-content {
    position: relative;
    z-index: 1;
}

.mixed-media-composition {
    position: relative;
    margin-top: 3rem;
    height: 200px;
    z-index: 1;
}

.media-piece {
    position: absolute;
    background: rgba(42, 32, 24, 0.8);
    border: 1px solid #4A3A28;
    padding: 1rem;
    opacity: 0;
}

.media-piece--timeline {
    top: 0;
    left: 0;
    width: 420px;
    transform: rotate(-3deg);
    animation: media-slide-left 600ms cubic-bezier(0.34, 1.56, 0.64, 1) 1400ms forwards;
}

.media-piece--document {
    top: 20px;
    left: 320px;
    width: 280px;
    transform: rotate(2deg);
    animation: media-slide-right 600ms cubic-bezier(0.34, 1.56, 0.64, 1) 1600ms forwards;
    filter: sepia(0.3);
}

.media-piece--sketch {
    top: -10px;
    right: 10%;
    width: 220px;
    transform: rotate(4deg);
    animation: media-slide-up 600ms cubic-bezier(0.34, 1.56, 0.64, 1) 1800ms forwards;
}

.timeline-fragment {
    width: 100%;
    height: auto;
}

.graph-fragment {
    width: 100%;
    height: auto;
}

.document-texture {
    padding: 0.5rem;
}

.document-text {
    font-family: 'Libre Baskerville', Georgia, serif;
    font-style: italic;
    font-size: 14px;
    color: #E8D8C0;
    line-height: 1.6;
}

.document-attr {
    font-family: 'DM Mono', monospace;
    font-size: 11px;
    color: #A0907A;
    display: block;
    margin-top: 0.5rem;
}

/* ============================================
   SECTION 2: TOOLS
   ============================================ */
.section--tools {
    background: #2A2018;
    padding: 10rem 8vw 12rem;
    clip-path: polygon(0 0, 100% 5%, 100% 95%, 0 100%);
    margin-top: -60px;
}

.tools-content {
    position: relative;
    z-index: 1;
    max-width: 900px;
    margin: 0 auto;
}

.flame-icon {
    width: 14px;
    height: 20px;
    flex-shrink: 0;
}

.flame-icon--small {
    width: 10px;
    height: 14px;
}

.flame-icon .candle-flame,
.flame-icon path:first-child {
    transform-origin: center bottom;
    animation: flame-flicker 800ms ease-in-out infinite;
}

.tool-showcase {
    margin-top: 2rem;
}

.tool-interface {
    background: #1A1410;
    border: 1px solid #4A3A28;
    border-radius: 4px;
    overflow: hidden;
}

.tool-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1.25rem;
    background: rgba(74, 58, 40, 0.3);
    border-bottom: 1px solid #4A3A28;
}

.tool-label {
    font-family: 'DM Mono', monospace;
    font-size: 11px;
    color: #D4A040;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.tool-meta {
    font-family: 'DM Mono', monospace;
    font-size: 11px;
    color: #A0907A;
}

.tool-canvas {
    padding: 2rem 1.5rem;
    position: relative;
    overflow-x: auto;
}

.tool-timeline {
    width: 100%;
    height: auto;
    min-width: 600px;
}

.timeline-node {
    cursor: pointer;
    transition: filter 200ms ease;
}

.timeline-node:hover circle {
    filter: drop-shadow(0 0 8px rgba(212, 160, 64, 0.5));
}

.tool-status {
    display: flex;
    gap: 1.5rem;
    padding: 0.75rem 1.25rem;
    border-top: 1px solid #4A3A28;
    font-family: 'DM Mono', monospace;
    font-size: 11px;
    color: #A0907A;
}

.tool-status-item {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.tool-status-item--glitch {
    color: #40C080;
    animation: glitch-burst 100ms linear;
    animation-play-state: paused;
}

.tool-status-item--glitch:hover {
    animation-play-state: running;
    animation-iteration-count: 1;
}

/* ============================================
   SECTION 3: GALLERY
   ============================================ */
.section--gallery {
    background: #3A2A18;
    padding: 10rem 8vw 12rem;
    clip-path: polygon(0 5%, 100% 0, 100% 100%, 0 95%);
    margin-top: -60px;
}

.gallery-content {
    position: relative;
    z-index: 1;
    max-width: 1000px;
    margin: 0 auto;
}

.section-title--gallery {
    text-align: center;
    justify-content: center;
}

.collage {
    position: relative;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: auto auto;
    gap: 2rem;
    margin-top: 3rem;
}

.collage-piece {
    background: rgba(26, 20, 16, 0.8);
    border: 1px solid #4A3A28;
    padding: 1.5rem;
    transition: transform 300ms ease, box-shadow 300ms ease;
}

.collage-piece:hover {
    box-shadow: 0 0 30px rgba(212, 160, 64, 0.1);
}

.collage-piece--1 {
    transform: rotate(-2deg);
    grid-column: 1 / 2;
}

.collage-piece--1:hover {
    transform: rotate(-2deg) translateY(-4px);
}

.collage-piece--2 {
    transform: rotate(1.5deg);
    grid-column: 2 / 3;
}

.collage-piece--2:hover {
    transform: rotate(1.5deg) translateY(-4px);
}

.collage-piece--3 {
    transform: rotate(-3deg);
    grid-column: 3 / 4;
    filter: sepia(0.4) contrast(1.1);
}

.collage-piece--3:hover {
    transform: rotate(-3deg) translateY(-4px);
}

.collage-piece--4 {
    transform: rotate(2.5deg);
    grid-column: 1 / 2;
}

.collage-piece--4:hover {
    transform: rotate(2.5deg) translateY(-4px);
}

.collage-piece--5 {
    transform: rotate(-1deg);
    grid-column: 2 / 4;
}

.collage-piece--5:hover {
    transform: rotate(-1deg) translateY(-4px);
}

.collage-inner {
    min-height: 120px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.collage-inner--graph {
    display: flex;
    align-items: center;
    justify-content: center;
}

.collage-inner--graph svg {
    width: 100%;
    height: auto;
}

.collage-inner--document {
    display: flex;
    align-items: center;
    justify-content: center;
}

.collage-quote {
    font-family: 'Libre Baskerville', Georgia, serif;
    font-style: italic;
    font-size: clamp(14px, 1.1vw, 17px);
    color: #E8D8C0;
    line-height: 1.7;
}

.collage-quote--small {
    font-size: clamp(13px, 1vw, 15px);
}

.collage-source {
    font-family: 'DM Mono', monospace;
    font-size: 11px;
    color: #A0907A;
    margin-top: 0.75rem;
}

.faux-document {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 0.5rem;
}

.faux-line {
    height: 2px;
    background: #A0907A;
    opacity: 0.3;
    border-radius: 1px;
}

/* ============================================
   SECTION 4: DEMO
   ============================================ */
.section--demo {
    background: #1A1410;
    padding: 8rem 8vw 6rem;
    margin-top: -60px;
}

.demo-content {
    position: relative;
    z-index: 1;
    max-width: 1000px;
    margin: 0 auto;
}

.demo-subtitle {
    font-family: 'Libre Baskerville', Georgia, serif;
    font-style: italic;
    font-size: 14px;
    color: #A0907A;
    margin-bottom: 2rem;
}

.demo-canvas {
    position: relative;
    background: rgba(42, 32, 24, 0.3);
    border: 1px solid #4A3A28;
    border-radius: 4px;
    padding: 2rem;
    overflow-x: auto;
}

.demo-timeline {
    width: 100%;
    height: auto;
    min-width: 700px;
}

.demo-node {
    cursor: pointer;
}

.demo-node-glow {
    transition: opacity 200ms ease;
}

.demo-node-ring {
    transition: stroke-width 200ms ease, r 200ms ease;
}

.demo-node:hover .demo-node-glow {
    opacity: 0.15;
}

.demo-node:hover .demo-node-ring {
    stroke-width: 3;
}

.demo-node.active .demo-node-glow {
    opacity: 0.3;
}

.demo-node.active .demo-node-ring {
    stroke-width: 3;
    stroke: #D4A040;
}

.demo-node.active .demo-node-core {
    fill: #E8D8C0;
}

.demo-connection {
    transition: opacity 300ms ease;
}

.demo-connection.highlighted {
    opacity: 0.8;
    stroke-width: 2.5;
}

.demo-info {
    position: absolute;
    bottom: 1.5rem;
    right: 1.5rem;
    width: 320px;
    background: rgba(26, 20, 16, 0.95);
    border: 1px solid #4A3A28;
    border-radius: 4px;
    padding: 1.25rem;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 300ms ease, transform 300ms ease;
    pointer-events: none;
}

.demo-info.visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.demo-info-year {
    font-family: 'DM Mono', monospace;
    font-size: 12px;
    color: #D4A040;
    letter-spacing: 0.05em;
}

.demo-info-event {
    font-family: 'Libre Baskerville', Georgia, serif;
    font-weight: 700;
    font-size: 18px;
    color: #E8D8C0;
    margin: 0.25rem 0 0.5rem;
}

.demo-info-detail {
    font-family: 'Libre Baskerville', Georgia, serif;
    font-size: 13px;
    color: #A0907A;
    line-height: 1.7;
}

/* ============================================
   FOOTER
   ============================================ */
.site-footer {
    background: #0A0A08;
    padding: 3rem 8vw;
    text-align: center;
}

.footer-rule {
    width: 80px;
    height: 1px;
    background: #D4A040;
    margin: 0 auto 2rem;
}

.footer-nav {
    display: flex;
    justify-content: center;
    gap: 2.5rem;
    margin-bottom: 2rem;
}

.footer-link {
    font-family: 'Libre Baskerville', Georgia, serif;
    font-variant: small-caps;
    font-size: 14px;
    color: #A0907A;
    text-decoration: none;
    letter-spacing: 0.08em;
    transition: color 200ms ease;
}

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

.footer-candle {
    margin: 1.5rem auto;
    width: 20px;
    height: 40px;
}

.candle-svg {
    width: 100%;
    height: 100%;
}

.candle-flame-group {
    transform-origin: 10px 16px;
    animation: flame-flicker 800ms ease-in-out infinite;
}

.candle-flame {
    transform-origin: center bottom;
}

.footer-copy {
    font-family: 'DM Mono', monospace;
    font-size: 11px;
    color: #4A3A28;
    margin-top: 1rem;
}

/* ============================================
   SCROLL REVEAL (JS applies .revealed)
   ============================================ */
.reveal-on-scroll {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 600ms ease, transform 600ms ease;
}

.reveal-on-scroll.revealed {
    opacity: 1;
    transform: translateY(0);
}

.reveal-left {
    opacity: 0;
    transform: translateX(-40px);
    transition: opacity 600ms ease, transform 600ms ease;
}

.reveal-left.revealed {
    opacity: 1;
    transform: translateX(0);
}

.reveal-right {
    opacity: 0;
    transform: translateX(40px);
    transition: opacity 600ms ease, transform 600ms ease;
}

.reveal-right.revealed {
    opacity: 1;
    transform: translateX(0);
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 900px) {
    .mixed-media-composition {
        height: auto;
        display: flex;
        flex-direction: column;
        gap: 1rem;
    }

    .media-piece {
        position: relative;
        width: 100% !important;
        top: auto !important;
        left: auto !important;
        right: auto !important;
    }

    .media-piece--timeline {
        transform: rotate(-1deg);
    }

    .media-piece--document {
        transform: rotate(1deg);
    }

    .media-piece--sketch {
        transform: rotate(-0.5deg);
    }

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

    .collage-piece--5 {
        grid-column: 1;
    }

    .section--tools {
        clip-path: polygon(0 0, 100% 2%, 100% 98%, 0 100%);
        padding: 6rem 5vw 8rem;
    }

    .section--gallery {
        clip-path: polygon(0 2%, 100% 0, 100% 100%, 0 98%);
        padding: 6rem 5vw 8rem;
    }

    .demo-info {
        position: relative;
        bottom: auto;
        right: auto;
        width: 100%;
        margin-top: 1rem;
    }
}

@media (max-width: 600px) {
    .section--hero {
        padding: 4rem 5vw 8rem;
    }

    .tool-canvas {
        padding: 1rem;
    }

    .footer-nav {
        flex-direction: column;
        gap: 1rem;
        align-items: center;
    }
}
