/* ============================================================
   Rex Moran Loba — Executive Portfolio
   Statesman aesthetic: ink navy, champagne gold, Marcellus.
   Self-contained design system (no Bootstrap / template CSS).
   ============================================================ */

:root {
    --ink: #0a111f;
    --ink-2: #0e1830;
    --ink-3: #14203c;
    --panel: rgba(255, 255, 255, 0.035);
    --panel-border: rgba(201, 162, 39, 0.18);
    --gold: #c9a227;
    --gold-light: #e8c766;
    --gold-dim: rgba(201, 162, 39, 0.55);
    --cream: #f3eede;
    --muted: #97a3b8;
    --font-display: 'Marcellus', 'Times New Roman', serif;
    --font-body: 'Albert Sans', 'Segoe UI', sans-serif;
    --ease: cubic-bezier(0.22, 1, 0.36, 1);
    --maxw: 1240px;
}

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

html { scroll-behavior: smooth; }

body {
    background-color: var(--ink);
    background-image:
        radial-gradient(1200px 600px at 85% -10%, rgba(201, 162, 39, 0.08), transparent 60%),
        radial-gradient(900px 500px at -10% 30%, rgba(46, 78, 145, 0.18), transparent 55%),
        repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.012) 0 1px, transparent 1px 9px);
    background-attachment: fixed;
    color: var(--cream);
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

img { max-width: 100%; }
a { color: var(--gold-light); text-decoration: none; }
a:hover { color: var(--gold-light); }

h1, h2, h3, h4 {
    font-family: var(--font-display);
    font-weight: 400;
    color: var(--cream);
    line-height: 1.18;
}

::selection { background: var(--gold); color: var(--ink); }

::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-track { background: var(--ink); }
::-webkit-scrollbar-thumb { background: var(--ink-3); border-radius: 6px; }
::-webkit-scrollbar-thumb:hover { background: var(--gold-dim); }

.wrap {
    max-width: var(--maxw);
    margin: 0 auto;
    padding: 0 28px;
}

/* ---------- Header ---------- */

.site-header {
    position: fixed;
    inset: 0 0 auto 0;
    z-index: 100;
    background: linear-gradient(180deg, rgba(10, 17, 31, 0.92), rgba(10, 17, 31, 0.78));
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid rgba(201, 162, 39, 0.14);
}

.site-header .wrap {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 76px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
}

.brand img {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid var(--gold-dim);
    padding: 2px;
}

.brand-text { line-height: 1.25; white-space: nowrap; }

.brand-text .brand-name {
    font-family: var(--font-display);
    font-size: 1.05rem;
    letter-spacing: 0.06em;
    color: var(--cream);
}

.brand-text .brand-role {
    font-size: 0.62rem;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--gold);
}

.site-nav { display: flex; align-items: center; gap: 34px; }

.site-nav a {
    position: relative;
    font-size: 0.78rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--muted);
    padding: 6px 0;
    transition: color 0.25s var(--ease);
}

.site-nav a::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: 0;
    width: 100%;
    height: 1px;
    background: var(--gold);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.3s var(--ease);
}

.site-nav a:hover,
.site-nav a.active { color: var(--cream); }

.site-nav a.active::after,
.site-nav a:hover::after { transform: scaleX(1); }

.nav-toggle {
    display: none;
    background: none;
    border: 1px solid var(--panel-border);
    border-radius: 8px;
    width: 44px;
    height: 44px;
    cursor: pointer;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

.nav-toggle span {
    display: block;
    width: 20px;
    height: 2px;
    background: var(--gold-light);
    transition: transform 0.3s var(--ease), opacity 0.2s;
}

body.menu-open .nav-toggle span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
body.menu-open .nav-toggle span:nth-child(2) { opacity: 0; }
body.menu-open .nav-toggle span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

@media (max-width: 900px) {
    .nav-toggle { display: flex; }

    .site-nav {
        position: fixed;
        top: 76px;
        left: 0;
        right: 0;
        flex-direction: column;
        gap: 0;
        background: rgba(10, 17, 31, 0.97);
        border-bottom: 1px solid var(--panel-border);
        padding: 10px 0 18px;
        transform: translateY(-130%);
        transition: transform 0.35s var(--ease);
    }

    body.menu-open .site-nav { transform: translateY(0); }

    .site-nav a { padding: 14px 28px; width: 100%; text-align: center; }
    .site-nav a::after { display: none; }
    .site-nav a.active { color: var(--gold-light); }
}

/* ---------- Page scaffolding ---------- */

#spa-content {
    padding-top: 76px;
    min-height: 100vh;
    transition: opacity 0.35s var(--ease), transform 0.35s var(--ease);
    opacity: 1;
    transform: translateY(0);
}

.spa-transitioning #spa-content {
    opacity: 0;
    transform: translateY(14px);
}

.section { padding: 72px 0; }

.section-head { margin-bottom: 44px; }

.kicker {
    display: inline-flex;
    align-items: center;
    gap: 14px;
    font-size: 0.72rem;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    color: var(--gold);
}

.kicker::before {
    content: '';
    width: 42px;
    height: 1px;
    background: var(--gold);
}

.section-head h2 {
    font-size: clamp(1.8rem, 3.4vw, 2.6rem);
    margin-top: 12px;
}

/* ---------- Hero ---------- */

.hero {
    position: relative;
    padding: 84px 0 64px;
}

.hero .wrap {
    display: grid;
    grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
    gap: 64px;
    align-items: center;
}

.hero-portrait {
    position: relative;
    justify-self: center;
    width: min(100%, 420px);
}

.hero-portrait::before {
    content: '';
    position: absolute;
    inset: 18px -18px -18px 18px;
    border: 1px solid var(--gold-dim);
    border-radius: 4px;
    pointer-events: none;
}

.hero-portrait img {
    position: relative;
    display: block;
    width: 100%;
    border-radius: 4px;
    filter: saturate(0.92) contrast(1.04);
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.55);
}

.hero-portrait .portrait-seal {
    position: absolute;
    top: -26px;
    left: -26px;
    width: 84px;
    height: 84px;
    border-radius: 50%;
    background: var(--ink-2);
    border: 1px solid var(--gold-dim);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    z-index: 2;
}

.hero-portrait .portrait-seal img {
    width: 78%;
    height: 78%;
    object-fit: contain;
    border-radius: 50%;
    box-shadow: none;
}

.hero-text h1 {
    font-size: clamp(2.5rem, 5.4vw, 4.2rem);
    letter-spacing: 0.015em;
    margin: 14px 0 6px;
}

.hero-roles {
    min-height: 2.2em;
    font-family: var(--font-display);
    font-size: clamp(1.05rem, 2vw, 1.4rem);
    color: var(--gold-light);
    letter-spacing: 0.04em;
}

.hero-roles .type-cursor {
    display: inline-block;
    width: 2px;
    height: 1em;
    margin-left: 3px;
    background: var(--gold);
    vertical-align: -0.12em;
    animation: blink 1s steps(1) infinite;
}

@keyframes blink { 50% { opacity: 0; } }

.hero-summary {
    margin-top: 22px;
    max-width: 56ch;
    color: var(--muted);
    font-size: 1.02rem;
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    margin-top: 30px;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 13px 26px;
    border-radius: 2px;
    font-size: 0.76rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    border: 1px solid var(--gold-dim);
    color: var(--cream);
    background: transparent;
    cursor: pointer;
    transition: background 0.3s var(--ease), color 0.3s var(--ease), transform 0.3s var(--ease);
}

.btn:hover { transform: translateY(-2px); color: var(--cream); }

.btn-gold {
    background: linear-gradient(120deg, var(--gold), var(--gold-light));
    color: #1a1404;
    border-color: transparent;
    font-weight: 600;
}

.btn-gold:hover { color: #1a1404; box-shadow: 0 10px 28px rgba(201, 162, 39, 0.3); }

.hero-contacts {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 28px;
    margin-top: 28px;
    padding-top: 22px;
    border-top: 1px solid rgba(255, 255, 255, 0.07);
}

.hero-contacts a {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    color: var(--muted);
    font-size: 0.9rem;
    transition: color 0.25s;
}

.hero-contacts a:hover { color: var(--gold-light); }

.hero-contacts svg { width: 16px; height: 16px; fill: var(--gold); flex: none; }

@media (max-width: 1000px) {
    .hero { padding-top: 48px; }
    .hero .wrap { grid-template-columns: 1fr; gap: 56px; }
    .hero-portrait { width: min(78%, 360px); }
}

/* ---------- Stats band ---------- */

.stats-band {
    border-top: 1px solid rgba(201, 162, 39, 0.16);
    border-bottom: 1px solid rgba(201, 162, 39, 0.16);
    background: linear-gradient(180deg, rgba(201, 162, 39, 0.05), rgba(201, 162, 39, 0.015));
}

.stats-band .wrap {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0;
}

.stat {
    text-align: center;
    padding: 34px 12px;
    border-left: 1px solid rgba(201, 162, 39, 0.12);
}

.stat:first-child { border-left: none; }

.stat .stat-value {
    font-family: var(--font-display);
    font-size: clamp(1.9rem, 3.6vw, 2.8rem);
    color: var(--gold-light);
    line-height: 1;
}

.stat .stat-label {
    margin-top: 10px;
    font-size: 0.68rem;
    letter-spacing: 0.24em;
    text-transform: uppercase;
    color: var(--muted);
}

@media (max-width: 760px) {
    .stats-band .wrap { grid-template-columns: repeat(2, 1fr); }
    .stat:nth-child(3) { border-left: none; }
    .stat:nth-child(n+3) { border-top: 1px solid rgba(201, 162, 39, 0.12); }
}

/* ---------- Organization / selector cards ---------- */

.card-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 18px;
}

@media (max-width: 1100px) { .card-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 820px) { .card-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 480px) { .card-grid { grid-template-columns: 1fr; } }

.org-card {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 16px;
    padding: 34px 22px 28px;
    background: var(--panel);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 6px;
    overflow: hidden;
    transition: transform 0.35s var(--ease), border-color 0.35s var(--ease), background 0.35s var(--ease);
    cursor: pointer;
}

.org-card::before {
    content: '';
    position: absolute;
    inset: 0 0 auto 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--gold), transparent);
    opacity: 0;
    transition: opacity 0.35s;
}

.org-card:hover,
.org-card.selected {
    transform: translateY(-5px);
    border-color: var(--panel-border);
    background: rgba(255, 255, 255, 0.055);
}

.org-card:hover::before,
.org-card.selected::before { opacity: 1; }

.org-card .org-logo {
    width: 100%;
    height: 88px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.org-card .org-logo img {
    max-width: 70%;
    max-height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.4));
}

.org-card h4 { font-size: 1rem; letter-spacing: 0.03em; }

.org-card .org-role {
    font-size: 0.68rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--gold);
}

/* ---------- Detail panel (careers / engagements / recognitions) ---------- */

.detail-panel {
    display: grid;
    grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
    gap: 0;
    background: var(--panel);
    border: 1px solid var(--panel-border);
    border-radius: 8px;
    overflow: hidden;
}

.detail-media {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 380px;
    padding: 36px;
    background:
        radial-gradient(500px 320px at 50% 40%, rgba(201, 162, 39, 0.07), transparent 70%),
        var(--ink-2);
    border-right: 1px solid rgba(201, 162, 39, 0.12);
}

.detail-media img,
.detail-media .logo-pair {
    max-width: 100%;
    max-height: 420px;
    object-fit: contain;
    transition: transform 0.4s var(--ease);
}

.detail-media img.zoomable { cursor: zoom-in; }
.detail-media img.zoomable:hover { transform: scale(1.025); }

.detail-body { padding: 42px 46px; }

.detail-body .detail-org {
    font-size: 0.7rem;
    letter-spacing: 0.28em;
    text-transform: uppercase;
    color: var(--gold);
    margin-bottom: 10px;
}

.detail-body h3 {
    font-size: clamp(1.35rem, 2.4vw, 1.85rem);
    margin-bottom: 8px;
}

.detail-body .detail-period {
    font-size: 0.82rem;
    color: var(--muted);
    letter-spacing: 0.08em;
    margin-bottom: 20px;
}

.detail-body .detail-rule {
    width: 56px;
    height: 2px;
    background: linear-gradient(90deg, var(--gold), transparent);
    margin-bottom: 24px;
}

.detail-body .detail-desc {
    color: #c4ccda;
    font-size: 0.97rem;
    font-weight: 300;
}

.detail-body .detail-desc b { color: var(--gold-light); font-weight: 600; }

@media (max-width: 900px) {
    .detail-panel { grid-template-columns: 1fr; }
    .detail-media { border-right: none; border-bottom: 1px solid rgba(201, 162, 39, 0.12); min-height: 260px; }
    .detail-body { padding: 30px 26px; }
}

/* ---------- Group sections (engagements / recognitions) ---------- */

.group-block { margin-bottom: 52px; }

.group-block .group-title {
    display: flex;
    align-items: baseline;
    gap: 18px;
    font-size: 1.25rem;
    margin-bottom: 22px;
    letter-spacing: 0.04em;
}

.group-block .group-title::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, rgba(201, 162, 39, 0.4), transparent);
    transform: translateY(-4px);
}

.thumb-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
    gap: 14px;
}

.thumb-card {
    display: flex;
    flex-direction: column;
    background: var(--panel);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 6px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.3s var(--ease), border-color 0.3s var(--ease);
}

.thumb-card:hover,
.thumb-card.selected {
    transform: translateY(-4px);
    border-color: var(--gold-dim);
}

.thumb-card .thumb-img {
    height: 120px;
    overflow: hidden;
    background: var(--ink-2);
}

.thumb-card .thumb-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s var(--ease);
}

.thumb-card:hover .thumb-img img { transform: scale(1.06); }

.thumb-card .thumb-label {
    padding: 12px 14px;
    font-size: 0.78rem;
    line-height: 1.45;
    color: #cdd5e2;
}

/* ---------- Footer ---------- */

.site-footer {
    margin-top: 40px;
    border-top: 1px solid rgba(201, 162, 39, 0.16);
    background: linear-gradient(180deg, rgba(201, 162, 39, 0.04), transparent);
    padding: 48px 0 36px;
}

.site-footer .wrap {
    display: flex;
    flex-wrap: wrap;
    gap: 24px;
    align-items: center;
    justify-content: space-between;
}

.footer-name {
    font-family: var(--font-display);
    font-size: 1.2rem;
    letter-spacing: 0.06em;
}

.footer-name span {
    display: block;
    font-family: var(--font-body);
    font-size: 0.64rem;
    letter-spacing: 0.26em;
    text-transform: uppercase;
    color: var(--gold);
    margin-top: 4px;
}

.footer-links { display: flex; gap: 22px; }

.footer-links a {
    color: var(--muted);
    font-size: 0.8rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    transition: color 0.25s;
}

.footer-links a:hover { color: var(--gold-light); }

/* ---------- Image modal ---------- */

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    inset: 0;
    background: rgba(6, 10, 19, 0.92);
    backdrop-filter: blur(6px);
    align-items: center;
    justify-content: center;
    padding: 4vh 4vw;
    cursor: zoom-out;
}

.modal.open { display: flex; }

.modal-content {
    max-width: 92vw;
    max-height: 90vh;
    object-fit: contain;
    border: 1px solid var(--gold-dim);
    border-radius: 4px;
    box-shadow: 0 40px 90px rgba(0, 0, 0, 0.7);
}

.close {
    position: absolute;
    top: 22px;
    right: 32px;
    color: var(--cream);
    font-size: 38px;
    font-family: var(--font-display);
    cursor: pointer;
    line-height: 1;
    transition: color 0.25s;
}

.close:hover { color: var(--gold-light); }

/* ---------- Reveal animations ---------- */

.reveal {
    opacity: 0;
    transform: translateY(26px);
    transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
    transition-delay: var(--reveal-delay, 0s);
}

.reveal.in {
    opacity: 1;
    transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
    .reveal { opacity: 1; transform: none; transition: none; }
    #spa-content { transition: none; }
}

/* ============================================================
   PWA install affordances — install button + iOS hint banner
   ============================================================ */

.pwa-install-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 40px;
    padding: 0 16px;
    margin-left: 12px;
    background: linear-gradient(180deg, var(--gold-light), var(--gold));
    color: var(--ink);
    border: 1px solid var(--gold);
    border-radius: 999px;
    font-family: var(--font-body);
    font-size: 0.9rem;
    font-weight: 600;
    letter-spacing: 0.4px;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(201, 162, 39, 0.28);
    transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease), filter 0.2s var(--ease);
}

.pwa-install-btn[hidden] { display: none; }

.pwa-install-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 22px rgba(201, 162, 39, 0.4);
    filter: brightness(1.04);
}

.pwa-install-btn:focus-visible {
    outline: 2px solid var(--cream);
    outline-offset: 2px;
}

.pwa-install-btn svg { flex: 0 0 auto; }

@media (max-width: 900px) {
    .pwa-install-btn { margin-left: auto; margin-right: 8px; padding: 0 12px; font-size: 0.82rem; }
    .pwa-install-btn span { display: none; }
}

.ios-install-hint {
    position: fixed;
    left: 50%;
    bottom: 18px;
    transform: translateX(-50%);
    width: min(92vw, 480px);
    z-index: 1000;
    background: rgba(14, 24, 48, 0.96);
    color: var(--cream);
    border: 1px solid var(--panel-border);
    border-radius: 14px;
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(6px);
    font-family: var(--font-body);
    animation: ios-hint-in 0.4s var(--ease);
}

.ios-install-hint[hidden] { display: none; }

.ios-install-hint::after {
    content: "";
    position: absolute;
    left: 50%;
    bottom: -10px;
    width: 18px;
    height: 18px;
    transform: translateX(-50%) rotate(45deg);
    background: rgba(14, 24, 48, 0.96);
    border-right: 1px solid var(--panel-border);
    border-bottom: 1px solid var(--panel-border);
    border-bottom-right-radius: 4px;
}

.ios-install-hint-inner {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
}

.ios-install-hint-title {
    font-family: var(--font-display);
    font-size: 1.02rem;
    color: var(--gold-light);
    margin-bottom: 4px;
}

.ios-install-hint-body {
    font-size: 0.88rem;
    line-height: 1.45;
    color: var(--cream);
}

.ios-install-hint-body svg {
    vertical-align: -2px;
    color: var(--gold-light);
    margin: 0 2px;
}

.ios-install-hint-body strong {
    color: var(--gold-light);
    font-weight: 600;
}

.ios-install-hint-close {
    flex: 0 0 auto;
    background: none;
    border: 0;
    color: var(--muted);
    font-size: 1.6rem;
    line-height: 1;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 6px;
    transition: color 0.15s var(--ease), background 0.15s var(--ease);
}

.ios-install-hint-close:hover {
    color: var(--cream);
    background: rgba(255, 255, 255, 0.06);
}

@keyframes ios-hint-in {
    from { opacity: 0; transform: translate(-50%, 14px); }
    to   { opacity: 1; transform: translate(-50%, 0); }
}

/* Share button reuses .pwa-install-btn for all base styling. When the install
   button appears next to it, tighten the gap so the two buttons read as a
   single grouped control rather than two separate gold pills. */
.pwa-share-btn + .pwa-install-btn { margin-left: 8px; }

@media (max-width: 900px) {
    .pwa-share-btn + .pwa-install-btn { margin-left: 6px; }
}

.pwa-share-toast {
    position: fixed;
    left: 50%;
    bottom: 24px;
    transform: translate(-50%, 8px);
    z-index: 1100;
    padding: 10px 18px;
    background: rgba(14, 24, 48, 0.96);
    color: var(--cream);
    border: 1px solid var(--gold);
    border-radius: 999px;
    font-family: var(--font-body);
    font-size: 0.88rem;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s var(--ease), transform 0.2s var(--ease);
}

.pwa-share-toast[hidden] { display: none; }

.pwa-share-toast.is-visible {
    opacity: 1;
    transform: translate(-50%, 0);
}

@media (prefers-reduced-motion: reduce) {
    .ios-install-hint { animation: none; }
    .pwa-install-btn { transition: none; }
    .pwa-share-toast { transition: none; }
}
