/* Cocoa Noir — dark majestic theme for fredeaker.com
   Layers on top of Bootstrap 5.3.3. Fonts: Fraunces + Manrope (variable).
   All motion is compositor-only (transform/opacity) and respects prefers-reduced-motion. */

:root {
    --cocoa-0: #0d0907;
    --cocoa-1: #1a0e0a;
    --cocoa-2: #241410;
    --cocoa-3: #2c1a14;
    --cocoa-4: #3a241b;

    --cream-0: #e8dccb;
    --cream-1: #d4a574;
    --cream-2: #f0d4a8;
    --gold:    #c9a87c;
    --rust:    #8b5a3c;
    --muted:   #9b8b7a;

    --serif: 'Fraunces', Georgia, 'Times New Roman', serif;
    --sans:  'Manrope', 'Helvetica Neue', Arial, sans-serif;

    --ease:    cubic-bezier(.2, .7, .2, 1);
    --t-fast:  180ms;
    --t-med:   320ms;
    --t-slow:  600ms;

    color-scheme: dark;
}

html { scroll-behavior: smooth; }

html, body {
    background-color: var(--cocoa-0);
    color: var(--cream-0);
}

body {
    font-family: var(--sans);
    font-weight: 300;
    font-size: 1.0625rem;
    line-height: 1.7;
    letter-spacing: 0.005em;

    background-image:
        radial-gradient(ellipse 60% 50% at 15% 10%, rgba(139, 90, 60, 0.18), transparent 60%),
        radial-gradient(ellipse 70% 60% at 85% 90%, rgba(58, 36, 27, 0.55), transparent 65%),
        radial-gradient(ellipse 100% 80% at 50% 50%, var(--cocoa-1), var(--cocoa-0) 75%);
    background-attachment: fixed;
    background-repeat: no-repeat;
    min-height: 100vh;
}

/* Static grain — fixed, GPU-composited, no layout impact */
body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    opacity: 0.035;
    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 values='0 0 0 0 1  0 0 0 0 0.95  0 0 0 0 0.8  0 0 0 1 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
    mix-blend-mode: overlay;
}

.container, main, nav, footer { position: relative; z-index: 1; }

/* Typography — extreme weight contrast */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--serif);
    color: var(--cream-0);
    letter-spacing: -0.015em;
}

h1, .display-1 {
    font-weight: 200;
    font-variation-settings: "opsz" 144, "SOFT" 80, "WONK" 0;
    line-height: 1.05;
    letter-spacing: -0.03em;
}

h2, .display-4 {
    font-weight: 800;
    font-variation-settings: "opsz" 60, "SOFT" 30;
    line-height: 1.1;
    letter-spacing: -0.025em;
}

h3, .display-5 {
    font-weight: 300;
    font-style: italic;
    font-variation-settings: "opsz" 36, "SOFT" 60;
    line-height: 1.2;
}

.lead {
    font-family: var(--sans);
    font-weight: 200;
    font-size: 1.35rem;
    line-height: 1.55;
    color: var(--cream-0);
    letter-spacing: 0;
}

p { font-weight: 300; }
strong, b { font-weight: 800; color: var(--cream-2); }
em, i { color: var(--gold); font-style: italic; }
small { color: var(--muted); }

/* Links — growing underline */
a {
    color: var(--cream-1);
    text-decoration: none;
    font-weight: 500;
    position: relative;
    transition: color var(--t-fast) var(--ease);
}
a::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: -2px;
    height: 1px;
    background: currentColor;
    transform: scaleX(0);
    transform-origin: left center;
    transition: transform var(--t-med) var(--ease);
}
a:hover, a:focus-visible {
    color: var(--cream-2);
}
a:hover::after, a:focus-visible::after {
    transform: scaleX(1);
}

/* Image-wrapping anchors: skip the underline, keep the image hover effect */
a:has(> img)::after,
.navbar-brand::after,
.dropdown-item::after {
    display: none;
}
a:has(> img) { font-weight: inherit; }

/* Navbar */
.navbar.bg-body-tertiary {
    background: linear-gradient(180deg, rgba(13, 9, 7, 0.92), rgba(13, 9, 7, 0.78)) !important;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-bottom: 1px solid rgba(201, 168, 124, 0.12);
}
.navbar .navbar-brand {
    font-family: var(--sans);
    font-weight: 800;
    letter-spacing: 0.02em;
    color: var(--cream-0) !important;
}
.navbar .nav-link {
    font-family: var(--sans);
    font-weight: 500;
    color: var(--cream-0) !important;
    transition: color var(--t-fast) var(--ease), transform var(--t-fast) var(--ease);
    position: relative;
}
.navbar .nav-link::after { display: none; }
.navbar .nav-link:hover,
.navbar .nav-link:focus-visible {
    color: var(--cream-2) !important;
}

/* Dropdown — dark surface with sliding accent */
.dropdown-menu {
    background-color: var(--cocoa-2);
    border: 1px solid rgba(201, 168, 124, 0.15);
    border-radius: 4px;
    padding: 0.5rem 0;
}
.dropdown-item {
    color: var(--cream-0) !important;
    font-family: var(--sans);
    font-weight: 400;
    position: relative;
    padding-left: 1.25rem;
    transition: background-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.dropdown-item::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--gold);
    transform: scaleY(0);
    transform-origin: center;
    transition: transform var(--t-med) var(--ease);
}
.dropdown-item:hover,
.dropdown-item:focus {
    background-color: rgba(201, 168, 124, 0.08);
    color: var(--cream-2) !important;
}
.dropdown-item:hover::before,
.dropdown-item:focus::before {
    transform: scaleY(1);
}
.dropdown-item.active,
.dropdown-item:active {
    background-color: rgba(201, 168, 124, 0.12);
    color: var(--cream-2) !important;
}
.dropdown-item.active::before { transform: scaleY(1); }

/* Images — circular portrait, thumbnails */
img.rounded-circle,
img.img-fluid,
.border.rounded-3,
a img {
    transition: transform var(--t-med) var(--ease), filter var(--t-med) var(--ease), box-shadow var(--t-med) var(--ease);
}
img.rounded-circle,
.border-2.border-black {
    border-color: var(--gold) !important;
    box-shadow: 0 0 0 1px rgba(201, 168, 124, 0.2), 0 20px 60px rgba(0, 0, 0, 0.5);
}
a:hover img,
a:focus-visible img {
    transform: scale(1.02);
    filter: brightness(1.08);
}

/* Footer override (stuff/index.php uses .text-bg-light) */
.text-bg-light {
    background-color: var(--cocoa-2) !important;
    color: var(--muted) !important;
    border-top: 1px solid rgba(201, 168, 124, 0.1);
}
.text-bg-light a { color: var(--cream-1); }

/* Philosophy footnote box uses bs-secondary classes — warm them up */
.bs-secondary-bg {
    background-color: var(--cocoa-3) !important;
    color: var(--cream-0) !important;
    border-left: 2px solid var(--gold);
    border-radius: 2px;
}
.bs-secondary-color { color: var(--muted) !important; }
.text-muted { color: var(--muted) !important; }

/* Selection */
::selection {
    background: var(--gold);
    color: var(--cocoa-0);
}

/* Focus ring */
:focus-visible {
    outline: 2px solid var(--gold);
    outline-offset: 3px;
    border-radius: 2px;
}

/* Reveal animation — only when motion is welcome */
@media (prefers-reduced-motion: no-preference) {
    h1, .display-1 {
        animation: cocoa-reveal var(--t-slow) var(--ease) both;
    }
    .lead {
        animation: cocoa-reveal var(--t-slow) var(--ease) 120ms both;
    }
    @keyframes cocoa-reveal {
        from { opacity: 0; transform: translateY(12px); }
        to   { opacity: 1; transform: translateY(0); }
    }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation: none !important;
        transition: none !important;
    }
    html { scroll-behavior: auto; }
}
