/* ============================================================
   Tools bridge — map the imported calculator UI onto the
   Legacy Investing Show field guide without changing the
   compact form + live-result layout.

   Load after /assets/css/styles.css and the calcs2 stylesheet.
   ============================================================ */

:root {
    --ink: #1f2a24;
    --ink-muted: #4a5850;
    --ink-faint: #626e66;
    --paper: #fbf8f1;
    --paper-raised: #fbf8f1;
    --line: #ddd4be;
    --accent: #16352a;
    --accent-hover: #0f2419;
    --accent-soft: #e4efe5;
    --danger: #b0503c;
    --danger-soft: #f6e4dd;
    --font-inter: 'Public Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --font-sans: 'Public Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

html,
body,
.font-sans,
[class*='inter_'] {
    font-family: var(--font-sans) !important;
}

html:has(body.tools-surface),
body.tools-surface {
    min-height: 100%;
}

body.tools-surface {
    display: flex;
    flex-direction: column;
    background: var(--paper);
    color: var(--ink);
}

body.tools-surface main h1 {
    color: var(--forest);
}

body.tools-surface main h1,
body.tools-surface main h2,
body.tools-surface main h3,
body.tools-surface main h4 {
    margin-top: 0;
}

body.tools-surface main h2 {
    font-size: 1.125rem;
    line-height: 1.3;
    letter-spacing: -0.01em;
}

body.tools-surface main h2[class*='uppercase'] {
    font-size: 0.8125rem;
    font-weight: 500;
    letter-spacing: 0.06em;
    color: var(--ink-faint);
}

body.tools-surface main h3 {
    font-size: 0.9375rem;
    line-height: 1.35;
}

body.tools-surface main h2::after {
    content: none !important;
    display: none !important;
}

body.tools-surface main p {
    margin: 0;
}

body.tools-surface main a {
    color: inherit;
    text-decoration: none;
}

body.tools-surface main a:hover {
    color: var(--emerald);
}

body.tools-surface main ul.list-disc {
    list-style: disc;
    padding-left: 1.25rem;
}

body.tools-surface main ol.list-decimal {
    list-style: decimal;
    padding-left: 1.25rem;
}

body.tools-surface > header:not(.site-header),
body.tools-surface header.sticky.top-0.z-40:not(.site-header) {
    display: none !important;
}

body.tools-surface > footer:not(.site-footer),
body.tools-surface footer.mt-auto.border-t:not(.site-footer) {
    display: none !important;
}

.guide-skip {
    position: absolute;
    left: 50%;
    top: -100%;
    transform: translateX(-50%);
    z-index: 9999;
    padding: 0.875rem 1.75rem;
    border-radius: 999px;
    background: var(--forest);
    color: var(--paper);
    font-weight: 600;
    text-decoration: none;
}

.guide-skip:focus {
    top: 0.75rem;
    color: var(--paper);
}

.tools-subnav {
    position: sticky;
    top: 3.75rem;
    z-index: 40;
    background: var(--paper);
    border-bottom: 1px solid var(--line);
}

.tools-subnav-inner {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    min-height: 2.75rem;
    overflow-x: auto;
    scrollbar-width: none;
}

.tools-subnav-inner::-webkit-scrollbar {
    display: none;
}

.tools-subnav-inner::after {
    content: '';
    flex: 0 0 0.75rem;
}

.tools-subnav a {
    position: relative;
    flex: 0 0 auto;
    padding: 0.65rem 0;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--ink-soft);
    text-decoration: none;
    white-space: nowrap;
}

.tools-subnav a::after {
    content: '';
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    height: 2px;
    background: var(--gold);
    transform: scaleX(0);
    transform-origin: left center;
    transition: transform 0.3s var(--ease-smooth, cubic-bezier(0.16, 1, 0.3, 1));
}

.tools-subnav a:hover {
    color: var(--forest);
}

.tools-subnav a:hover::after,
.tools-subnav a[aria-current='page']::after {
    transform: scaleX(1);
}

.tools-subnav a[aria-current='page'] {
    color: var(--emerald);
    font-weight: 600;
}

body.tools-surface .site-footer {
    margin-top: auto;
}

/* ------------------------------------------------------------
   Inputs. Site Tailwind preflight is unlayered and sets
   `input { padding: 0 }` after the calcs2 utilities, which
   sits the $ prefix on top of the value. Restore padding here
   (also unlayered, loaded last). Do not use !important so the
   tax-structure money field can keep its underline treatment.
   ------------------------------------------------------------ */

body.tools-surface main input.py-2\.5,
body.tools-surface main .tools-control {
    padding-top: 0.625rem;
    padding-bottom: 0.625rem;
    font-variant-numeric: tabular-nums;
}

body.tools-surface main input.px-3 {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
}

body.tools-surface main input.pr-3 {
    padding-right: 0.75rem;
}

body.tools-surface main input.pl-7,
body.tools-surface main input.tools-control--prefix,
body.tools-surface main .relative:has(> .left-3) > input,
body.tools-surface main .relative:has(> .tools-affix--prefix) > input {
    padding-left: 1.75rem;
}

body.tools-surface main input.pr-12,
body.tools-surface main input.tools-control--suffix,
body.tools-surface main .relative:has(> .right-3) > input,
body.tools-surface main .relative:has(> .tools-affix--suffix) > input {
    padding-right: 3rem;
}

body.tools-surface main input[type='search'] {
    padding: 0.625rem 0.875rem;
}

body.tools-surface main select {
    padding: 0.625rem 2rem 0.625rem 0.75rem;
}

.tools-affix {
    position: absolute;
    top: 0;
    bottom: 0;
    z-index: 1;
    display: flex;
    align-items: center;
    pointer-events: none;
    font-size: 13px;
    color: var(--ink-faint);
}

.tools-affix--prefix {
    left: 0.75rem;
}

.tools-affix--suffix {
    right: 0.75rem;
}

body.tools-surface main nav[aria-label='Categories'] {
    gap: 0.5rem 1.25rem;
}

body.tools-surface main [id] {
    scroll-margin-top: 7rem;
}

body.tools-surface main nav[aria-label='Categories'] a {
    background: transparent;
    border: 0;
    border-radius: 0;
    padding: 0.25rem 0;
    color: var(--ink-soft);
}

body.tools-surface main nav[aria-label='Categories'] a:hover {
    color: var(--emerald);
    background: transparent;
    border-color: transparent;
}

body.tools-surface main .money input {
    padding: 4px 0 8px;
    border: 0;
    background: transparent;
    border-radius: 0;
}
