/* Opulence 2026 — Component library
 * Ported from brief/opulence-platform-design-system.html.
 * Shared, reusable components matching the Trade Portal design language.
 * Depends on tokens.css (CSS custom properties).
 */

/* ---------------------------------------------------------------------------
 * Eyebrow / section label
 * ------------------------------------------------------------------------- */
.eyebrow {
    font-family: var(--body);
    font-weight: 500;
    font-size: .7rem;
    letter-spacing: .28em;
    text-transform: uppercase;
    color: var(--gold-text); /* HI-058: AA on cream/white at this small size. */
    display: inline-flex;
    align-items: center;
    gap: .7em;
}
.eyebrow::before {
    content: "";
    width: 26px;
    height: 1px;
    background: var(--gold);
}
.eyebrow.on-dark { color: var(--gold-2); }
.eyebrow.on-dark::before { background: var(--gold-2); }

/* ---------------------------------------------------------------------------
 * Sections
 * ------------------------------------------------------------------------- */
.sec {
    padding: var(--space-section) 0;
    border-bottom: 1px solid var(--line-soft);
}
.sec > .wrap > .eyebrow { margin-bottom: var(--space-2xs); }
.sec h2 {
    font-size: var(--fs-700);
    line-height: var(--leading-tight);
    margin-bottom: var(--space-2xs);
}
.sec .intro {
    color: var(--muted);
    max-width: var(--measure);
    margin-bottom: var(--space-md);
}

/* ---------------------------------------------------------------------------
 * Masthead
 * ------------------------------------------------------------------------- */
.mast {
    background: var(--forest-deep);
    color: var(--cream);
    padding: var(--space-xl) 0 var(--space-lg);
    position: relative;
    overflow: hidden;
}
.mast::before {
    content: "";
    position: absolute;
    top: -30%;
    right: -8%;
    width: 520px;
    height: 520px;
    background: radial-gradient(circle, rgba(182, 144, 79, .14), transparent 65%);
}
.mast .wrap { position: relative; }
.mast h1 {
    font-size: var(--fs-800);
    line-height: var(--leading-tight);
    color: var(--cream);
    max-width: 20ch;
    margin: var(--space-xs) 0 var(--space-xs);
}
.mast h1 em { font-style: italic; color: var(--gold-2); }
.mast p {
    color: rgba(246, 242, 232, .78);
    max-width: 60ch;
    font-weight: 300;
}

/* ---------------------------------------------------------------------------
 * Buttons (HI-069 — one consolidated system)
 * Three semantic variants, each with default / hover / focus-visible / active /
 * disabled states, a guaranteed 44px minimum touch target, and a single
 * transition duration + easing (--motion) honoured by prefers-reduced-motion.
 *
 *   .btn-primary   solid gold — reserved for the ONE main conversion action
 *                  per section. Legacy alias: .btn-gold.
 *   .btn-secondary outlined charcoal — supporting actions.
 *                  Legacy aliases: .btn-ghost, .btn-dark.
 *   .btn-tertiary  underlined text — low-emphasis / inline actions.
 *
 * On dark backgrounds add .on-dark to the secondary/tertiary variants.
 * ------------------------------------------------------------------------- */
.btn {
    font-family: var(--body);
    font-weight: 500;
    font-size: .82rem;
    letter-spacing: .06em;
    text-transform: uppercase;
    padding: 14px 26px;
    min-height: var(--touch);
    border: 1px solid transparent;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .6em;
    transition: color var(--motion), background-color var(--motion), border-color var(--motion);
    border-radius: var(--radius);
    text-decoration: none;
}
.btn:focus-visible {
    outline: 2px solid var(--gold);
    outline-offset: 2px;
}
.btn:disabled,
.btn[aria-disabled="true"],
.btn.is-disabled {
    opacity: .5;
    cursor: not-allowed;
    pointer-events: none;
}

/* Primary — solid gold (single main action per section) */
.btn-primary,
.btn-gold {
    background: var(--gold);
    color: var(--forest-deep);
    border-color: var(--gold);
}
.btn-primary:hover,
.btn-gold:hover {
    background: var(--gold-deep);
    color: #fff;
    border-color: var(--gold-deep);
}
.btn-primary:active,
.btn-gold:active { background: var(--gold-deep); border-color: var(--gold-deep); transform: translateY(1px); }

/* Secondary — outlined charcoal (supporting actions) */
.btn-secondary,
.btn-ghost {
    background: transparent;
    color: var(--forest);
    border-color: var(--line);
}
.btn-secondary:hover,
.btn-ghost:hover {
    border-color: var(--forest);
    background: var(--cream-2);
    color: var(--forest);
}
.btn-secondary:active,
.btn-ghost:active { background: var(--cream-2); border-color: var(--forest); transform: translateY(1px); }

/* Secondary, solid charcoal fill (legacy alias retained) */
.btn-dark {
    background: var(--forest-deep);
    color: var(--cream);
    border-color: var(--forest-deep);
}
.btn-dark:hover { background: var(--forest); border-color: var(--forest); }
.btn-dark:active { background: var(--forest); transform: translateY(1px); }

/* Secondary/tertiary on dark backgrounds (legacy alias .btn-ghost-light) */
.btn-secondary.on-dark,
.btn-tertiary.on-dark,
.btn-ghost-light {
    background: transparent;
    color: var(--cream);
    border-color: rgba(246, 242, 232, .4);
}
.btn-secondary.on-dark:hover,
.btn-tertiary.on-dark:hover,
.btn-ghost-light:hover {
    border-color: var(--gold-2);
    color: var(--gold-2);
}
.btn-secondary.on-dark:focus-visible,
.btn-tertiary.on-dark:focus-visible,
.btn-ghost-light:focus-visible { outline-color: var(--gold-2); }

/* Tertiary — underlined text (low emphasis) */
.btn-tertiary {
    background: transparent;
    color: var(--forest);
    border-color: transparent;
    padding-left: 6px;
    padding-right: 6px;
    text-decoration: underline;
    text-underline-offset: 4px;
    text-decoration-thickness: 1px;
    text-decoration-color: var(--line);
}
.btn-tertiary:hover {
    color: var(--gold-deep);
    text-decoration-color: currentColor;
}
.btn-tertiary:active { color: var(--gold-deep); transform: translateY(1px); }

.btn-block { width: 100%; justify-content: center; }

/* ---------------------------------------------------------------------------
 * Panels & grids
 * ------------------------------------------------------------------------- */
.panel {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 26px;
    background: #fff;
}
.panel.dark { background: var(--forest-deep); border-color: var(--forest-deep); }
.panel h4 {
    font-size: .72rem;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 16px;
    font-weight: 500;
    font-family: var(--body);
}
.panel.dark h4 { color: rgba(246, 242, 232, .6); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.demo-row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }

/* ---------------------------------------------------------------------------
 * Badges (stock status + trade tier)
 * ------------------------------------------------------------------------- */
.badge {
    font-size: .58rem;
    letter-spacing: .08em;
    text-transform: uppercase;
    padding: 5px 10px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 1px solid;
    border-radius: 2px;
    font-weight: 500;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; }
.badge-in { color: #2f6a48; border-color: rgba(78, 140, 99, .5); background: rgba(78, 140, 99, .14); }
.badge-in::before { background: var(--stock-in); }
.badge-low { color: #8a6320; border-color: rgba(185, 131, 43, .5); background: rgba(185, 131, 43, .14); }
.badge-low::before { background: var(--stock-low); }
.badge-order { color: #5a554f; border-color: rgba(107, 101, 96, .4); background: rgba(107, 101, 96, .12); }
.badge-order::before { background: var(--stock-order); }
.badge-tier { color: var(--burgundy); border-color: rgba(141, 59, 60, .4); background: rgba(141, 59, 60, .1); }
.badge-tier::before { background: var(--burgundy); }

/* ---------------------------------------------------------------------------
 * Cards
 * ------------------------------------------------------------------------- */
.card {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
    background: #fff;
    transition: transform .35s var(--ease), box-shadow .35s;
}
.card:hover { transform: translateY(-4px); box-shadow: var(--elev); }
.card-img {
    height: 150px;
    background: linear-gradient(150deg, var(--cream-2), #e5dcc9);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--display);
    font-size: 2.4rem;
    color: rgba(154, 119, 57, .3);
    position: relative;
}
.card-flag {
    position: absolute;
    top: 12px;
    left: 12px;
    font-size: .54rem;
    letter-spacing: .12em;
    text-transform: uppercase;
    background: var(--burgundy);
    color: var(--cream);
    padding: 4px 9px;
    font-weight: 500;
}
.card-b { padding: 20px; }
.card-brand {
    font-size: .6rem;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 6px;
}
.card-title {
    font-family: var(--display);
    font-size: 1.25rem;
    margin-bottom: 8px;
}
.card-price {
    font-family: var(--display);
    font-size: 1.35rem;
    color: var(--forest);
}

/* ---------------------------------------------------------------------------
 * Form fields
 * ------------------------------------------------------------------------- */
.field { margin-bottom: 16px; }
.field label {
    display: block;
    font-size: .62rem;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--gold-text);
    margin-bottom: 6px;
    font-weight: 500;
}
.field input,
.field textarea {
    width: 100%;
    background: #fff;
    border: 1px solid var(--line);
    color: var(--ink);
    padding: 12px 14px;
    font-family: var(--body);
    font-size: .9rem;
    border-radius: var(--radius);
    transition: border-color .25s;
}
.field input:focus,
.field textarea:focus { outline: none; border-color: var(--gold); }
.field.dark input { background: #17301f; border-color: rgba(246, 242, 232, .18); color: var(--cream); }

/* ---------------------------------------------------------------------------
 * Icon set
 * ------------------------------------------------------------------------- */
.icon-set { display: flex; gap: 20px; flex-wrap: wrap; }
.icon-set span {
    width: 48px;
    height: 48px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--gold-deep);
}
.icon-set svg {
    width: 24px;
    height: 24px;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.4;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* ---------------------------------------------------------------------------
 * Tables
 * ------------------------------------------------------------------------- */
.tbl { width: 100%; border-collapse: collapse; font-size: .86rem; }
.tbl th,
.tbl td {
    text-align: left;
    padding: 14px 16px;
    border-bottom: 1px solid var(--line-soft);
    vertical-align: top;
}
.tbl th {
    font-size: .64rem;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--muted);
    font-weight: 500;
    background: var(--cream-2);
}
.tbl td b { color: var(--forest); }
.tbl .comp { font-family: var(--display); font-size: 1.05rem; color: var(--ink); }

/* ---------------------------------------------------------------------------
 * Responsive
 * ------------------------------------------------------------------------- */
@media (max-width: 820px) {
    .grid2,
    .grid3 { grid-template-columns: 1fr; }
    .tbl { font-size: .78rem; }
}

/* ---------------------------------------------------------------------------
 * HI-070: restrained entrance motion (one pattern site-wide)
 * A short fade with a small upward translate on section entry, lightly
 * staggered across cards. Uses the single shared --motion (duration + easing)
 * from HI-069. Driven by IntersectionObserver in theme.js (which adds
 * .is-visible). Only hidden when JS is present, so no-JS users always see
 * content; reduced-motion users get an instant fade with no translate.
 * ------------------------------------------------------------------------- */
.js .reveal {
    opacity: 0;
    transform: translateY(16px);
    transition: opacity var(--motion), transform var(--motion);
    will-change: opacity, transform;
}
.js .reveal.is-visible {
    opacity: 1;
    transform: none;
}

/* ---------------------------------------------------------------------------
 * HI-069: honour reduced-motion for all interactive transitions site-wide.
 * Collapses the shared --motion duration and any transitions/animations to
 * near-zero for users who prefer reduced motion, while keeping state changes
 * functional (colours/outlines still apply, just without animation).
 * ------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        transition-duration: .01ms !important;
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        scroll-behavior: auto !important;
    }
    .btn:active,
    .btn-primary:active,
    .btn-secondary:active,
    .btn-tertiary:active,
    .btn-gold:active,
    .btn-ghost:active,
    .btn-dark:active { transform: none; }
    /* HI-070: no translate for reduced-motion; content simply appears. */
    .js .reveal { transform: none; }
}

