/* The department page from the owner's design (command 18, _incoming/dept-ref). After home-page.css (tokens, header, footer,
   search) and, with a featured tool, tool.css. The calculator panel keeps its cream tokens in both themes. */
@media screen {
  :root, :root:not([data-theme="light"]), :root[data-theme="dark"] { --bg: #0d0c0c; --overline: #d48a9a; }
}
@media screen and (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) { --bg: #ffffff; --overline: #8c1d40; }
}
/* One section rhythm; adjacent section padding and ad margins must not accumulate. */
[data-page-kind="department"] { --department-section-gap: 32px; --department-heading-gap: 16px; --department-ad-gap: 24px; }
body { font-size: 15px; line-height: 1.5; }
.crumbs ol { margin-block: 0; }
.dhero { padding: 8px 0 calc(var(--department-section-gap) / 2); }
.dhero-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 320px); gap: 40px; align-items: center; min-height: 0; }
.dhero-grid > * { min-width: 0; max-width: 100%; }
.dhero h1 { overflow-wrap: anywhere; hyphens: auto; font: 500 calc(clamp(44px, 4.5vw, 60px) - 4px)/1.02 var(--serif); letter-spacing: -.04em; margin-top: 10px; max-width: none; }
.dlead { font: clamp(20px, 2vw, 25px)/1.3 var(--serif); margin-top: 8px; color: var(--ink); }
.ddesc { color: var(--ink2); margin: 8px 0 16px; max-width: none; }
.dhero-art { min-width: 0; display: flex; flex-direction: column; align-items: center; }
.dhero-art img { width: min(100%, 220px); max-width: 100%; height: auto; object-fit: contain; }
.art-caption { margin-top: 6px; font: 700 9px/1.4 var(--sans); letter-spacing: .2em; text-transform: uppercase; color: var(--ink2); text-align: center; }

.featured { padding: 0 0 54px; }
.section-intro { display: flex; align-items: end; justify-content: space-between; gap: 25px; margin-bottom: var(--department-heading-gap); }
.overline { font: 700 11px/1.5 var(--sans); letter-spacing: .2em; text-transform: uppercase; color: var(--overline); margin-bottom: 8px; }
.section-intro h2 { font: 500 clamp(30px, 3vw, 38px)/1.12 var(--serif); letter-spacing: -.029em; }
.section-intro p:not(.overline) { color: var(--ink2); margin-top: 9px; font: 15px/1.5 var(--serif); }
.small-label { font-size: 12px; color: var(--ink2); white-space: nowrap; }

/* cream in both themes: the calculator's own parts read these tokens */
.calc-paper {
  --bg: #ece2d5; --ink: #251f1d; --ink2: #5f544e; --hair: #d3c1ae; --border: #7c6d64; --accent: #7a2d42; --focus: #7a2d42; --critical: #9c2a00;
  color-scheme: light; background: #ece2d5; color: var(--ink); border: 1px solid #d9c7b5; border-radius: 10px; box-shadow: 0 17px 38px #0004; overflow: hidden;
}
.calc-paper .strip, .calc-paper .ctotal, .calc-paper .rng, .calc-paper .ends, .calc-paper .clampnote, .calc-paper .tocheck { display: none !important; }
.calc.embed { margin-top: 0; border-top: 0; }
.calc.embed .inputs { padding: 30px 36px 24px; }
.calc.embed .outputs { --bg: #e4d8c7; background: #e4d8c7; padding: 0; border-left: 0; }
.calc.embed .outputs > section { display: none; border-top: 0; }
.calc.embed .outputs > #result { display: block; padding: 34px 36px 27px; }
.calc.embed .inputs h2.h { font: 500 32px/1.17 var(--serif); letter-spacing: -.02em; }
.calc.embed .total { font-family: var(--serif); letter-spacing: -.04em; }
.calc.embed a { color: var(--ink); }
.calc.embed .f { border-bottom: 0; padding-block: 9px; }
.calc.embed .blk { border-color: var(--hair); }
@media (min-width: 960px) {
  .calc.embed { grid-template-columns: 1.04fr .96fr; }
  .calc.embed .inputs { padding-right: 36px; }
  .calc.embed .outputs { border-left: 1px solid var(--hair); }
  .calc.embed .core { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 18px; align-items: start; }
  .calc.embed .core > fieldset, .calc.embed .core > .f:has(fieldset) { grid-column: 1 / -1; }
}
.under-calc { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 4px 20px; margin-top: 10px; font-size: 13px; color: var(--ink2); }
.under-calc a { display: inline-flex; align-items: center; min-height: 44px; font: 14px var(--serif); color: var(--accent); }

.topics-section { padding: calc(var(--department-section-gap) / 2) 0 0; }
[data-page-kind="department"] .ad-placement.cpscount-ad { margin-block: var(--department-ad-gap); }
/* Keep the same separation when advertising is disabled or omitted. */
[data-page-kind="department"] .topics-section + .featured,
[data-page-kind="department"] .ad-placement[hidden] ~ .featured { padding-top: var(--department-ad-gap); }
.simple-link { display: inline-flex; align-items: center; min-height: 44px; color: var(--accent); font: 14px var(--serif); white-space: nowrap; }
.topic-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); column-gap: 30px; row-gap: 5px; }
.topic-tile { min-width: 0; border-top: 1px solid var(--hair); }
.topic-tile[open] { grid-column: 1 / -1; }
.topic-tile > summary { display: flex; gap: 15px; align-items: flex-start; min-height: 44px; padding: 16px 0; cursor: pointer; list-style: none; }
.topic-tile > summary::-webkit-details-marker { display: none; }
.topic-tile > summary:hover h3 { color: var(--accent); }
.topic-number { font-size: 12px; color: var(--accent); padding-top: 5px; }
.topic-content { flex: 1; min-width: 0; }
.topic-content h3 { font: 500 21px/1.2 var(--serif); }
.topic-content small { display: block; color: var(--ink2); margin-top: 3px; font-size: 13px; }
.topic-arrow { color: var(--accent); font: 22px/1 var(--sans); }
.topic-tile[open] .topic-arrow { transform: rotate(45deg); }
.topic-tile .tlist { list-style: none; margin: 0 0 18px; padding: 0; }
.topic-tile .tlist li { padding: 2px 0 8px; border-top: 1px solid var(--hair); }
.topic-tile .tlist a { display: inline-flex; align-items: center; min-height: 44px; font: 17px var(--serif); }
.topic-tile .tlist .q { margin: 0; color: var(--ink2); font-size: 13px; }
@media (min-width: 720px) { .topic-tile .tlist { columns: 2 320px; column-gap: 30px; } .topic-tile .tlist li { break-inside: avoid; } }

@media (max-width: 990px) {
  .dhero-grid { grid-template-columns: minmax(0, 1.15fr) minmax(230px, .85fr); gap: 20px; }
  .topic-grid { column-gap: 19px; }
}
@media (max-width: 770px) {
  [data-page-kind="department"] { --department-section-gap: 24px; --department-heading-gap: 16px; }
  .dhero-grid { grid-template-columns: minmax(0, 1fr); gap: 0; min-height: 0; }
  .dhero-art { display: none; }
  .topic-grid { grid-template-columns: minmax(0, 1fr); }
  .section-intro { flex-direction: column; align-items: flex-start; }
}
@media (max-width: 540px) {
  .dhero h1 { font-size: calc(clamp(44px, 11vw, 61px) - 4px); }
  .calc.embed .inputs { padding: 22px 16px; }
  .calc.embed .outputs > #result { padding: 22px 16px; }
}
@media print {
  .calc-paper { box-shadow: none; }
  .topic-tile .tlist { columns: 1; }
}
/* the fields are lighter than the panel; the total and the small labels as in the design */
.calc-paper .box { background: #f6f1ea; border-radius: 6px; }
.calc-paper .box input { background: transparent; }
.calc.embed .total { font-size: clamp(47px, 5vw, 67px); line-height: 1; }
.calc-paper { --s-principal: #1f4fa8; --s-interest: #d9590f; --s-tax: #0e7d5c; --s-ins: #5e4300; --s-hoa: #3c96b4; --s-pmi: #858585; --s-balance: #4a3aa7; }
.calc.embed .pair > .box { width: 100%; min-width: 0; }
/* the box has its final size before the image loads: no layout shift */
.dhero-art picture { display: block; width: min(100%, 220px); max-width: 100%; margin: 0; }
.dhero-art img { width: 100%; }

/* Approved department artwork stays on a dark plate in either page theme. */
.dhero-art { background: #080808; border-radius: 10px; padding: 8px 20px; }
.dhero-art .art-caption { color: #bcb0ab; letter-spacing: .14em; }
.illustrated-topic { border: 1px solid var(--hair); border-radius: 8px; background: var(--card); padding-inline: 16px; }
.illustrated-topic > summary { align-items: center; gap: 16px; padding-block: 14px; }
.illustrated-topic .topic-image { width: 80px; height: 80px; object-fit: contain; flex: none; background: #080808; border-radius: 6px; }
.illustrated-topic .topic-content h3 { font-size: 20px; }
.topic-grid:has(.illustrated-topic) { gap: 16px; }
.embed-context { max-width: 65ch; color: var(--ink2); font-size: 16px; margin-top: 16px; }
.under-calc .full-calculator { font-weight: 700; }
/* Long localized breakdown headings must fit the result panel as well. */
.calc.embed .legend { width: 100%; table-layout: fixed; }
.calc.embed .legend th, .calc.embed .legend td { white-space: normal; overflow-wrap: anywhere; }
.calc.embed .legend th:first-child, .calc.embed .legend td:first-child { width: 42%; }
@media (max-width: 540px) { .illustrated-topic .topic-image { width: 64px; height: 64px; } }

@media(min-width:1100px) { .topic-grid { grid-template-columns: repeat(4,minmax(0,1fr)); } .illustrated-topic { padding-inline:12px; } .illustrated-topic > summary { gap:12px; } .illustrated-topic .topic-image { width:56px; height:56px; } .illustrated-topic .topic-content h3 { font-size:19px; } }

/* Compact Hero Variant 1: use the existing illustration plate and card face. */
.dhero-art { width: min(100%, 320px); justify-self: center; }
.dhero .hbox { height: 44px; }
.dhero .hsearch .pop { top: 44px; }
.topics-section .pay-more-tools { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: stretch; gap: 8px 20px; margin-top: 12px; }
.topics-section .pay-more-label { grid-column: 1 / -1; }
.topics-section .pay-more-tools a { display: flex; align-items: center; min-width: 0; min-height: 44px; padding-block: 6px; color: var(--ink); font-size: 16px; line-height: 1.4; overflow-wrap: anywhere; text-underline-offset: 3px; }
.topics-section .pay-more-tools a:is(:hover, :focus-visible) { color: var(--accent); }
@media (min-width: 1100px) { .topics-section .pay-more-tools { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 540px) { .topics-section .pay-more-tools { grid-template-columns: minmax(0, 1fr); } }
@media(min-width:960px) {
  [data-page-kind="department"] main.wrap { max-width: 1200px; padding-inline: 24px; padding-top: 8px; }
  .topics-section details.illustrated-topic > summary { min-height: 76px; padding-block: 10px; }
  .topics-section .illustrated-topic .topic-image { width: 56px; height: 56px; }
}
/* Keep the approved department typography; the shared header owns its placement. */
@media(min-width:1200px) {
  [data-page-kind="department"] .topnav ul { gap: 10px; }
  [data-page-kind="department"] .topnav a, [data-page-kind="department"] .topnav button { font-size: 15px; }
}

@media(max-width:770px) {
  .topics-section .section-intro { gap: 12px; }
  .featured .section-intro { gap: 8px; }
}
