/* ==========================================================================
   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);
    font-weight: var(--font-weight-body);
    color: var(--ciea-text);
    -webkit-font-smoothing: antialiased;
}

/* Light controls need readable prompts too. Class-scoped dark and variant
   control rules remain more specific than this shared fallback. */
body input::placeholder,
body textarea::placeholder {
    color: var(--ciea-muted);
    opacity: 1;
}

/* 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);
    font-weight: var(--font-weight-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: var(--font-weight-label);
    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: var(--font-weight-strong);
    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: var(--font-weight-label);
    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: var(--font-weight-label);
    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: var(--font-weight-label);
    color: var(--ciea-gold-deep);
    cursor: pointer;
    transition: color 0.2s ease;
    text-decoration: none;
}

.link-gold:hover {
    color: var(--ciea-text);
}

/* --- Homepage insights band source line (on ink) ------------------------ */

.insights-source {
    margin: 28px 0 0;
    font-size: 13px;
    line-height: 1.6;
    color: var(--ciea-dark-faint);
}

.insights-source a {
    color: var(--ciea-gold-bright);
    text-decoration: underline;
    text-decoration-color: var(--ciea-gold-a35);
    text-underline-offset: 3px;
    transition: color 0.2s ease, text-decoration-color 0.2s ease;
}

.insights-source a:hover {
    color: var(--ciea-cream);
    text-decoration-color: currentColor;
}

.insights-source a:focus-visible {
    outline: 2px solid var(--ciea-gold-bright);
    outline-offset: 2px;
    border-radius: 3px;
}

/* --- 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-dark-faint);
    border-radius: var(--radius-btn);
    padding: 13px 16px;
    font-size: 14px;
    font-family: var(--font-sans);
    font-weight: var(--font-weight-body);
    color: var(--ciea-cream);
    outline: none;
    width: 100%;
    transition: border-color 0.2s ease;
}

.input-dark::placeholder {
    color: var(--ciea-dark-dim);
    opacity: 1;
}

.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: 12px;
    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: 12px;
    font-weight: var(--font-weight-label);
    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 minmax(0, 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-weight: var(--font-weight-display);
    font-size: 23px;
    color: var(--ciea-gold-deep);
}

.ledger-note {
    display: grid;
    grid-template-columns: 64px minmax(0, 1fr) auto;
    gap: 24px;
    padding-bottom: 22px;
}

.advisory-cta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 28px;
    background: var(--ciea-white);
    border: 1px solid var(--ciea-line);
    border-radius: var(--radius-panel);
    padding: 20px 26px;
    gap: 16px;
}

@media (max-width: 639px) {
    .ledger-row,
    .ledger-note {
        grid-template-columns: 32px minmax(0, 1fr) auto;
        gap: 16px;
    }

    .advisory-cta { flex-wrap: wrap; }
    .advisory-cta > * { min-width: 0; max-width: 100%; }
    .advisory-cta .btn-ink { white-space: normal; }
}

/* --- 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: 12px;
    letter-spacing: 0.1em;
    font-weight: var(--font-weight-strong);
    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: var(--font-weight-display); /* 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: var(--font-weight-display);
    margin: 1.7em 0 0.5em;
}

#article-body h4, .ciea-article-body h4 {
    font-family: var(--font-sans);
    font-weight: var(--font-weight-strong);
    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-text); }

#article-body strong, .ciea-article-body strong { font-weight: var(--font-weight-strong); 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: var(--font-weight-label); }

#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: var(--font-weight-label); }

/* --- Shared navigation --------------------------------------------------- */
#nav-container {
    display: block;
    background: var(--ciea-ink);
    min-height: 89px;
}
.site-nav { border-bottom: 1px solid var(--ciea-gold-a22); }
.site-nav-container { padding-inline: 24px; }
.site-nav-bar { display: flex; align-items: center; justify-content: space-between; height: 88px; gap: 20px; }
.site-nav-home { flex-shrink: 0; }
.site-nav-desktop { display: none; }
.site-nav-link {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 44px;
    font-family: var(--font-sans);
    font-size: 14px;
    color: var(--ciea-nav-link);
    text-decoration: none;
    transition: color 180ms ease;
}
.site-nav-link:hover, .nav-dropdown-link:hover,
.site-nav-link[aria-current="page"], .nav-dropdown-link[aria-current="page"],
.nav-parent-current { color: var(--ciea-gold-bright); }
.site-nav-link[aria-current="page"], .nav-dropdown-link[aria-current="page"],
.nav-parent-current { font-weight: var(--font-weight-label); }
.site-nav a:focus-visible, .site-nav button:focus-visible {
    outline: 2px solid var(--ciea-gold-bright);
    outline-offset: 3px;
}
.nav-disclosure { position: relative; }
.nav-disclosure-button {
    flex-direction: row;
    align-items: center;
    gap: 6px;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: pointer;
}
.nav-disclosure-button i { font-size: 10px; }
.nav-disclosure-button[aria-expanded="true"] { color: var(--ciea-gold-bright); }
.nav-dropdown-panel {
    position: absolute;
    top: calc(100% + 12px);
    left: 0;
    width: 310px;
    max-height: calc(100vh - 100px);
    max-height: calc(100dvh - 100px);
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 12px;
    background: var(--ciea-ink);
    border: 1px solid var(--ciea-gold-a30);
    border-radius: 6px;
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
    z-index: 60;
}
.nav-dropdown-link {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 44px;
    padding: 10px 12px;
    border-radius: 3px;
    font-family: var(--font-sans);
    font-size: 14px;
    color: var(--ciea-nav-link);
    text-decoration: none;
    transition: color 180ms ease;
}
.nav-link-description { margin-top: 3px; color: var(--ciea-dark-muted); font-size: 12px; font-weight: var(--font-weight-body); line-height: 1.5; }
.site-nav-toggle { display: grid; place-items: center; width: 44px; height: 44px; color: var(--ciea-cream); font-size: 20px; border: 0; background: transparent; cursor: pointer; }
.site-nav-mobile {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    max-height: calc(100vh - 89px);
    max-height: calc(100dvh - 89px);
    overflow-y: auto;
    overscroll-behavior: contain;
    background: var(--ciea-ink);
    border-top: 1px solid var(--ciea-gold-a18);
    border-bottom: 1px solid var(--ciea-gold-a30);
}
.site-nav-mobile-inner { display: flex; flex-direction: column; gap: 4px; padding: 16px 24px 24px; }
.nav-mobile-group { display: flex; flex-direction: column; gap: 2px; padding-block: 12px; border-block: 1px solid var(--ciea-gold-a18); }
.nav-mobile-label { color: var(--ciea-gold-bright); font-size: 12px; font-weight: var(--font-weight-label); letter-spacing: 0.12em; text-transform: uppercase; margin-bottom: 4px; }
.site-nav-mobile .site-nav-contact { align-self: flex-start; margin-top: 12px; }
.site-nav [hidden] { display: none; }
.site-footer-columns { display: grid; grid-template-columns: minmax(0, 1fr); gap: 40px; }
.site-footer-columns a { overflow-wrap: anywhere; }
@media (min-width: 768px) {
    .site-footer-columns { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.footer-services-secondary { margin-top: 8px; font-size: 12px; color: var(--ciea-gold-line); }
@media (min-width: 1024px) {
    .site-nav-desktop { display: flex; align-items: center; gap: clamp(16px, 1.7vw, 28px); }
    .site-nav-desktop > .site-nav-link, .nav-disclosure-button { white-space: nowrap; font-size: 13px; }
    .site-nav-contact { white-space: nowrap; }
    .site-nav-toggle, .site-nav-mobile { display: none; }
}
@media (min-width: 1280px) {
    .site-nav-container { padding-inline: 56px; }
    .site-footer-columns { grid-template-columns: 1.4fr 1fr 1fr 1fr 1.1fr; gap: 32px; }
    .site-nav-desktop > .site-nav-link, .nav-disclosure-button { font-size: 14px; }
}
@media (prefers-reduced-motion: reduce) {
    .site-nav-link, .nav-dropdown-link { transition: none; }
}

/* --- 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;
    }
}
