/* Extra styles for the sub-calculator pages (loaded after styles.css) */

:root {
  --c1: var(--accent);
  --c2: var(--height);
  --c3: var(--angle);
  --c4: var(--rect);
  --c5: #d6336c;
  --c6: #f59f00;
}
:root[data-theme="dark"] { --c5: #ff6b9a; --c6: #ffc23d; }

/* mode tabs: text only */
.mode-tabs .tab { padding: 9px 6px; }
.mode-tabs .tab span { font-size: 12.5px; }

/* second headline result (e.g. perimeter) */
.main2 { display: flex; align-items: baseline; gap: 8px; margin-top: 6px; }
.main2 .m2-label { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.main2 .m2-val { font-family: var(--math); font-size: 22px; font-weight: 600; color: var(--c2); font-variant-numeric: tabular-nums; }
.main2 .m2-unit { font-size: 14px; font-weight: 700; color: var(--muted); }

/* ---------- SVG pieces ---------- */
.pc1 { fill: color-mix(in srgb, var(--c1) 26%, transparent); }
.pc1o { fill: color-mix(in srgb, var(--c1) 10%, transparent); stroke: var(--c1); stroke-width: 1.2; stroke-dasharray: 4 4; }
.pc2 { fill: color-mix(in srgb, var(--c2) 26%, transparent); }
.pc2o { fill: color-mix(in srgb, var(--c2) 10%, transparent); stroke: var(--c2); stroke-width: 1.2; stroke-dasharray: 4 4; }
.pc3 { fill: color-mix(in srgb, var(--c3) 24%, transparent); }
.pc3o { fill: color-mix(in srgb, var(--c3) 10%, transparent); stroke: var(--c3); stroke-width: 1.2; stroke-dasharray: 4 4; }
.pc4 { fill: color-mix(in srgb, var(--c4) 22%, transparent); }
.pc4o { fill: color-mix(in srgb, var(--c4) 9%, transparent); stroke: var(--c4); stroke-width: 1.4; stroke-dasharray: 5 4; }
.pc5 { fill: color-mix(in srgb, var(--c5) 20%, transparent); }
.pc5o { fill: color-mix(in srgb, var(--c5) 8%, transparent); stroke: var(--c5); stroke-width: 1.3; stroke-dasharray: 5 4; }
.pc6 { fill: color-mix(in srgb, var(--c6) 24%, transparent); }

.ghost { fill: color-mix(in srgb, var(--muted) 7%, transparent); stroke: var(--muted); stroke-width: 1.5; stroke-dasharray: 5 4; }
.ghost-line { stroke: var(--muted); stroke-width: 1.3; stroke-dasharray: 5 4; fill: none; }
.faint-line { stroke: color-mix(in srgb, var(--c1) 40%, transparent); stroke-width: 1; fill: none; }
.lattice { stroke: color-mix(in srgb, var(--c1) 45%, transparent); stroke-width: 1; }
.axis-sym { stroke: var(--c5); stroke-width: 1.5; stroke-dasharray: 10 4 2 4; }
.eq-tick { stroke: var(--ink-2); stroke-width: 2; stroke-linecap: round; }

.seg1, .seg2, .seg3 { stroke-width: 6; stroke-linecap: round; fill: none; }
.seg1 { stroke: var(--c1); }
.seg2 { stroke: var(--c2); }
.seg3 { stroke: var(--c3); }
.edge1, .edge2, .edge3 { stroke-width: 4; stroke-linecap: round; fill: none; }
.edge1 { stroke: var(--c1); }
.edge2 { stroke: var(--c2); }
.edge3 { stroke: var(--c3); }

.incircle { fill: color-mix(in srgb, var(--c4) 8%, transparent); stroke: var(--c4); stroke-width: 1.5; stroke-dasharray: 5 4; }
.circum { fill: none; stroke: var(--c4); stroke-width: 1.6; stroke-dasharray: 6 5; }
.cdot { fill: var(--c4); }
.rline { stroke: var(--c4); stroke-width: 1.6; }
.tdot { fill: var(--panel); stroke: var(--ink-2); stroke-width: 1.5; }

.ang-arc.given { fill: color-mix(in srgb, var(--c3) 20%, transparent); stroke: var(--c3); }
.ang-arc.calc { fill: color-mix(in srgb, var(--c6) 20%, transparent); stroke: var(--c6); }
.ang-label.calc { fill: var(--c6); }
.ang-arc.big { fill: color-mix(in srgb, var(--c3) 16%, transparent); stroke: var(--c3); stroke-width: 2; }

.lbl { font: 600 12.5px var(--math); paint-order: stroke; stroke: var(--panel); stroke-width: 4px; stroke-linejoin: round; }
.lbl.sm { font-size: 11px; }
.lbl.l1 { fill: var(--c1); } .lbl.l2 { fill: var(--c2); } .lbl.l3 { fill: var(--c3); }
.lbl.l4 { fill: var(--c4); } .lbl.l5 { fill: var(--c5); } .lbl.l6 { fill: var(--c6); }
.lbl.mu { fill: var(--muted); } .lbl.ink { fill: var(--ink); }

.arr1 line, .arr2 line, .arr3 line, .arr5 line, .arrm line { stroke-width: 2.5; stroke-linecap: round; }
.arr1 line { stroke: var(--c1); } .arr1 path { fill: var(--c1); }
.arr2 line { stroke: var(--c2); } .arr2 path { fill: var(--c2); }
.arr3 line { stroke: var(--c3); } .arr3 path { fill: var(--c3); }
.arr5 line { stroke: var(--c5); } .arr5 path { fill: var(--c5); }
.arrm line { stroke: var(--muted); stroke-width: 1.5; } .arrm path { fill: var(--muted); }

.floor-minor { stroke: var(--grid-minor); stroke-width: 1; }
.floor-major { stroke: var(--grid-major); stroke-width: 1; }
.shadow { fill: color-mix(in srgb, var(--ink) 7%, transparent); stroke: color-mix(in srgb, var(--ink) 20%, transparent); stroke-width: 1; stroke-dasharray: 3 3; }
.drop { stroke: color-mix(in srgb, var(--ink) 22%, transparent); stroke-width: 1; stroke-dasharray: 2 3; }

.tile { fill: var(--c4); }
.tile-edge { fill: none; stroke: color-mix(in srgb, var(--c4) 45%, transparent); stroke-width: 1; }

/* overlays (screen space) */
.ov-panel { fill: color-mix(in srgb, var(--panel) 92%, transparent); stroke: var(--line); }
.ov-title { fill: var(--muted); font: 700 10.5px var(--sans); letter-spacing: .06em; text-transform: uppercase; }
.ov-text { fill: var(--ink-2); font: 600 11.5px var(--math); }
.ov-bar1 { fill: var(--c1); } .ov-bar2 { fill: var(--c2); } .ov-bar3 { fill: var(--c3); }
.ov-curve { fill: color-mix(in srgb, var(--c1) 12%, transparent); stroke: var(--c1); stroke-width: 2; }
.ov-axis { stroke: var(--line); stroke-width: 1; }
.ov-guide { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 3; }
.ov-dot { fill: var(--c1); stroke: var(--panel); stroke-width: 2; }

/* ---------- related calculators ---------- */
.related { margin-top: 56px; }
.related-title { margin: 0 0 14px; font-size: 22px; font-weight: 800; letter-spacing: -0.02em; }
.related-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.rel-card {
  display: block; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel);
  text-decoration: none; font-weight: 700; font-size: 14px; color: var(--ink-2); transition: border-color .15s, color .15s, transform .15s;
}
.rel-card:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-1px); }
.rel-card.home { background: var(--accent-soft); color: var(--accent); border-color: color-mix(in srgb, var(--accent) 35%, var(--line)); }

/* long formulas wrap under the method name instead of overflowing */
.formula-banner { flex-wrap: wrap; row-gap: 6px; }
.formula-banner .fexpr { white-space: normal; max-width: 100%; }

/* keep cards inside narrow screens */
.presets, .preset-list, .formula-banner, .fields { min-width: 0; }
.formula-banner .fexpr { overflow-wrap: anywhere; }
@media (max-width: 920px) {
  .tool { grid-template-columns: minmax(0, 1fr); }
}

/* =========================================================
   Sub-calculator guide content
   ========================================================= */
.crumbs { font-size: 13.5px; color: var(--muted); margin-bottom: 8px; display: flex; gap: 8px; flex-wrap: wrap; }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--accent); text-decoration: underline; }
.crumbs span[aria-current] { color: var(--ink-2); font-weight: 600; }

/* input → formula → output pipeline */
.pipe { display: grid; grid-template-columns: 1fr 34px 1.1fr 34px 1fr; align-items: stretch; margin: 22px 0; }
.pipe-box { padding: 16px 18px; }
.pipe-box.accent { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 35%, var(--line)); }
.pipe-k { font-size: 12px !important; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--muted) !important; margin: 0 0 8px !important; }
.pipe-box ul { margin: 0; padding-left: 18px; }
.pipe-box li { font-size: 15px !important; line-height: 1.55 !important; }
.pipe-box .mono { color: var(--accent); font-weight: 700; font-size: 15px; display: block; margin-bottom: 6px; }
.pipe-box p { font-size: 14.5px !important; margin: 0 !important; }
.pipe-arrow { display: grid; place-items: center; color: var(--muted); font-size: 22px; font-weight: 700; }

/* code formulas */
.code-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 16px 0; }
.code-card { padding: 14px 16px; }
.code-card .k { font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 0 0 6px !important; }
.code-card code { display: block; white-space: pre-wrap; word-break: break-word; background: transparent !important; padding: 0 !important; color: var(--accent) !important; font-size: 13.5px; }

/* heat-map chart cells */
.heat td { text-align: center !important; font-family: var(--math); font-size: 14px; }
.heat thead th { text-align: center !important; }
.heat td.hc { color: var(--ink); }

/* bar chart */
.bars-fig svg { width: 100%; height: auto; }
.bc-bg { fill: var(--panel-2); }
.bc-bar { fill: var(--accent); }
.bc-bar.alt { fill: var(--height); }
.bc-l { fill: var(--ink-2); font: 600 12.5px var(--sans); }
.bc-v { fill: var(--ink); font: 600 12px var(--math); }

/* extra diagram strokes */
.d-s1 { stroke: var(--c1); stroke-width: 5; stroke-linecap: round; fill: none; }
.d-s2 { stroke: var(--c2); stroke-width: 5; stroke-linecap: round; fill: none; }
.d-s3 { stroke: var(--c3); stroke-width: 5; stroke-linecap: round; fill: none; }
.d-f1 { fill: color-mix(in srgb, var(--c1) 22%, transparent); }
.d-f2 { fill: color-mix(in srgb, var(--c2) 22%, transparent); }
.d-f3 { fill: color-mix(in srgb, var(--c3) 22%, transparent); }
.d-f4 { fill: color-mix(in srgb, var(--c4) 18%, transparent); }
.d-ghost { fill: color-mix(in srgb, var(--muted) 8%, transparent); stroke: var(--muted); stroke-width: 1.6; stroke-dasharray: 6 5; }
.d-lat { stroke: color-mix(in srgb, var(--c1) 50%, transparent); stroke-width: 1.2; fill: none; }
.d-ax { stroke: var(--muted); stroke-width: 1.4; fill: none; }
.d-sym { stroke: var(--c5); stroke-width: 1.8; stroke-dasharray: 10 4 2 4; }
.d-tick { stroke: var(--ink-2); stroke-width: 2; }
.d-a1 { stroke: var(--c1); stroke-width: 3; fill: none; } .d-ah1 { fill: var(--c1); }
.d-a3 { stroke: var(--c3); stroke-width: 3; fill: none; } .d-ah3 { fill: var(--c3); }
.d-a5 { stroke: var(--c5); stroke-width: 3; fill: none; } .d-ah5 { fill: var(--c5); }
.d-am { stroke: var(--muted); stroke-width: 1.5; fill: none; } .d-ahm { fill: var(--muted); }
.d-t.c1 { fill: var(--c1); } .d-t.c2 { fill: var(--c2); } .d-t.c3 { fill: var(--c3); } .d-t.c4 { fill: var(--c4); } .d-t.c5 { fill: var(--c5); }
.d-t.mono { font-family: var(--math); font-size: 14px; }
.d-tile { fill: color-mix(in srgb, var(--c4) 30%, transparent); stroke: color-mix(in srgb, var(--c4) 50%, transparent); stroke-width: 1; }

@media (max-width: 820px) {
  .pipe { grid-template-columns: 1fr; }
  .pipe-arrow { transform: rotate(90deg); height: 30px; }
  .code-grid { grid-template-columns: 1fr; }
}

/* =========================================================
   About / legal pages
   ========================================================= */
.legal { margin-top: 8px; }
.updated { font-size: 14px !important; color: var(--muted) !important; }
.usegrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 18px 0; }
.usecard { padding: 16px 18px; text-decoration: none; display: flex; flex-direction: column; gap: 6px; transition: border-color .2s, transform .2s; }
.usecard:hover { border-color: var(--accent); transform: translateY(-2px); }
.usecard .who { font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.usecard .tool { font-weight: 800; color: var(--ink); font-size: 15.5px; }
.usecard .task { font-size: 14.5px; color: var(--ink-2); line-height: 1.55; }
.rules { list-style: none; padding: 0; margin: 18px 0; display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.rules li { padding: 16px 18px 16px 58px; position: relative; }
.rules li .n { position: absolute; left: 16px; top: 15px; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: #fff; font-weight: 800; font-size: 14px; }
@media (max-width: 820px) {
  .usegrid, .rules { grid-template-columns: 1fr; }
}
/* contact form */
.contact-form { padding: 20px 22px; display: grid; gap: 14px; margin: 20px 0; max-width: 640px; }
.cf-row { display: grid; gap: 6px; }
.cf-row label { font-weight: 700; font-size: 14px; color: var(--ink); }
.cf-row input, .cf-row textarea { width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel-2); font-size: 15px; }
.cf-row input:focus, .cf-row textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.cf-send { justify-self: start; border: 0; border-radius: 999px; padding: 10px 22px; background: var(--accent); color: #fff; font-weight: 800; cursor: pointer; }
.cf-send:disabled { opacity: .6; cursor: wait; }
.cf-status { margin: 0 !important; font-size: 14.5px !important; min-height: 1.4em; }
.cf-status[data-state="success"] { color: var(--angle) !important; }
.cf-status[data-state="error"] { color: var(--danger) !important; }
.cf-status[data-state="sending"] { color: var(--muted) !important; }
.legal h3 { margin-top: 22px; }
.sitemap-list { columns: 2; column-gap: 32px; }
.sitemap-list li { break-inside: avoid; }
@media (max-width: 820px) { .sitemap-list { columns: 1; } }
[dir="rtl"] .stepper li { padding: 14px 62px 14px 18px; }
[dir="rtl"] .stepper li::before { left: auto; right: 16px; }
[dir="rtl"] .faq summary { padding: 16px 20px 16px 52px; }
[dir="rtl"] .faq summary::after { right: auto; left: 20px; }
[dir="rtl"] .ticks li { padding-left: 0; padding-right: 30px; }
[dir="rtl"] .ticks.bad li::before { left: auto; right: 0; }
[dir="rtl"] .example, [dir="rtl"] .derive { border-left: 1px solid var(--line); border-right: 4px solid var(--accent); }
[dir="rtl"] .guide th, [dir="rtl"] .guide td, [dir="rtl"] .guide caption { text-align: right; }
[dir="rtl"] .tool, [dir="rtl"] #canvas, [dir="rtl"] .stage, [dir="rtl"] .num-wrap input, [dir="rtl"] .mono, [dir="rtl"] .step-math, [dir="rtl"] .fexpr { direction: ltr; }
[dir="rtl"] .tool { text-align: right; }
/* 3 × 3 matrix display */
.matrix-fig { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 22px; margin: 18px 0; font-family: var(--math); font-size: 20px; color: var(--ink); direction: ltr; }
.matrix-fig .mx-l { font-weight: 600; }
.matrix-fig .mx-bar { width: 2px; align-self: stretch; background: var(--ink); border-radius: 2px; }
.matrix-fig .mx-grid { display: grid; grid-template-columns: repeat(3, 44px); gap: 8px 6px; text-align: center; color: var(--accent); font-weight: 600; }

/* scalene: 3 colour-coded heights */
.sc-h { stroke-width: 2.2; stroke-dasharray: 6 4; fill: none; }
.sc-h1, .sc-m1 { stroke: var(--c1); } .sc-h2, .sc-m2 { stroke: var(--c2); } .sc-h3, .sc-m3 { stroke: var(--c3); }
.sc-m { fill: none; stroke-width: 1.6; }
.sc-d { stroke: var(--panel); stroke-width: 1.5; }
.sc-d1 { fill: var(--c1); } .sc-d2 { fill: var(--c2); } .sc-d3 { fill: var(--c3); }
.badge.warn { color: var(--danger); border-color: var(--danger); }
.seg1.thin, .seg2.thin, .seg3.thin { stroke-width: 2.6; }
.circum.alt { stroke: var(--c5); }
.rline.alt { stroke: var(--c5); }
/* prism sketch */
.pr-face { fill: color-mix(in srgb, var(--c1) 10%, transparent); stroke: var(--c1); stroke-width: 1.6; stroke-linejoin: round; }
.pr-face.side { fill: color-mix(in srgb, var(--c4) 10%, transparent); stroke: var(--c4); }
.pr-hidden { fill: none; stroke: var(--muted); stroke-width: 1.4; stroke-dasharray: 5 4; }
.pr-len { stroke: var(--c2); stroke-width: 2.2; }
