/* ============================================================
   Door44 design foundation — pass 4b
   Brand guide V2 is law: black canvas, bone like moonlight,
   blood red only for seals. Three type voices, never mixed.
   All assets self-hosted. No external requests.
   ============================================================ */

/* ---------- Fonts (self-hosted) ---------- */
@font-face {
    font-family: 'Engravers Old English';
    src: url('../fonts/d44/engravers-old-english.woff2') format('woff2'),
         url('../fonts/d44/engravers-old-english.ttf') format('truetype');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Playfair Display';
    src: url('../fonts/d44/playfair-var.ttf') format('truetype-variations');
    font-weight: 400 900;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Playfair Display';
    src: url('../fonts/d44/playfair-italic-var.ttf') format('truetype-variations');
    font-weight: 400 900;
    font-style: italic;
    font-display: swap;
}
/* Kelvinch: italic face available today; upright falls through to serif
   stack until the full family is sourced (flagged in progress notes). */
@font-face {
    font-family: 'Kelvinch';
    src: url('../fonts/d44/kelvinch.otf') format('opentype');
    font-weight: 400;
    font-style: italic;
    font-display: swap;
}

/* ---------- Tokens ---------- */
:root {
    --d44-black: #000000;
    --d44-off: #161B1F;
    --d44-bone: #F5F5F5;
    --d44-bone-60: rgba(245, 245, 245, 0.60);
    --d44-bone-30: rgba(245, 245, 245, 0.30);
    --d44-bone-12: rgba(245, 245, 245, 0.12);
    --d44-red: #8B0000; /* seals + rare narrative emphasis ONLY */
    --d44-display: 'Engravers Old English', serif;
    --d44-heading: 'Playfair Display', Georgia, serif;
    --d44-body: 'Kelvinch', Georgia, 'Times New Roman', serif;
    /* type scale ~ brand guide 110/60/36/22/14/12 */
    --d44-fs-display: clamp(3rem, 8vw, 6.875rem);
    --d44-fs-h1: clamp(2.2rem, 5vw, 3.75rem);
    --d44-fs-h2: clamp(1.6rem, 3.2vw, 2.25rem);
    --d44-fs-h3: clamp(1.2rem, 2vw, 1.375rem);
    --d44-fs-body: 1.0625rem;
    --d44-fs-small: 0.8125rem;
}

/* ---------- Base ---------- */
body.d44 {
    background: var(--d44-black);
    color: var(--d44-bone);
    font-family: var(--d44-body);
    font-size: var(--d44-fs-body);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}
body.d44 ::selection { background: var(--d44-bone); color: var(--d44-black); }
body.d44 a { color: var(--d44-bone); }

body.d44 h1, body.d44 h2, body.d44 h3 {
    font-family: var(--d44-heading);
    font-weight: 700;
    font-style: italic;
    color: var(--d44-bone);
    line-height: 1.15;
}
body.d44 h1 { font-size: var(--d44-fs-h1); }
body.d44 h2 { font-size: var(--d44-fs-h2); }
body.d44 h3 { font-size: var(--d44-fs-h3); font-family: var(--d44-body); font-style: normal; }

.d44-display,
body.d44 h1.d44-display, body.d44 h2.d44-display {
    font-family: var(--d44-display);
    font-weight: 400;
    font-style: normal;
    font-size: var(--d44-fs-display);
    line-height: 1.05;
    letter-spacing: 0.01em;
}

.d44-kicker {
    font-family: var(--d44-body);
    font-style: normal;
    font-size: var(--d44-fs-small);
    letter-spacing: 0.35em;
    text-transform: uppercase;
    color: var(--d44-bone-60);
}

/* ---------- Header band + footer ---------- */
.d44-band {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 72px;
    background: var(--d44-black);
    border-bottom: 1px solid var(--d44-bone-12);
    position: relative;
    z-index: 10;
}
.d44-band img { height: 40px; width: auto; display: block; }
.d44-foot {
    padding: 48px 24px 56px;
    text-align: center;
    font-size: var(--d44-fs-small);
    letter-spacing: 0.25em;
    text-transform: uppercase;
    color: var(--d44-bone-30);
    border-top: 1px solid var(--d44-bone-12);
    margin-top: 96px;
}

/* ---------- Ornamental rule ---------- */
.d44-rule {
    border: 0;
    height: 1px;
    margin: 40px auto;
    max-width: 520px;
    background: linear-gradient(90deg, transparent, var(--d44-bone-30), transparent);
}
.d44-rule--orn { position: relative; overflow: visible; }
.d44-rule--orn::after {
    content: '\271B'; /* ✛ */
    position: absolute;
    left: 50%; top: 50%;
    transform: translate(-50%, -50%);
    background: var(--d44-black);
    padding: 0 14px;
    color: var(--d44-bone-60);
    font-size: 0.75rem;
}

/* ---------- The button: ✛ LABEL ✛ framed, Playfair letterspaced ---------- */
.d44-cta {
    display: inline-block;
    font-family: var(--d44-heading);
    font-weight: 700;
    font-style: italic;
    font-size: 0.9375rem;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--d44-bone);
    text-decoration: none;
    padding: 15px 36px;
    border: 1px solid var(--d44-bone-60);
    outline: 1px solid var(--d44-bone-12);
    outline-offset: 4px;
    background: transparent;
    transition: background 0.35s ease, color 0.35s ease, outline-color 0.35s ease;
    cursor: pointer;
}
.d44-cta::before { content: '\271B\00a0\00a0'; opacity: 0.65; font-style: normal; }
.d44-cta::after  { content: '\00a0\00a0\271B'; opacity: 0.65; font-style: normal; }
.d44-cta:hover, .d44-cta:focus-visible {
    background: var(--d44-bone);
    color: var(--d44-black);
    outline-color: var(--d44-bone-60);
}
.d44-cta:focus-visible { outline-width: 2px; }

/* ---------- Liturgy column (sales/ritual pages) ---------- */
.d44-liturgy {
    max-width: 640px;
    margin: 0 auto;
    padding: 64px 24px 96px;
    text-align: center;
}
.d44-liturgy p { margin: 0 0 1em; }
.d44-liturgy em { font-family: 'Kelvinch', Georgia, serif; font-style: italic; color: var(--d44-bone-60); }

/* ---------- Product card, engraved (replaces stock white card) ---------- */
.d44-product {
    background: var(--d44-off);
    border: 1px solid var(--d44-bone-30);
    outline: 1px solid var(--d44-bone-12);
    outline-offset: 5px;
    max-width: 420px;
    margin: 48px auto;
    padding: 28px 28px 32px;
}
.d44-product img { width: 100%; height: auto; display: block; filter: grayscale(1) contrast(1.05); }
.d44-product .d44-product-title {
    font-family: var(--d44-heading);
    font-weight: 700; font-style: italic;
    font-size: 1.125rem;
    letter-spacing: 0.08em;
    margin: 20px 0 18px;
}
.d44-product .d44-cta { display: block; text-align: center; }

/* ---------- Liturgy pages (doors, sealed states, rituals) ----------
   Centered ritual column with the breathing room the originals had. */
.d44-lit {
    position: relative;
    max-width: 640px;
    margin: 0 auto;
    padding: 9vh 24px 12vh;
    text-align: center;
    z-index: 1;
}
.d44-lit section { padding: 34px 0; }
.d44-lit p {
    margin: 0 0 1.25em;
    line-height: 1.9;
    font-size: 1.0625rem;
    color: rgba(245, 245, 245, 0.88);
}
.d44-lit h1 { margin: 0 0 30px; }
.d44-lit h2 { margin: 0 0 26px; }
.d44-lit .d44-display { margin: 0 0 14px; }
.d44-lit .d44-punch { margin: 10px 0 6px; line-height: 1.35; }
.d44-lit .d44-cta { margin-top: 30px; }
.d44-lit em { color: var(--d44-bone-60); }
.d44-lit .d44-rule { margin: 52px auto; }

/* atmospheric backdrop for liturgy pages: vignette + breathing candlelight
   + a floor of slow smoke. Pure CSS, subtle. */
.d44-atmo {
    position: fixed; inset: 0;
    pointer-events: none;
    z-index: 0;
    background:
        radial-gradient(ellipse 75% 55% at 50% 18%, rgba(245,240,225,0.045), transparent 60%),
        radial-gradient(ellipse 110% 70% at 50% 115%, rgba(22,27,31,0.9), transparent 72%),
        #000;
}
.d44-atmo::before {
    content: '';
    position: absolute; inset: 0;
    background: radial-gradient(ellipse 55% 45% at 50% 30%, rgba(245,240,225,0.05), transparent 65%);
    animation: d44-atmo-breathe 9s ease-in-out infinite;
}
.d44-atmo::after {
    content: '';
    position: absolute; left: -10%; right: -10%; bottom: -8%; height: 38%;
    background:
        radial-gradient(ellipse 30% 55% at 28% 80%, rgba(245,245,245,0.05), transparent 70%),
        radial-gradient(ellipse 26% 50% at 74% 85%, rgba(245,245,245,0.04), transparent 70%);
    filter: blur(24px);
    animation: d44-atmo-floor 26s ease-in-out infinite alternate;
}
@keyframes d44-atmo-breathe { 0%, 100% { opacity: 0.5; } 50% { opacity: 1; } }
@keyframes d44-atmo-floor {
    from { transform: translateX(-3%) scale(1); }
    to   { transform: translateX(4%) scale(1.15); }
}

/* liturgy pages arrive out of the dark */
.d44-lit {
    animation: d44-lit-in 0.7s ease both;
}
@keyframes d44-lit-in {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: none; }
}

/* redirect fallback ("Sealed. / Continue"): invisible unless the instant
   redirect somehow fails — prevents the split-second flash */
.d44-fallback {
    opacity: 0;
    animation: d44-fallback-in 0.5s ease 1.6s forwards;
}
@keyframes d44-fallback-in { to { opacity: 1; } }

/* the door you are stepping through: a dark ghost of each room's own
   arch, sunk into the black behind the ritual column */
.d44-ghost-door {
    position: fixed;
    left: 50%; top: 54%;
    transform: translate(-50%, -50%);
    height: 92vh;
    aspect-ratio: 3 / 4;
    background-size: cover;
    background-position: center;
    opacity: 0.34;
    pointer-events: none;
    z-index: 0;
    -webkit-mask-image: radial-gradient(ellipse 68% 62% at 50% 48%, #000 38%, transparent 78%);
    mask-image: radial-gradient(ellipse 68% 62% at 50% 48%, #000 38%, transparent 78%);
    animation: d44-ghost-loom 11s ease-in-out infinite;
}
@keyframes d44-ghost-loom {
    0%, 100% { opacity: 0.28; }
    50% { opacity: 0.4; }
}

/* Ghost stock product card (Black Pass, model rooms, bundle, door pages)
   brought on-brand: off-black engraved panel, no white, restrained rating,
   Playfair letterspaced button. */
.d44-lit .kg-product-card { margin: 40px auto; max-width: 460px; }
/* !important: Ghost injects cards.min.css AFTER the theme stylesheet with a
   more specific selector, so the override must force these. */
.d44-lit .kg-product-card-container {
    background: var(--d44-off) !important;
    border: 1px solid var(--d44-bone-30) !important;
    outline: 1px solid var(--d44-bone-12);
    outline-offset: 5px;
    border-radius: 0 !important;
    padding: 26px !important;
}
.d44-lit .kg-product-card-image {
    border-radius: 0 !important;
    filter: grayscale(1) contrast(1.05) brightness(0.95);
    margin-bottom: 20px;
}
.d44-lit .kg-product-card-title {
    font-family: var(--d44-heading);
    font-weight: 700; font-style: italic;
    font-size: 1.15rem;
    letter-spacing: 0.04em;
    color: var(--d44-bone);
}
/* the 5-star rating reads as hype — dim it to a faint engraved mark */
.d44-lit .kg-product-card-rating { opacity: 0.25; }
.d44-lit .kg-product-card-rating-star svg { fill: var(--d44-bone); }
.d44-lit .kg-product-card-button {
    background: transparent !important;
    color: var(--d44-bone) !important;
    border: 1px solid var(--d44-bone-60) !important;
    border-radius: 0 !important;
    font-family: var(--d44-heading) !important;
    font-weight: 700 !important;
    font-style: italic !important;
    letter-spacing: 0.18em !important;
    text-transform: uppercase !important;
    height: auto !important;
    padding: 15px 30px !important;
    transition: background 0.35s ease, color 0.35s ease;
}
.d44-lit .kg-product-card-button:hover {
    background: var(--d44-bone) !important;
    color: var(--d44-black) !important;
}

/* editor-content buttons (the rooms' ENTER links) sized like the site's
   own buttons — production baked small inline-styled buttons into the copy */
.d44-lit .kg-btn {
    font-family: var(--d44-heading) !important;
    font-weight: 700 !important;
    font-style: italic !important;
    font-size: 1rem !important;
    letter-spacing: 0.22em !important;
    text-transform: uppercase !important;
    padding: 17px 46px !important;
    border-radius: 0 !important;
    height: auto !important;
    line-height: 1.2 !important;
}

/* ---------- Motion discipline ---------- */
@media (prefers-reduced-motion: reduce) {
    body.d44 *, body.d44 *::before, body.d44 *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
