/* ==========================================================
   VARUNA Roster – palette taken from the printed roster book
   ========================================================== */
:root {
    --v-dark: #1b2420;          /* page background */
    --v-frame: #34503f;         /* bevelled frame */
    --v-frame-light: #879a8a;
    --v-glow: #1f4a2c;
    --v-name: #8d2324;          /* maroon names */
    --v-phone: #12703a;         /* green phone */
    --v-biz: #2a2266;           /* navy business */
    --v-cat: #7b2a7c;           /* purple category */
    --v-gold: #f2d21b;          /* 'I' / 'WE' highlight */
    --v-paper: #eef5e6;
    --v-ink: #1f2a24;
    --font-display: "Oswald", "Arial Narrow", sans-serif;
    --font-serif: "Cinzel", Georgia, serif;
    --font-script: "Great Vibes", cursive;
    --font-body: "Source Sans 3", system-ui, sans-serif;
}

html { font-size: 16px; }
body { font-family: var(--font-body); color: var(--v-ink); background: #f6f8f3; min-height: 100vh; display: flex; flex-direction: column; }
main { flex: 1; }
.text-varuna { color: var(--v-name); }

/* ---------- buttons ---------- */
.btn-varuna { background: var(--v-frame); color: #fff; border: none; }
.btn-varuna:hover, .btn-varuna:focus { background: #284033; color: #fff; }
.btn-gold { background: var(--v-gold); color: #1b2420; font-weight: 700; border: none; }
.btn-gold:hover { background: #ffe24a; color: #1b2420; }

/* ---------- header / footer ---------- */
.site-header { background: var(--v-dark); border-bottom: 2px solid var(--v-frame); }
.brand { display: flex; align-items: center; gap: .6rem; }
.brand-name { display: block; font-family: var(--font-serif); font-weight: 700; letter-spacing: .12em; line-height: 1; font-size: 1.35rem; }
.brand-sub { display: block; font-family: var(--font-script); font-size: 1rem; color: #cfe3d3; line-height: 1.1; }
.site-header .nav-link { font-family: var(--font-display); text-transform: uppercase; letter-spacing: .06em; }
.site-header .nav-link.active { color: var(--v-gold) !important; }
.site-footer { background: var(--v-dark); color: #cfd8d1; padding: 1.25rem 0; font-size: .9rem; border-top: 2px solid var(--v-frame); }
.tagline-footer { font-style: italic; }

/* ---------- hero ---------- */
.hero {
    background: radial-gradient(ellipse at 30% 30%, var(--v-glow) 0, transparent 55%),
                radial-gradient(ellipse at 75% 60%, var(--v-glow) 0, transparent 55%), var(--v-dark);
    color: #fff; padding: 3rem 0 2.5rem; border-bottom: 5px solid var(--v-frame);
}
.hero-logo { display: block; width: 140px; height: auto; margin: 0 auto -10px; position: relative; z-index: 1; }
.hero-frame { display: inline-block; border: 2px solid #fff; border-radius: 14px; padding: 1.25rem 2.5rem .2rem; position: relative; }
.hero-title { font-family: var(--font-serif); font-size: clamp(3rem, 10vw, 6rem); letter-spacing: .08em; margin: 0; line-height: 1; }
.hero-sub { font-family: var(--font-script); font-size: clamp(1.25rem, 3vw, 1.8rem); background: var(--v-dark); display: inline-block; white-space: nowrap; padding: 0 .6rem; margin: 0 0 -1.25rem; position: relative; top: .6rem; }
.hero-tagline { font-family: Georgia, serif; font-size: clamp(1.1rem, 2.5vw, 1.6rem); margin-top: 1.8rem; }
.hero-tagline b, .cover-tagline b, .cl-tag b { color: var(--v-gold); }
.hero-stats { display: flex; justify-content: center; gap: 2.5rem; margin-top: 2rem; flex-wrap: wrap; }
.hero-stats strong { display: block; font-family: var(--font-display); font-size: 2.2rem; color: var(--v-gold); line-height: 1; }
.hero-stats span { font-size: .85rem; text-transform: uppercase; letter-spacing: .08em; color: #b8c8bc; }

/* ---------- sections ---------- */
.section-title { font-family: var(--font-display); text-transform: uppercase; color: var(--v-name); text-align: center; letter-spacing: .03em; }
.section-lead { text-align: center; color: #5b6a60; margin-bottom: 2rem; }
.page-head { background: var(--v-dark); color: #fff; padding: 1.5rem 0; border-bottom: 3px solid var(--v-frame); }
.page-head h1 { font-family: var(--font-display); text-transform: uppercase; margin: 0 0 .25rem; }

/* office bearers */
.bearer { display: flex; flex-direction: column; align-items: center; text-align: center; text-decoration: none; color: inherit; background: #fff; border-radius: 16px; padding: 1.5rem 1rem; box-shadow: 0 2px 12px rgb(0 0 0 / .06); height: 100%; transition: transform .15s; }
.bearer:hover { transform: translateY(-3px); }
.bearer img { width: 150px; height: 150px; border-radius: 50%; object-fit: cover; border: 3px solid var(--v-frame-light); }
.bearer-role { margin-top: .75rem; background: var(--v-frame); color: #fff; font-size: .8rem; text-transform: uppercase; letter-spacing: .1em; padding: .15rem .75rem; border-radius: 99px; }
.bearer-name { font-family: var(--font-display); font-size: 1.5rem; color: var(--v-name); text-transform: uppercase; margin-top: .4rem; }
.bearer-phone { color: var(--v-phone); font-weight: 700; }
.bearer-biz { color: var(--v-biz); font-weight: 700; text-transform: uppercase; font-size: .9rem; }
.bearer-cat { color: var(--v-cat); font-size: .9rem; text-transform: uppercase; }

/* sectors */
.sectors { background: var(--v-paper); }
.sector-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: .75rem; }
.sector-chip { display: inline-flex; justify-content: space-between; align-items: center; gap: .75rem; padding: .8rem 1rem; background: #fff; border: 1px solid #d6e3d2; border-radius: 12px; color: var(--v-biz); font-weight: 600; text-decoration: none; }
.sector-chip b { background: var(--v-frame); color: #fff; border-radius: 99px; min-width: 2rem; text-align: center; font-size: .85rem; padding: .1rem .5rem; }
.sector-chip:hover { border-color: var(--v-frame); }
.sector-chip.sm { padding: .25rem .75rem; font-size: .9rem; }

/* ---------- directory ---------- */
.directory-filter { display: grid; grid-template-columns: 1fr minmax(180px, 280px) auto; gap: .75rem; }
@media (max-width: 767px) { .directory-filter { grid-template-columns: 1fr; } }
.roster-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 480px), 1fr)); gap: 1rem; }
.empty-state { text-align: center; padding: 3rem 1rem; color: #6b776f; }
.empty-state i { font-size: 2.5rem; }

/* roster card – mirrors a row of the printed book */
.roster-card {
    display: grid; grid-template-columns: 120px 1fr 104px; gap: 1rem; align-items: center;
    padding: .9rem; border-radius: 14px; background: linear-gradient(135deg, #f7fbf2 0%, #e2f0d6 100%);
    border: 1px solid #d3e4cb; box-shadow: 0 1px 4px rgb(0 0 0 / .05);
}
.roster-card[hidden] { display: none; }
.roster-photo { position: relative; display: block; }
.roster-photo img { width: 120px; height: 120px; object-fit: cover; border-radius: 12px; background: #c9cdc4; display: block; }
.role-badge { position: absolute; left: 50%; bottom: -8px; transform: translateX(-50%); background: var(--v-name); color: #fff; font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; padding: .1rem .55rem; border-radius: 99px; white-space: nowrap; }
.roster-body { text-align: center; min-width: 0; }
.roster-name { font-family: var(--font-display); font-weight: 600; text-transform: uppercase; color: var(--v-name); font-size: 1.3rem; line-height: 1.1; margin: 0 0 .2rem; }
.roster-name a { color: inherit; text-decoration: none; }
.roster-name a:hover { text-decoration: underline; }
.roster-name small { font-size: .65em; color: var(--v-biz); margin-left: .25rem; }
.roster-phone { display: inline-block; font-family: Georgia, serif; font-weight: 700; color: var(--v-phone); text-decoration: none; font-size: 1.1rem; }
.roster-business { font-family: var(--font-display); font-weight: 500; color: var(--v-biz); text-transform: uppercase; font-size: .95rem; line-height: 1.2; }
.roster-category { font-family: var(--font-display); font-weight: 500; color: var(--v-cat); text-transform: uppercase; font-size: .95rem; line-height: 1.2; }
.roster-qr img { width: 104px; height: auto; border-radius: 10px; background: #fff; display: block; }
@media (max-width: 520px) {
    .roster-card { grid-template-columns: 84px 1fr; }
    .roster-photo img { width: 84px; height: 84px; }
    .roster-qr { display: none; }
    .roster-body { text-align: left; }
    .roster-name { font-size: 1.1rem; }
}

/* ---------- member profile ---------- */
.profile { display: grid; grid-template-columns: 260px 1fr 220px; gap: 2rem; align-items: start; background: linear-gradient(135deg, #f7fbf2, #e2f0d6); border-radius: 18px; padding: 1.5rem; border: 1px solid #d3e4cb; }
.profile-photo { position: relative; }
.profile-photo img { width: 100%; height: auto; aspect-ratio: 1; object-fit: cover; border-radius: 16px; }
.profile .roster-name { font-size: 2rem; }
.profile-qr { text-align: center; display: flex; flex-direction: column; gap: .5rem; align-items: center; }
.profile-qr img { width: 200px; height: auto; background: #fff; border-radius: 12px; }
@media (max-width: 991px) { .profile { grid-template-columns: 180px 1fr; } .profile-qr { grid-column: 1 / -1; } }
@media (max-width: 575px) { .profile { grid-template-columns: 1fr; } .profile-photo { max-width: 220px; } }

/* ==========================================================
   Roster book (screen preview + print)
   ========================================================== */
.book-body { background: #d9ded7; }
.book-toolbar { display: flex; justify-content: space-between; align-items: center; padding: 1.25rem .75rem; }
.book { display: flex; flex-direction: column; align-items: center; gap: 1.5rem; padding-bottom: 3rem; }
.book-page {
    width: min(100% - 2rem, 520px); aspect-ratio: 287.29 / 318;
    background: linear-gradient(to top right, var(--v-frame-light) 50%, var(--v-frame) 50%);
    padding: 4.4%; box-shadow: 0 8px 24px rgb(0 0 0 / .25); container-type: inline-size; min-height: 0; overflow: hidden;
}
.book-inner { width: 100%; height: 100%; position: relative; overflow: hidden; }
.book-page.dark .book-inner {
    background: radial-gradient(ellipse at 30% 25%, var(--v-glow) 0, transparent 50%),
                radial-gradient(ellipse at 70% 60%, var(--v-glow) 0, transparent 50%), var(--v-dark);
    color: #fff; text-align: center;
}
.cover { display: flex; flex-direction: column; align-items: center; padding-top: 4cqw; }
.cover-logo { width: 32cqw; margin-bottom: -6cqw; position: relative; z-index: 1; }
.cover-frame { border: 2px solid #fff; border-radius: 3cqw; padding: 7cqw 6cqw 0; width: 72%; }
.cover-title { font-family: var(--font-serif); font-size: 15cqw; line-height: 1; }
.cover-sub { font-family: var(--font-script); font-size: 4.6cqw; background: var(--v-dark); display: inline-block; white-space: nowrap; padding: 0 2cqw; position: relative; top: 3cqw; }
.cover-tagline { font-family: Georgia, serif; font-size: 4.3cqw; margin: 6cqw 0 3cqw; }
.cover-big { font-family: "Oswald", Impact, sans-serif; font-weight: 700; font-size: 17cqw; line-height: 1.05; }

.bearers { padding-top: 4cqw; }
.bearers-head { font-family: var(--font-display); font-weight: 700; font-size: 7.5cqw; }
.bearer-book { font-family: var(--font-display); font-size: 3.3cqw; line-height: 1.25; }
.bearer-book img { width: 21cqw; height: 21cqw; border-radius: 50%; object-fit: cover; border: 1cqw solid var(--v-frame-light); background: #fff; }
.bearer-book.main img { width: 22cqw; height: 22cqw; }
.bb-name { font-weight: 700; font-size: 5.6cqw; }
.bb-role { font-size: 3cqw; font-weight: 600; }
.bb-line, .bb-biz, .bb-cat { font-weight: 600; text-transform: uppercase; }
.bearer-book .ph { font-family: Georgia, serif; }
.bearers-row { display: grid; grid-template-columns: 1fr 1fr; margin-top: 4cqw; }

.book-inner.light { background: linear-gradient(135deg, #f4faee 0%, #d9ecc8 100%); padding: 1.2cqw 2cqw; display: grid; grid-template-rows: repeat(5, minmax(0, 1fr)); }
.book-row { min-height: 0; overflow: hidden; display: grid; grid-template-columns: 19cqw 1fr 18cqw; gap: 2cqw; align-items: center; border-bottom: 1px dashed #8a9c88; padding: 1cqw 0; }
.book-row:last-child { border-bottom: none; }
.br-photo { width: 19cqw; height: 18cqw; object-fit: cover; border-radius: 2cqw; background: #c9cdc4; }
.br-qr { width: 17cqw; border-radius: 2cqw; background: #fff; }
.br-body { text-align: center; font-family: var(--font-display); line-height: 1.15; }
.br-name { color: var(--v-name); font-weight: 700; font-size: 4.4cqw; line-height: 1.05; }
.br-name small { font-size: .6em; color: var(--v-biz); }
.br-phone { color: var(--v-phone); font-family: Georgia, serif; font-weight: 700; font-size: 3.4cqw; }
.br-biz { color: var(--v-biz); font-weight: 600; font-size: 2.9cqw; }
.br-cat { color: var(--v-cat); font-weight: 600; font-size: 3.1cqw; }
.book-closing { grid-row: span var(--rest, 1); display: flex; align-items: center; justify-content: center; gap: 3cqw; }
.book-closing img { width: 18cqw; filter: drop-shadow(0 0 1px #1b2420); }
.cl-title { font-family: var(--font-serif); font-weight: 700; color: var(--v-biz); font-size: 10cqw; line-height: 1; }
.cl-sub { font-family: var(--font-script); color: #1c74b9; font-size: 4cqw; }
.cl-tag { font-family: Georgia, serif; font-size: 3cqw; color: var(--v-biz); }
.cl-tag b { color: var(--v-biz); }

/* layout toggle: pagewise / single column */
.book-actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.btn-outline-varuna { color: var(--v-frame); border-color: var(--v-frame); background: #fff; }
.btn-outline-varuna:hover { color: #fff; background: var(--v-frame); border-color: var(--v-frame); }
.btn-check:checked + .btn-outline-varuna { color: #fff; background: var(--v-frame); border-color: var(--v-frame); }
.btn-check:focus-visible + .btn-outline-varuna { box-shadow: 0 0 0 .2rem rgb(52 80 63 / .35); }

/* single column: member pages merge into one continuous strip, rows keep the book's proportions */
.book.single .member-page { aspect-ratio: auto; padding: 0 4.4%; background: var(--v-frame); box-shadow: 0 8px 24px rgb(0 0 0 / .18); }
.book.single .member-page + .member-page { margin-top: -1.5rem; }
.book.single .member-page.first { padding-top: 4.4%; }
.book.single .member-page.last { padding-bottom: 4.4%; }
.book.single .member-page .book-inner.light { display: block; height: auto; padding: 0 2cqw; background: #e6f2dc; }
.book.single .member-page.first .book-inner { padding-top: 1.2cqw; }
.book.single .member-page.last .book-inner { padding-bottom: 1.2cqw; }
.book.single .member-page:not(.last) .book-row:last-child { border-bottom: 1px dashed #8a9c88; }
.book.single .book-row { min-height: 21cqw; }
.book.single .book-closing { padding: 4cqw 0; }

@media print {
    body, .book-body { background: #fff; }
    .book { gap: 0; padding: 0; }
    .book-page { width: 101.3mm; height: 112.2mm; box-shadow: none; break-after: page; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .site-header, .site-footer { display: none !important; }
}

/* ==========================================================
   Admin
   ========================================================== */
.admin-body { background: #f2f4f1; }
.admin-shell { display: grid; grid-template-columns: 230px 1fr; min-height: 100vh; }
.admin-nav { background: var(--v-dark); color: #fff; padding: 1rem; }
.admin-nav .brand-name { font-size: 1.2rem; }
.admin-nav a.nav-link { color: #cfd8d1; border-radius: 8px; padding: .5rem .75rem; }
.admin-nav a.nav-link:hover, .admin-nav a.nav-link.active { background: var(--v-frame); color: #fff; }
.admin-main { padding: 1.5rem; min-width: 0; }
.admin-thumb { width: 44px; height: 44px; object-fit: cover; border-radius: 8px; background: #ddd; }
.stat-card { background: #fff; border-radius: 12px; padding: 1rem 1.25rem; border: 1px solid #e1e7df; }
.stat-card strong { display: block; font-family: var(--font-display); font-size: 2rem; color: var(--v-name); }
.img-preview { width: 160px; height: 160px; object-fit: cover; border-radius: 12px; border: 1px solid #d9e0d7; background: #fff; }
@media (max-width: 767px) { .admin-shell { grid-template-columns: 1fr; } }

/* ==========================================================
   App shell – phones & tablets (< 992px), installed app (PWA)
   ========================================================== */
:root { --tabbar-h: 62px; --safe-b: env(safe-area-inset-bottom, 0px); }
.site-header .btn-gold[hidden], [data-install][hidden] { display: none !important; }

/* bottom tab bar */
.tabbar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 1030;
    display: flex; justify-content: space-around; align-items: stretch;
    height: calc(var(--tabbar-h) + var(--safe-b)); padding-bottom: var(--safe-b);
    background: rgb(27 36 32 / .97); border-top: 1.5px solid var(--v-frame);
    backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.tabbar .tab {
    flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    color: #a9b8ad; text-decoration: none; background: none; border: 0; padding: 0;
    font-family: var(--font-display); font-size: .7rem; letter-spacing: .06em; text-transform: uppercase;
    -webkit-tap-highlight-color: transparent; transition: color .15s;
}
.tabbar .tab i { font-size: 1.35rem; line-height: 1; }
.tabbar .tab.active { color: var(--v-gold); }
.tabbar .tab:active { color: #fff; transform: scale(.94); }
.header-install { margin-left: auto; white-space: nowrap; }

/* "Add to Home Screen" bottom sheet */
.install-sheet {
    position: fixed; left: .75rem; right: .75rem; z-index: 1040;
    bottom: calc(var(--tabbar-h) + var(--safe-b) + .75rem);
    display: flex; align-items: center; gap: .75rem;
    max-width: 520px; margin: 0 auto; padding: .75rem .9rem;
    background: var(--v-dark); color: #fff; border: 1px solid var(--v-frame); border-radius: 16px;
    box-shadow: 0 10px 30px rgb(0 0 0 / .35);
    transform: translateY(calc(100% + 6rem)); opacity: 0; transition: transform .3s ease, opacity .3s ease;
}
.install-sheet.show { transform: none; opacity: 1; }
.install-sheet img { border-radius: 12px; flex: none; }
.install-sheet-text { flex: 1; min-width: 0; line-height: 1.2; }
.install-sheet-text strong { display: block; font-family: var(--font-display); letter-spacing: .03em; }
.install-sheet-text small { color: #b8c8bc; }
@media (min-width: 992px) { .install-sheet { bottom: 1.25rem; } }
.install-steps { padding-left: 1.25rem; margin: 0; }
.install-steps li { margin-bottom: .6rem; }
.install-steps i { color: var(--v-frame); font-size: 1.1rem; }

@media (max-width: 991.98px) {
    html { -webkit-text-size-adjust: 100%; }
    body { padding-bottom: calc(var(--tabbar-h) + var(--safe-b)); overscroll-behavior-y: none; }
    a, button, .btn { -webkit-tap-highlight-color: transparent; }

    /* compact sticky app bar */
    .site-header { position: sticky; top: 0; z-index: 1020; padding-top: env(safe-area-inset-top, 0px); border-bottom-width: 1.5px; }
    .site-header .navbar { padding-top: .4rem; padding-bottom: .4rem; flex-wrap: nowrap; }
    .site-header .navbar-brand { margin-right: .5rem; min-width: 0; }
    .brand img { width: 36px; height: auto; }
    .brand-name { font-size: 1.15rem; }
    .brand-sub { font-size: .85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .site-footer { padding: 1rem 0; font-size: .8rem; }

    /* hero & headings */
    .hero { padding: 2rem 0 1.75rem; border-bottom-width: 3px; }
    .hero-logo { width: 104px; }
    .hero-frame { padding: 1rem 1.5rem .2rem; }
    .hero .btn-lg { flex: 1 1 0; min-width: 150px; }
    .hero-stats { gap: 1.5rem; margin-top: 1.5rem; }
    .hero-stats strong { font-size: 1.8rem; }
    .page-head { padding: 1rem 0; border-bottom-width: 2px; }
    .page-head h1 { font-size: 1.5rem; }
    .page-head p { font-size: .9rem; }

    /* directory: search stays pinned under the app bar */
    .directory-filter {
        position: sticky; top: var(--header-h, 57px); z-index: 1010;
        margin: -1.5rem calc(var(--bs-gutter-x) * -.5) 0; padding: .75rem calc(var(--bs-gutter-x) * .5);
        background: rgb(246 248 243 / .95); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
        border-bottom: 1px solid #dfe7da;
    }
    .directory-filter .form-control, .directory-filter .form-select, .directory-filter .input-group-text { font-size: 1rem; }
    .roster-card { transition: transform .1s; }
    .roster-card:active { transform: scale(.985); }

    /* member profile: big full-width actions */
    .profile { padding: 1rem; gap: 1rem; }
    .profile-body .btn-lg { flex: 1 1 100%; }
    .breadcrumb { font-size: .85rem; }
    .bearer img { width: 120px; height: 120px; }
}

/* tablets: two cards per row */
@media (min-width: 576px) and (max-width: 991.98px) {
    .directory-filter { grid-template-columns: 1fr minmax(160px, 240px); }
    .roster-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; }
    .roster-card { grid-template-columns: 88px 1fr; gap: .75rem; padding: .75rem; }
    .roster-photo img { width: 88px; height: 88px; }
    .roster-qr { display: none; }
    .roster-body { text-align: left; }
    .roster-name { font-size: 1.1rem; }
    .roster-business, .roster-category { font-size: .85rem; }
    .profile-body .btn-lg { flex: 1 1 0; }
}

/* phones */
@media (max-width: 575.98px) {
    .container { --bs-gutter-x: 1.5rem; }
    .roster-grid { gap: .6rem; }
    .roster-card { padding: .65rem; border-radius: 12px; gap: .75rem; }
    .roster-phone { font-size: 1rem; padding: .15rem 0; }
    .section-title { font-size: 1.4rem; }
    .sector-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem; }
    .sector-chip { padding: .65rem .75rem; font-size: .9rem; }
    .profile-photo { max-width: 180px; margin: 0 auto; }
    .profile .roster-name { font-size: 1.6rem; }
    .profile-body { text-align: center; }
    .profile-qr img { width: 170px; }
    .book-toolbar { flex-wrap: wrap; gap: .75rem; }
    .book-actions, .view-toggle, .book-toolbar .btn-print { width: 100%; }
    .view-toggle .btn { flex: 1 1 0; }
}

/* running as an installed app */
.is-app body { user-select: none; -webkit-user-select: none; }
.is-app input, .is-app textarea, .is-app .roster-phone { user-select: text; -webkit-user-select: text; }
.is-app .site-footer .link-light { display: none; }
@media (display-mode: standalone) { [data-install] { display: none !important; } }
@media print { .tabbar, .install-sheet { display: none !important; } body { padding-bottom: 0 !important; } }
