/* ============================================================
   RRIDDL.com -- Cathedral of Enigma
   Diagonal sections, duotone foundation, surrealist puzzle box
   ============================================================ */

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

:root {
    --void: #0b0c10;
    --parchment: #e8e0d0;
    --ink: #2c2a28;
    --cipher-gold: #c9a84c;
    --enigma-violet: #4a2d6b;
    --revelation-teal: #2a9d8f;
    --phantom-gray: #6b6e7a;
    --hint-red: #8b3a3a;

    --reveal-grad: linear-gradient(135deg, #0b0c10 0%, #4a2d6b 40%, #2a9d8f 70%, #e8e0d0 100%);

    --serif: 'Playfair Display', 'Crimson Pro', Georgia, serif;
    --serif-text: 'Crimson Pro', Georgia, serif;
    --sans: 'DM Sans', system-ui, sans-serif;
    --mono: 'Fira Code', 'Courier New', monospace;
}

html { scroll-behavior: smooth; }

body {
    font-family: var(--sans);
    background: var(--void);
    color: var(--parchment);
    overflow-x: hidden;
    cursor: none;
    line-height: 1.6;
    position: relative;
}

/* labyrinth background SVG */
.labyrinth-bg {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
    mix-blend-mode: screen;
}

/* ===== Pip nav ===== */
.pip-nav {
    position: fixed;
    right: 28px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 50;
    display: flex;
    flex-direction: column;
    gap: 18px;
}
.pip {
    width: 28px;
    height: 28px;
    display: grid;
    place-items: center;
    text-decoration: none;
    border: 1px solid rgba(201, 168, 76, 0.25);
    border-radius: 50%;
    background: rgba(11, 12, 16, 0.55);
    transition: border-color 0.4s, background 0.4s, transform 0.4s;
}
.pip-glyph {
    font-family: var(--serif);
    font-size: 14px;
    color: var(--cipher-gold);
    transition: transform 0.6s ease, color 0.4s;
    display: inline-block;
    line-height: 1;
}
.pip.active {
    border-color: var(--cipher-gold);
    background: rgba(201, 168, 76, 0.12);
    transform: scale(1.15);
}
.pip.active .pip-glyph {
    transform: rotate(180deg);
    color: var(--revelation-teal);
}
.pip:hover {
    border-color: var(--cipher-gold);
}

/* ===== Custom cursor ===== */
.cursor-crosshair {
    position: fixed;
    width: 18px;
    height: 18px;
    pointer-events: none;
    z-index: 9999;
    mix-blend-mode: difference;
    transform: translate(-50%, -50%);
    transition: opacity 0.2s;
}
.cursor-crosshair::before,
.cursor-crosshair::after {
    content: '';
    position: absolute;
    background: var(--parchment);
}
.cursor-crosshair::before {
    width: 18px; height: 1px;
    top: 50%; left: 0;
    transform: translateY(-50%);
}
.cursor-crosshair::after {
    width: 1px; height: 18px;
    left: 50%; top: 0;
    transform: translateX(-50%);
}
.cursor-question {
    position: fixed;
    font-family: var(--serif);
    font-size: 22px;
    color: var(--cipher-gold);
    pointer-events: none;
    z-index: 9998;
    transform: translate(-50%, -50%) scale(0);
    transition: transform 0.25s cubic-bezier(.22,.9,.3,1.4);
    line-height: 1;
    font-weight: 700;
}
.cursor-question.active {
    transform: translate(-50%, -50%) scale(1);
}

/* ===== HERO: Entry Labyrinth ===== */
.entry-labyrinth {
    position: relative;
    min-height: 100vh;
    overflow: hidden;
    isolation: isolate;
    background: var(--void);
}
.split-shadow {
    position: absolute;
    inset: 0;
    background: var(--void);
    clip-path: polygon(0 0, 100% 0, 0 100%);
    z-index: 1;
    transform-origin: 0 0;
    animation: split-rotate 22s ease-in-out infinite alternate;
}
.split-parchment {
    position: absolute;
    inset: 0;
    background: var(--parchment);
    clip-path: polygon(100% 0, 100% 100%, 0 100%);
    z-index: 1;
    transform-origin: 100% 100%;
    animation: split-rotate-alt 22s ease-in-out infinite alternate;
}
@keyframes split-rotate {
    0%   { transform: rotate(-1.2deg); }
    100% { transform: rotate(1.2deg); }
}
@keyframes split-rotate-alt {
    0%   { transform: rotate(1.2deg); }
    100% { transform: rotate(-1.2deg); }
}

.watermark-q {
    position: absolute;
    font-family: var(--serif);
    font-size: 40vw;
    font-weight: 900;
    color: var(--cipher-gold);
    opacity: 0.04;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -55%);
    pointer-events: none;
    z-index: 2;
    line-height: 0.85;
}

.hero-impossible {
    position: absolute;
    width: 220px;
    height: 220px;
    right: 8%;
    top: 14%;
    z-index: 3;
    animation: rotate-slow 42s linear infinite;
    opacity: 0.85;
}
.penrose { width: 100%; height: 100%; }

@keyframes rotate-slow {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

.hero-content {
    position: relative;
    z-index: 5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 8vh 8vw;
    max-width: 1400px;
    margin: 0 auto;
}

.eyebrow {
    font-family: var(--mono);
    font-size: 12px;
    letter-spacing: 0.4em;
    color: var(--cipher-gold);
    margin-bottom: 36px;
    text-transform: uppercase;
}
.eyebrow .dot { color: var(--revelation-teal); }

.hero-title {
    font-family: var(--serif);
    font-weight: 900;
    font-size: clamp(2.5rem, 7vw, 8rem);
    line-height: 0.96;
    letter-spacing: -0.025em;
    margin-bottom: 40px;
}
.line-light {
    display: block;
    color: var(--parchment);
    mix-blend-mode: difference;
}
.line-dark {
    display: block;
    color: var(--ink);
    padding-left: 2.5vw;
    font-style: italic;
    mix-blend-mode: difference;
}
.line-accent {
    display: block;
    color: var(--cipher-gold);
    padding-left: 5vw;
    font-size: 0.72em;
    font-weight: 700;
    text-shadow: 4px 4px 0 rgba(74, 45, 107, 0.55);
}

.hero-tagline {
    font-family: var(--serif-text);
    font-style: italic;
    font-size: clamp(1rem, 1.6vw, 1.4rem);
    color: var(--phantom-gray);
    max-width: 540px;
    margin-bottom: 52px;
    mix-blend-mode: difference;
}

.hero-meta {
    display: flex;
    align-items: center;
    gap: 14px;
    font-family: var(--mono);
    font-size: 12px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--cipher-gold);
    mix-blend-mode: difference;
}
.meta-divider, .meta-text { color: var(--phantom-gray); }
.meta-arrow {
    color: var(--cipher-gold);
    font-size: 16px;
    animation: bob 2.4s ease-in-out infinite;
}
@keyframes bob {
    0%,100% { transform: translateY(0); }
    50%     { transform: translateY(6px); }
}

/* ===== CORRIDORS ===== */
.corridors {
    position: relative;
    z-index: 2;
    background: var(--void);
}

.corridor {
    position: relative;
    min-height: 100vh;
    display: flex;
    align-items: center;
    padding: 14vh 8vw;
    overflow: hidden;
}
.corridor-a {
    background: var(--void);
    color: var(--parchment);
    clip-path: polygon(0 8%, 100% 0, 100% 92%, 0 100%);
    margin-top: -6vh;
}
.corridor-b {
    background: var(--parchment);
    color: var(--ink);
    clip-path: polygon(0 0, 100% 6%, 100% 100%, 0 94%);
    margin-top: -6vh;
}

.corridor-inner {
    max-width: 920px;
    width: 100%;
    transform: skewY(0deg);
    transition: transform 0.8s ease;
}
.corridor[data-angle] .corridor-inner {
    /* counter-rotate for readability */
}

.corridor-meta {
    font-family: var(--mono);
    font-size: 11px;
    letter-spacing: 0.32em;
    text-transform: uppercase;
    color: var(--cipher-gold);
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 28px;
}
.corridor-meta.light { color: var(--enigma-violet); }
.enigma-tag { color: var(--phantom-gray); font-style: italic; letter-spacing: 0.12em; text-transform: none; font-family: var(--serif-text); font-size: 14px; }

.corridor-heading {
    font-family: var(--serif);
    font-weight: 700;
    font-size: clamp(2rem, 5vw, 4.5rem);
    line-height: 1.05;
    letter-spacing: -0.02em;
    margin-bottom: 28px;
    max-width: 16ch;
}
.corridor-heading em {
    font-style: italic;
    color: var(--cipher-gold);
    font-weight: 400;
}
.corridor-heading.dark em { color: var(--enigma-violet); }

.corridor-body {
    font-family: var(--serif-text);
    font-size: clamp(1rem, 1.4vw, 1.25rem);
    line-height: 1.65;
    max-width: 60ch;
    margin-bottom: 40px;
    color: rgba(232, 224, 208, 0.78);
}
.corridor-body.dark {
    color: rgba(44, 42, 40, 0.82);
}

.shadow-word {
    color: inherit;
    text-shadow: 3px 3px 0 var(--enigma-violet);
    font-style: italic;
}
.shadow-word.teal { text-shadow: 3px 3px 0 var(--revelation-teal); }

/* ===== Riddle cards (tilt-3D) ===== */
.riddle-card {
    position: relative;
    background: rgba(11, 12, 16, 0.55);
    border: 1px solid rgba(201, 168, 76, 0.32);
    padding: 36px 36px 28px;
    max-width: 560px;
    transform-style: preserve-3d;
    perspective: 1000px;
    transition: transform 0.18s ease-out, border-color 0.4s, box-shadow 0.4s;
    will-change: transform;
}
.riddle-card.light {
    background: rgba(255, 255, 255, 0.45);
    border-color: rgba(74, 45, 107, 0.28);
}
.riddle-card:hover {
    border-color: var(--cipher-gold);
    box-shadow: 0 30px 60px -25px rgba(201, 168, 76, 0.35);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-family: var(--mono);
    font-size: 11px;
    letter-spacing: 0.18em;
    margin-bottom: 24px;
    color: var(--cipher-gold);
}
.card-num { color: var(--cipher-gold); }
.card-status {
    color: var(--hint-red);
    padding: 3px 8px;
    border: 1px solid rgba(139, 58, 58, 0.5);
    border-radius: 2px;
    transition: color 0.4s, border-color 0.4s;
}
.riddle-card.solved .card-status {
    color: var(--revelation-teal);
    border-color: var(--revelation-teal);
}
.riddle-card.solved .card-status::before { content: 'SOLVED'; }
.riddle-card.solved .card-status-text { display: none; }

.card-question {
    font-family: var(--serif);
    font-size: clamp(1.1rem, 1.6vw, 1.4rem);
    line-height: 1.4;
    font-style: italic;
    margin-bottom: 28px;
    color: inherit;
}

.card-answer {
    display: flex;
    align-items: baseline;
    gap: 14px;
    padding: 14px 0;
    border-top: 1px dashed rgba(201, 168, 76, 0.3);
    border-bottom: 1px dashed rgba(201, 168, 76, 0.3);
    margin-bottom: 14px;
    filter: blur(8px);
    transition: filter 0.6s ease;
}
.riddle-card:hover .card-answer,
.riddle-card.solved .card-answer {
    filter: blur(0);
}
.answer-label {
    font-family: var(--mono);
    font-size: 10px;
    letter-spacing: 0.3em;
    color: var(--revelation-teal);
}
.answer-text {
    font-family: var(--serif);
    font-size: 1.4rem;
    color: var(--cipher-gold);
    font-weight: 700;
}
.riddle-card.light .answer-text { color: var(--enigma-violet); }

.card-foot {
    font-family: var(--mono);
    font-size: 10px;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--phantom-gray);
}

/* ===== MIRROR CHAMBER ===== */
.mirror-chamber {
    position: relative;
    z-index: 3;
    background: linear-gradient(180deg, var(--void) 0%, #14111c 50%, var(--void) 100%);
    padding: 16vh 8vw;
    min-height: 100vh;
    margin-top: -6vh;
}
.chamber-header {
    max-width: 720px;
    margin: 0 auto 60px;
    text-align: center;
}
.chamber-eyebrow {
    font-family: var(--mono);
    font-size: 12px;
    letter-spacing: 0.4em;
    color: var(--cipher-gold);
    text-transform: uppercase;
}
.chamber-title {
    font-family: var(--serif);
    font-size: clamp(2.2rem, 5vw, 4.5rem);
    font-weight: 700;
    margin: 18px 0 22px;
    letter-spacing: -0.02em;
}
.chamber-title em {
    font-style: italic;
    color: var(--revelation-teal);
}
.chamber-sub {
    font-family: var(--serif-text);
    font-size: 1.1rem;
    color: var(--phantom-gray);
    line-height: 1.6;
}
.chamber-sub em { color: var(--cipher-gold); font-style: italic; }

.bento {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1px;
    max-width: 1200px;
    margin: 0 auto;
    background: rgba(201, 168, 76, 0.25);
    border: 1px solid rgba(201, 168, 76, 0.25);
}
.bento-cell {
    position: relative;
    background: var(--void);
    padding: 60px 40px;
    min-height: 280px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: background 0.5s, transform 0.5s;
    overflow: hidden;
}
.bento-cell.mirror {
    background: #0e0f15;
    opacity: 0.78;
}
.bento-cell.mirror::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent 0%, rgba(74, 45, 107, 0.08) 100%);
    pointer-events: none;
}
.bento-cell:hover {
    background: rgba(74, 45, 107, 0.18);
    transform: scale(1.005);
}
.bento-cell.mirror:hover {
    background: rgba(42, 157, 143, 0.12);
}

.cell-tag {
    font-family: var(--mono);
    font-size: 10px;
    letter-spacing: 0.3em;
    color: var(--cipher-gold);
    text-transform: uppercase;
}
.bento-cell.mirror .cell-tag { color: var(--revelation-teal); }

.cell-glyph {
    font-family: var(--serif);
    font-size: 6rem;
    color: var(--cipher-gold);
    line-height: 1;
    text-align: center;
    margin: 20px 0;
    transition: transform 0.6s ease;
}
.cell-glyph.flipped {
    transform: scaleX(-1);
    color: var(--enigma-violet);
}
.bento-cell.mirror .cell-glyph {
    filter: drop-shadow(0 0 18px rgba(74, 45, 107, 0.4));
}

.cell-text {
    font-family: var(--serif);
    font-style: italic;
    font-size: 1.2rem;
    color: var(--parchment);
    text-align: center;
}
.cell-text.flipped-text {
    color: var(--phantom-gray);
    transform: scaleX(-1);
    direction: rtl;
}

.cell-corner {
    position: absolute;
    bottom: 14px;
    right: 18px;
    font-family: var(--mono);
    font-size: 11px;
    color: var(--phantom-gray);
    letter-spacing: 0.18em;
}
.bento-cell.mirror .cell-corner {
    left: 18px;
    right: auto;
}

/* ===== CIPHER WHEEL section ===== */
.cipher-section {
    position: relative;
    background: var(--void);
    padding: 16vh 8vw;
    z-index: 2;
    overflow: hidden;
}
.cipher-section::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 80% 50%, rgba(74, 45, 107, 0.18), transparent 50%);
    pointer-events: none;
}
.cipher-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 80px;
    max-width: 1280px;
    margin: 0 auto;
    align-items: center;
    position: relative;
    z-index: 1;
}
.cipher-eyebrow {
    font-family: var(--mono);
    font-size: 12px;
    letter-spacing: 0.4em;
    color: var(--cipher-gold);
    text-transform: uppercase;
    display: block;
    margin-bottom: 18px;
}
.cipher-heading {
    font-family: var(--serif);
    font-size: clamp(2rem, 4.5vw, 4rem);
    font-weight: 700;
    line-height: 1.05;
    margin-bottom: 24px;
}
.cipher-heading em {
    font-style: italic;
    color: var(--cipher-gold);
}
.cipher-body {
    font-family: var(--serif-text);
    font-size: 1.15rem;
    line-height: 1.7;
    color: rgba(232, 224, 208, 0.78);
    margin-bottom: 40px;
    max-width: 50ch;
}
.cipher-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    border-top: 1px solid rgba(201, 168, 76, 0.25);
    padding-top: 28px;
    max-width: 480px;
}
.stat-label {
    display: block;
    font-family: var(--mono);
    font-size: 10px;
    letter-spacing: 0.28em;
    color: var(--phantom-gray);
    margin-bottom: 8px;
    text-transform: uppercase;
}
.stat-value {
    font-family: var(--serif);
    font-size: 1.6rem;
    color: var(--cipher-gold);
    font-weight: 700;
}

.cipher-wheel {
    position: relative;
    width: 100%;
    aspect-ratio: 1;
    max-width: 460px;
    margin: 0 auto;
}
.wheel-outer, .wheel-inner {
    position: absolute;
    border-radius: 50%;
    border: 1px solid rgba(201, 168, 76, 0.4);
    overflow: hidden;
    inset: 0;
}
.wheel-outer {
    animation: wheel-spin 60s linear infinite;
}
.wheel-inner {
    inset: 18%;
    animation: wheel-spin-rev 40s linear infinite;
    border-color: rgba(42, 157, 143, 0.45);
}
.wheel-outer span, .wheel-inner span {
    position: absolute;
    top: 50%;
    left: 50%;
    transform-origin: 0 0;
    font-family: var(--mono);
    font-size: 14px;
    color: var(--cipher-gold);
    transform: translate(-50%, -50%);
}
.wheel-inner span { color: var(--revelation-teal); font-size: 12px; }

/* circular text positioning via JS */
@keyframes wheel-spin {
    from { transform: rotate(0); }
    to   { transform: rotate(360deg); }
}
@keyframes wheel-spin-rev {
    from { transform: rotate(0); }
    to   { transform: rotate(-360deg); }
}

.wheel-core {
    position: absolute;
    inset: 38%;
    border-radius: 50%;
    background: var(--void);
    border: 1px solid var(--cipher-gold);
    display: grid;
    place-items: center;
    box-shadow: 0 0 0 6px rgba(11, 12, 16, 0.8), 0 0 40px rgba(201, 168, 76, 0.25);
}
.core-q {
    font-family: var(--serif);
    font-size: 3rem;
    color: var(--cipher-gold);
    font-weight: 900;
    animation: core-pulse 4s ease-in-out infinite;
}
@keyframes core-pulse {
    0%,100% { opacity: 1; transform: scale(1); }
    50%     { opacity: 0.7; transform: scale(1.08); }
}

/* ===== REVEAL: orthogonal resolution ===== */
.reveal-section {
    position: relative;
    background: var(--reveal-grad);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12vh 8vw;
    z-index: 2;
}
.reveal-inner {
    max-width: 760px;
    text-align: center;
    background: rgba(11, 12, 16, 0.65);
    border: 1px solid rgba(201, 168, 76, 0.35);
    padding: 80px 60px;
    backdrop-filter: blur(6px);
}
.reveal-mark {
    font-family: var(--serif);
    font-size: 5rem;
    color: var(--revelation-teal);
    line-height: 0.5;
    margin-bottom: 30px;
}
.reveal-line {
    font-family: var(--serif);
    font-style: italic;
    font-weight: 400;
    font-size: clamp(1.6rem, 3.5vw, 3rem);
    line-height: 1.25;
    color: var(--parchment);
    margin-bottom: 36px;
    letter-spacing: -0.01em;
}
.reveal-code {
    font-family: var(--mono);
    font-size: 13px;
    letter-spacing: 0.24em;
    color: var(--cipher-gold);
    text-transform: uppercase;
    margin-bottom: 36px;
}
.code-bracket { color: var(--revelation-teal); }
.reveal-rule {
    width: 60px;
    height: 1px;
    background: var(--cipher-gold);
    margin: 0 auto 28px;
}
.reveal-foot {
    font-family: var(--serif-text);
    font-style: italic;
    font-size: 0.95rem;
    color: var(--phantom-gray);
}

/* ===== Footer ===== */
.site-foot {
    background: var(--void);
    padding: 50px 8vw;
    border-top: 1px solid rgba(201, 168, 76, 0.15);
    position: relative;
    z-index: 2;
}
.foot-grid {
    max-width: 1280px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}
.foot-brand {
    font-family: var(--serif);
    font-weight: 900;
    font-size: 1.4rem;
    color: var(--parchment);
    letter-spacing: 0.05em;
}
.foot-q {
    color: var(--cipher-gold);
    font-style: italic;
    margin-left: 4px;
}
.foot-meta {
    font-family: var(--serif-text);
    font-style: italic;
    color: var(--phantom-gray);
    font-size: 0.9rem;
}
.foot-cipher {
    font-family: var(--mono);
    font-size: 12px;
    color: var(--cipher-gold);
    letter-spacing: 0.2em;
}

/* ===== Reveal-on-scroll baseline ===== */
.reveal-on-scroll {
    opacity: 0;
    transform: translateY(28px);
    transition: opacity 0.9s ease, transform 0.9s ease;
}
.reveal-on-scroll.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ===== Responsive ===== */
@media (max-width: 900px) {
    .cipher-container { grid-template-columns: 1fr; gap: 60px; }
    .bento { grid-template-columns: 1fr; }
    .pip-nav { right: 14px; gap: 12px; }
    .pip { width: 22px; height: 22px; }
    .hero-impossible { width: 130px; height: 130px; right: 6%; top: 6%; }
    .reveal-inner { padding: 50px 28px; }
    .foot-grid { flex-direction: column; align-items: flex-start; }
    body { cursor: auto; }
    .cursor-crosshair, .cursor-question { display: none; }
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--void); }
::-webkit-scrollbar-thumb {
    background: var(--cipher-gold);
    border-radius: 3px;
}
