:root {
    --gold: #C9A227;
    /* Responsive Knowledge Graph heights (used by #kg-modal-root + sub-layouts).
       clamp() gives sane mobile (min) / desktop (max) behavior while adapting to viewport height.
       JS resize listener in initKGModalGraph further adjusts the D3 simulation. */
    --kg-modal-height: clamp(420px, 64vh, 760px);
    --kg-header-height: 48px;
    --kg-footer-height: 58px;
}

body {
    font-family: 'Inter', system_ui, sans-serif;
}

.heading-serif {
    font-family: 'Playfair Display', Georgia, serif;
    font-feature-settings: "kern" "liga" "tnum";
}

.section-header {
    font-family: 'Playfair Display', Georgia, serif;
    letter-spacing: -0.025em;
}

.nav-link {
    position: relative;
    transition: color 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-link:after {
    content: '';
    position: absolute;
    width: 0;
    height: 1px;
    bottom: -2px;
    left: 0;
    background-color: #C9A227;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-link:hover:after,
.nav-link.active:after {
    width: 100%;
}

.gold-accent {
    color: #C9A227;
}

.prose-elegant {
    font-size: 1.05rem;
    line-height: 1.75;
    color: #CBD5E1;
}

.card {
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1),
                box-shadow 0.4s cubic-bezier(0.4, 0, 0.2, 1),
                border-color 0.3s ease;
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
    border-color: #C9A227;
}

.timeline-item {
    position: relative;
}

.timeline-item:not(:last-child):after {
    content: '';
    position: absolute;
    left: 15px;
    top: 48px;
    bottom: -24px;
    width: 1px;
    background: linear-gradient(to bottom, #334155, transparent);
}

.subtle-grid {
    background-image:
        linear-gradient(rgba(201, 162, 39, 0.035) 1px, transparent 1px),
        linear-gradient(90deg, rgba(201, 162, 39, 0.035) 1px, transparent 1px);
    background-size: 48px 48px;
}

.scripture {
    font-family: 'Playfair Display', Georgia, serif;
    font-style: italic;
    border-left: 3px solid #C9A227;
}

/* scrolled state owned by .site-nav.nav-scrolled in css/main.css */

.fade-in {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.7s cubic-bezier(0.4, 0, 0.2, 1),
                transform 0.7s cubic-bezier(0.4, 0, 0.2, 1);
}

.fade-in.visible {
    opacity: 1;
    transform: translateY(0);
}

.gold-underline {
    position: relative;
    display: inline-block;
}

.gold-underline:after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 100%;
    height: 1px;
    background: linear-gradient(to right, #C9A227, transparent);
}

.project-badge {
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    padding: 1px 10px;
    border-radius: 9999px;
    background: rgba(201, 162, 39, 0.1);
    color: #C9A227;
    border: 1px solid rgba(201, 162, 39, 0.2);
}

.elegant-divider {
    height: 1px;
    background: linear-gradient(to right, transparent, #334155, transparent);
}

/* Optional project support — Ko-fi widget within the portfolio design system */
.support-card {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem;
    text-align: left;
    border: 1px solid rgba(201, 162, 39, 0.24);
    border-radius: 1.25rem;
    background:
        radial-gradient(circle at top left, rgba(201, 162, 39, 0.13), transparent 44%),
        rgba(10, 15, 28, 0.72);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.support-card-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 3rem;
    height: 3rem;
    border: 1px solid rgba(201, 162, 39, 0.28);
    border-radius: 0.9rem;
    background: rgba(201, 162, 39, 0.1);
    font-size: 1.25rem;
}

.support-card-copy {
    min-width: 0;
}

.support-card-eyebrow {
    margin-bottom: 0.2rem;
    color: #C9A227;
    font-size: 0.62rem;
    font-weight: 600;
    letter-spacing: 0.16em;
}

.support-card h3 {
    color: #F8FAFC;
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: -0.015em;
}

.support-card p {
    margin-top: 0.35rem;
    color: #94A3B8;
    font-size: 0.78rem;
    line-height: 1.55;
}

.support-card-widget {
    min-width: 0;
    justify-self: end;
    text-align: right;
}

body .support-card-fallback {
    display: inline-flex;
    min-height: 1.625rem;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    padding: 0.3rem 0.55rem;
    border-radius: 0.3125rem;
    background: #72A4F2;
    color: #FFFFFF !important;
    font-size: 0.65rem;
    font-weight: 700;
    text-decoration: none !important;
}

.support-card-fallback-icon {
    width: 0.875rem;
    height: 0.6875rem;
    flex: 0 0 auto;
    object-fit: contain;
}

body .support-card-fallback:focus-visible {
    outline: 2px solid #F8FAFC;
    outline-offset: 3px;
}

@media (max-width: 639px) {
    .support-card {
        grid-template-columns: auto minmax(0, 1fr);
        align-items: start;
        padding: 1.1rem;
    }

    .support-card-widget {
        grid-column: 1 / -1;
        justify-self: stretch;
        margin-top: 0.15rem;
        text-align: center;
    }
}

/* Project case study modal — restrained, native to the design system */
.modal {
    animation: modalEnter 0.22s cubic-bezier(0.4, 0, 0.2, 1) backwards;
}

@keyframes modalEnter {
    from { opacity: 0; transform: translateY(14px) scale(0.982); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-backdrop {
    animation: backdropEnter 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes backdropEnter {
    from { opacity: 0; }
    to { opacity: 1; }
}

.case-study h4 {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 1.05rem;
    letter-spacing: -0.01em;
    color: #E2E8F0;
    margin-top: 1.65rem;
    margin-bottom: 0.45rem;
}

.case-study p {
    color: #94A3B8;
    line-height: 1.72;
    font-size: 0.98rem;
}

.case-study .intersection {
    border-left: 3px solid #C9A227;
    padding-left: 1.25rem;
    font-style: italic;
    color: #CBD5E1;
}

/* Lightweight pipeline visuals for rich project modals (reuses existing aesthetic) */
.case-study .pipeline-flow {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}
.case-study .pipeline-step {
    background: rgba(255,255,255,0.045);
    border: 1px solid rgba(255,255,255,0.10);
    padding: 5px 11px;
    border-radius: 9px;
    font-size: 0.73rem;
    color: #CBD5E1;
    white-space: nowrap;
    letter-spacing: -0.1px;
}
.case-study .pipeline-arrow {
    color: #64748B;
    font-size: 0.85rem;
    padding: 0 2px;
}
.case-study .pipeline-note {
    font-size: 0.72rem;
    color: #64748B;
    margin-top: 8px;
    line-height: 1.4;
}

/* Filter chips — Reflections */
.filter-chip {
    font-size: 0.75rem;
    padding: 5px 15px;
    border-radius: 9999px;
    border: 1px solid rgba(201, 162, 39, 0.22);
    background: rgba(10, 15, 28, 0.55);
    color: #CBD5E1;
    transition: all 0.18s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    user-select: none;
}

.filter-chip:hover {
    border-color: #C9A227;
    color: #C9A227;
}

.filter-chip.active {
    background: #C9A227;
    color: #0A0F1C;
    border-color: #C9A227;
    font-weight: 500;
}

/* Count badges inside filter chips (populated by initReflectionsFilter) */
.filter-chip .count {
    font-size: 0.65rem;
    line-height: 1;
    opacity: 0.8;
    margin-left: 5px;
    padding: 1px 5.5px;
    border-radius: 9999px;
    background: rgba(255,255,255,0.12);
    font-weight: 400;
}
.filter-chip.active .count {
    background: rgba(0,0,0,0.18);
    color: inherit;
    opacity: 0.9;
}

/* Clear button for Reflections filter (works with #reflections-clear) */
#reflections-clear {
    font-size: 0.7rem;
    padding: 4px 11px;
    border-radius: 9999px;
    border: 1px solid rgba(255,255,255,0.15);
    color: #64748B;
    background: transparent;
    transition: all 0.15s ease;
    cursor: pointer;
    user-select: none;
}
#reflections-clear:hover {
    color: #C9A227;
    border-color: rgba(201,162,39,0.4);
}

.reflection-item {
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.reflection-item.hidden {
    display: none;
}

/* Knowledge Graph Modal Styles — Obsidian aesthetic */
.kg-modal-btn {
    font-size: 9.5px;
    padding: 1px 8px;
    border-radius: 9999px;
    border: 1px solid rgba(255,255,255,0.13);
    color: #CBD5E1;
    background: rgba(255,255,255,0.025);
    transition: all 0.12s ease;
    cursor: pointer;
    line-height: 1.35;
}
.kg-modal-btn:hover {
    border-color: #C9A227;
    color: #C9A227;
}
.kg-modal-container .kg-modal-node {
    transition: filter 120ms ease, stroke-width 120ms ease;
}

/* Responsive Knowledge Graph container (used inside project modal templates + any direct embeds).
   - Uses CSS custom properties from :root for viewport-adaptive height.
   - Flex layout + percentage/flex children allow SVG to fill available space.
   - On mobile / short viewports the clamp() + flex keeps controls usable.
   - JS (initKGModalGraph + resize listener) keeps D3 force sim in sync with actual rendered size. */
.kg-modal-container {
    height: var(--kg-modal-height);
    width: 100%;
    min-height: 280px; /* safety floor */
    background: #0A0F1C;
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 14px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.03);
}
.kg-modal-container .kg-graph-area {
    flex: 1 1 auto;
    position: relative;
    min-height: 180px; /* allows very small viewports */
    background: #0A0F1C;
}

/* === The Intersection: vignette cards (deep navy, gold left accent, native to site) === */
.vignette-card {
    background-color: #0A0F1C;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-left: 4px solid #C9A227;
    border-radius: 1.5rem;
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1),
                box-shadow 0.35s cubic-bezier(0.4, 0, 0.2, 1),
                border-color 0.2s ease;
    padding-left: 1.65rem;
}
.vignette-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    border-color: rgba(201, 162, 39, 0.22);
}
.vignette-tag {
    font-size: 0.65rem;
    letter-spacing: 0.075em;
    padding: 2px 9px;
    border-radius: 9999px;
    background: rgba(201, 162, 39, 0.08);
    color: #C9A227;
    border: 1px solid rgba(201, 162, 39, 0.18);
    white-space: nowrap;
    display: inline-block;
}
