/* =======================================================
   HHASSL.com — The Cabinet of Secured Artifacts
   Flat-design · layered-depth · dark-neon · vintage glitch
   Typography source notes: (Google Fonts); Interactive elements (links) use neon pulse restraint.
   ======================================================= */

:root {
    --obsidian: #0a0a0f;
    --charcoal: #141420;
    --midnight-plum: #1e1a2e;
    --cyan: #00ffd5;
    --magenta: #ff2d7b;
    --amber: #ffb700;
    --text-primary: #e0dfe6;
    --text-secondary: #9690b0;
    --glitch-red: #ff003c;
    --sepia: #c9a96e;

    --f-display: "Josefin Sans", "Inter", sans-serif;
    --f-body: "DM Sans", "Inter", sans-serif;
    --f-serif: "Playfair Display", Georgia, serif;
    --f-mono: "IBM Plex Mono", "Space Mono", monospace;

    --col-max: 720px;

    --ease: cubic-bezier(.2,.7,.2,1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
    background: var(--obsidian);
    color: var(--text-primary);
    font-family: var(--f-body);
    font-size: 17px;
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    overflow-x: hidden;
}

body {
    background:
        radial-gradient(1200px 800px at 80% -10%, rgba(255,45,123,0.05), transparent 60%),
        radial-gradient(900px 700px at -10% 110%, rgba(0,255,213,0.05), transparent 60%),
        linear-gradient(180deg, #0a0a0f 0%, #141420 100%);
    min-height: 100vh;
    position: relative;
}

/* ============== Overlays ============== */
.grain-overlay {
    position: fixed; inset: 0;
    pointer-events: none;
    z-index: 9998;
    opacity: 0.06;
    mix-blend-mode: overlay;
    background-image:
        url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix type='saturate' values='0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)' opacity='0.8'/></svg>");
}

.scanlines {
    position: fixed; inset: 0;
    pointer-events: none;
    z-index: 9997;
    background: repeating-linear-gradient(
        0deg,
        transparent 0 1px,
        rgba(0,255,213,0.025) 1px 2px
    );
    opacity: 0.7;
}

/* ============== Nav ============== */
.site-nav {
    position: fixed;
    top: 0; left: 0; right: 0;
    padding: 22px 40px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    z-index: 100;
    background: linear-gradient(180deg, rgba(10,10,15,0.85), transparent);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.brand-mark {
    font-family: var(--f-display);
    text-decoration: none;
    color: var(--text-primary);
    display: inline-flex;
    align-items: baseline;
    gap: 6px;
    letter-spacing: 0.04em;
}
.brand-glyph {
    font-weight: 700;
    font-size: 18px;
    color: var(--cyan);
    text-shadow: 0 0 10px rgba(0,255,213,0.35);
}
.brand-word {
    font-weight: 400;
    font-size: 14px;
    color: var(--text-secondary);
    text-transform: lowercase;
}

.nav-links {
    list-style: none;
    display: flex;
    gap: 34px;
}
.nav-link {
    font-family: var(--f-mono);
    font-size: 12px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--text-secondary);
    text-decoration: none;
    position: relative;
    padding-bottom: 4px;
    transition: color 300ms var(--ease);
}
.nav-link::after {
    content: "";
    position: absolute;
    left: 0; bottom: 0;
    height: 1px; width: 0%;
    background: var(--cyan);
    transition: width 400ms var(--ease);
    box-shadow: 0 0 6px rgba(0,255,213,0.5);
}
.nav-link:hover { color: var(--text-primary); }
.nav-link:hover::after { width: 100%; }

/* ============== Sections ============== */
.section {
    position: relative;
    padding: 140px 40px 140px;
    min-height: 100vh;
    width: 100%;
    overflow: hidden;
}

.slice-top {
    background: var(--charcoal);
    clip-path: polygon(0 4%, 100% 0, 100% 96%, 0 100%);
    margin-top: -30px;
}
.slice-alt {
    background: var(--midnight-plum);
    clip-path: polygon(0 0, 100% 4%, 100% 100%, 0 96%);
    margin-top: -30px;
}

.chapter-inner {
    max-width: var(--col-max);
    margin: 0 auto;
    position: relative;
    z-index: 5;
}

/* ============== Parallax layers ============== */
.parallax-layer {
    position: absolute;
    inset: 0;
    pointer-events: none;
    will-change: transform;
}

/* ============== Hero ============== */
.hero {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding-top: 120px;
    background:
        radial-gradient(600px 400px at 50% 40%, rgba(30,26,46,0.8), transparent 70%),
        linear-gradient(180deg, #0a0a0f 0%, #14121e 100%);
}

.ornament {
    position: absolute;
    opacity: 0.5;
}
.ornament-rosette.top-left {
    top: 120px; left: 80px;
    width: 160px; height: 160px;
    animation: slow-spin 80s linear infinite;
}
.ornament-diamond.bottom-right {
    bottom: 100px; right: 100px;
    width: 100px; height: 100px;
    animation: slow-spin 120s linear infinite reverse;
}
@keyframes slow-spin {
    to { transform: rotate(360deg); }
}

.hero-emblem {
    position: absolute;
    top: 50%; left: 50%;
    width: 360px; height: 450px;
    transform: translate(-50%, -50%);
    opacity: 0.85;
    filter: drop-shadow(0 0 40px rgba(0,255,213,0.12));
}
.glow-ring {
    animation: neon-pulse 3s ease-in-out infinite;
    transform-origin: 160px 200px;
}
@keyframes neon-pulse {
    0%, 100% { filter: drop-shadow(0 0 2px rgba(0,255,213,0.5)); }
    50%      { filter: drop-shadow(0 0 12px rgba(0,255,213,0.9)); }
}

.hero-copy {
    position: relative;
    z-index: 5;
    text-align: center;
    max-width: 820px;
    padding: 0 24px;
}

.meta-stamp {
    font-family: var(--f-mono);
    font-size: 11px;
    letter-spacing: 0.32em;
    text-transform: uppercase;
    color: var(--sepia);
    margin-bottom: 36px;
    display: inline-flex;
    align-items: center;
    gap: 10px;
}
.meta-stamp .dot {
    width: 6px; height: 6px;
    background: var(--cyan);
    border-radius: 50%;
    box-shadow: 0 0 8px rgba(0,255,213,0.8);
    animation: neon-dot 2.4s ease-in-out infinite;
}
@keyframes neon-dot {
    0%, 100% { opacity: 1; box-shadow: 0 0 8px rgba(0,255,213,0.8); }
    50%      { opacity: 0.6; box-shadow: 0 0 14px rgba(0,255,213,1); }
}

.hero-title {
    font-family: var(--f-display);
    font-weight: 700;
    font-size: clamp(40px, 7vw, 88px);
    line-height: 1.02;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-primary);
    margin-bottom: 28px;
    position: relative;
}
.hero-italic {
    font-family: var(--f-serif);
    font-style: italic;
    font-weight: 500;
    text-transform: lowercase;
    color: var(--sepia);
    letter-spacing: 0;
}

.hero-subtitle {
    font-family: var(--f-serif);
    font-style: italic;
    font-weight: 500;
    font-size: clamp(16px, 1.4vw, 20px);
    color: var(--text-secondary);
    max-width: 560px;
    margin: 0 auto 40px;
    line-height: 1.55;
}

.hero-divider {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin: 0 auto 30px;
    max-width: 360px;
}
.hero-divider .line {
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--sepia), transparent);
}
.hero-divider .diamond-end,
.hero-divider .diamond-mid {
    width: 6px; height: 6px;
    background: var(--sepia);
    transform: rotate(45deg);
    flex-shrink: 0;
}
.hero-divider .diamond-mid {
    width: 9px; height: 9px;
    background: transparent;
    border: 1px solid var(--sepia);
}

.hero-scroll-cue {
    font-family: var(--f-mono);
    font-size: 11px;
    letter-spacing: 0.28em;
    text-transform: uppercase;
    color: var(--text-secondary);
    opacity: 0.7;
    animation: bob 3s ease-in-out infinite;
}
@keyframes bob {
    0%, 100% { transform: translateY(0); opacity: 0.6; }
    50%      { transform: translateY(4px); opacity: 1; }
}

/* ============== Chapters ============== */
.chapter-number {
    font-family: var(--f-serif);
    font-style: italic;
    font-weight: 500;
    font-size: 56px;
    color: var(--sepia);
    margin-bottom: 24px;
    letter-spacing: 0.08em;
    opacity: 0.8;
}

.chapter-heading {
    font-family: var(--f-display);
    font-weight: 700;
    font-size: clamp(34px, 5.4vw, 64px);
    line-height: 1.05;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-primary);
    margin-bottom: 32px;
    position: relative;
    display: inline-block;
}

/* Glitch on heading (fires on scroll-entry via JS class) */
.chapter-heading.glitching::before,
.chapter-heading.glitching::after {
    content: attr(data-text);
    white-space: pre;
    position: absolute;
    top: 0; left: 0;
    width: 100%;
    font: inherit;
    pointer-events: none;
    text-transform: uppercase;
    letter-spacing: inherit;
}
.chapter-heading.glitching::before {
    color: var(--cyan);
    animation: glitch-left 300ms steps(2,end);
    mix-blend-mode: screen;
}
.chapter-heading.glitching::after {
    color: var(--magenta);
    animation: glitch-right 300ms steps(2,end);
    mix-blend-mode: screen;
}
@keyframes glitch-left {
    0%   { transform: translate(0,0); opacity: 0; }
    20%  { transform: translate(-2px, 1px); opacity: 1; clip-path: inset(0 0 60% 0); }
    40%  { transform: translate(2px, -1px); clip-path: inset(30% 0 30% 0); }
    60%  { transform: translate(-3px, 0); clip-path: inset(60% 0 0 0); }
    80%  { transform: translate(1px, 0); opacity: 1; }
    100% { transform: translate(0,0); opacity: 0; }
}
@keyframes glitch-right {
    0%   { transform: translate(0,0); opacity: 0; }
    20%  { transform: translate(2px,-1px); opacity: 1; clip-path: inset(50% 0 0 0); }
    40%  { transform: translate(-2px,1px); clip-path: inset(20% 0 40% 0); }
    60%  { transform: translate(3px, 0); clip-path: inset(0 0 70% 0); }
    80%  { transform: translate(-1px, 0); opacity: 1; }
    100% { transform: translate(0,0); opacity: 0; }
}

.chapter-lede {
    font-family: var(--f-serif);
    font-style: italic;
    font-weight: 500;
    font-size: clamp(18px, 1.6vw, 22px);
    color: var(--text-primary);
    margin-bottom: 48px;
    line-height: 1.55;
    max-width: 620px;
}
.accent-word {
    color: var(--cyan);
    font-style: normal;
    text-shadow: 0 0 4px rgba(0,255,213,0.4);
    animation: neon-text 3s ease-in-out infinite;
}
@keyframes neon-text {
    0%, 100% { text-shadow: 0 0 0px rgba(0,255,213,0.4); }
    50%      { text-shadow: 0 0 6px rgba(0,255,213,0.7); }
}

.narrative p {
    color: var(--text-secondary);
    margin-bottom: 24px;
    font-size: 17px;
}
.narrative p:last-child { margin-bottom: 0; }

/* ============== Cartouche ============== */
.cartouche {
    position: relative;
    margin: 64px -20px 32px;
    padding: 40px 48px 30px;
}
.cartouche-wide { margin: 64px -40px 32px; padding: 40px 64px 30px; }
.cartouche-frame {
    position: absolute;
    inset: 0;
    width: 100%; height: 100%;
    pointer-events: none;
}
.cartouche blockquote {
    font-family: var(--f-serif);
    font-style: italic;
    font-weight: 500;
    font-size: clamp(18px, 1.7vw, 24px);
    line-height: 1.5;
    color: var(--text-primary);
    text-align: center;
    padding: 0 20px;
}
.quote-mark {
    color: var(--sepia);
    font-size: 1.4em;
    vertical-align: -0.15em;
    margin-right: 4px;
}
.quote-mark.closing { margin-left: 4px; margin-right: 0; }
.cartouche-attribution {
    font-family: var(--f-mono);
    font-size: 11px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--sepia);
    text-align: center;
    margin-top: 16px;
    opacity: 0.85;
}

/* ============== Diorama / cards ============== */
.diorama {
    display: grid;
    gap: 28px;
    margin-top: 20px;
}
.card {
    position: relative;
    padding: 48px;
    background: var(--obsidian);
    border: 1px solid transparent;
    transition: transform 400ms var(--ease), box-shadow 400ms var(--ease), border-color 300ms var(--ease);
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 24px;
    align-items: start;
    color: var(--text-primary);
    overflow: hidden;
}
.card::before {
    content: "";
    position: absolute;
    top: 0; left: 0;
    height: 1px;
    width: 0%;
    background: var(--cyan);
    box-shadow: 0 0 6px rgba(0,255,213,0.7);
    transition: width 500ms var(--ease);
}
.card[data-layer="1"] { margin-right: 48px; background: var(--midnight-plum); }
.card[data-layer="2"] { margin: 0 24px; background: #18162a; }
.card[data-layer="3"] { margin-left: 48px; background: var(--obsidian); }

.card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 32px rgba(0,255,213,0.10);
    border-color: rgba(0,255,213,0.4);
}
.card:hover::before { width: 100%; }
.card:hover .card-glyph { color: var(--cyan); transform: rotate(8deg); }
.card:hover .card-title { animation: micro-glitch 220ms ease-in-out; }

@keyframes micro-glitch {
    0%,100% { transform: translate(0,0); }
    25%     { transform: translate(-2px, 0); }
    50%     { transform: translate(2px, 0); }
    75%     { transform: translate(-1px, 1px); }
}

.card-meta {
    font-family: var(--f-mono);
    font-size: 11px;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--sepia);
    margin-bottom: 14px;
}
.monoslash { color: var(--text-secondary); opacity: 0.6; margin: 0 2px; }
.card-title {
    font-family: var(--f-display);
    font-weight: 700;
    font-size: 26px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    margin-bottom: 14px;
    color: var(--text-primary);
}
.card-body {
    color: var(--text-secondary);
    font-size: 16px;
    line-height: 1.65;
}
.card-glyph {
    width: 60px; height: 60px;
    color: var(--sepia);
    transition: color 400ms var(--ease), transform 500ms var(--ease);
}

/* ============== Illustration wrap (key) ============== */
.illustration-wrap {
    margin: 48px -40px 48px;
    padding: 0;
    display: flex;
    justify-content: center;
}
.illustration-key {
    width: 100%;
    max-width: 560px;
    height: auto;
    filter: drop-shadow(0 0 20px rgba(0,255,213,0.08));
}

/* ============== Interlude / glitch slabs ============== */
.chapter-interlude .chapter-lede {
    max-width: 680px;
}
.glitch-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-top: 48px;
}
.glitch-slab {
    padding: 28px 24px;
    background: var(--obsidian);
    border: 1px solid rgba(150,144,176,0.15);
    position: relative;
    overflow: hidden;
}
.glitch-slab::before {
    content: "";
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(
        0deg,
        transparent 0 2px,
        rgba(255,45,123,0.04) 2px 3px
    );
    pointer-events: none;
}
.slab-a { box-shadow: inset 2px 0 0 var(--cyan); }
.slab-b { box-shadow: inset 2px 0 0 var(--magenta); }
.slab-c { box-shadow: inset 2px 0 0 var(--amber); }

.slab-code {
    font-family: var(--f-mono);
    font-size: 11px;
    letter-spacing: 0.2em;
    color: var(--sepia);
    margin-bottom: 12px;
}
.slab-a .slab-code { color: var(--cyan); }
.slab-b .slab-code { color: var(--magenta); }
.slab-c .slab-code { color: var(--amber); }
.slab-body {
    font-family: var(--f-serif);
    font-style: italic;
    font-size: 15px;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* ============== Floating shapes ============== */
.deco-layer { position: absolute; inset: 0; pointer-events: none; }
.float-shape {
    position: absolute;
    display: block;
}
.float-shape.shape-circle {
    width: 140px; height: 140px;
    border-radius: 50%;
    border: 1px solid currentColor;
}
.float-shape.shape-circle.small { width: 60px; height: 60px; }
.float-shape.shape-square {
    width: 80px; height: 80px;
    border: 1px solid currentColor;
}
.float-shape.shape-rect {
    width: 160px; height: 24px;
    background: currentColor;
    opacity: 0.14;
}
.float-shape.shape-ring {
    width: 180px; height: 180px;
    border-radius: 50%;
    border: 1px solid currentColor;
    opacity: 0.35;
}
.float-shape.shape-ring.large { width: 320px; height: 320px; }
.float-shape.shape-triangle {
    width: 0; height: 0;
    border-left: 40px solid transparent;
    border-right: 40px solid transparent;
    border-bottom: 64px solid currentColor;
    opacity: 0.35;
}

.neon-cyan        { color: var(--cyan); opacity: 0.35; }
.neon-cyan-ring   { color: var(--cyan); }
.neon-magenta     { color: var(--magenta); opacity: 0.35; }
.neon-amber       { color: var(--amber); opacity: 0.22; }
.neon-amber-outline { color: var(--amber); opacity: 0.5; }

/* place shapes in each chapter */
#chapter-one  .shape-circle  { top: 15%; right: 6%; }
#chapter-one  .shape-square  { bottom: 18%; left: 5%; transform: rotate(14deg); }

#chapter-two  .shape-rect    { top: 18%; left: -40px; transform: rotate(-4deg); }
#chapter-two  .shape-ring    { bottom: 10%; right: -80px; }

#chapter-three .shape-circle { top: 20%; left: 4%; }
#chapter-three .shape-triangle { bottom: 14%; right: 6%; transform: rotate(18deg); }

#chapter-four .shape-ring.large { top: 10%; right: -140px; }
#chapter-four .shape-square  { bottom: 18%; left: 8%; transform: rotate(26deg); }
#chapter-four .shape-circle.small { top: 25%; left: 20%; }

#chapter-five .shape-square  { top: 25%; right: 8%; transform: rotate(10deg); }

/* ============== Footer / Colophon ============== */
.colophon {
    position: relative;
    background: var(--obsidian);
    padding: 0;
    margin-top: -40px;
    z-index: 1;
}
.colophon-cutout {
    background: #070710;
    padding: 120px 40px 60px;
    clip-path: polygon(0 8%, 100% 0, 100% 100%, 0 100%);
    position: relative;
}
.colophon-cutout::before {
    content: "";
    position: absolute;
    top: 60px; left: 50%;
    transform: translateX(-50%);
    width: 40%;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--sepia), transparent);
    opacity: 0.5;
}
.colophon-inner {
    max-width: 960px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: 40px 60px;
    align-items: start;
}
.colophon-block { }
.colo-label {
    font-family: var(--f-mono);
    font-size: 10px;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    color: var(--sepia);
    margin-bottom: 10px;
}
.colo-value {
    font-family: var(--f-display);
    font-size: 14px;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    line-height: 1.6;
}
.colo-mark {
    grid-row: 1 / span 2;
    grid-column: 3;
    align-self: center;
}
.colo-mark svg {
    width: 54px; height: 54px;
}
.colo-footline {
    max-width: 960px;
    margin: 60px auto 0;
    font-family: var(--f-serif);
    font-style: italic;
    font-size: 13px;
    color: var(--text-secondary);
    opacity: 0.7;
    text-align: center;
    border-top: 1px solid rgba(201,169,110,0.18);
    padding-top: 30px;
}

/* ============== Scroll-entrance base ============== */
.fade-target {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 600ms var(--ease), transform 600ms var(--ease);
}
.fade-target.in {
    opacity: 1;
    transform: translateY(0);
}

/* ============== Responsive ============== */
@media (max-width: 860px) {
    .site-nav { padding: 16px 22px; }
    .nav-links { gap: 18px; }
    .nav-link { font-size: 10px; letter-spacing: 0.14em; }

    .section { padding: 110px 22px; }
    .hero { padding-top: 120px; }
    .hero-emblem { width: 280px; height: 350px; opacity: 0.55; }
    .ornament-rosette.top-left { top: 90px; left: 10px; width: 110px; height: 110px; }
    .ornament-diamond.bottom-right { right: 10px; width: 70px; height: 70px; }

    .card { grid-template-columns: 1fr; padding: 32px; }
    .card[data-layer="1"] { margin-right: 0; }
    .card[data-layer="2"] { margin: 0; }
    .card[data-layer="3"] { margin-left: 0; }

    .cartouche, .cartouche-wide { margin: 48px 0 20px; padding: 36px 28px 24px; }
    .illustration-wrap { margin: 40px -10px; }

    .colophon-inner { grid-template-columns: 1fr; gap: 28px; }
    .colo-mark { grid-row: auto; grid-column: auto; }
    .colophon-cutout { padding: 90px 22px 40px; }
}

/* ============== Reduced motion ============== */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 120ms !important;
    }
    .parallax-layer { transform: none !important; }
}
