/*
 * OneSixty Calculators: shared styles.
 * Flat layout: hairlines and underlined inputs, no cards. Fonts inherit from the page.
 * The OneSixty Wealth site skin (direction B) is at the end of this file.
 */
.osc {
  --osc-fg: #0c1829;
  --osc-muted: #5b6676;
  --osc-rule: #dcd9d1;
  --osc-bg: transparent;
  --osc-field: transparent;
  --osc-accent: #a8862f;
  --osc-accent-strong: #c9a84c;
  --osc-pos: #2f7d4f;
  --osc-neg: #b4412f;
  --osc-series-2: #4f7cac;
  --osc-series-3: #7a9a6b;
  --osc-hl: rgba(201, 168, 76, 0.12);
  --osc-gap: clamp(20px, 3vw, 40px);
  color: var(--osc-fg);
  background: var(--osc-bg);
  font: inherit;
  line-height: 1.5;
  container-type: inline-size;
}
.osc--dark {
  --osc-fg: #f1ece1;
  --osc-muted: #a7afbd;
  --osc-rule: #2b3a52;
  --osc-field: transparent;
  --osc-accent: #d4b25a;
  --osc-pos: #7cc596;
  --osc-neg: #ef8f7d;
  --osc-series-2: #8fb3dd;
  --osc-series-3: #a9c79a;
  --osc-hl: rgba(212, 178, 90, 0.14);
}
.osc *, .osc *::before, .osc *::after { box-sizing: border-box; }

/* Layout */
.osc-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--osc-gap); }
@container (min-width: 760px) {
  .osc-grid { grid-template-columns: minmax(260px, 340px) minmax(0, 1fr); }
  .osc-grid--wide { grid-template-columns: minmax(260px, 380px) minmax(0, 1fr); }
  .osc-inputs { position: sticky; top: 24px; align-self: start; }
}
.osc .osc-inputs.osc-inputs--tall { position: static; }
.osc-inputs, .osc-results { display: flex; flex-direction: column; gap: 22px; min-width: 0; }

/* Inputs */
.osc-group { border: 0; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.osc-group + .osc-group { padding-top: 20px; border-top: 1px solid var(--osc-rule); }
.osc-group__title, .osc-heading {
  font-size: 0.78rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--osc-muted); padding: 0; margin: 0 0 2px;
}
.osc-heading { margin: 6px 0 0; }
.osc-field { display: flex; flex-direction: column; gap: 4px; }
.osc-label { font-size: 0.92rem; font-weight: 500; }
.osc-affix { position: relative; display: flex; align-items: center; }
.osc-input {
  width: 100%; font: inherit; font-size: 1rem; color: var(--osc-fg); background: var(--osc-field);
  border: 0; border-bottom: 1px solid var(--osc-rule); border-radius: 0; padding: 9px 4px;
  font-variant-numeric: tabular-nums; -moz-appearance: textfield; appearance: none;
  transition: border-color .15s ease;
}
select.osc-input {
  padding-right: 28px; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--osc-muted) 50%), linear-gradient(135deg, var(--osc-muted) 50%, transparent 50%);
  background-position: calc(100% - 14px) 52%, calc(100% - 9px) 52%; background-size: 5px 5px; background-repeat: no-repeat;
}
.osc-input::-webkit-outer-spin-button, .osc-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.osc-input:hover { border-bottom-color: var(--osc-muted); }
.osc-input:focus { outline: none; border-bottom: 2px solid var(--osc-accent); padding-bottom: 8px; }
.osc-input:focus-visible { box-shadow: 0 2px 0 0 var(--osc-accent); }
.has-prefix .osc-input { padding-left: 18px; }
.has-suffix .osc-input { padding-right: 34px; }
.osc-prefix, .osc-suffix { position: absolute; color: var(--osc-muted); font-size: 0.95rem; pointer-events: none; }
.osc-prefix { left: 4px; }
.osc-suffix { right: 4px; }
.osc-hint { margin: 0; font-size: 0.8rem; color: var(--osc-muted); }
.osc-toggle { display: flex; align-items: center; gap: 10px; }
.osc-check { width: 18px; height: 18px; accent-color: var(--osc-accent); margin: 0; }
.osc-presets { display: flex; flex-wrap: wrap; gap: 6px; }
.osc-preset {
  font: inherit; font-size: 0.82rem; padding: 5px 12px; color: var(--osc-fg); cursor: pointer;
  background: transparent; border: 1px solid var(--osc-rule); border-radius: 999px;
}
.osc-preset:hover, .osc-preset:focus-visible { border-color: var(--osc-accent); outline: none; }

/* Results */
.osc-verdict { display: flex; flex-direction: column; gap: 6px; padding: 0 0 20px; border-bottom: 1px solid var(--osc-fg); }
.osc-verdict__eyebrow { font-size: 0.75rem; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--osc-accent); }
.osc-verdict__title { font-size: clamp(1.4rem, 3.2cqi, 2rem); line-height: 1.15; font-weight: 600; }
.osc-verdict__body { margin: 0; color: var(--osc-muted); max-width: 60ch; }
.osc-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); border-top: 1px solid var(--osc-rule); }
@container (min-width: 760px) { .osc-stats[style*="--osc-cols"] { grid-template-columns: repeat(var(--osc-cols), minmax(0, 1fr)); } }
.osc-stat { display: flex; flex-direction: column; gap: 2px; padding: 14px 14px 14px 0; border-bottom: 1px solid var(--osc-rule); min-width: 0; }
.osc-stat__label { font-size: 0.78rem; color: var(--osc-muted); letter-spacing: 0.02em; }
.osc-stat__value { font-size: 1.3rem; font-weight: 600; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.osc-stat__note { font-size: 0.78rem; color: var(--osc-muted); }
.osc-tone-pos .osc-stat__value, .osc-list__row.osc-tone-pos dd, .osc-tone-pos.osc-verdict .osc-verdict__title { color: var(--osc-pos); }
.osc-tone-neg .osc-stat__value, .osc-list__row.osc-tone-neg dd { color: var(--osc-neg); }
.osc-tone-accent .osc-stat__value, .osc-list__row.osc-tone-accent dd { color: var(--osc-accent); }
.osc-tone-neg.osc-verdict .osc-verdict__eyebrow { color: var(--osc-neg); }
.osc-list { margin: 0; border-top: 1px solid var(--osc-rule); }
.osc-list__row { display: flex; justify-content: space-between; gap: 16px; padding: 10px 0; border-bottom: 1px solid var(--osc-rule); }
.osc-list__row dt { color: var(--osc-muted); }
.osc-list__row dd { margin: 0; font-weight: 500; font-variant-numeric: tabular-nums; text-align: right; }
.osc-list__row.is-total { border-top: 1px solid var(--osc-fg); border-bottom-color: var(--osc-fg); }
.osc-list__row.is-total dt, .osc-list__row.is-total dd { color: var(--osc-fg); font-weight: 700; }
.osc-list__row.is-total.osc-tone-neg dd { color: var(--osc-neg); }
.osc-list__row.is-total.osc-tone-pos dd { color: var(--osc-pos); }
.osc-table-wrap { overflow-x: auto; border-top: 1px solid var(--osc-fg); -webkit-overflow-scrolling: touch; }
.osc-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.osc-table th { text-align: left; font-size: 0.72rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--osc-muted); padding: 10px 12px 10px 0; border-bottom: 1px solid var(--osc-rule); white-space: nowrap; }
.osc-table td { padding: 9px 12px 9px 0; border-bottom: 1px solid var(--osc-rule); vertical-align: top; }
.osc-table .is-num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.osc-table tr.is-hl td { background: var(--osc-hl); font-weight: 600; }
.osc-table td:first-child, .osc-table th:first-child { padding-left: 8px; }
.osc-bar { display: flex; height: 30px; background: var(--osc-hl); overflow: hidden; }
.osc-bar__seg { display: flex; align-items: center; justify-content: center; font-size: 0.75rem; font-weight: 600; color: #fff; transition: width .3s ease; white-space: nowrap; overflow: hidden; }
.osc-seg-0 { background: var(--osc-fg); }
.osc-seg-1 { background: var(--osc-accent); }
.osc-seg-2 { background: var(--osc-hl); color: var(--osc-fg); }
.osc-seg-3 { background: var(--osc-series-2); }
.osc-legend { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 8px; font-size: 0.8rem; color: var(--osc-muted); }
.osc-legend__item { display: inline-flex; align-items: center; gap: 6px; }
.osc-legend__item i { width: 10px; height: 10px; display: inline-block; border: 1px solid var(--osc-rule); }
.osc-chart { position: relative; width: 100%; }
.osc-note { margin: 0; font-size: 0.88rem; color: var(--osc-muted); max-width: 68ch; }
.osc-disclaimer { margin: 8px 0 0; padding-top: 14px; border-top: 1px solid var(--osc-rule); font-size: 0.78rem; color: var(--osc-muted); max-width: 80ch; }

@media (prefers-reduced-motion: reduce) {
  .osc *, .osc *::before, .osc *::after { transition: none !important; animation: none !important; }
}

/* Links, bullet lists and per-cell tones inside tool text */
.osc a { color: var(--osc-accent); text-decoration: underline; text-underline-offset: 2px; }
.osc a:hover { color: var(--osc-fg); }
.osc ul.osc-note, .osc ul.osc-bullets { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 6px; }
.osc .osc-table td.osc-tone-pos { color: var(--osc-pos); }
.osc .osc-table td.osc-tone-neg { color: var(--osc-neg); }
.osc-tone-neg.osc-verdict .osc-verdict__title { color: var(--osc-neg); }

/* Phones: tighter tables so most fit without sideways scrolling */
@container (max-width: 480px) {
  .osc-table { font-size: 0.78rem; }
  .osc-table th { font-size: 0.66rem; letter-spacing: 0.04em; padding: 8px 8px 8px 0; }
  .osc-table td { padding: 8px 8px 8px 0; }
  .osc-table td:first-child, .osc-table th:first-child { padding-left: 4px; }
}

/* Folded long tables */
.osc-fold > summary { cursor: pointer; padding: 12px 0; font-weight: 600; color: var(--osc-accent); list-style: none; display: flex; align-items: center; gap: 10px; border-top: 1px solid var(--osc-rule); }
.osc-fold > summary::-webkit-details-marker { display: none; }
.osc-fold > summary::before { content: ""; width: 7px; height: 7px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(-45deg); transition: transform .2s ease; }
.osc-fold[open] > summary::before { transform: rotate(45deg); }
.osc-fold > summary:focus-visible { outline: 2px solid var(--osc-accent); outline-offset: 2px; }

/*
 * OneSixty Wealth site skin (direction B, navy and gold). Moved here from the Breakdance global selector
 * collection "Calculators" so the site carries no global calculator CSS. The doubled .osc.osc keeps the
 * specificity the global selectors had. Colours and fonts read the Breakdance Global Settings palette and
 * font variables, with the B values as fallbacks. Accent is gold ink (#7a611c): the charts draw accent against
 * fg and pos, so it cannot also be navy. Dark tools (theme="dark") keep their own tokens.
 */
.osc.osc:not(.osc--dark) {
  --osc-fg: var(--navy, #0c1829);
  --osc-muted: var(--muted, #535d6c);
  --osc-rule: #dedad2;
  --osc-accent: var(--gold-ink, #7a611c);
  --osc-accent-strong: var(--navy, #0c1829);
  --osc-pos: var(--navy, #0c1829);
  --osc-neg: var(--negative, #a33a2c);
  --osc-series-2: #9aa4ae;
  --osc-series-3: #9aa6b1;
  --osc-hl: rgba(201, 168, 76, .14);
}
.osc.osc h3.osc-heading { color: var(--muted, #535d6c); font-family: var(--osw-font-text, inherit); font-weight: 600; font-size: 12px; line-height: 1.4; text-transform: uppercase; letter-spacing: 0.16em; }
.osc.osc .osc-verdict__title, .osc.osc .osc-stat__value { font-family: var(--osw-font-display, inherit); font-weight: 500; }
.osc.osc .osc-tone-pos.osc-verdict .osc-verdict__title { color: var(--navy, #0c1829); }
.osc.osc .osc-table-wrap { border-top: 1.5px solid var(--osc-fg); }
.osc.osc .osc-list, .osc.osc .osc-stats { border-top: 1.5px solid var(--osc-rule); }
/* Clears the 73px sticky site header (72px bar and a 1px rule) with 23px to spare, plus the WordPress admin bar when it shows. */
.osc.osc .osc-inputs { top: calc(var(--osc-sticky-top, 96px) + var(--wp-admin--admin-bar--height, 0px)); }
.osc.osc .osc-verdict__eyebrow { display: none; }
.osc.osc .osc-inputs > .osc-group:first-child > .osc-group__title { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/*
 * Compact phone layout (below 768px, version 0.3.0). Short fields sit two per row: core.js marks each pair
 * osc-field--half. Selects with long options, toggles, notes, results, tables and charts stay full width.
 * Every label and hint stays; the spacing between them is tighter. Inputs keep a 44px tap height and 16px text
 * so iOS Safari does not zoom on focus. Desktop and tablet layouts are unchanged.
 */
@media (max-width: 767.98px) {
  .osc-inputs { gap: 14px; }
  .osc-results { gap: 16px; }
  .osc-group { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
  .osc-group > * { grid-column: 1 / -1; min-width: 0; }
  .osc-group > .osc-field--half { grid-column: auto; }
  .osc-group + .osc-group { padding-top: 14px; }
  .osc-field { gap: 2px; }
  .osc-label { line-height: 1.3; }
  .osc-input { min-height: 44px; padding-top: 7px; padding-bottom: 7px; font-size: 16px; line-height: 1.25; }
  .osc-input:focus { padding-bottom: 6px; }
  .osc-hint { font-size: 13px; line-height: 1.35; }
  .osc-toggle { min-height: 44px; }
  .osc-preset { min-height: 44px; }
  .osc-verdict { gap: 4px; padding-bottom: 14px; }
  .osc-stat { padding: 10px 10px 10px 0; }
  .osc-list__row { padding: 8px 0; }
  .osc-fold > summary { min-height: 44px; padding: 8px 0; }
}
/* Paired fields share row tracks, so both labels, both inputs and both hints line up across the row. */
@supports (grid-template-rows: subgrid) {
  @media (max-width: 767.98px) {
    .osc-group > .osc-field--half { display: grid; grid-row: span 3; grid-template-rows: subgrid; row-gap: 2px; }
    .osc-group > .osc-field--half > .osc-label { align-self: end; }
  }
}
