/* Tools (lib/tools-page.js, theme/tools.js). Prefix tl-. */
.tl { padding: clamp(40px, 7vw, 96px) 0 clamp(60px, 8vw, 120px); }
.tl .label a { color: inherit; text-decoration: none; border-bottom: 1px solid var(--line); }
.tl .label a:hover { color: var(--fg); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* hero */
.tl-hero { max-width: 880px; }
.tl-hero h1 { margin: 16px 0 0; font: 400 clamp(2.8rem, 6.4vw, 5.6rem)/0.98 var(--display); letter-spacing: -0.02em; }
.tl-hero h1 em { color: var(--wheat); }
.tl-lede { margin: 24px 0 0; max-width: 58ch; font-size: clamp(1.05rem, 1.4vw, 1.2rem); line-height: 1.6; color: var(--muted); }
.tl-facts { list-style: none; margin: 34px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0; border-top: 1px solid var(--line); }
.tl-facts li { display: grid; gap: 4px; padding: 16px 32px 0 0; margin-right: 32px; border-right: 1px solid var(--line); }
.tl-facts li:last-child { border-right: 0; }
.tl-facts b { font: 400 1.5rem/1 var(--display); }
.tl-facts span { font-size: 0.86rem; color: var(--muted); }

/* layout */
.tl-grid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr); gap: clamp(32px, 5vw, 80px); align-items: start; margin-top: clamp(48px, 7vw, 96px); }
.tl-form { display: grid; gap: 0; }
.tl-step { border: 0; margin: 0; padding: 30px 0 34px; border-top: 1px solid var(--line); min-width: 0; display: grid; gap: 16px; }
.tl-step legend { float: left; width: 100%; padding: 0; display: flex; align-items: baseline; gap: 14px; }
.tl-step legend + * { clear: both; }
.tl-n { font: 500 0.72rem/1 var(--mono); letter-spacing: 0.1em; color: var(--ember); }
.tl-st { font: 400 clamp(1.6rem, 2.4vw, 2.1rem)/1.1 var(--display); }
.tl-help { margin: 0; color: var(--muted); font-size: 0.95rem; line-height: 1.55; max-width: 60ch; }

/* inputs */
.tl input, .tl select { font: inherit; color: var(--fg); }
.tl-money { display: flex; align-items: center; border: 1px solid var(--line); background: rgba(0,0,0,0.2); transition: border-color 0.2s; }
.tl-money:focus-within { border-color: var(--wheat); }
.tl-sym { padding: 0 0 0 14px; color: var(--muted); font-size: 0.95rem; }
.tl-money input { flex: 1; min-width: 0; border: 0; background: none; padding: 13px 14px 13px 6px; font-size: 1.05rem; -moz-appearance: textfield; }
.tl-money input:focus { outline: none; }
.tl input::-webkit-outer-spin-button, .tl input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.tl-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: stretch; }
.tl-big-in { display: flex; align-items: center; gap: 14px; flex: 1 1 280px; }
.tl-big-in .tl-money { flex: 1; }
.tl-big-in .tl-money input { font: 400 2rem/1 var(--display); padding: 12px 14px 10px 6px; }
.tl-big-in .tl-sym { font: 400 2rem/1 var(--display); }
.tl-small .tl-money input, .tl-small .tl-sym { font-size: 1.5rem; }
.tl-small { max-width: 360px; }
.tl-unit { color: var(--muted); font-size: 0.95rem; white-space: nowrap; }
.tl-cur select { height: 100%; min-height: 50px; border: 1px solid var(--line); background: rgba(0,0,0,0.2); padding: 0 34px 0 14px; appearance: none; -webkit-appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat; cursor: pointer; }
.tl-cur select:focus { outline: none; border-color: var(--wheat); }
.tl-cur option { background: var(--char); }

.tl-costs { display: grid; gap: 8px; }
.tl-cost { display: grid; grid-template-columns: minmax(0, 1fr) 160px 36px; gap: 8px; align-items: stretch; }
.tl-cl { border: 1px solid transparent; border-bottom-color: var(--line); background: none; padding: 12px 2px; font-size: 1rem; }
.tl-cl:hover { border-bottom-color: color-mix(in srgb, var(--fg) 30%, transparent); }
.tl-cl:focus { outline: none; border-bottom-color: var(--wheat); }
.tl-x { border: 0; background: none; color: var(--muted); font-size: 1.3rem; cursor: pointer; border-radius: 50%; }
.tl-x:hover { color: var(--fg); background: rgba(239,231,216,0.06); }
.tl-costfoot { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding-top: 6px; color: var(--muted); font-size: 0.95rem; }
.tl-costfoot b { color: var(--fg); font-weight: 500; }
.tl-add { border: 1px dashed var(--line); background: none; color: var(--fg); padding: 10px 16px; cursor: pointer; font: inherit; font-size: 0.92rem; }
.tl-add:hover { border-color: var(--wheat); color: var(--wheat); }

.tl-sliders { display: grid; gap: 26px; }
.tl-sl { display: grid; gap: 10px; }
.tl-slh { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.tl-slh b { font: 400 1.7rem/1 var(--display); color: var(--wheat); }
.tl-sl input[type=range] { width: 100%; accent-color: var(--ember); height: 24px; cursor: pointer; }
.tl-scale { display: flex; justify-content: space-between; font: 500 0.62rem/1 var(--mono); letter-spacing: 0.08em; color: var(--muted); padding: 0 4px; }
.tl-hint { font-size: 0.86rem; color: var(--muted); line-height: 1.5; }

.tl-stps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.tl-stp { display: grid; gap: 8px; padding: 14px; border: 1px solid var(--line); }
.tl-stp > span:first-child { font: 500 0.64rem/1.4 var(--mono); letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }
.tl-stpc { display: grid; grid-template-columns: 34px 1fr 34px; align-items: center; }
.tl-stpc button { height: 34px; border: 1px solid var(--line); background: none; color: var(--fg); font-size: 1.1rem; cursor: pointer; border-radius: 50%; }
.tl-stpc button:hover { border-color: var(--wheat); color: var(--wheat); }
.tl-stpc input { width: 100%; border: 0; background: none; text-align: center; font: 400 1.9rem/1 var(--display); -moz-appearance: textfield; }
.tl-stpc input:focus { outline: none; color: var(--wheat); }

/* the result */
.tl-out { position: sticky; top: calc(var(--head-h, 72px) + 24px); display: grid; gap: 14px; }
.tl-card { padding: clamp(24px, 3vw, 36px); border: 1px solid color-mix(in srgb, var(--ember) 40%, var(--line)); background: linear-gradient(180deg, color-mix(in srgb, var(--ember) 9%, transparent), transparent 60%), rgba(0,0,0,0.25); display: grid; gap: 18px; }
.tl-card .label { margin: 0; color: var(--wheat); }
.tl-rate { margin: -4px 0 0; font: 400 clamp(3.6rem, 7vw, 5.8rem)/0.9 var(--display); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.tl-rate::after { content: " a day"; font-size: 1.1rem; letter-spacing: 0; color: var(--muted); font-family: var(--body); }
.tl-sub { margin: 0; display: flex; flex-wrap: wrap; gap: 8px 22px; color: var(--muted); font-size: 0.95rem; }
.tl-sub b { color: var(--fg); font-weight: 500; }
.tl-split { display: flex; height: 10px; gap: 2px; border-radius: 5px; overflow: hidden; }
.tl-split i { flex: 1 1 0; transition: flex-grow 0.5s cubic-bezier(.2,.7,.2,1); min-width: 2px; }
.s-pay { background: var(--ember); } .s-cost { background: var(--wheat); } .s-buf { background: #a9b49a; }
.tl-legend { list-style: none; margin: -4px 0 0; padding: 0; display: grid; gap: 6px; font-size: 0.92rem; color: var(--muted); }
.tl-legend li { display: grid; grid-template-columns: 12px 1fr auto; gap: 10px; align-items: center; }
.tl-legend .d { width: 10px; height: 10px; border-radius: 3px; }
.tl-legend b { color: var(--fg); font-weight: 500; font-variant-numeric: tabular-nums; }
.tl-need { margin: 0; padding-top: 14px; border-top: 1px solid var(--line); font-size: 0.95rem; line-height: 1.55; color: var(--muted); }
.tl-need b { color: var(--fg); font-weight: 500; }
.tl-k { margin: 0 0 8px; font: 500 0.62rem/1.4 var(--mono); letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }
.tl-opts > div { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); grid-auto-flow: column; gap: 6px; }
.tl-opt { display: grid; gap: 4px; padding: 10px 12px; border: 1px solid var(--line); font-size: 0.8rem; color: var(--muted); }
.tl-opt b { font: 400 1.25rem/1 var(--display); color: var(--fg); font-variant-numeric: tabular-nums; }
.tl-opt.on { border-color: var(--wheat); background: color-mix(in srgb, var(--wheat) 8%, transparent); }
.tl-proj { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding-top: 14px; border-top: 1px solid var(--line); }
.tl-proj .tl-k { margin: 0; }
.tl-pp { margin: 0; font: 400 1.8rem/1 var(--display); font-variant-numeric: tabular-nums; }
.tl-cmp { padding: 14px 16px; border-left: 2px solid #a9b49a; background: rgba(169,180,154,0.08); font-size: 0.94rem; line-height: 1.55; }
.tl-cmp.is-low { border-left-color: var(--ember); background: color-mix(in srgb, var(--ember) 9%, transparent); }
.tl-cmp p { margin: 0; } .tl-cmp .tl-k { margin-bottom: 6px; }
.tl-cmp b { font-weight: 500; color: var(--fg); }

.tl-keep { display: grid; gap: 12px; padding: 20px clamp(20px, 3vw, 28px); border: 1px solid var(--line); }
.tl-mail { display: grid; gap: 10px; }
.tl-mail .tl-k { margin: 0; }
.tl-mrow { display: flex; flex-wrap: wrap; gap: 8px; }
.tl-mrow input { flex: 1 1 180px; min-width: 0; padding: 12px 14px; border: 1px solid var(--line); background: rgba(0,0,0,0.2); }
.tl-mrow input:focus { outline: none; border-color: var(--wheat); }
.tl-mrow .btn { white-space: nowrap; }
.tl-chk { display: flex; gap: 10px; align-items: flex-start; font-size: 0.88rem; line-height: 1.45; color: var(--muted); cursor: pointer; text-transform: none; letter-spacing: 0; }
.tl-chk input { margin-top: 3px; accent-color: var(--ember); }
.tl-fine { margin: 0; font-size: 0.82rem; color: var(--muted); }
.tl-mail.sent .tl-fine { color: var(--wheat); }
.tl-acts { display: flex; flex-wrap: wrap; gap: 6px 18px; padding-top: 12px; border-top: 1px solid var(--line); }
.tl-link { border: 0; background: none; padding: 0; color: var(--fg); font: inherit; font-size: 0.88rem; cursor: pointer; border-bottom: 1px solid var(--line); }
.tl-link:hover { border-bottom-color: var(--ember); }

/* how it works */
.tl-how { margin-top: clamp(64px, 9vw, 120px); padding-top: 34px; border-top: 1px solid var(--line); }
.tl-howgrid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(24px, 4vw, 56px); margin-top: 22px; }
.tl-howgrid b { font: 500 0.72rem/1 var(--mono); color: var(--ember); letter-spacing: 0.1em; }
.tl-howgrid h3 { margin: 12px 0 0; font-size: clamp(1.6rem, 2.2vw, 2rem); }
.tl-howgrid p { margin: 10px 0 0; color: var(--muted); line-height: 1.6; }
.tl-disc { margin-top: 30px; font-size: 0.86rem; }

/* the shared ending */
.tl-end { margin-top: clamp(64px, 9vw, 120px); display: grid; gap: clamp(48px, 6vw, 80px); }
.tl-nexts { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 12px; }
.tl-next { display: grid; gap: 10px; align-content: start; padding: clamp(24px, 3vw, 36px); border: 1px solid var(--line); color: var(--fg); text-decoration: none; transition: border-color 0.25s, background 0.25s; }
.tl-next:hover { border-color: var(--wheat); background: rgba(239,231,216,0.03); }
.tl-next .label { margin: 0; color: var(--wheat); }
.tl-next b { font: 400 clamp(1.8rem, 2.6vw, 2.4rem)/1.05 var(--display); }
.tl-next > span:not(.label) { color: var(--muted); line-height: 1.55; max-width: 52ch; }
.tl-next i { font-style: normal; margin-top: 8px; font: 500 0.68rem/1 var(--mono); letter-spacing: 0.14em; text-transform: uppercase; color: var(--fg); }
.tl-next.tl-le { background: linear-gradient(135deg, color-mix(in srgb, var(--ember) 12%, transparent), transparent 70%); border-color: color-mix(in srgb, var(--ember) 35%, var(--line)); }
.tl-morehead { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 16px; }
.tl-morehead .label { margin: 0; }
.tl-morehead span { display: flex; flex-wrap: wrap; gap: 6px 22px; justify-content: flex-end; }
.tl-morehead a { font-size: 0.9rem; color: var(--fg); text-decoration: none; border-bottom: 1px solid var(--line); }
.tl-moregrid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.tl-mini { display: grid; color: var(--fg); text-decoration: none; border: 1px solid var(--line); transition: border-color 0.25s; }
.tl-mini:hover { border-color: var(--wheat); }
.tl-miniimg { aspect-ratio: 16 / 10; overflow: hidden; }
.tl-miniimg img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.8s cubic-bezier(.2,.7,.2,1); }
.tl-mini:hover img { transform: scale(1.05); }
.tl-mini.is-soon img { filter: grayscale(0.6) brightness(0.75); }
.tl-minit { display: grid; gap: 6px; padding: 14px 16px 16px; }
.tl-minit .label { margin: 0; }
.tl-minit b { font: 400 1.35rem/1.1 var(--display); }

@media (max-width: 960px) {
  .tl-grid { grid-template-columns: 1fr; }
  .tl-out { position: static; }
  .tl-howgrid, .tl-moregrid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 600px) {
  .tl-facts li { padding-right: 18px; margin-right: 18px; }
  .tl-cost { grid-template-columns: minmax(0, 1fr) 104px 28px; gap: 6px; }
  .tl-stps { grid-template-columns: 1fr 1fr 1fr; gap: 6px; }
  .tl-stp { padding: 10px 8px; }
  .tl-stpc { grid-template-columns: 28px 1fr 28px; }
  .tl-stpc button { height: 28px; }
  .tl-howgrid, .tl-moregrid { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) { .tl-split i, .tl-miniimg img { transition: none; } }
@media print {
  .tl-form .tl-x, .tl-add, .tl-keep, .tl-end, .tl-how, header.site, footer, .yn { display: none !important; }
  .tl-grid { grid-template-columns: 1fr 1fr; }
  .tl-out { position: static; }
}
.tl-step legend, .tl-step > * { max-width: 100%; }
.tl-big-in, .tl-big-in .tl-money { min-width: 0; }
@media (max-width: 600px) { .tl-row { display: grid; grid-template-columns: 1fr; } .tl-big-in { flex: none; } .tl-cur select { width: 100%; } }
.tl-money input { width: 100%; }
.tl-out { scroll-margin-top: calc(var(--head-h, 72px) + 12px); }
.tl-peek { display: none; }
@media (max-width: 960px) {
  .tl-peek { display: flex; position: fixed; left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom)); z-index: 65; align-items: center; gap: 12px; padding: 12px 18px; background: #1d1a16; border: 1px solid color-mix(in srgb, var(--ember) 45%, var(--line)); box-shadow: 0 18px 40px -12px rgba(0,0,0,0.8); color: var(--fg); text-decoration: none; transform: translateY(140%); transition: transform 0.4s cubic-bezier(.2,.7,.2,1); }
  .tl-peek.on { transform: none; }
  .tl-peek span { font: 500 0.6rem/1.3 var(--mono); letter-spacing: 0.14em; text-transform: uppercase; color: var(--wheat); }
  .tl-peek b { font: 400 1.7rem/1 var(--display); font-weight: 400; }
  .tl-peek i { margin-left: auto; font-style: normal; font-size: 0.82rem; color: var(--muted); }
}
@media print { .tl-peek { display: none !important; } }
@media (prefers-reduced-motion: reduce) { .tl-peek { transition: none; } }

/* The method behind each tool (lib/methods.js): published in full on the tool's page (#method) and at /tools/methods. */
.mt { display: grid; grid-template-columns: minmax(0, 0.75fr) minmax(0, 1.25fr); gap: clamp(24px, 5vw, 72px); margin-top: clamp(64px, 9vw, 120px); padding-top: clamp(28px, 4vw, 44px); border-top: 1px solid var(--line); scroll-margin-top: calc(var(--head-h, 64px) + 20px); }
.mt-head { position: sticky; top: calc(var(--head-h, 64px) + 24px); align-self: start; display: grid; gap: 12px; }
.mt-head .label { margin: 0; color: var(--ember); }
.mt-head h2 { margin: 0; font-size: clamp(2rem, 3.4vw, 3rem); line-height: 1.05; }
.mt-by { margin: 0; color: var(--muted); font-size: 0.9rem; } .mt-by a { color: var(--fg); }
.mt-body { min-width: 0; display: grid; gap: 26px; }
.mt-answer { margin: 0; font: 400 clamp(1.25rem, 1.8vw, 1.5rem)/1.5 var(--serif, var(--display)); color: var(--fg); }
.mt-steps { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); counter-reset: none; }
.mt-steps li { display: grid; grid-template-columns: 44px 1fr; gap: 14px; padding: 16px 0; border-bottom: 1px solid var(--line); }
.mt-steps b { font: 500 0.7rem/1.9 var(--mono); color: var(--ember); }
.mt-steps h3 { margin: 0 0 4px; font-size: 1.25rem; }
.mt-steps p { margin: 0; color: var(--muted); line-height: 1.6; }
.mt-ex { margin: 0; padding: clamp(18px, 3vw, 28px); border: 1px solid color-mix(in srgb, var(--ember) 40%, var(--line)); background: linear-gradient(180deg, color-mix(in srgb, var(--ember) 8%, transparent), transparent 70%); }
.mt-ex figcaption { display: grid; gap: 6px; margin-bottom: 14px; font: 400 1.35rem/1.2 var(--display); } .mt-ex figcaption .label { margin: 0; color: var(--wheat); }
.mt-ex table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
.mt-ex th, .mt-ex td { padding: 9px 0; border-top: 1px solid var(--line); text-align: left; vertical-align: top; line-height: 1.45; }
.mt-ex th { width: 42%; padding-right: 16px; font-weight: 400; color: var(--muted); }
.mt-ex td { font-variant-numeric: tabular-nums; }
.mt-ex tr:last-child td { color: var(--fg); font-weight: 500; }
.mt-ex > p { margin: 14px 0 0; color: var(--muted); font-size: 0.92rem; line-height: 1.55; }
.mt-two { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.mt-two h3 { margin: 0 0 10px; font-size: 1.2rem; }
.mt-two ul { margin: 0; padding: 0 0 0 18px; display: grid; gap: 8px; color: var(--muted); line-height: 1.55; font-size: 0.95rem; }
.mt-two b { color: var(--fg); font-weight: 500; }
.mt-index { list-style: none; margin: clamp(36px, 5vw, 56px) 0 0; padding: 0; border-top: 1px solid var(--line); display: grid; grid-template-columns: 1fr 1fr; column-gap: 28px; }
.mt-index a { display: grid; grid-template-columns: 40px 1fr auto; gap: 10px; align-items: baseline; padding: 14px 0; border-bottom: 1px solid var(--line); color: var(--fg); text-decoration: none; }
.mt-index a:hover span { color: var(--wheat); }
.mt-index b { font: 500 0.66rem/1 var(--mono); color: var(--ember); } .mt-index span { font: 400 1.2rem/1.25 var(--display); } .mt-index em { font: 500 0.58rem/1.4 var(--mono); font-style: normal; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
@media (max-width: 900px) { .mt { grid-template-columns: 1fr; } .mt-head { position: static; } .mt-two, .mt-index { grid-template-columns: 1fr; } .mt-index a { grid-template-columns: 34px 1fr; } .mt-index em { grid-column: 2; } }
/* the quotable line on each method */
.mt-quote { margin: 0 0 26px; padding: 0 0 22px; border-bottom: 1px solid var(--line); }
.mt-quote p { margin: 0; font: 400 clamp(2rem, 4.2vw, 3.3rem)/1.06 var(--serif, var(--display)); color: var(--fg); letter-spacing: -0.01em; }
.mt-quote p::before { content: "“"; color: var(--ember); } .mt-quote p::after { content: "”"; color: var(--ember); }
.mt-quote footer { display: flex; flex-wrap: wrap; gap: 6px 18px; align-items: center; margin-top: 14px; font: 500 0.68rem/1.4 var(--mono, monospace); letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.mt-quote .tl-link { font: inherit; letter-spacing: inherit; text-transform: inherit; color: var(--ember); }
