/* ============================================================================
 * Trilogy Mind Body Soul — BMR Calculator
 * Site palette (Primary #1C0E21, Secondary #FF4500, Text #5E5E5E, Accent #F5FAFF).
 * ========================================================================== */

.tri-bmr {
    --tri-orange: #ff4500;
    --tri-primary: #1c0e21;
    --tri-text: #5e5e5e;
    --tri-accent: #f5faff;
    --tri-line: rgba(28, 14, 33, 0.1);
    --tri-ease: cubic-bezier(0.22, 0.61, 0.36, 1);

    max-width: 980px;
    margin: 40px auto;
    padding: 0 16px;
    box-sizing: border-box;
    color: var(--tri-primary);
    font-family: "Inter", "DM Sans", system-ui, -apple-system, sans-serif;
}
.tri-bmr *,
.tri-bmr *::before,
.tri-bmr *::after { box-sizing: border-box; }

.tri-bmr__card {
    background: #fff;
    border: 1px solid var(--tri-line);
    border-radius: 22px;
    box-shadow: 0 24px 60px -28px rgba(28, 14, 33, 0.28);
    padding: clamp(24px, 4vw, 44px);
}

/* ---- Header ---- */
.tri-bmr__eyebrow {
    display: inline-block;
    position: relative;
    color: var(--tri-orange);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    padding-bottom: 11px;
}
.tri-bmr__eyebrow::before {
    content: "";
    position: absolute;
    left: 0;
    bottom: 0;
    width: 100%;
    height: 3px;
    border-radius: 2px;
    background: var(--tri-orange);
}
.tri-bmr__title {
    margin: 16px 0 8px;
    font-size: clamp(1.7rem, 4vw, 2.4rem);
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1.1;
}
.tri-bmr__intro {
    margin: 0;
    color: var(--tri-text);
    line-height: 1.6;
}

/* ---- Layout ---- */
.tri-bmr__grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 26px;
    align-items: stretch;
    margin-top: 26px;
}
.tri-bmr__field { margin-bottom: 16px; }
.tri-bmr__label {
    display: block;
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 8px;
}

/* ---- Segmented controls (sex / units) ---- */
.tri-bmr__seg {
    position: relative;
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
    padding: 4px;
    background: var(--tri-accent);
    border-radius: 999px;
    box-shadow: inset 0 0 0 1px var(--tri-line);
    -webkit-tap-highlight-color: transparent;
}
.tri-bmr__thumb {
    position: absolute;
    top: 4px;
    bottom: 4px;
    left: 4px;
    width: calc(50% - 4px);
    border-radius: 999px;
    background: var(--tri-orange);
    box-shadow: 0 6px 16px -5px rgba(255, 69, 0, 0.55);
    transition: transform 0.34s var(--tri-ease);
    z-index: 0;
}
.tri-bmr__seg.is-second .tri-bmr__thumb { transform: translateX(100%); }
.tri-bmr__opt {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1px;
    cursor: pointer;
    border-radius: 999px;
    padding: 9px 8px;
    color: var(--tri-text);
    transition: color 0.25s ease;
}
.tri-bmr__opt input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.tri-bmr__opt-name { font-weight: 700; font-size: 14px; line-height: 1.1; }
.tri-bmr__opt-hint { font-size: 11px; font-weight: 500; opacity: 0.75; line-height: 1.1; }
.tri-bmr__opt-icon { display: inline-flex; }
.tri-bmr__opt-icon svg { width: 18px; height: 18px; }
.tri-bmr__opt.is-active { color: #fff; }
.tri-bmr__opt:not(.is-active):hover { color: var(--tri-primary); }

/* ---- Inputs ---- */
.tri-bmr__inputs { display: flex; gap: 10px; }
.tri-bmr__input-wrap { position: relative; flex: 1; }
.tri-bmr__input-wrap input {
    width: 100%;
    height: 52px;
    padding: 0 46px 0 16px;
    font-size: 16px;
    color: var(--tri-primary);
    background: #fff;
    border: 1.5px solid var(--tri-line);
    border-radius: 12px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    -moz-appearance: textfield;
}
.tri-bmr__input-wrap input::-webkit-outer-spin-button,
.tri-bmr__input-wrap input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.tri-bmr__input-wrap input:focus {
    outline: none;
    border-color: var(--tri-orange);
    box-shadow: 0 0 0 3px rgba(255, 69, 0, 0.15);
}
.tri-bmr__suffix {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--tri-text);
    font-size: 14px;
    font-weight: 600;
    pointer-events: none;
}

/* ---- Select ---- */
.tri-bmr__select-wrap { position: relative; }
.tri-bmr__select-wrap::after {
    content: "";
    position: absolute;
    right: 18px;
    top: 50%;
    width: 9px;
    height: 9px;
    border-right: 2px solid var(--tri-text);
    border-bottom: 2px solid var(--tri-text);
    transform: translateY(-65%) rotate(45deg);
    pointer-events: none;
}
.tri-bmr__select {
    width: 100%;
    height: 52px;
    padding: 0 40px 0 16px;
    font-size: 15px;
    color: var(--tri-primary);
    background: #fff;
    border: 1.5px solid var(--tri-line);
    border-radius: 12px;
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.tri-bmr__select:focus {
    outline: none;
    border-color: var(--tri-orange);
    box-shadow: 0 0 0 3px rgba(255, 69, 0, 0.15);
}

/* ---- Button ---- */
.tri-bmr__btn {
    margin-top: 8px;
    width: 100%;
    border: none;
    cursor: pointer;
    background: var(--tri-orange);
    color: #fff;
    font-size: 16px;
    font-weight: 700;
    padding: 15px 24px;
    border-radius: 80px;
    box-shadow: 0 12px 26px -8px rgba(255, 69, 0, 0.55);
    transition: transform 0.2s var(--tri-ease), box-shadow 0.2s var(--tri-ease);
}
.tri-bmr__btn:hover { transform: translateY(-2px); box-shadow: 0 18px 34px -10px rgba(255, 69, 0, 0.65); }
.tri-bmr__btn:active { transform: translateY(0); }
.tri-bmr__error { margin: 14px 0 0; color: #e63946; font-size: 14px; font-weight: 600; }

/* ---- Result panel ---- */
.tri-bmr__panel--result {
    background: linear-gradient(160deg, #ffffff 0%, var(--tri-accent) 100%);
    border: 1px solid var(--tri-line);
    border-radius: 18px;
    padding: 28px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 420px;
}

/* score (shared look for preview + result) */
.tri-bmr__empty-eyebrow,
.tri-bmr__result-label {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--tri-text);
    opacity: 0.8;
}
.tri-bmr__empty-score,
.tri-bmr__score {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin: 10px 0 4px;
}
.tri-bmr__empty-num,
.tri-bmr__score-value {
    font-size: clamp(2.6rem, 7vw, 3.5rem);
    font-weight: 800;
    line-height: 1;
    letter-spacing: -0.02em;
}
.tri-bmr__score-value { color: var(--tri-primary); }
.tri-bmr__empty-num {
    color: rgba(28, 14, 33, 0.18);
    animation: triBmrPulse 1.8s ease-in-out infinite;
}
.tri-bmr__empty-tag,
.tri-bmr__score-unit { font-size: 15px; font-weight: 600; color: var(--tri-text); }
.tri-bmr__result-sub {
    margin: 6px 0 16px;
    font-size: 13.5px;
    line-height: 1.5;
    color: var(--tri-text);
}
@keyframes triBmrPulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.45; } }

/* ---- Circular gauge visual ---- */
.tri-bmr__result { text-align: center; }
.tri-bmr__empty { align-items: center; text-align: center; }
.tri-bmr__gauge {
    position: relative;
    width: 188px;
    max-width: 72%;
    aspect-ratio: 1 / 1;
    margin: 12px auto 8px;
}
.tri-bmr__ring { width: 100%; height: 100%; display: block; }
.tri-bmr__ring-track { fill: none; stroke: rgba(28, 14, 33, 0.09); stroke-width: 13; }
.tri-bmr__ring-arc {
    fill: none;
    stroke: var(--tri-orange);
    stroke-width: 13;
    stroke-linecap: round;
    stroke-dasharray: 540.354;
    stroke-dashoffset: 540.354; /* empty; JS sets the target */
    transform: rotate(-90deg);
    transform-origin: 50% 50%;
    transition: stroke-dashoffset 0.9s var(--tri-ease);
}
.tri-bmr__gauge--ghost .tri-bmr__ring-track { stroke-dasharray: 4 9; opacity: 0.7; }
.tri-bmr__gauge-center {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
}
.tri-bmr__gauge .tri-bmr__score-value,
.tri-bmr__gauge .tri-bmr__empty-num {
    font-size: clamp(1.9rem, 5.5vw, 2.5rem);
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1;
}
.tri-bmr__gauge .tri-bmr__score-unit { font-size: 12px; }

/* Gender icon inside the gauge (swaps with the selection). */
.tri-bmr__sexicon { display: inline-flex; margin-bottom: 4px; }
.tri-bmr__sexicon svg { width: 24px; height: 24px; color: var(--tri-orange); }
.tri-bmr__sexicon .i-female { display: none; }
.tri-bmr__gauge[data-sex="female"] .i-male { display: none; }
.tri-bmr__gauge[data-sex="female"] .i-female { display: inline; }

/* ---- Activity levels list ---- */
.tri-bmr__levels { display: flex; flex-direction: column; gap: 10px; width: 100%; text-align: left; }
.tri-bmr__levels--preview { margin: 14px 0 16px; opacity: 0.7; }
.tri-bmr__level {
    display: grid;
    grid-template-columns: 84px 1fr auto;
    align-items: center;
    gap: 12px;
}
.tri-bmr__level-name { font-size: 13px; font-weight: 600; color: var(--tri-primary); }
.tri-bmr__level-track {
    height: 8px;
    border-radius: 999px;
    background: rgba(28, 14, 33, 0.08);
    overflow: hidden;
}
.tri-bmr__level-fill {
    display: block;
    height: 100%;
    width: 0;
    border-radius: 999px;
    background: linear-gradient(90deg, #ff8a4c, var(--tri-orange));
    transition: width 0.7s var(--tri-ease);
}
.tri-bmr__levels--preview .tri-bmr__level-fill {
    background: rgba(28, 14, 33, 0.16);
    transition: none;
}
.tri-bmr__level-val {
    font-size: 13px;
    font-weight: 700;
    color: var(--tri-text);
    font-variant-numeric: tabular-nums;
    min-width: 56px;
    text-align: right;
}
.tri-bmr__level.is-selected .tri-bmr__level-name { color: var(--tri-orange); }
.tri-bmr__level.is-selected .tri-bmr__level-val { color: var(--tri-orange); }
.tri-bmr__level.is-selected .tri-bmr__level-track { box-shadow: 0 0 0 2px rgba(255, 69, 0, 0.25); }

.tri-bmr__empty-text {
    margin: 0;
    font-size: 14px;
    line-height: 1.6;
    color: var(--tri-text);
}
.tri-bmr__empty-text strong { color: var(--tri-primary); }

.tri-bmr__result { animation: triBmrFade 0.45s var(--tri-ease) both; }
@keyframes triBmrFade { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

.tri-bmr__disclaimer {
    margin: 26px 0 0;
    font-size: 12.5px;
    line-height: 1.6;
    color: var(--tri-text);
}

/* ---- Responsive ---- */
@media (max-width: 900px) {
    .tri-bmr__grid { grid-template-columns: 1fr; }
    .tri-bmr__panel--result { min-height: auto; }
}

@media (prefers-reduced-motion: reduce) {
    .tri-bmr__btn,
    .tri-bmr__thumb,
    .tri-bmr__empty-num,
    .tri-bmr__level-fill,
    .tri-bmr__ring-arc,
    .tri-bmr__result {
        transition: none !important;
        animation: none !important;
    }
}
