/* =========================================================
   Martin Ondiwa — Portfolio
   Palette: deep ink + survey amber + signal teal
   ========================================================= */
:root {
    --ink: #0b1220;
    --ink-2: #121c31;
    --ink-3: #1b2742;
    --paper: #f5f6fa;
    --surface: #ffffff;
    --line: #e3e7ef;
    --text: #18202f;
    --muted: #5d6779;
    --accent: #f5a524;
    --accent-dark: #d48806;
    --teal: #2dd4bf;
    --sky: #8fb8ff;
    --radius: 16px;
    --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 8px 24px rgba(16, 24, 40, .06);
    --shadow-lg: 0 20px 50px rgba(11, 18, 32, .14);
    --font-head: 'Space Grotesk', system-ui, sans-serif;
    --font-body: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --font-mono: 'JetBrains Mono', ui-monospace, monospace;
}

html { scroll-behavior: smooth; }
body {
    font-family: var(--font-body);
    color: var(--text);
    background: var(--paper);
    -webkit-font-smoothing: antialiased;
    line-height: 1.65;
}
h1, h2, h3, h4, .brand-text { font-family: var(--font-head); letter-spacing: -.02em; }
a { color: inherit; }
img { max-width: 100%; }
::selection { background: var(--accent); color: var(--ink); }

.skip-link { position: absolute; top: 8px; left: 8px; z-index: 2000; background: var(--accent); color: var(--ink); padding: .5rem 1rem; border-radius: 8px; }
.text-muted-light { color: rgba(255,255,255,.55) !important; }
.sep { color: #b6bdca; margin: 0 .25rem; }

/* ---------- Buttons ---------- */
.btn { border-radius: 12px; font-weight: 600; transition: transform .15s ease, box-shadow .2s ease, background .2s ease; }
.btn:active { transform: translateY(1px); }
.btn-accent { background: var(--accent); color: var(--ink); border: 1px solid var(--accent); }
.btn-accent:hover, .btn-accent:focus { background: #ffb73d; color: var(--ink); border-color: #ffb73d; box-shadow: 0 8px 24px rgba(245,165,36,.35); }
.btn-ghost { color: #fff; border: 1px solid rgba(255,255,255,.25); background: rgba(255,255,255,.04); }
.btn-ghost:hover { color: #fff; background: rgba(255,255,255,.1); border-color: rgba(255,255,255,.45); }
.btn-dark-soft { background: var(--ink); color: #fff; border: 1px solid var(--ink); }
.btn-dark-soft:hover { background: var(--ink-3); color: #fff; }
.btn-outline-dark-soft { border: 1px solid var(--line); color: var(--text); background: var(--surface); }
.btn-outline-dark-soft:hover { border-color: var(--text); color: var(--text); }

/* ---------- Navbar ---------- */
.site-nav { padding: 1.1rem 0; transition: background .3s ease, padding .3s ease, box-shadow .3s ease; }
.site-nav .nav-link { color: rgba(255,255,255,.75); font-weight: 500; font-size: .95rem; padding: .4rem .8rem !important; border-radius: 8px; }
.site-nav .nav-link:hover, .site-nav .nav-link.active { color: #fff; background: rgba(255,255,255,.06); }
.site-nav.scrolled { background: rgba(11,18,32,.88); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); padding: .6rem 0; box-shadow: 0 1px 0 rgba(255,255,255,.06); }
.navbar-toggler { color: #fff; border: 1px solid rgba(255,255,255,.2); font-size: 1.4rem; padding: .2rem .55rem; }
.navbar-toggler:focus { box-shadow: 0 0 0 3px rgba(245,165,36,.4); }
@media (max-width: 991.98px) {
    .site-nav .navbar-collapse { background: rgba(11,18,32,.97); margin-top: .75rem; padding: 1rem; border-radius: 14px; border: 1px solid rgba(255,255,255,.08); }
    .site-nav { background: rgba(11,18,32,.9); backdrop-filter: blur(10px); }
}

.brand { display: inline-flex; align-items: center; gap: .6rem; text-decoration: none; color: #fff; }
.brand:hover { color: #fff; }
.brand-mark {
    display: grid; place-items: center; width: 38px; height: 38px; border-radius: 10px;
    background: linear-gradient(135deg, var(--accent), #ffcf70); color: var(--ink);
    font-family: var(--font-mono); font-weight: 600; font-size: .9rem;
}
.brand-text { font-weight: 600; font-size: 1.05rem; }

/* ---------- Hero ---------- */
.hero {
    position: relative; overflow: hidden; color: #fff;
    background: radial-gradient(1200px 600px at 85% 20%, rgba(45,212,191,.12), transparent 60%),
                radial-gradient(900px 500px at 10% 90%, rgba(245,165,36,.10), transparent 60%),
                var(--ink);
    padding: 9rem 0 6rem; min-height: 100vh; display: flex; align-items: center;
}
.hero-contours, .section-contours {
    position: absolute; inset: 0; background: url('../img/contours.svg') center/cover no-repeat;
    opacity: .35; pointer-events: none; animation: drift 40s ease-in-out infinite alternate;
}
.hero-grid {
    position: absolute; inset: 0; pointer-events: none;
    background-image: linear-gradient(rgba(255,255,255,.035) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.035) 1px, transparent 1px);
    background-size: 64px 64px;
    mask-image: radial-gradient(ellipse at center, #000 30%, transparent 75%);
}
@keyframes drift { from { transform: scale(1.05) translate(0,0); } to { transform: scale(1.12) translate(-2%, 1%); } }

.status-pill {
    display: inline-flex; align-items: center; gap: .55rem; font-size: .85rem; font-weight: 500;
    padding: .4rem .9rem; border-radius: 999px; background: rgba(45,212,191,.1); color: #9ff5e8;
    border: 1px solid rgba(45,212,191,.3); margin-bottom: 1.5rem;
}
.pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--teal); box-shadow: 0 0 0 0 rgba(45,212,191,.7); animation: pulse 2s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 10px rgba(45,212,191,0); } 100% { box-shadow: 0 0 0 0 rgba(45,212,191,0); } }

.hero-title { font-size: clamp(2.6rem, 6vw, 4.6rem); font-weight: 700; line-height: 1.05; margin-bottom: 1rem; }
.text-gradient { background: linear-gradient(90deg, var(--accent), #ffd98a 50%, var(--teal)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero-role { font-family: var(--font-mono); font-size: clamp(1rem, 2vw, 1.25rem); color: var(--sky); min-height: 1.8em; margin-bottom: 1.2rem; }
.mono-label { color: var(--accent); margin-right: .4rem; }
.caret { color: var(--accent); animation: blink 1s steps(1) infinite; margin-left: 2px; }
@keyframes blink { 50% { opacity: 0; } }
.hero-lead { font-size: 1.15rem; color: rgba(255,255,255,.72); max-width: 600px; }
.hero-meta { display: flex; flex-wrap: wrap; gap: 1.5rem; margin-top: 2rem; color: rgba(255,255,255,.6); font-size: .92rem; }
.hero-meta i { color: var(--accent); margin-right: .45rem; }

.social-row { display: flex; gap: .6rem; }
.social-row a {
    width: 42px; height: 42px; display: grid; place-items: center; border-radius: 12px;
    border: 1px solid rgba(255,255,255,.14); color: rgba(255,255,255,.8); text-decoration: none; font-size: 1.1rem;
    transition: all .2s ease;
}
.social-row a:hover { color: var(--ink); background: var(--accent); border-color: var(--accent); transform: translateY(-3px); }

/* Portrait */
.portrait-wrap { position: relative; width: min(400px, 82vw); aspect-ratio: 1; margin: 0 auto; }
.portrait {
    position: absolute; inset: 10%; border-radius: 50%; overflow: hidden;
    border: 4px solid rgba(255,255,255,.08); box-shadow: 0 30px 80px rgba(0,0,0,.5), 0 0 0 10px rgba(245,165,36,.08);
}
.portrait img { width: 100%; height: 100%; object-fit: cover; }
.portrait-ring { position: absolute; border-radius: 50%; border: 1px dashed rgba(143,184,255,.35); }
.ring-1 { inset: 2%; animation: spin 50s linear infinite; }
.ring-2 { inset: -6%; border-style: solid; border-color: rgba(245,165,36,.18); border-top-color: var(--accent); animation: spin 18s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.chip-float {
    position: absolute; font-size: .78rem; font-weight: 600; white-space: nowrap;
    background: rgba(18,28,49,.85); backdrop-filter: blur(8px); border: 1px solid rgba(255,255,255,.12);
    padding: .45rem .8rem; border-radius: 10px; color: #fff; box-shadow: 0 10px 30px rgba(0,0,0,.3);
    animation: float 6s ease-in-out infinite;
}
.chip-float i { color: var(--accent); margin-right: .3rem; }
.chip-a { top: 8%; left: -6%; }
.chip-b { top: 46%; right: -10%; animation-delay: -2s; }
.chip-c { bottom: 6%; left: 2%; animation-delay: -4s; }
@keyframes float { 50% { transform: translateY(-10px); } }
.coord-tag { position: absolute; bottom: -8%; right: 6%; font-family: var(--font-mono); font-size: .72rem; color: rgba(255,255,255,.4); }
@media (max-width: 575.98px) { .chip-a { left: -2%; } .chip-b { right: -2%; } }

.scroll-cue { position: absolute; left: 50%; bottom: 1.5rem; transform: translateX(-50%); color: rgba(255,255,255,.5); font-size: 1.4rem; animation: bob 2s ease-in-out infinite; }
@keyframes bob { 50% { transform: translate(-50%, 6px); } }

/* ---------- Sections ---------- */
.section { padding: 6.5rem 0; position: relative; }
.section-alt { background: var(--surface); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.section-dark { background: var(--ink); color: #fff; overflow: hidden; }
.section-dark .section-contours { opacity: .18; }
.eyebrow { font-family: var(--font-mono); font-size: .8rem; letter-spacing: .08em; text-transform: uppercase; color: var(--accent-dark); margin-bottom: .75rem; }
.eyebrow-light { color: var(--accent); }
.section-title { font-size: clamp(1.9rem, 3.6vw, 2.75rem); font-weight: 700; line-height: 1.15; }
.sub-title { font-size: 1.2rem; font-weight: 600; margin-bottom: 1.25rem; }
.sub-title i { color: var(--accent-dark); }

/* About */
.about-text p { font-size: 1.08rem; color: #3a4456; }
.about-text p:first-child { font-size: 1.22rem; color: var(--text); font-weight: 500; }
.highlight-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.highlight { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem; box-shadow: var(--shadow); }
.highlight-value { font-family: var(--font-head); font-size: 2rem; font-weight: 700; color: var(--ink); }
.highlight-label { font-size: .85rem; color: var(--muted); line-height: 1.35; }

/* Timeline */
.timeline { position: relative; padding-left: 2rem; }
.timeline::before { content: ''; position: absolute; left: 7px; top: 8px; bottom: 8px; width: 2px; background: linear-gradient(var(--accent), var(--line) 40%); }
.timeline-item { position: relative; margin-bottom: 1.5rem; }
.timeline-dot { position: absolute; left: calc(-2rem + 1px); top: 1.75rem; width: 14px; height: 14px; border-radius: 50%; background: var(--surface); border: 3px solid #c4cbd8; }
.timeline-dot.is-current { border-color: var(--accent); box-shadow: 0 0 0 5px rgba(245,165,36,.18); }
.exp-card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.5rem 1.75rem; transition: box-shadow .25s ease, transform .25s ease, border-color .25s ease; }
.exp-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); border-color: #d4d9e4; background: var(--surface); }
.exp-role { font-size: 1.2rem; font-weight: 600; margin: 0; }
.exp-period { font-family: var(--font-mono); font-size: .8rem; color: var(--muted); white-space: nowrap; }
.exp-company { font-weight: 600; color: var(--accent-dark); margin-bottom: .75rem; }
.exp-points { padding-left: 1.1rem; color: #3a4456; margin-bottom: 1rem; }
.exp-points li { margin-bottom: .35rem; }
.exp-points li::marker { color: var(--accent); }
.badge-current { background: rgba(45,212,191,.15); color: #0f766e; font-weight: 600; }

/* Tags */
.tag-row { display: flex; flex-wrap: wrap; gap: .4rem; }
.tag { font-size: .76rem; font-weight: 500; padding: .28rem .6rem; border-radius: 8px; background: #eef1f6; color: #3a4456; border: 1px solid #e3e7ef; }
.tag-dark { background: rgba(255,255,255,.06); color: rgba(255,255,255,.85); border-color: rgba(255,255,255,.1); }

/* Projects */
.filter-bar { display: flex; flex-wrap: wrap; gap: .4rem; }
.filter-btn { border: 1px solid var(--line); background: var(--surface); color: var(--muted); font-size: .85rem; font-weight: 500; padding: .45rem .9rem; border-radius: 999px; transition: all .2s ease; }
.filter-btn:hover { color: var(--text); border-color: #c4cbd8; }
.filter-btn.active { background: var(--ink); color: #fff; border-color: var(--ink); }
.project-col.is-hidden { display: none; }
.project-card { height: 100%; display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; transition: transform .3s ease, box-shadow .3s ease; }
.project-card:hover { transform: translateY(-6px); box-shadow: var(--shadow-lg); }
.project-media { position: relative; display: block; aspect-ratio: 16/9; overflow: hidden; background: var(--ink-2); }
.project-media img { width: 100%; height: 100%; object-fit: cover; transition: transform .6s ease; }
.project-card:hover .project-media img { transform: scale(1.06); }
.project-placeholder {
    width: 100%; height: 100%; display: grid; place-items: center; color: var(--accent); font-size: 3rem;
    background: url('../img/contours.svg') center/180% no-repeat, linear-gradient(135deg, var(--ink-2), var(--ink-3));
}
.project-placeholder i { filter: drop-shadow(0 6px 20px rgba(245,165,36,.4)); transition: transform .4s ease; }
.project-card:hover .project-placeholder i { transform: scale(1.12) rotate(-6deg); }
.ribbon { position: absolute; top: 12px; left: 12px; background: var(--accent); color: var(--ink); font-size: .72rem; font-weight: 700; padding: .25rem .6rem; border-radius: 6px; }
.project-body { padding: 1.4rem 1.5rem .5rem; flex: 1; }
.project-meta { display: flex; justify-content: space-between; gap: .5rem; font-family: var(--font-mono); font-size: .72rem; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; margin-bottom: .6rem; }
.project-title { font-size: 1.15rem; font-weight: 600; line-height: 1.3; }
.project-title a { text-decoration: none; }
.project-title a:hover { color: var(--accent-dark); }
.project-summary { color: var(--muted); font-size: .93rem; }
.project-foot { display: flex; justify-content: space-between; align-items: center; padding: 1rem 1.5rem 1.3rem; border-top: 1px solid var(--line); margin-top: 1rem; }
.project-foot a { color: var(--muted); text-decoration: none; }
.project-foot a:hover { color: var(--text); }
.link-arrow { font-weight: 600; color: var(--text) !important; text-decoration: none; }
.link-arrow i { transition: transform .2s ease; display: inline-block; }
.link-arrow:hover i { transform: translateX(4px); }
.empty-state { text-align: center; padding: 3rem; border: 2px dashed var(--line); border-radius: var(--radius); color: var(--muted); }

/* Skills */
.skill-card { height: 100%; padding: 1.75rem; border-radius: var(--radius); background: rgba(255,255,255,.03); border: 1px solid rgba(255,255,255,.08); transition: border-color .25s ease, background .25s ease, transform .25s ease; }
.skill-card:hover { border-color: rgba(245,165,36,.45); background: rgba(255,255,255,.05); transform: translateY(-4px); }
.skill-icon { width: 48px; height: 48px; border-radius: 12px; display: grid; place-items: center; font-size: 1.35rem; color: var(--ink); background: linear-gradient(135deg, var(--accent), #ffd98a); margin-bottom: 1.1rem; }
.skill-title { font-size: 1.1rem; font-weight: 600; margin-bottom: 1rem; }

/* Education */
.edu-card { display: flex; gap: 1.1rem; height: 100%; padding: 1.5rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.edu-icon { flex: 0 0 48px; height: 48px; border-radius: 12px; display: grid; place-items: center; background: #fff4e0; color: var(--accent-dark); font-size: 1.35rem; }
.edu-degree { font-size: 1.1rem; font-weight: 600; margin: .35rem 0 .2rem; }
.edu-school { font-weight: 500; color: var(--text); margin-bottom: .5rem; }
.edu-details { font-size: .9rem; color: var(--muted); margin: 0; }
.list-clean { list-style: none; padding: 0; margin: 0; }
.list-clean li { display: flex; gap: 1rem; padding: .9rem 0; border-bottom: 1px solid var(--line); }
.list-year { font-family: var(--font-mono); font-size: .8rem; color: var(--accent-dark); padding-top: .15rem; min-width: 42px; }
.pub-card { padding: 1.4rem; border-left: 3px solid var(--accent); background: var(--surface); border-radius: 0 var(--radius) var(--radius) 0; box-shadow: var(--shadow); }
.pub-title { font-family: var(--font-head); font-weight: 600; font-size: 1.05rem; margin-bottom: .35rem; line-height: 1.35; }

/* Contact */
.contact-list { list-style: none; padding: 0; }
.contact-list li { display: flex; align-items: center; gap: .9rem; padding: .55rem 0; }
.contact-list i { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 10px; background: var(--paper); border: 1px solid var(--line); color: var(--accent-dark); }
.contact-list a { text-decoration: none; font-weight: 500; }
.contact-list a:hover { color: var(--accent-dark); }
.contact-form { background: var(--paper); border: 1px solid var(--line); border-radius: 20px; padding: 2rem; }
.form-label { font-weight: 500; font-size: .9rem; }
.form-control, .form-select { border-radius: 10px; border-color: #d6dbe5; padding: .7rem .9rem; }
.form-control:focus, .form-select:focus { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(245,165,36,.15); }
.hp-field { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* Footer */
.site-footer { background: var(--ink); color: #fff; padding: 3.5rem 0; }

.to-top { position: fixed; right: 1.25rem; bottom: 1.25rem; width: 46px; height: 46px; border-radius: 12px; border: none; background: var(--accent); color: var(--ink); font-size: 1.2rem; box-shadow: var(--shadow-lg); opacity: 0; visibility: hidden; transform: translateY(10px); transition: all .3s ease; z-index: 1000; }
.to-top.show { opacity: 1; visibility: visible; transform: none; }

/* Project detail */
.project-hero { position: relative; overflow: hidden; background: var(--ink); color: #fff; padding: 8.5rem 0 3.5rem; }
.project-hero .hero-contours { opacity: .22; }
.project-hero-title { font-size: clamp(2rem, 4.5vw, 3.2rem); font-weight: 700; max-width: 900px; line-height: 1.12; }
.back-link { color: rgba(255,255,255,.65); text-decoration: none; font-size: .9rem; }
.back-link:hover { color: var(--accent); }
.project-facts { display: flex; flex-wrap: wrap; gap: 2.5rem; margin-top: 2rem; padding-top: 1.5rem; border-top: 1px solid rgba(255,255,255,.1); }
.project-facts div { font-weight: 500; }
.project-facts span { display: block; font-family: var(--font-mono); font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: rgba(255,255,255,.5); margin-bottom: .2rem; }
.project-figure { border-radius: var(--radius); overflow: hidden; margin-bottom: 2rem; box-shadow: var(--shadow-lg); }
.project-figure img { width: 100%; display: block; }
.prose { font-size: 1.07rem; color: #333d4f; }
.prose ul { padding-left: 1.2rem; }
.prose li { margin-bottom: .5rem; }
.prose li::marker { color: var(--accent); }
.side-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.6rem; box-shadow: var(--shadow); z-index: 1; }
.side-title { font-size: .8rem; font-family: var(--font-mono); text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: .9rem; }
.project-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-top: 4rem; padding-top: 2rem; border-top: 1px solid var(--line); }
.project-nav a { text-decoration: none; font-family: var(--font-head); font-weight: 600; padding: 1rem; border-radius: 12px; transition: background .2s ease; }
.project-nav a:hover { background: var(--surface); }
.project-nav span { display: block; font-family: var(--font-mono); font-size: .75rem; color: var(--muted); font-weight: 400; margin-bottom: .3rem; }
.page-top { padding-top: 7rem; }

/* Reveal on scroll */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity .7s ease, transform .7s ease; }
.reveal.in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
    .reveal { opacity: 1; transform: none; }
}
@media (max-width: 767.98px) {
    .section { padding: 4.5rem 0; }
    .hero { padding: 7.5rem 0 4.5rem; }
    .contact-form { padding: 1.4rem; }
    .exp-card { padding: 1.25rem; }
}

/* =========================================================
   Project showcase: dashboards, gallery, reports
   ========================================================= */
.min-w-0 { min-width: 0; }
.media-section { margin-top: 4.5rem; scroll-margin-top: 100px; }
.media-heading { font-size: clamp(1.5rem, 2.6vw, 2rem); font-weight: 700; margin-bottom: 1.75rem; }

.jump-list { display: grid; gap: .4rem; }
.jump-list a { display: flex; align-items: center; gap: .6rem; padding: .55rem .75rem; border-radius: 10px; background: var(--paper); border: 1px solid var(--line); text-decoration: none; font-size: .9rem; font-weight: 500; transition: border-color .2s, background .2s; }
.jump-list a:hover { border-color: var(--accent); background: #fffaf0; }
.jump-list i { color: var(--accent-dark); }

/* Dashboards / interactive */
.viz-card { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; overflow: hidden; box-shadow: var(--shadow); margin-bottom: 1.75rem; }
.viz-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: 1rem 1.25rem; border-bottom: 1px solid var(--line); }
.viz-provider { font-family: var(--font-mono); font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); display: inline-flex; align-items: center; gap: .4rem; }
.viz-provider i { color: var(--accent-dark); font-size: .9rem; }
.viz-title { font-family: var(--font-head); font-weight: 600; font-size: 1.08rem; margin-top: .15rem; }
.viz-frame { position: relative; width: 100%; background: #eef1f6; }
.viz-frame.aspect-16x9 { aspect-ratio: 16 / 9; }
.viz-frame.aspect-4x3 { aspect-ratio: 4 / 3; }
.viz-frame.aspect-1x1 { aspect-ratio: 1 / 1; max-height: 80vh; }
.viz-frame.aspect-tall { height: min(900px, 85vh); }
.viz-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: transparent; }
.viz-loading { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); font-size: .9rem; }
@media (max-width: 767.98px) {
    .viz-frame.aspect-16x9, .viz-frame.aspect-4x3 { aspect-ratio: auto; height: 70vh; }
    .viz-head .btn { padding: .3rem .5rem; font-size: .8rem; }
}

/* Gallery */
.gallery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; }
.gallery-item { position: relative; display: block; padding: 0; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: var(--ink-2); aspect-ratio: 4 / 3; cursor: zoom-in; }
.gallery-item:first-child:nth-last-child(n+3) { grid-column: span 2; grid-row: span 2; aspect-ratio: auto; }
@media (max-width: 575.98px) { .gallery-item:first-child:nth-last-child(n+3) { grid-column: auto; grid-row: auto; aspect-ratio: 4 / 3; } }
.gallery-item img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s ease, opacity .3s; }
.gallery-item:hover img { transform: scale(1.05); }
.gallery-caption { position: absolute; left: 0; right: 0; bottom: 0; padding: 2rem .9rem .75rem; text-align: left; color: #fff; font-size: .85rem; font-weight: 500; line-height: 1.35; background: linear-gradient(transparent, rgba(11,18,32,.85)); }
.gallery-zoom { position: absolute; top: .6rem; right: .6rem; width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: rgba(11,18,32,.6); color: #fff; opacity: 0; transform: scale(.8); transition: all .25s ease; }
.gallery-item:hover .gallery-zoom, .gallery-item:focus-visible .gallery-zoom { opacity: 1; transform: none; }
.gallery-item:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* Lightbox */
.lightbox .modal-content { background: rgba(8, 12, 22, .97); border: 0; border-radius: 0; }
.lightbox-slide { height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 4rem 4.5rem 1.5rem; }
.lightbox-slide img { max-width: 100%; max-height: calc(100vh - 9rem); object-fit: contain; border-radius: 8px; box-shadow: 0 30px 80px rgba(0,0,0,.6); }
.lightbox-caption { color: rgba(255,255,255,.85); margin-top: 1rem; text-align: center; max-width: 900px; font-size: .95rem; }
.lightbox-count { font-family: var(--font-mono); font-size: .75rem; color: var(--accent); margin-right: .6rem; }
.lightbox-close { position: absolute; top: 1rem; right: 1rem; z-index: 5; width: 44px; height: 44px; border-radius: 12px; border: 1px solid rgba(255,255,255,.2); background: rgba(255,255,255,.06); color: #fff; font-size: 1.1rem; }
.lightbox-close:hover { background: var(--accent); color: var(--ink); }
.lightbox .carousel-control-prev, .lightbox .carousel-control-next { width: 4.5rem; opacity: 1; }
.lb-arrow { width: 46px; height: 46px; display: grid; place-items: center; border-radius: 50%; background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.2); color: #fff; font-size: 1.2rem; transition: background .2s; }
.lightbox .carousel-control-prev:hover .lb-arrow, .lightbox .carousel-control-next:hover .lb-arrow { background: var(--accent); color: var(--ink); }
@media (max-width: 575.98px) { .lightbox-slide { padding: 4rem .75rem 1rem; } .lightbox .carousel-control-prev, .lightbox .carousel-control-next { width: 3rem; align-items: flex-end; padding-bottom: 1rem; } }

/* Documents */
.doc-card { display: flex; align-items: center; gap: 1rem; padding: 1.1rem 1.25rem; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; text-decoration: none; transition: border-color .2s, box-shadow .2s, transform .2s; }
.doc-card:hover { border-color: var(--accent); box-shadow: var(--shadow); transform: translateY(-2px); }
.doc-card strong { display: block; font-family: var(--font-head); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-card small { color: var(--muted); }
.doc-icon { flex: 0 0 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; background: #fde8e8; color: #c0392b; font-size: 1.3rem; }

/* Card media badges */
.media-badges { position: absolute; right: 12px; bottom: 12px; display: flex; gap: .35rem; }
.media-badges span { display: inline-flex; align-items: center; gap: .3rem; font-size: .72rem; font-weight: 600; padding: .25rem .5rem; border-radius: 7px; color: #fff; background: rgba(11,18,32,.75); backdrop-filter: blur(6px); }
.media-badges i { color: var(--accent); }
.gallery-grid.gallery-few { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.gallery-grid.gallery-few .gallery-item { aspect-ratio: 16 / 10; }
.gallery-grid.gallery-few .gallery-item:only-child { max-width: 900px; }
