/* ==========================================================================
   CIEA "Midnight Ink" component styles
   Built entirely on the design tokens in css/tokens.css. Tailwind utilities
   handle layout; the reusable brand primitives (eyebrows, diamonds, buttons,
   panels, hairlines, ledger rows, cards) live here so every page and every
   JS-generated component shares one visual language.
   ========================================================================== */

/* --- Base ------------------------------------------------------------- */

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-sans);
    -webkit-font-smoothing: antialiased;
}

/* The injected nav is constrained by its wrapper, so the wrapper owns sticky positioning. */
#nav-container {
    position: sticky;
    top: 0;
    z-index: 50;
}

#nav-container > nav {
    position: relative;
}

.font-display {
    font-family: var(--font-display);
}

/* Custom scrollbar ink track, gold thumb */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--ciea-ink);
}

::-webkit-scrollbar-thumb {
    background: var(--ciea-gold-dim);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--ciea-gold);
}

/* --- Logo sizing ------------------------------------------------------ */

.ciea-logo {
    height: 54px;
    width: auto;
    object-fit: contain;
}

.ciea-logo-footer {
    height: 56px;
    width: auto;
    object-fit: contain;
}

/* --- Eyebrow (tracked label) ------------------------------------------- */

.eyebrow {
    display: flex;
    width: fit-content;
    align-self: flex-start;
    align-items: center;
    gap: 12px;
    text-align: left;
    font-family: var(--font-sans);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--ciea-gold-deep);          /* on light */
}

.eyebrow-dark {
    color: var(--ciea-gold-line);          /* on dark */
    letter-spacing: 0.22em;
}

/* --- Gold hairlines ----------------------------------------------------- */

.gold-hairline-fade {
    height: 1px;
    background: linear-gradient(90deg, rgba(227, 178, 100, 0.7), rgba(227, 178, 100, 0.05));
}

.hairline-paper {
    border-color: var(--ciea-line);
}

.hairline-white {
    border-color: var(--ciea-line-light);
}

/* --- Diamond ornaments -------------------------------------------------- */

.diamond {
    display: inline-block;
    width: 7px;
    height: 7px;
    transform: rotate(45deg);
    background: var(--ciea-gold);
    flex-shrink: 0;
}

.diamond-band {
    display: flex;
    justify-content: center;
    gap: 22px;
}

.diamond-band span {
    width: 7px;
    height: 7px;
    transform: rotate(45deg);
}

.diamond-band span:nth-child(1),
.diamond-band span:nth-child(5) {
    background: var(--ciea-gold-deepest);
}

.diamond-band span:nth-child(2),
.diamond-band span:nth-child(4) {
    background: var(--ciea-gold-dim);
}

.diamond-band span:nth-child(3) {
    background: var(--ciea-gold);
}

/* List bullet: 6px gold diamond */
.diamond-bullet {
    display: inline-block;
    width: 6px;
    height: 6px;
    transform: rotate(45deg);
    background: var(--ciea-gold-line);
    flex-shrink: 0;
}

/* --- Buttons ------------------------------------------------------------ */

.btn-gold {
    display: inline-block;
    background: var(--ciea-gold);
    color: var(--ciea-ink);
    font-family: var(--font-sans);
    font-size: 15px;
    font-weight: 700;
    padding: 16px 34px;
    border-radius: var(--radius-btn);
    border: none;
    cursor: pointer;
    text-align: center;
    transition: background-color 0.2s ease;
}

.btn-gold:hover {
    background: var(--ciea-gold-bright);
}

.btn-gold-sm {
    padding: 12px 26px;
    font-size: 14px;
}

.btn-outline-gold {
    display: inline-block;
    background: transparent;
    color: var(--ciea-cream-soft);
    font-family: var(--font-sans);
    font-size: 15px;
    font-weight: 600;
    padding: 15px 30px;
    border: 1px solid var(--ciea-gold-a45);
    border-radius: var(--radius-btn);
    cursor: pointer;
    text-align: center;
    transition: border-color 0.2s ease, color 0.2s ease;
}

.btn-outline-gold:hover {
    border-color: var(--ciea-gold);
    color: var(--ciea-gold-bright);
}

.btn-ink {
    display: inline-block;
    background: var(--ciea-text);
    color: var(--ciea-cream);
    font-family: var(--font-sans);
    font-size: 13.5px;
    font-weight: 600;
    padding: 12px 24px;
    border-radius: var(--radius-btn);
    border: none;
    cursor: pointer;
    white-space: nowrap;
    text-align: center;
    transition: background-color 0.2s ease;
}

.btn-ink:hover {
    background: var(--ciea-ink);
}

.link-gold {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--ciea-gold-deep);
    cursor: pointer;
    transition: color 0.2s ease;
    text-decoration: none;
}

.link-gold:hover {
    color: var(--ciea-gold-dim);
}

/* --- Dark panel recipe (Nisab widget, contact form) ---------------------- */

.panel-dark {
    background: var(--ciea-panel-bg);
    border: 1px solid var(--ciea-gold-a35);
    border-radius: var(--radius-panel);
    backdrop-filter: blur(4px);
}

.input-dark {
    background: var(--ciea-input-bg);
    border: 1px solid var(--ciea-gold-a30);
    border-radius: var(--radius-btn);
    padding: 13px 16px;
    font-size: 14px;
    font-family: var(--font-sans);
    color: var(--ciea-cream);
    outline: none;
    width: 100%;
    transition: border-color 0.2s ease;
}

.input-dark::placeholder {
    color: var(--ciea-dark-dim);
}

.input-dark:focus {
    border-color: var(--ciea-gold);
}

/* Native select: brand the closed control with a gold caret (text inputs/
   textarea keep their native rendering) and make the open option list
   readable instead of white-on-white. */
select.input-dark {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none' stroke='%23D2A656' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M1 1.5 6 6.5 11 1.5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    background-size: 12px 8px;
    padding-right: 40px;
}

.input-dark option {
    background-color: var(--ciea-ink-deep);
    color: var(--ciea-cream-soft);
}

/* Selected / highlighted option: gold fill, ink text (matches .nisab-tab-active). */
.input-dark option:checked,
.input-dark option:hover {
    background-color: var(--ciea-gold);
    color: var(--ciea-ink);
}

/* --- Contact info rows (Speak with us) ----------------------------------- */

.contact-line {
    display: flex;
    align-items: baseline;
    gap: 16px;
}

.contact-line-label {
    flex: 0 0 80px;                 /* fixed label column sized by basis, not width */
    font-size: 11.5px;
    letter-spacing: 0.12em;
    color: var(--ciea-dark-faint);
}

.contact-line-value {
    min-width: 0;                   /* let long values wrap instead of overlapping */
    font-size: 15px;
}

.input-label-dark {
    font-size: 12px;
    letter-spacing: 0.08em;
    color: var(--ciea-dark-faint);
    text-transform: uppercase;
}

/* --- Nisab widget (hero panel) -------------------------------------------- */

.nisab-tab {
    font-family: var(--font-sans);
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--ciea-dark-faint);
    background: transparent;
    border: 1px solid var(--ciea-gold-a22);
    border-radius: var(--radius-btn);
    padding: 7px 12px;
    cursor: pointer;
    transition: color 0.2s ease, border-color 0.2s ease, background-color 0.2s ease;
}

.nisab-tab:hover {
    color: var(--ciea-gold-bright);
    border-color: var(--ciea-gold-a45);
}

.nisab-tab-active {
    color: var(--ciea-ink);
    background: var(--ciea-gold);
    border-color: var(--ciea-gold);
}

.nisab-tab-active:hover {
    color: var(--ciea-ink);
    background: var(--ciea-gold-bright);
    border-color: var(--ciea-gold-bright);
}

.live-dot {
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--ciea-live-dark);
}

/* --- Watermark (arch monogram on dark sections) -------------------------- */

.watermark-arch {
    position: absolute;
    pointer-events: none;
    opacity: 0.10;
    user-select: none;
}

/* --- Services ledger rows ------------------------------------------------ */

.ledger-row {
    display: grid;
    grid-template-columns: 64px 1fr auto;
    gap: 24px;
    align-items: center;
    padding: 26px 0;
    border-top: 1px solid var(--ciea-line);
    cursor: pointer;
    transition: background-color 0.2s ease;
    text-decoration: none;
}

.ledger-row:last-of-type {
    border-bottom: 1px solid var(--ciea-line);
}

.ledger-row:hover {
    background: var(--ciea-gold-tint);
}

.ledger-num {
    font-family: var(--font-display);
    font-size: 23px;
    color: var(--ciea-gold-line);
}

/* --- Event cards (used by EventsWidget) ----------------------------------- */

.event-card {
    border: 1px solid var(--ciea-line-light);
    border-radius: var(--radius-card);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    background: var(--ciea-white);
    transition: box-shadow 0.2s ease;
}

.event-card:hover {
    box-shadow: var(--shadow-card-hover);
}

.event-card-image {
    position: relative;
    height: 180px;
    overflow: hidden;
    flex-shrink: 0;
}

.event-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Dark monogram media area for events without imagery */
.event-card-image-dark {
    background: var(--ciea-ink);
    display: flex;
    align-items: center;
    justify-content: center;
}

.event-card-image-dark img.event-arch {
    position: absolute;
    height: 240px;
    width: auto;
    opacity: 0.14;
}

.event-card-image-dark .event-monogram-text {
    font-family: var(--font-display);
    font-size: 22px;
    color: var(--ciea-gold-bright);
    position: relative;
    text-align: center;
    padding: 0 20px;
}

/* The monogram markup is always present in the card so the image onerror
   handler has something to reveal. Hide it while a photo is showing, and let
   the dark-ground rules below bring it back. Order matters: these two blocks
   have equal specificity, so the reveal must come second. */
.event-card-image > .event-arch,
.event-card-image > .event-monogram-text {
    display: none;
}

.event-card-image-dark > .event-arch,
.event-card-image-dark > .event-monogram-text {
    display: block;
}

/* A cancelled event must not read like a completed one. Completed keeps its
   normal treatment; cancelled strikes the title through and pairs that with
   the gold "Cancelled" badge the widget puts on the card face. */
.event-card[data-lifecycle="cancelled"] h3 {
    text-decoration: line-through;
    text-decoration-color: var(--ciea-gold-deep);
    text-decoration-thickness: 1px;
}

.event-card-badge {
    position: absolute;
    top: 14px;
    left: 14px;
    font-size: 10.5px;
    letter-spacing: 0.1em;
    font-weight: 700;
    padding: 6px 12px;
    border-radius: 2px;
    text-transform: uppercase;
}

.event-card-badge-gold {
    background: var(--ciea-gold);
    color: var(--ciea-ink);
}

.event-card-badge-white {
    background: rgba(255, 255, 255, 0.92);
    color: var(--ciea-text);
}

/* --- Article body typography ----------------------------------------------- */
/* Renders clean semantic HTML produced by the CMS Markdown editor on-brand, on both
   the live article page (#article-body) and the admin live preview (.ciea-article-body).
   Real descendant selectors (not :where) are used deliberately: they must outrank
   Tailwind's Preflight reset, which zeroes heading margins/sizes and strips list
   markers at element-level specificity. No published article carries baked-in utility
   classes today, so there is nothing to defer to. */

#article-body, .ciea-article-body {
    font-family: var(--font-sans);
    color: var(--ciea-text);
    font-size: 16.5px;
    line-height: 1.75;
}

#article-body > :first-child, .ciea-article-body > :first-child { margin-top: 0; }

#article-body p, .ciea-article-body p { margin: 0 0 1.25em; }

#article-body h2, .ciea-article-body h2 {
    font-family: var(--font-display);
    color: var(--ciea-text);
    font-size: 1.7rem;
    line-height: 1.25;
    font-weight: 400; /* Marcellus is single-weight, never bold */
    margin: 2em 0 0.6em;
}

#article-body h3, .ciea-article-body h3 {
    font-family: var(--font-display);
    color: var(--ciea-text);
    font-size: 1.32rem;
    line-height: 1.3;
    font-weight: 400;
    margin: 1.7em 0 0.5em;
}

#article-body h4, .ciea-article-body h4 {
    font-family: var(--font-sans);
    font-weight: 700;
    color: var(--ciea-text);
    font-size: 1.05rem;
    margin: 1.5em 0 0.4em;
}

#article-body a, .ciea-article-body a {
    color: var(--ciea-gold-deep);
    text-decoration: underline;
    text-underline-offset: 2px;
    transition: color 0.2s ease;
}

#article-body a:hover, .ciea-article-body a:hover { color: var(--ciea-gold-dim); }

#article-body strong, .ciea-article-body strong { font-weight: 700; color: var(--ciea-text); }
#article-body em, .ciea-article-body em { font-style: italic; }

#article-body ul, .ciea-article-body ul {
    margin: 0 0 1.25em;
    padding-left: 1.4em;
    list-style: disc outside;
}

#article-body ol, .ciea-article-body ol {
    margin: 0 0 1.25em;
    padding-left: 1.5em;
    list-style: decimal outside;
}

#article-body li, .ciea-article-body li { margin: 0.4em 0; padding-left: 0.2em; }

#article-body ul li::marker, .ciea-article-body ul li::marker { color: var(--ciea-gold-line); }
#article-body ol li::marker, .ciea-article-body ol li::marker { color: var(--ciea-gold-deep); font-weight: 600; }

#article-body blockquote, .ciea-article-body blockquote {
    margin: 1.5em 0;
    padding: 0.6em 1.1em;
    background: var(--ciea-paper);
    border-left: 2px solid var(--ciea-gold-line);
    border-radius: 3px;
    color: var(--ciea-muted);
    font-style: italic;
}

#article-body blockquote p:last-child, .ciea-article-body blockquote p:last-child { margin-bottom: 0; }

#article-body img, .ciea-article-body img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 1.6em auto;
    border-radius: var(--radius-card);
}

#article-body hr, .ciea-article-body hr {
    border: none;
    height: 1px;
    background: var(--ciea-line);
    margin: 2.2em 0;
}

#article-body code, .ciea-article-body code {
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 0.88em;
    background: var(--ciea-cream);
    padding: 0.12em 0.4em;
    border-radius: 3px;
    color: var(--ciea-gold-deep);
}

#article-body pre, .ciea-article-body pre {
    background: var(--ciea-ink);
    color: var(--ciea-cream);
    padding: 1.1em 1.25em;
    border-radius: var(--radius-card);
    overflow-x: auto;
    margin: 1.5em 0;
}

#article-body pre code, .ciea-article-body pre code { background: none; color: inherit; padding: 0; }

#article-body table, .ciea-article-body table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5em 0;
    font-size: 0.95em;
}

#article-body th, .ciea-article-body th,
#article-body td, .ciea-article-body td {
    border: 1px solid var(--ciea-line);
    padding: 0.55em 0.75em;
    text-align: left;
}

#article-body th, .ciea-article-body th { background: var(--ciea-cream); font-weight: 600; }

/* --- Navigation -------------------------------------------------------------
   The nav is injected at runtime by js/components.js (renderNav), so this FOUC
   guard reserves the bar's space and paints the ink background before the markup
   lands. min-height matches the live rendered nav (88px content + 1px gold
   hairline = 89px). The injected <nav> keeps its own `sticky top-0 z-50`. The
   mobile menu uses the `hidden` Tailwind class for show/hide, so no stale
   max-height rules remain to re-clamp a leftover panel. */

#nav-container {
    display: block;
    background: var(--ciea-ink);
    min-height: 89px;
}

/* --- FAQ / accordion -------------------------------------------------------- */

.animate-fade-in {
    animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.transition-transform {
    transition: transform 0.3s ease;
}

.rotate-180 {
    transform: rotate(180deg);
}

/* --- Print ------------------------------------------------------------------ */

@media print {
    .no-print {
        display: none !important;
    }

    body {
        font-size: 12pt;
        line-height: 1.4;
    }

    .print-break {
        page-break-before: always;
    }
}

/* --- Reduced motion ----------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    html {
        scroll-behavior: auto;
    }
}
