/* ============================================================
   tsundere.tube — CSS
   Cottagecore romanticism × Glitch-art disruption
   ============================================================ */

/* --- Google Font Import (fallback in case HTML link is cached) --- */
@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,400;0,700;1,400;1,700&family=DM+Mono:wght@400;500&family=Lora:wght@400;500&display=swap');

/* ============================================================
   CSS Custom Properties
   ============================================================ */
:root {
    /* Color Palette */
    --linen-cream:     #F5EDD9;
    --dusk-umber:      #3D2B1F;
    --terracotta-rose: #C4714A;
    --amber-glow:      #D4953A;
    --sage-moss:       #7A8C5E;
    --forest-floor:    #4A3728;
    --warm-card:       #FBF3E4;
    --glitch-cyan:     #7FDFED;
    --glitch-magenta:  #F06090;

    /* Typography Scale — Variable Fluid */
    --text-xs:   clamp(0.65rem, 1vw, 0.75rem);
    --text-sm:   clamp(0.8rem,  1.5vw, 0.9rem);
    --text-base: clamp(1rem,    2vw, 1.15rem);
    --text-lg:   clamp(1.2rem,  2.5vw, 1.4rem);
    --text-xl:   clamp(1.5rem,  4vw, 2rem);
    --text-2xl:  clamp(2rem,    6vw, 3.5rem);
    --text-hero: clamp(2.8rem,  8vw, 5.5rem);

    /* Layout */
    --column-width: 640px;
    --column-gutter-mobile: 24px;
    --column-gutter-desktop: 48px;
    --section-padding: 80px;
}

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

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

body {
    background-color: var(--linen-cream);
    color: var(--dusk-umber);
    font-family: 'Lora', Georgia, serif;
    font-size: var(--text-base);
    line-height: 1.75;
    overflow-x: hidden;
}

/* ============================================================
   Scroll Container — Narrative Scroll Architecture
   ============================================================ */
.scroll-container {
    scroll-snap-type: y proximity;
    overflow-y: scroll;
    height: 100vh;
}

/* ============================================================
   Section Base — Reveal Animation
   ============================================================ */
section {
    scroll-snap-align: start;
    min-height: 100vh;
    position: relative;
    overflow: hidden;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.4s ease-out, transform 0.4s ease-out;
}

section.revealed {
    opacity: 1;
    transform: translateY(0);
}

.section-inner {
    max-width: var(--column-width);
    margin: 0 auto;
    padding: var(--section-padding) var(--column-gutter-desktop);
    position: relative;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* ============================================================
   Typography Helpers
   ============================================================ */
.dm-mono {
    font-family: 'DM Mono', 'Courier New', monospace;
}

.section-label {
    font-family: 'DM Mono', monospace;
    font-size: var(--text-xs);
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--terracotta-rose);
    display: block;
    margin-bottom: 1.5rem;
}

.section-label-light {
    color: rgba(245, 237, 217, 0.6);
}

/* ============================================================
   Links — Tsundere Personality
   Leans away first (translateX(-2px)), then accepts (underline)
   ============================================================ */
a {
    color: var(--terracotta-rose);
    text-decoration: none;
    transition: transform 0.1s ease, text-decoration-color 0.15s ease;
    display: inline-block;
}

a:hover {
    text-decoration: underline;
    text-decoration-color: var(--terracotta-rose);
    transform: translateX(-2px);
}

/* ============================================================
   Section 1: The Threshold (Hero)
   ============================================================ */
.section-threshold {
    background-color: var(--linen-cream);
}

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

.hero-title {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: var(--text-hero);
    font-weight: 700;
    font-style: italic;
    color: var(--dusk-umber);
    line-height: 1.05;
    margin-bottom: 1.5rem;
    margin-left: -12px; /* Slightly off-center per design */
}

.hero-title em {
    font-style: italic;
    color: var(--terracotta-rose);
}

.hero-tagline {
    font-family: 'Lora', serif;
    font-size: var(--text-lg);
    color: var(--forest-floor);
    line-height: 1.6;
    font-style: italic;
}

/* Scroll hint */
.scroll-hint {
    position: absolute;
    bottom: 40px;
    left: var(--column-gutter-desktop);
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--sage-moss);
    font-size: var(--text-xs);
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.scroll-hint-line {
    width: 40px;
    height: 1px;
    background-color: var(--sage-moss);
    animation: hint-pulse 2s ease-in-out infinite;
}

@keyframes hint-pulse {
    0%, 100% { opacity: 1; width: 40px; }
    50%       { opacity: 0.4; width: 24px; }
}

/* ============================================================
   Diamond Badge (Primary Motif)
   ============================================================ */
.diamond-badge {
    width: 40px;
    height: 40px;
    background-color: var(--amber-glow);
    border: 1px solid var(--terracotta-rose);
    transform: rotate(45deg);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    position: absolute;
    z-index: 3;
}

.diamond-badge:hover {
    transform: rotate(45deg) scale(1.2);
}

/* Diamond pulse — hero breathes */
.diamond-hero {
    top: 80px;
    right: var(--column-gutter-desktop);
    animation: diamond-breathe 4s ease-in-out infinite, ripple-expand 3s ease-out infinite;
}

.diamond-footer {
    bottom: 120px;
    left: var(--column-gutter-desktop);
}

@keyframes diamond-breathe {
    0%, 100% { transform: rotate(45deg) scale(1.0); }
    50%       { transform: rotate(45deg) scale(1.08); }
}

/* ============================================================
   Ripple Animation (Amber Glow rings)
   ============================================================ */
@keyframes ripple-expand {
    0%   { box-shadow: 0 0 0 0px   rgba(212, 149, 58, 0.7); }
    40%  { box-shadow: 0 0 0 40px  rgba(212, 149, 58, 0.3); }
    80%  { box-shadow: 0 0 0 80px  rgba(212, 149, 58, 0.1); }
    100% { box-shadow: 0 0 0 120px rgba(212, 149, 58, 0); }
}

@keyframes ripple-expand-slow {
    0%   { box-shadow: 0 0 0 0px   rgba(212, 149, 58, 0.5); }
    40%  { box-shadow: 0 0 0 60px  rgba(212, 149, 58, 0.25); }
    80%  { box-shadow: 0 0 0 120px rgba(212, 149, 58, 0.08); }
    100% { box-shadow: 0 0 0 180px rgba(212, 149, 58, 0); }
}

.ripple-origin {
    position: relative;
}

.ripple-origin::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50%;
    animation: ripple-expand 3s ease-out infinite;
    pointer-events: none;
}

.ripple-origin::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50%;
    animation: ripple-expand 3s ease-out infinite 1.5s;
    pointer-events: none;
}

.ripple-slow::after {
    animation: ripple-expand-slow 8s ease-out infinite;
}

.ripple-slow::before {
    animation: ripple-expand-slow 8s ease-out infinite 4s;
}

/* ============================================================
   Diamond Fragments in Margins
   ============================================================ */
.diamond-fragment {
    width: 20px;
    height: 20px;
    background-color: var(--amber-glow);
    transform: rotate(45deg);
    position: absolute;
    opacity: 0.65;
    z-index: 1;
}

/* Offsets — escape into left margin outside 640px column */
.df-1 { left: -28px; top: 140px; opacity: 0.5; }
.df-2 { left: -18px; top: 280px; opacity: 0.35; width: 14px; height: 14px; }
.df-3 { left: -38px; top: 420px; opacity: 0.25; width: 10px; height: 10px; }

/* ============================================================
   Triangle Fragments (Tertiary Motif)
   ============================================================ */
.triangle-fragment {
    width: 0;
    height: 0;
    position: absolute;
    z-index: 1;
    opacity: 0.4;
}

/* Up-pointing triangles */
.tf-1 {
    border-left: 10px solid transparent;
    border-right: 10px solid transparent;
    border-bottom: 18px solid var(--terracotta-rose);
    top: 160px;
    right: calc(var(--column-gutter-desktop) + 80px);
}

.tf-2 {
    border-left: 7px solid transparent;
    border-right: 7px solid transparent;
    border-bottom: 13px solid var(--sage-moss);
    top: 380px;
    right: calc(var(--column-gutter-desktop) + 20px);
    opacity: 0.3;
}

.tf-3 {
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-bottom: 15px solid var(--amber-glow);
    top: 200px;
    right: calc(var(--column-gutter-desktop) + 60px);
    opacity: 0.35;
}

.tf-4 {
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-bottom: 11px solid var(--terracotta-rose);
    top: 120px;
    right: calc(var(--column-gutter-desktop) + 30px);
    opacity: 0.4;
}

.tf-footer-1 {
    border-left: 9px solid transparent;
    border-right: 9px solid transparent;
    border-bottom: 16px solid rgba(245, 237, 217, 0.3);
    top: 100px;
    right: calc(var(--column-gutter-desktop) + 50px);
}

.tf-footer-2 {
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-bottom: 11px solid rgba(212, 149, 58, 0.4);
    top: 200px;
    right: calc(var(--column-gutter-desktop) + 100px);
}

/* ============================================================
   Section 2: The Garden Corridor
   ============================================================ */
.section-garden {
    background-color: var(--linen-cream);
}

.garden-content {
    position: relative;
    z-index: 2;
}

.bordered-column {
    border-left: 2px dashed var(--terracotta-rose);
    padding-left: 28px;
}

.section-title {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: var(--text-2xl);
    font-weight: 700;
    color: var(--dusk-umber);
    line-height: 1.15;
    margin-bottom: 1.5rem;
}

.body-prose {
    font-family: 'Lora', serif;
    font-size: var(--text-base);
    color: var(--forest-floor);
    line-height: 1.75;
    margin-bottom: 1.25rem;
}

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

/* ============================================================
   Section 3: The Glitch Meadow
   ============================================================ */
.section-glitch {
    background-color: var(--dusk-umber);
    display: flex;
    align-items: center;
    min-height: 70vh;
}

.section-glitch .section-inner {
    min-height: 70vh;
    justify-content: center;
    padding-top: 60px;
    padding-bottom: 60px;
}

/* The geometric shape field */
.glitch-field {
    position: relative;
    width: 100%;
    height: 340px;
    margin: 2rem 0;
}

/* --- Geometric shapes (botanical proxies) --- */
.geo-shape {
    position: absolute;
    transition: filter 0.1s, transform 0.1s;
}

/* Circles */
.geo-circle {
    border-radius: 50%;
}

.gc-1 {
    width: 80px; height: 80px;
    background-color: var(--terracotta-rose);
    top: 20px; left: 60px;
    opacity: 0.85;
}

.gc-2 {
    width: 48px; height: 48px;
    background-color: var(--amber-glow);
    top: 180px; right: 80px;
    opacity: 0.7;
}

/* Hexagons via clip-path */
.geo-hex {
    width: 32px; height: 32px;
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
}

.gh-1 {
    background-color: var(--sage-moss);
    top: 60px; left: 180px;
}

.gh-2 {
    background-color: var(--terracotta-rose);
    top: 240px; left: 100px;
    width: 24px; height: 24px;
}

.gh-3 {
    background-color: var(--amber-glow);
    top: 100px; right: 140px;
    width: 40px; height: 40px;
}

/* Diamonds */
.geo-diamond {
    width: 36px; height: 36px;
    transform: rotate(45deg);
    background-color: var(--amber-glow);
    border: 1px solid var(--terracotta-rose);
}

.gd-1 {
    top: 160px; left: 240px;
}

.gd-2 {
    top: 60px; right: 60px;
    width: 28px; height: 28px;
    background-color: var(--sage-moss);
}

/* Triangles (CSS border trick) */
.geo-triangle {
    width: 0; height: 0;
}

.gt-1 {
    border-left: 24px solid transparent;
    border-right: 24px solid transparent;
    border-bottom: 42px solid var(--terracotta-rose);
    top: 180px; right: 200px;
    opacity: 0.75;
}

.gt-2 {
    border-left: 16px solid transparent;
    border-right: 16px solid transparent;
    border-bottom: 28px solid var(--amber-glow);
    top: 280px; left: 300px;
    opacity: 0.65;
}

.gt-3 {
    border-left: 12px solid transparent;
    border-right: 12px solid transparent;
    border-bottom: 20px solid var(--sage-moss);
    top: 40px; right: 260px;
    opacity: 0.5;
}

/* Rings (outline circles) */
.geo-ring {
    border-radius: 50%;
    background: transparent;
    border: 2px solid;
}

.gr-1 {
    width: 60px; height: 60px;
    border-color: var(--sage-moss);
    top: 240px; right: 180px;
    opacity: 0.55;
}

.gr-2 {
    width: 36px; height: 36px;
    border-color: var(--amber-glow);
    top: 140px; left: 340px;
    opacity: 0.45;
}

/* Glitch caption */
.glitch-caption {
    font-size: var(--text-xs);
    color: rgba(245, 237, 217, 0.4);
    letter-spacing: 0.15em;
    text-transform: uppercase;
    display: block;
    text-align: center;
    margin-top: 1rem;
}

/* ============================================================
   Glitch Animation — fires on Intersection Observer entry
   ============================================================ */
@keyframes glitch-shift {
    0%   { transform: translateX(0);    filter: none; }
    20%  { transform: translateX(-6px); filter: drop-shadow(4px 0 0 #7FDFED) drop-shadow(-4px 0 0 #F06090); }
    40%  { transform: translateX(4px);  filter: drop-shadow(-3px 0 0 #7FDFED) drop-shadow(3px 0 0 #F06090); }
    60%  { transform: translateX(-2px); filter: drop-shadow(2px 0 0 #7FDFED); }
    80%  { transform: translateX(1px);  filter: none; }
    100% { transform: translateX(0);    filter: none; }
}

.glitch-active .geo-shape {
    animation: glitch-shift 0.6s steps(4, end);
}

/* Override diamond's rotate when glitch-active — preserve rotation */
.glitch-active .geo-diamond {
    animation: glitch-shift-diamond 0.6s steps(4, end);
}

@keyframes glitch-shift-diamond {
    0%   { transform: rotate(45deg) translateX(0);    filter: none; }
    20%  { transform: rotate(45deg) translateX(-6px); filter: drop-shadow(4px 0 0 #7FDFED) drop-shadow(-4px 0 0 #F06090); }
    40%  { transform: rotate(45deg) translateX(4px);  filter: drop-shadow(-3px 0 0 #7FDFED) drop-shadow(3px 0 0 #F06090); }
    60%  { transform: rotate(45deg) translateX(-2px); filter: drop-shadow(2px 0 0 #7FDFED); }
    80%  { transform: rotate(45deg) translateX(1px);  filter: none; }
    100% { transform: rotate(45deg) translateX(0);    filter: none; }
}

/* ============================================================
   Section 4: The Catalog
   ============================================================ */
.section-catalog {
    background-color: var(--linen-cream);
}

.catalog-list {
    margin-top: 2rem;
    position: relative;
}

.catalog-card {
    display: flex;
    gap: 20px;
    padding: 28px 0;
    position: relative;
    cursor: default;
    transition: background-color 0.3s ease 0.2s; /* 200ms tsundere delay */
    border-radius: 4px;
    padding-left: 8px;
    padding-right: 8px;
}

.catalog-card:hover {
    background-color: var(--warm-card);
}

/* Wavy SVG dividers */
.wavy-divider {
    display: block;
    width: 100%;
    height: 8px;
    overflow: visible;
}

/* Card badge shapes */
.card-badge {
    flex-shrink: 0;
    margin-top: 4px;
    position: relative;
}

/* Diamond badge */
.badge-diamond {
    width: 22px;
    height: 22px;
    background-color: var(--amber-glow);
    border: 1px solid var(--terracotta-rose);
    transform: rotate(45deg);
    transition: transform 0.2s ease;
    align-self: flex-start;
    margin-top: 8px;
}

.badge-diamond:hover {
    transform: rotate(45deg) scale(1.2);
}

.badge-diamond-alt {
    background-color: var(--terracotta-rose);
    border-color: var(--amber-glow);
}

/* Hexagon badge */
.badge-hexagon {
    width: 26px;
    height: 26px;
    background-color: var(--sage-moss);
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    align-self: flex-start;
    margin-top: 6px;
}

.badge-hexagon-alt {
    background-color: var(--terracotta-rose);
}

/* Triangle badge */
.badge-triangle {
    width: 0;
    height: 0;
    border-left: 12px solid transparent;
    border-right: 12px solid transparent;
    border-bottom: 21px solid var(--amber-glow);
    align-self: flex-start;
    margin-top: 8px;
    background: none;
}

.card-body {
    flex: 1;
}

.card-category {
    font-size: var(--text-xs);
    color: var(--terracotta-rose);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    display: block;
    margin-bottom: 0.5rem;
}

.card-title {
    font-family: 'Playfair Display', serif;
    font-size: var(--text-lg);
    font-weight: 700;
    color: var(--dusk-umber);
    line-height: 1.3;
    margin-bottom: 0.6rem;
}

.card-desc {
    font-family: 'Lora', serif;
    font-size: var(--text-sm);
    color: var(--forest-floor);
    line-height: 1.7;
    margin-bottom: 0.8rem;
}

.card-link {
    font-family: 'DM Mono', monospace;
    font-size: var(--text-xs);
    color: var(--terracotta-rose);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    text-decoration: none;
    transition: transform 0.1s ease, text-decoration-color 0.15s ease;
    display: inline-block;
}

.card-link:hover {
    text-decoration: underline;
    text-decoration-color: var(--terracotta-rose);
    transform: translateX(-2px);
}

/* ============================================================
   Section 5: The Interlude (Full-width ripple panel)
   ============================================================ */
.section-interlude {
    background-color: var(--dusk-umber);
    display: flex;
    align-items: center;
    justify-content: center;
}

.section-interlude .section-inner {
    justify-content: center;
    align-items: center;
    text-align: center;
    position: relative;
}

/* Ripple center — concentric CSS rings */
.ripple-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 4px;
    height: 4px;
    z-index: 1;
}

.ripple-ring {
    position: absolute;
    border-radius: 50%;
    border: 1.5px solid rgba(212, 149, 58, 0.4);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation: ring-expand 3s ease-out infinite;
}

.ripple-ring.r1 { animation-delay: 0s; }
.ripple-ring.r2 { animation-delay: 0.75s; }
.ripple-ring.r3 { animation-delay: 1.5s; }
.ripple-ring.r4 { animation-delay: 2.25s; }

@keyframes ring-expand {
    0%   { width: 0;    height: 0;    opacity: 0.9; }
    100% { width: 500px; height: 500px; opacity: 0; }
}

.interlude-text {
    position: relative;
    z-index: 2;
}

.interlude-quote {
    font-family: 'Playfair Display', serif;
    font-size: var(--text-xl);
    font-style: italic;
    color: var(--linen-cream);
    line-height: 1.5;
    margin: 1rem 0;
    border: none;
    padding: 0;
}

.interlude-quote em {
    color: var(--amber-glow);
}

.interlude-credit {
    font-size: var(--text-xs);
    color: rgba(245, 237, 217, 0.45);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    display: block;
    margin-top: 1.5rem;
}

/* ============================================================
   Section 6: The Threshold Reversed (Footer)
   ============================================================ */
.section-footer {
    background-color: var(--dusk-umber);
    min-height: 80vh;
}

.section-footer .section-inner {
    min-height: 80vh;
    justify-content: flex-end;
    padding-bottom: 64px;
}

.footer-content {
    position: relative;
    z-index: 2;
}

.footer-wordmark {
    font-size: var(--text-xl);
    color: var(--linen-cream);
    letter-spacing: 0.08em;
    margin-bottom: 0.75rem;
}

.footer-tagline {
    font-family: 'Lora', serif;
    font-size: var(--text-sm);
    color: rgba(245, 237, 217, 0.5);
    font-style: italic;
    margin-bottom: 1.5rem;
}

.footer-meta {
    font-size: var(--text-xs);
    color: rgba(245, 237, 217, 0.35);
    letter-spacing: 0.1em;
    display: flex;
    align-items: center;
    gap: 12px;
}

.footer-sep {
    color: var(--amber-glow);
    opacity: 0.5;
}

.footer-link {
    color: rgba(245, 237, 217, 0.5);
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-size: var(--text-xs);
    transition: color 0.15s ease 0.1s, transform 0.1s ease;
    display: inline-block;
}

.footer-link:hover {
    color: var(--amber-glow);
    text-decoration: none;
    transform: translateX(-2px);
}

/* ============================================================
   Responsive — Mobile
   ============================================================ */
@media (max-width: 720px) {
    .section-inner {
        padding: 60px var(--column-gutter-mobile);
    }

    /* Hide margin fragments on mobile — prevent overflow */
    .diamond-fragment,
    .triangle-fragment {
        display: none;
    }

    .diamond-hero {
        top: 40px;
        right: 20px;
    }

    .glitch-field {
        height: 260px;
    }

    .catalog-card {
        gap: 14px;
    }

    .scroll-hint {
        left: var(--column-gutter-mobile);
    }

    @keyframes ring-expand {
        0%   { width: 0;    height: 0;    opacity: 0.9; }
        100% { width: 300px; height: 300px; opacity: 0; }
    }
}
