/* Tools' home page. The shared home.css gives the nav, hero type, section heads, studio cards
   and footer; this adds the readouts in the hero, the four cards, and the calculators. */

.logo .sq { transform-origin: 16px 16px; transition: transform .5s cubic-bezier(.65, 0, .25, 1); }
.logo:hover .sq { transform: rotate(-90deg); }

/* Hero: three live answers, one from each kind of calculator */
.tl-readouts { display: grid; grid-template-columns: 1.25fr 1fr 1fr; gap: 14px; margin: 72px 0 0; }
.tl-ro { display: grid; align-content: start; gap: 10px; padding: 22px; border-radius: var(--r-lg); border: 1px solid var(--line); background: var(--panel); }
.js .tl-ro[data-rise]:nth-child(2) { transition-delay: .12s; }
.js .tl-ro[data-rise]:nth-child(3) { transition-delay: .24s; }
.tl-ro-label { color: var(--text-2); font-size: 12px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; }
.tl-sum { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; color: var(--text-2); font: 15px var(--mono); }
.tl-op { color: var(--text); font-weight: 700; }
.tl-ro-main { font: 700 clamp(32px, 4vw, 52px)/1 var(--mono); font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.tl-ro-tc .tl-ro-main { font-size: clamp(36px, 4.6vw, 60px); }
.tl-ro-sub { color: var(--text-2); font-size: 14px; line-height: 1.5; }
.tl-crop { position: relative; display: grid; place-items: center; aspect-ratio: 16 / 9; border-radius: 4px; background: repeating-linear-gradient(135deg, var(--raised) 0 8px, var(--panel) 8px 16px); box-shadow: inset 0 0 0 1px var(--line-strong); }
.tl-crop span { width: 100%; height: 74.4%; background: var(--text); transition: height 1s cubic-bezier(.65, 0, .25, 1) .4s; }
.js .tl-ro:not(.is-in) .tl-crop span { height: 100%; }

/* What's inside */
.tl-inside { padding: 140px 0 40px; border-top: 1px solid var(--line); margin-top: 40px; }
.tl-cards { list-style: none; width: min(1240px, calc(100% - 48px)); margin: 0 auto; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.tl-cards a { display: grid; align-content: start; gap: 10px; height: 100%; padding: 22px; border-radius: var(--r-lg); border: 1px solid var(--line); background: var(--panel); color: var(--text); text-decoration: none; transition: border-color .2s ease; }
.tl-cards a:hover { border-color: var(--line-strong); }
.js .tl-cards li[data-rise]:nth-child(2) { transition-delay: .08s; }
.js .tl-cards li[data-rise]:nth-child(3) { transition-delay: .16s; }
.js .tl-cards li[data-rise]:nth-child(4) { transition-delay: .24s; }
.tl-n { color: var(--text-2); font: 13px var(--mono); }
.tl-name { font: 700 26px/1.05 var(--display); font-stretch: 82%; }
.tl-copy { color: var(--text-2); line-height: 1.55; }

/* Why trust the numbers */
.tl-why { padding: 140px 0 40px; border-top: 1px solid var(--line); margin-top: 80px; }
.tl-why-list { list-style: none; width: min(1240px, calc(100% - 48px)); margin: 0 auto; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 32px; }
.tl-why-list li { color: var(--text-2); font-size: 17px; line-height: 1.6; padding-top: 18px; border-top: 2px solid var(--text); }
.tl-why-list b { display: block; margin-bottom: 8px; color: var(--text); font: 700 22px/1.15 var(--display); font-stretch: 85%; }

/* The calculators */
.tools { width: min(1240px, calc(100% - 48px)); margin: 0 auto; }
.tool { display: grid; grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr); gap: 32px; margin-top: 56px; padding-top: 32px; border-top: 1px solid var(--line); scroll-margin-top: 88px; }
.tool-head h2 { margin: 0; font: 700 28px/1.1 var(--display); font-stretch: 85%; }
.tool-head p { margin: 10px 0 0; color: var(--text-2); line-height: 1.6; }
.tool-head code { padding: 1px 5px; border-radius: 4px; background: var(--raised); font: 13px var(--mono); color: var(--text); }
.tool-body { display: grid; gap: 14px; align-content: start; }

.f { display: grid; gap: 6px; min-width: 0; font-size: 14px; font-weight: 560; }
.f input, .f select { width: 100%; min-height: 44px; font-size: 16px; }
.f input[inputmode="numeric"]:not([type]) { font-family: var(--mono); letter-spacing: .02em; }
.f input[aria-invalid="true"] { border-color: var(--text); box-shadow: inset 0 0 0 1px var(--text); }
.f-inline { grid-template-columns: auto minmax(0, 220px); align-items: center; gap: 12px; }
.row-tc { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 12px; }
.row-tc > :last-child { grid-column: 1 / -1; }
.row-2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
.row-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.row-3:has(> [hidden]) { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.seg { display: inline-flex; padding: 2px; gap: 2px; border-radius: var(--r-md); border: 1px solid var(--line); background: var(--panel); }
.seg button { width: 44px; min-height: 38px; border: 0; border-radius: 6px; background: none; color: var(--text-2); font: 700 20px var(--font); cursor: pointer; }
.seg button[aria-checked="true"] { background: var(--invert); color: var(--on-invert); }

.answer { display: grid; gap: 4px; padding: 18px 20px; border-radius: var(--r-lg); background: var(--panel); border: 1px solid var(--line); }
.answer-main { font: 700 clamp(30px, 5vw, 44px)/1.05 var(--mono); font-variant-numeric: tabular-nums; letter-spacing: -0.01em; overflow-wrap: anywhere; }
.answer-sub { color: var(--text-2); font-size: 14px; }
.answer-sm .answer-main { font-size: 26px; }
.answer.is-error .answer-main { font: 600 16px/1.4 var(--font); }
.tool-note { margin: 0; color: var(--text-2); font-size: 14px; }

.crop-view { display: grid; place-items: center; padding: 16px; border-radius: var(--r-lg); background: var(--panel); border: 1px solid var(--line); }
.crop-src { position: relative; display: grid; place-items: center; width: min(100%, 420px); max-height: 260px; background: repeating-linear-gradient(135deg, var(--raised) 0 8px, var(--panel) 8px 16px); box-shadow: inset 0 0 0 1px var(--line-strong); }
.crop-box { background: var(--text); opacity: .9; transition: width .2s ease, height .2s ease; }


@media (max-width: 960px) {
  .tl-readouts { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .tl-ro-tc { grid-column: 1 / -1; }
  .tl-cards { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .tl-why-list { grid-template-columns: minmax(0, 1fr); gap: 24px; }
}
@media (max-width: 760px) {
  .tools, .tl-cards, .tl-why-list { width: calc(100% - 32px); }
  .tl-readouts { grid-template-columns: minmax(0, 1fr); margin-top: 44px; }
  .tl-inside, .tl-why { padding-top: 96px; }
  .tl-cards { grid-template-columns: minmax(0, 1fr); }
  .tool { grid-template-columns: 1fr; gap: 16px; margin-top: 40px; padding-top: 24px; }
  .row-3, .row-3:has(> [hidden]) { grid-template-columns: 1fr 1fr; }
  .row-tc { grid-template-columns: minmax(0, 1fr); }
  .row-tc .op > span { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .crop-box, .tl-crop span, .logo .sq { transition: none; }
  .js .tl-ro:not(.is-in) .tl-crop span { height: 74.4%; }
}
