/* ==============================================================
   ARCHDIOCESE DIRECTORY — DESIGN SYSTEM
   A reverent, editorial aesthetic: warm parchment, burgundy
   accents, serif display typography, quiet confidence.
   ============================================================== */

/* ---------- Tokens ------------------------------------------- */
:root {
    --ivory:       #f6f1e7;
    --ivory-2:     #efe7d4;
    --cream:       #fbf7ee;
    --paper:       #ffffff;
    --ink:         #1c1712;
    --ink-soft:    #3c342a;
    --ink-muted:   #6d6353;
    --rule:        #d8ccb2;
    --rule-soft:   #e6dcc4;

    --burgundy:    #6b1d2b;   /* primary liturgical accent */
    --burgundy-d:  #4e1420;
    --burgundy-l:  #8a2638;
    --gold:        #a07a2c;
    --gold-l:      #c89b46;
    --sage:        #4a5d3f;
    --danger:      #8b2a2a;
    --success:     #3d6b4a;

    --shadow-sm: 0 1px 2px rgba(28,23,18,.06);
    --shadow:    0 10px 30px -12px rgba(28,23,18,.18), 0 2px 6px rgba(28,23,18,.06);
    --shadow-lg: 0 24px 60px -20px rgba(28,23,18,.25);

    --radius:    4px;
    --radius-lg: 8px;

    --font-display: 'Cormorant Garamond', 'Garamond', Georgia, serif;
    --font-serif:   'Fraunces', 'Iowan Old Style', Georgia, serif;
    --font-sans:    'DM Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --font-mono:    'JetBrains Mono', ui-monospace, Menlo, monospace;
}

/* ---------- Reset -------------------------------------------- */
*,*::before,*::after { box-sizing: border-box; }
html,body { margin: 0; padding: 0; }
body {
    font-family: var(--font-sans);
    font-size: 15px;
    line-height: 1.55;
    color: var(--ink);
    background: var(--ivory);
    background-image:
        radial-gradient(ellipse 80% 50% at 50% -10%, rgba(107,29,43,.05), transparent 60%),
        radial-gradient(ellipse 50% 50% at 100% 100%, rgba(160,122,44,.04), transparent 60%);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}
img,svg { max-width: 100%; display: block; }
a { color: var(--burgundy); text-decoration: none; }
a:hover { color: var(--burgundy-d); text-decoration: underline; text-underline-offset: 3px; }
button { font: inherit; cursor: pointer; }

/* ---------- Typography --------------------------------------- */
h1,h2,h3,h4 {
    font-family: var(--font-display);
    font-weight: 500;
    letter-spacing: -0.01em;
    color: var(--ink);
    margin: 0 0 .4em;
    line-height: 1.15;
}
h1 { font-size: clamp(2rem, 4vw, 3rem); font-weight: 500; }
h2 { font-size: clamp(1.5rem, 2.5vw, 2rem); }
h3 { font-size: 1.25rem; }
h4 { font-size: 1rem; font-family: var(--font-sans); font-weight: 600; letter-spacing: .02em; text-transform: uppercase; color: var(--ink-muted); }

.eyebrow {
    font-family: var(--font-sans);
    font-size: .72rem;
    font-weight: 600;
    letter-spacing: .24em;
    text-transform: uppercase;
    color: var(--burgundy);
}

.display {
    font-family: var(--font-display);
    font-weight: 400;
    font-style: italic;
    font-size: clamp(2.5rem, 6vw, 4.5rem);
    line-height: 1.05;
    letter-spacing: -0.02em;
}

.muted { color: var(--ink-muted); }
.small { font-size: .85rem; }

/* ornamental rule */
.rule-orn {
    text-align: center;
    color: var(--gold);
    font-size: 1.2rem;
    letter-spacing: .5em;
    margin: 2rem 0;
}
.rule-orn::before { content: '✦ ✦ ✦'; }

/* ---------- Layout ------------------------------------------- */
.shell { min-height: 100vh; display: flex; flex-direction: column; }
.container { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 24px; }
.container-narrow { max-width: 780px; margin: 0 auto; padding: 0 24px; }

main.app-main { flex: 1; padding: 40px 0 80px; }

/* ---------- Header (app) ------------------------------------- */
.app-header {
    background: var(--paper);
    border-bottom: 1px solid var(--rule);
    position: sticky; top: 0; z-index: 50;
    backdrop-filter: saturate(1.1);
}
.app-header .container { display: flex; align-items: center; gap: 28px; height: 68px; }
.brand {
    display: flex; align-items: center; gap: 10px;
    font-family: var(--font-display); font-weight: 500; font-size: 1.35rem;
    color: var(--ink); text-decoration: none;
}
.brand-mark {
    width: 32px; height: 32px; border-radius: 50%;
    background: var(--burgundy); color: var(--ivory);
    display: grid; place-items: center; font-size: .95rem; font-weight: 500;
    font-family: var(--font-display);
}
.brand small { font-family: var(--font-sans); font-size: .65rem; letter-spacing: .22em; color: var(--ink-muted); text-transform: uppercase; display: block; margin-top: -4px; }

.nav { display: flex; gap: 4px; margin-left: auto; align-items: center; }
.nav a {
    color: var(--ink-soft);
    padding: 8px 14px;
    font-size: .9rem;
    font-weight: 500;
    border-radius: var(--radius);
    text-decoration: none;
    position: relative;
}
.nav a:hover { background: var(--ivory-2); color: var(--ink); }
.nav a.active { color: var(--burgundy); }
.nav a.active::after {
    content: ''; position: absolute; left: 14px; right: 14px; bottom: 2px;
    height: 1px; background: var(--burgundy);
}
.nav .bell {
    position: relative; padding: 8px 10px;
}
.nav .bell-count {
    position: absolute; top: 2px; right: 2px;
    background: var(--burgundy); color: var(--ivory);
    font-size: .65rem; font-weight: 600;
    min-width: 16px; height: 16px; border-radius: 8px;
    display: grid; place-items: center; padding: 0 4px;
}
.nav-user {
    display: flex; align-items: center; gap: 10px; padding-left: 16px;
    border-left: 1px solid var(--rule);
}
.nav-user .who { line-height: 1.1; }
.nav-user .who strong { font-weight: 600; font-size: .88rem; display: block; }
.nav-user .who span { font-size: .72rem; color: var(--ink-muted); letter-spacing: .08em; text-transform: uppercase; }

.mobile-toggle { display: none; background: none; border: 0; font-size: 1.5rem; color: var(--ink); }

@media (max-width: 860px) {
    .mobile-toggle { display: block; margin-left: auto; }
    .nav { display: none; position: absolute; top: 68px; left: 0; right: 0;
           background: var(--paper); flex-direction: column; align-items: stretch;
           padding: 8px; border-bottom: 1px solid var(--rule); box-shadow: var(--shadow); }
    .nav.open { display: flex; }
    .nav a, .nav-user { padding: 12px 16px; border-left: 0; }
    .nav-user { border-top: 1px solid var(--rule); margin-top: 4px; padding-top: 12px; }
}

/* ---------- Footer ------------------------------------------- */
.app-footer {
    border-top: 1px solid var(--rule);
    padding: 24px 0;
    color: var(--ink-muted);
    font-size: .82rem;
    text-align: center;
    background: var(--cream);
}
.app-footer .orn { color: var(--gold); letter-spacing: .4em; }

/* ---------- Cards -------------------------------------------- */
.card {
    background: var(--paper);
    border: 1px solid var(--rule);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-sm);
}
.card-hd {
    display: flex; align-items: baseline; justify-content: space-between;
    gap: 16px; margin: -24px -24px 20px; padding: 18px 24px;
    border-bottom: 1px solid var(--rule-soft);
    background: linear-gradient(to bottom, var(--cream), var(--paper));
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.card-hd h3 { margin: 0; }

.page-hd {
    display: flex; align-items: flex-end; justify-content: space-between;
    gap: 24px; margin-bottom: 32px; padding-bottom: 20px;
    border-bottom: 1px solid var(--rule);
}
.page-hd h1 { margin: 0; }
.page-hd .eyebrow { margin-bottom: 8px; display: block; }

/* ---------- Buttons ------------------------------------------ */
.btn {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 10px 20px; font-size: .92rem; font-weight: 500;
    border-radius: var(--radius); border: 1px solid var(--burgundy);
    background: var(--burgundy); color: var(--ivory);
    text-decoration: none; transition: all .15s ease;
    font-family: var(--font-sans); letter-spacing: .02em;
}
.btn:hover { background: var(--burgundy-d); border-color: var(--burgundy-d); color: var(--ivory); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn-ghost {
    background: transparent; color: var(--ink);
    border-color: var(--rule);
}
.btn-ghost:hover { background: var(--ivory-2); color: var(--ink); border-color: var(--ink-muted); }

.btn-text {
    background: transparent; border: 0; padding: 6px 10px;
    color: var(--burgundy); text-decoration: underline; text-underline-offset: 3px;
}
.btn-sm { padding: 6px 12px; font-size: .82rem; }
.btn-danger { background: var(--danger); border-color: var(--danger); }
.btn-danger:hover { background: #6b1f1f; border-color: #6b1f1f; }
.btn-group { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- Forms -------------------------------------------- */
.field { margin-bottom: 18px; }
.field label, .label {
    display: block; font-size: .78rem; font-weight: 600;
    letter-spacing: .1em; text-transform: uppercase;
    color: var(--ink-muted); margin-bottom: 6px;
}
.input, .select, .textarea {
    width: 100%; padding: 10px 14px;
    font: inherit; font-family: var(--font-sans);
    color: var(--ink); background: var(--paper);
    border: 1px solid var(--rule); border-radius: var(--radius);
    transition: border-color .15s, box-shadow .15s;
}
.input:focus, .select:focus, .textarea:focus {
    outline: none; border-color: var(--burgundy);
    box-shadow: 0 0 0 3px rgba(107,29,43,.12);
}
.textarea { min-height: 90px; resize: vertical; }
.hint { font-size: .78rem; color: var(--ink-muted); margin-top: 4px; }
.field-row { display: grid; gap: 16px; }
.field-row-2 { grid-template-columns: 1fr 1fr; }
.field-row-3 { grid-template-columns: 1fr 1fr 1fr; }
@media (max-width: 640px) {
    .field-row-2, .field-row-3 { grid-template-columns: 1fr; }
}

/* Checkbox / radio — native, but tamed */
.check { display: flex; align-items: center; gap: 10px; font-size: .92rem; }
.check input { width: 16px; height: 16px; accent-color: var(--burgundy); }

/* ---------- Alerts / Flashes --------------------------------- */
.alert {
    padding: 12px 16px; border-radius: var(--radius);
    border: 1px solid; margin-bottom: 20px; font-size: .92rem;
    display: flex; gap: 10px; align-items: flex-start;
}
.alert-info    { background: #eef3ea; border-color: #c9d6b8; color: #2d4224; }
.alert-success { background: #e9f1ec; border-color: #b4d0bd; color: #234a32; }
.alert-error   { background: #f6e3e3; border-color: #d8b1b1; color: #5a1a1a; }
.alert-warn    { background: #f7f0df; border-color: #dbc48a; color: #5a4815; }

/* ---------- Tables ------------------------------------------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--rule); border-radius: var(--radius-lg); background: var(--paper); }
table.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
table.table th, table.table td { padding: 12px 16px; text-align: left; vertical-align: top; }
table.table th {
    font-size: .72rem; font-weight: 600; letter-spacing: .12em;
    text-transform: uppercase; color: var(--ink-muted);
    background: var(--cream); border-bottom: 1px solid var(--rule);
}
table.table tr + tr td { border-top: 1px solid var(--rule-soft); }
table.table tr:hover td { background: var(--cream); }
table.table td .muted { font-size: .82rem; }

/* ---------- Badges ------------------------------------------- */
.badge {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 3px 10px; font-size: .72rem; font-weight: 600;
    letter-spacing: .08em; text-transform: uppercase;
    border-radius: 999px; background: var(--ivory-2); color: var(--ink-soft);
    border: 1px solid var(--rule);
}
.badge-gold { background: #f6ecd2; border-color: #e1ca86; color: #6a4d0f; }
.badge-burgundy { background: #efdbde; border-color: #d4a3aa; color: var(--burgundy-d); }
.badge-sage { background: #e3ebdd; border-color: #b5c6a5; color: #2f4423; }
.badge-ink { background: var(--ink); border-color: var(--ink); color: var(--ivory); }

/* ---------- Stat tiles --------------------------------------- */
.stats { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); margin-bottom: 32px; }
.stat {
    background: var(--paper); border: 1px solid var(--rule);
    border-radius: var(--radius-lg); padding: 20px;
    position: relative; overflow: hidden;
}
.stat::before {
    content: ''; position: absolute; top: 0; left: 0; bottom: 0; width: 3px;
    background: var(--burgundy);
}
.stat .eyebrow { display: block; margin-bottom: 8px; }
.stat .num { font-family: var(--font-display); font-size: 2.4rem; line-height: 1; color: var(--ink); }
.stat .sub { font-size: .82rem; color: var(--ink-muted); margin-top: 6px; }

/* ---------- Auth pages --------------------------------------- */
.auth-wrap {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1fr 1fr;
}
.auth-aside {
    background: var(--burgundy);
    color: var(--ivory);
    padding: 60px;
    display: flex; flex-direction: column; justify-content: space-between;
    position: relative; overflow: hidden;
}
.auth-aside::before {
    content: ''; position: absolute; inset: 0;
    background:
        radial-gradient(ellipse at 20% 10%, rgba(255,255,255,.08), transparent 50%),
        radial-gradient(ellipse at 80% 90%, rgba(0,0,0,.25), transparent 50%);
    pointer-events: none;
}
.auth-aside > * { position: relative; z-index: 1; }
.auth-brand { font-family: var(--font-display); font-size: 1.25rem; }
.auth-brand small { display: block; font-family: var(--font-sans); font-size: .7rem; letter-spacing: .3em; text-transform: uppercase; color: rgba(246,241,231,.7); }
.auth-quote { font-family: var(--font-display); font-style: italic; font-size: 1.6rem; line-height: 1.35; font-weight: 400; }
.auth-quote-by { margin-top: 12px; font-family: var(--font-sans); font-size: .78rem; letter-spacing: .2em; text-transform: uppercase; color: rgba(246,241,231,.6); }
.auth-foot { font-size: .78rem; color: rgba(246,241,231,.6); }

.auth-main { padding: 60px; display: flex; flex-direction: column; justify-content: center; }
.auth-form { width: 100%; max-width: 380px; margin: 0 auto; }
.auth-form h1 { font-size: 2.2rem; }
.auth-form .subhead { color: var(--ink-muted); margin-bottom: 32px; }

@media (max-width: 820px) {
    .auth-wrap { grid-template-columns: 1fr; }
    .auth-aside { padding: 32px; min-height: 200px; }
    .auth-aside .auth-quote { font-size: 1.2rem; }
    .auth-main { padding: 40px 24px; }
}

/* ---------- Landing ------------------------------------------ */
.landing-hero {
    padding: 100px 0 80px;
    text-align: center;
    position: relative;
}
.landing-hero h1 { font-size: clamp(2.5rem, 6vw, 4.2rem); font-weight: 400; margin: 16px auto 20px; max-width: 880px; }
.landing-hero h1 em { color: var(--burgundy); font-style: italic; }
.landing-hero .lead { font-size: 1.1rem; color: var(--ink-soft); max-width: 620px; margin: 0 auto 32px; }
.landing-grid {
    display: grid; gap: 1px; background: var(--rule);
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    border: 1px solid var(--rule); border-radius: var(--radius-lg); overflow: hidden;
    margin: 40px 0;
}
.landing-grid .feat {
    background: var(--paper); padding: 32px 28px;
}
.landing-grid .feat .num {
    font-family: var(--font-display); font-style: italic;
    color: var(--gold); font-size: 1.4rem; margin-bottom: 10px;
}
.landing-grid .feat h3 { font-size: 1.3rem; margin-bottom: 8px; }
.landing-grid .feat p { color: var(--ink-muted); margin: 0; font-size: .92rem; line-height: 1.6; }

.role-tiles { display: grid; gap: 20px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); margin: 40px 0; }
.role-tile { background: var(--paper); border: 1px solid var(--rule); border-radius: var(--radius-lg); padding: 28px; transition: transform .2s, box-shadow .2s; }
.role-tile:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.role-tile h3 { margin-top: 12px; }
.role-tile p { color: var(--ink-muted); font-size: .9rem; }

/* ---------- Empty state -------------------------------------- */
.empty {
    text-align: center; padding: 56px 24px;
    color: var(--ink-muted);
}
.empty .orn { color: var(--gold); font-size: 1.4rem; letter-spacing: .5em; }
.empty h3 { color: var(--ink); margin-top: 12px; }

/* ---------- Utilities ---------------------------------------- */
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.stack > * + * { margin-top: 1rem; }
.mt-0 { margin-top: 0; } .mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; } .mt-4 { margin-top: 40px; }
.mb-0 { margin-bottom: 0; } .mb-2 { margin-bottom: 16px; } .mb-3 { margin-bottom: 24px; }
.text-right { text-align: right; } .text-center { text-align: center; }
.hidden { display: none !important; }
