/* Template: calculator (every free tool page). The tool comes first, the explanation after it. */

/* ---------- compact hero, so the tool is in view straight away ---------- */
.tl-hero { padding-block: clamp(1.4rem, 1rem + 1.6vw, 2.4rem) clamp(1.8rem, 1.2rem + 2vw, 3rem); }
.tl-hero .crumbs { margin-bottom: 1.2rem; }
.tl-hero .page-hero__title { font-size: clamp(2rem, 1.3rem + 2.4vw, 3.2rem); letter-spacing: -0.045em; margin: 0.8rem 0 0.9rem; }
.tl-hero .lede { max-width: 62ch; font-size: 1.05rem; }

/* ---------- the tool ---------- */
.tl-tool { padding-block: clamp(1.4rem, 1rem + 2vw, 3rem) clamp(3rem, 2rem + 3vw, 5rem); }

/* calculator: inputs left, your result right (sticky); one column on phones */
.calc { position: relative; display: grid; grid-template-columns: minmax(0, 1fr); gap: 1.2rem; padding: clamp(1.1rem, 0.8rem + 1.4vw, 2rem); border-radius: var(--r-xl); background: #fff; color: var(--ink); border: 1px solid var(--line); }
.calc > *, .schedule { min-width: 0; }
.calc [hidden] { display: none !important; }
.tl-calc { grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr); gap: clamp(1.2rem, 0.8rem + 2vw, 2.5rem); align-items: start; }
.tl-calc__in { display: grid; gap: 1.1rem; }
.tl-calc__head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 0.8rem 1.5rem; padding-bottom: 1.1rem; border-bottom: 1px solid var(--line); }
.tl-calc__head .h3 { margin: 0; }
.tl-calc .field-row > .field { grid-template-rows: 1fr auto; }
.tl-calc .field-row .field__label { align-self: end; }
.calc .field__input { font-size: 1.1rem; font-variant-numeric: tabular-nums; min-height: 3.1rem; }
.calc .field__input:focus { border-color: var(--ink); box-shadow: 0 0 0 3px rgba(215, 38, 45, 0.28); }
.calc select.field__input { -webkit-appearance: none; appearance: none; padding-right: 2.6rem; font-size: 1rem; cursor: pointer; background: var(--paper) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235F6068' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 1rem center / 14px; }
.field--currency { min-width: 12rem; max-width: 15rem; gap: 0.3rem; }
.field--currency .field__label { font-size: 0.85rem; font-weight: 500; color: var(--slate); }
.field--currency .field__input { min-height: 2.9rem; padding-block: 0.6rem; }
.suffix { position: relative; }
.suffix .field__input { padding-right: 3.8rem; }
.suffix span { position: absolute; right: 1rem; top: 50%; transform: translateY(-50%); font-size: 0.9rem; color: var(--slate); pointer-events: none; }

/* your result: the dark panel with the cut corner and the red dot */
.tl-calc .cc.tl-res { position: sticky; top: calc(var(--header-h) + 1rem); }
.out { display: grid; gap: 1rem; padding: clamp(1.3rem, 1rem + 1vw, 1.8rem); border-radius: var(--r-lg); background: var(--night); color: #fff; }
.out__main { padding-right: 3.2rem; }
.out__main small, .out__row small { display: block; font-size: 0.88rem; color: var(--mist); }
.out__main output { display: block; margin-top: 0.35rem; font-size: clamp(2.6rem, 1.9rem + 2.6vw, 4rem); font-weight: 800; letter-spacing: -0.05em; line-height: 1; color: #fff; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.out__rows { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0; border-top: 1px solid var(--line-dark); }
.out__rows--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.out__row { padding: 0.75rem 0.8rem 0.75rem 0; border-bottom: 1px solid var(--line-dark); }
.out__row output { display: block; margin-top: 0.2rem; font-weight: 700; font-size: 1.15rem; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.out__hint { color: var(--mist); font-size: 0.95rem; line-height: 1.55; }
.out__hint b { color: #fff; }

/* choice between two ways to calculate */
.seg-field { border: 0; padding: 0; margin: 0; min-width: 0; }
.seg-field legend { padding: 0; margin-bottom: 0.5rem; }
.seg { display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 4px; border-radius: 12px; background: var(--snow); border: 1px solid var(--line); }
.seg label { position: relative; }
.seg input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.seg span { display: flex; align-items: center; min-height: 2.75rem; padding: 0 1.1rem; border-radius: 9px; font-weight: 600; font-size: 0.95rem; color: var(--slate); transition: background 0.2s, color 0.2s; }
.seg input:checked + span { background: var(--ink); color: #fff; }
.seg input:focus-visible + span { outline: 3px solid var(--lamp); outline-offset: 2px; }

/* mortgage: yearly breakdown, full width under the calculator */
.tl-calc .schedule { grid-column: 1 / -1; border-top: 1px solid var(--line); padding-top: 0.6rem; }
.schedule summary { display: flex; align-items: center; min-height: 2.75rem; cursor: pointer; font-weight: 700; }
.schedule .table-wrap { margin-top: 0.6rem; max-height: 22rem; overflow: auto; border: 1px solid var(--line); border-radius: var(--r-sm); }
.schedule table { width: 100%; border-collapse: collapse; font-size: 0.88rem; font-variant-numeric: tabular-nums; }
.schedule th, .schedule td { padding: 0.55rem 0.8rem; text-align: right; border-bottom: 1px solid var(--line); white-space: nowrap; }
.schedule th:first-child, .schedule td:first-child { text-align: left; }
.schedule th { position: sticky; top: 0; background: var(--snow); font-size: 0.8rem; font-weight: 600; color: var(--slate); }

@media (max-width: 900px) {
	.tl-calc { grid-template-columns: minmax(0, 1fr); }
	.tl-calc .cc.tl-res { position: static; }
}
@media (max-width: 520px) {
	.out__rows--3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
	.field--currency { min-width: 0; max-width: none; flex: 1 1 100%; }
}

/* ---------- text editor ---------- */
.editor { display: grid; grid-template-columns: minmax(0, 1fr) 20rem; gap: 1.25rem; align-items: start; }
.editor__main { display: grid; gap: 1rem; padding: clamp(1rem, 0.8rem + 1vw, 1.6rem); }
.editor__bar { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.editor__btn { min-height: 2.75rem; padding: 0 0.95rem; border-radius: 10px; border: 1px solid var(--line); background: var(--paper); color: var(--ink); font: inherit; font-size: 0.9rem; font-weight: 600; cursor: pointer; transition: border-color 0.2s, background 0.2s; }
.editor__btn:hover { border-color: var(--ink); background: var(--snow); }
.editor__btn:focus-visible { outline: 3px solid var(--lamp); outline-offset: 2px; }
.editor__text { width: 100%; min-height: 24rem; resize: vertical; padding: 1.1rem 1.2rem; border-radius: var(--r-sm); border: 1.5px solid #9a9aa2; background: var(--paper); color: var(--ink); font: inherit; font-size: 1.05rem; line-height: 1.65; }
.editor__text:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px rgba(215, 38, 45, 0.28); }
.editor__foot { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem 1rem; }
.editor__note { font-size: 0.88rem; color: var(--slate); }
.editor__status { font-size: 0.88rem; font-weight: 700; color: #12805c; }
.editor__actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-left: auto; }
.editor__actions .btn--sm { min-height: 2.75rem; }
.editor__side { display: grid; gap: 1.25rem; position: sticky; top: calc(var(--header-h) + 1rem); }
.editor__side .out__main output { font-size: clamp(2.4rem, 2rem + 2vw, 3.4rem); }
.limits { display: grid; gap: 0.9rem; }
.limits__help { margin-top: -0.3rem; font-size: 0.9rem; color: var(--slate); }
.limit__head { display: flex; justify-content: space-between; gap: 1rem; font-size: 0.92rem; font-weight: 600; }
.limit__head output { font-size: 0.88rem; font-weight: 500; font-variant-numeric: tabular-nums; }
.limit__bar { height: 8px; margin-top: 0.35rem; border-radius: 99px; background: var(--snow); overflow: hidden; }
.limit__bar i { display: block; height: 100%; width: calc(var(--p, 0) * 100%); border-radius: inherit; background: #1f9d6b; transition: width 0.2s, background 0.2s; }
.limit[data-state="near"] .limit__bar i { background: var(--lamp); }
.limit[data-state="over"] .limit__bar i { background: #d92d20; }
.limit[data-state="over"] output { color: #b42318; }
@media (max-width: 1000px) {
	.editor { grid-template-columns: minmax(0, 1fr); }
	.editor__side { position: static; }
	.editor__text { min-height: 15rem; }
}

/* ---------- emoji mixer ---------- */
.mixer { display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); gap: 1.25rem; align-items: start; }
.mixer__stage { position: sticky; top: calc(var(--header-h) + 1rem); display: grid; justify-items: center; gap: 1rem; padding: clamp(1rem, 0.8rem + 1vw, 1.8rem); }
.mixer__stage canvas { width: 100%; max-width: 420px; aspect-ratio: 1; border-radius: var(--r-lg); background: repeating-conic-gradient(#efeff1 0% 25%, #fff 0% 50%) 50% / 28px 28px; }
.mixer__actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.6rem; }
.mixer__note { max-width: 26rem; text-align: center; font-size: 0.85rem; color: var(--slate); }
.mixer__controls { display: grid; gap: 1rem; }
.mixer__slots { display: flex; flex-wrap: wrap; align-items: center; gap: 0.8rem; }
.mixer__slot { display: grid; justify-items: center; gap: 0.2rem; width: 5.4rem; padding: 0.7rem 0.4rem; border-radius: var(--r-sm); border: 2px solid var(--line); background: var(--paper); font: inherit; cursor: pointer; }
.mixer__slot.is-active { border-color: var(--ink); box-shadow: inset 0 -4px 0 var(--lamp); }
.mixer__slot-emoji { font-size: 2.4rem; line-height: 1.1; }
.mixer__slot small { font-size: 0.8rem; color: var(--slate); }
.mixer__plus { font-size: 1.6rem; font-weight: 800; color: var(--slate); }
.mixer__swap { margin-left: auto; width: 2.8rem; height: 2.8rem; border-radius: 50%; border: 1px solid var(--line); background: var(--paper); font-size: 1.2rem; cursor: pointer; }
.mixer__swap:hover { border-color: var(--ink); }
.mixer__help { font-size: 0.9rem; color: var(--slate); }
.mixer__tabs { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.mixer__tabs button { min-height: 2.75rem; padding: 0 0.9rem; border-radius: 10px; border: 1px solid var(--line); background: var(--paper); color: var(--ink); font: inherit; font-size: 0.88rem; font-weight: 600; cursor: pointer; }
.mixer__tabs button[aria-selected="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.mixer__grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(2.8rem, 1fr)); gap: 0.25rem; max-height: 17rem; overflow-y: auto; padding: 0.3rem; border-radius: var(--r-sm); background: var(--snow); }
.mixer__emoji { aspect-ratio: 1; border: 0; border-radius: 10px; background: transparent; font-size: 1.6rem; line-height: 1; cursor: pointer; }
.mixer__emoji:hover { background: #fff; }
.mixer__sliders { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.8rem 1.2rem; }
.mixer__range { display: grid; gap: 0.35rem; font-size: 0.9rem; font-weight: 600; }
.mixer__range input { width: 100%; min-height: 2.75rem; accent-color: #b01d23; }
@media (max-width: 1000px) {
	.mixer { grid-template-columns: minmax(0, 1fr); }
	.mixer__stage { position: static; }
	/* smaller canvas on phones so the emoji picker is close by */
	.mixer__stage canvas { max-width: 260px; }
}
@media (max-width: 480px) { .mixer__sliders { grid-template-columns: minmax(0, 1fr); } }

/* ---------- the explanation, after the tool ---------- */
.tl-explain { padding-block: clamp(3rem, 2rem + 3vw, 5rem); }
.tl-prose { max-width: 46rem; }
.tl-prose h2 { margin-top: 2.6rem; padding-top: 2rem; border-top: 1px solid var(--line); }
.tl-prose > h2:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
.tl-explain__cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(2rem, 1rem + 4vw, 5rem); align-items: start; }
.tl-explain__cols .prose { max-width: 40rem; }
@media (max-width: 900px) { .tl-explain__cols { grid-template-columns: minmax(0, 1fr); } }
/* explanation and FAQ share a white background: a rule keeps them apart */
.tl-explain + .section--paper > .container { padding-top: clamp(2.6rem, 1.8rem + 3vw, 4.5rem); border-top: 1px solid var(--line); }

/* formulas */
.prose .formula-list { list-style: none; padding: 0; display: grid; gap: 0.5rem; }
.formula-list li { display: flex; flex-wrap: wrap; align-items: center; gap: 0.45rem; padding: 0.8rem 1rem; border-radius: var(--r-sm); background: var(--snow); border: 1px solid var(--line); color: var(--ink); font-size: 0.95rem; line-height: 1.5; }
.formula-list li::marker { content: none; }
.formula-list span { padding: 0.15rem 0.55rem; border-radius: 6px; background: #fff; border: 1px solid var(--line); }
.formula-list b { color: var(--ink); font-weight: 700; }
.emoji-guide { max-width: 46rem; }

/* ---------- more tools, the service and glossary terms ---------- */
.tool-more { padding-block: clamp(3rem, 2rem + 3vw, 5rem); }
.tool-more__grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 1.25rem; align-items: start; }
.tool-links { list-style: none; display: grid; margin-top: 0.8rem; border-top: 1px solid var(--line); }
.tool-links li { border-bottom: 1px solid var(--line); }
.tool-links a { display: grid; grid-template-columns: 2.6rem minmax(0, 1fr); gap: 0.9rem; align-items: center; padding: 0.85rem 0.5rem; color: var(--ink); text-decoration: none; transition: background 0.2s; }
.tool-links a:hover { background: var(--snow); }
.tool-links a:hover b { text-decoration: underline; text-decoration-color: var(--lamp); text-decoration-thickness: 2px; text-underline-offset: 0.2em; }
.tool-links__icon { display: grid; place-items: center; width: 2.6rem; height: 2.6rem; border-radius: 10px; background: var(--ink); color: #fff; }
.tool-links__icon svg { width: 1.2rem; height: 1.2rem; }
.tool-links b { display: block; }
.tool-links small { display: block; font-size: 0.9rem; color: var(--slate); }
.tool-more .chips { margin-top: 1rem; }
.tool-more__side { display: grid; gap: 1.25rem; align-content: start; }
.tool-more .svc-mini { padding: 1.5rem; border-radius: var(--r-xl); background: var(--night); color: #fff; }
.tool-more .svc-mini .promo-title { font-size: 1.3rem; margin: 0.6rem 0; color: #fff; }
.tool-more .svc-mini p { color: var(--mist); font-size: 0.98rem; }
.tool-more .svc-mini p a { color: #fff; font-weight: 600; text-decoration: underline; text-decoration-color: var(--lamp); text-underline-offset: 0.15em; }
.tool-more .svc-mini .btn { margin-top: 1.1rem; }
@media (max-width: 900px) { .tool-more__grid { grid-template-columns: minmax(0, 1fr); } }

@media (prefers-reduced-motion: reduce) {
	.tool-links a, .editor__btn, .seg span, .limit__bar i { transition: none; }
}

/* ---------- human touch (2026-11-20): softer headings in the explanation, figures that line up ---------- */
.tl-prose h2 { font-weight: 700; letter-spacing: -0.03em; }
.tl-prose h3 { font-weight: 600; }
.tool-more .h2, .tl-explain + .section--paper .h2 { font-weight: 500; }
.tool-more .svc-mini .promo-title { font-weight: 600; }
.formula-list, .out__rows, .calc .field__input { font-variant-numeric: tabular-nums lining-nums; }
