/* balatat.com — The Balata, explained. Loads after shared/theme.css.
   Three drawings on white cards; maroon is used for dimension lines and call-outs only. Drawings never mirror in RTL. */
:root { --c-line: #fff; }
svg { direction: ltr; }
.probe { position: absolute; pointer-events: none; }
.page-head .pills { margin-block-start: 4px; }
.head-acts { display: flex; margin-block-start: 6px; }
.to-calc .arr { width: 8px; height: 8px; margin-inline-start: 2px; border-block-start: 1.5px solid currentColor; border-inline-end: 1.5px solid currentColor; transform: rotate(45deg); transition: transform .4s var(--ease); }
[dir="rtl"] .to-calc .arr { transform: rotate(-45deg); }
.to-calc:hover .arr { transform: translateX(3px) rotate(45deg); }
[dir="rtl"] .to-calc:hover .arr { transform: translateX(-3px) rotate(-45deg); }

/* ───────── steps ───────── */
.steps { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; padding-block: 20px 0; }
.step { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; align-content: start; padding: 18px 16px 16px; overflow: hidden; }
.cap { display: grid; gap: 4px; align-content: start; min-width: 0; }
.cap .sec-head { margin-block-end: 0; }
.cap .h2 { font-weight: 400; }
.cap .muted { font-size: var(--fs-body); max-width: 34ch; text-wrap: pretty; }
.fig { width: 100%; max-width: 440px; margin-inline: auto; min-width: 0; }
.fig svg { width: 100%; height: auto; overflow: visible; }
.fig-size { max-width: 340px; margin-inline: auto; }

/* the real cut face: the pattern through the 15 mm thickness (photo untouched, only cropped) */
.cutface { margin-block-start: 18px; display: grid; gap: 8px; }
.cutface-row { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: stretch; gap: 8px; }
.cutface-dim { display: flex; align-items: center; gap: 6px; font-size: 11px; line-height: 1; white-space: nowrap; font-variant-numeric: tabular-nums; color: var(--ink); }
.cutface-dim b { font-weight: 500; }
.cutface-dim i { position: relative; align-self: stretch; width: 7px; }
.cutface-dim i::before { content: ""; position: absolute; inset-block: 0; left: 3px; width: 1px; background: var(--maroon); }
.cutface-dim i::after { content: ""; position: absolute; inset: 0; border-block: 1px solid var(--maroon); }
.cutface-band { position: relative; height: 64px; border-radius: 6px; overflow: hidden; background: var(--wash); }
.cutface-band img { position: absolute; inset: 0; width: 100%; height: 100%; max-width: none; object-fit: cover; }
.cutface figcaption { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 10px; font-size: var(--fs-s); color: var(--ink-2); }
.cutface-t bdi { color: var(--ink); }

/* ───────── drawing vocabulary (1 user unit = 1 mm) ───────── */
.ln { fill: none; stroke: var(--ink); stroke-width: .5; }
.ln.thin { stroke-width: .35; }
.ln.dash { stroke-dasharray: 2.4 1.8; stroke-width: .4; stroke-opacity: .6; }
.ln.acc, line.acc { stroke: var(--maroon); }
.ext { stroke-width: .35; }
.acc-fill, .dim-arrow { fill: var(--maroon); }
.fig text { font-family: var(--font); }
.t-m { font-size: 7px; font-weight: 400; fill: var(--ink); font-variant-numeric: tabular-nums; }
.t-big { font-size: 8.4px; font-weight: 500; }
.t-dim { font-size: 6.2px; fill: var(--ink-2); }
.t-huge { font-size: 30px; font-weight: 300; letter-spacing: -.03em; }
.t-s { font-size: 6.6px; font-weight: 400; fill: var(--ink-2); }
.t-l { font-size: 9.5px; font-weight: 400; fill: var(--ink-2); }
.t-ink { fill: var(--ink); } .t-acc { fill: var(--maroon); }
.tagc { fill: #fff; stroke: var(--maroon); stroke-width: .5; }
.tagt { fill: var(--maroon); font-weight: 500; }
.a4 rect { fill: rgba(21, 23, 28, .025); stroke: var(--ink-3); stroke-width: .4; stroke-dasharray: 3 2; }

/* reveal primitives: hidden until the step is .in, instant reset when it leaves */
.step .fade, .step .a4, .step .pop { opacity: 0; }
.step.in .fade, .step.in .a4 { opacity: 1; transition: opacity var(--t, .5s) ease var(--d, 0s); }
.step.in .pop { opacity: 1; transition: opacity .25s ease var(--d, 0s); }
.draw { stroke-dasharray: 1; stroke-dashoffset: 1; }
.step.in .draw { stroke-dashoffset: 0; transition: stroke-dashoffset var(--t, .8s) cubic-bezier(.6, 0, .2, 1) var(--d, 0s); }

/* 02 cutting */
.step.in .offcut { opacity: 0; transform: translateY(8px); transition: transform .6s cubic-bezier(.5, 0, .9, .6) .7s, opacity .4s linear .8s; }
.step.in .cutlines .first { stroke-width: .8; }
.first-label { opacity: 0; }
.step.in .first-label { animation: firstlabel 1.9s linear .15s both; }
@keyframes firstlabel { 0%, 100% { opacity: 0; } 20%, 75% { opacity: 1; } }
.step.in .rem { opacity: .13; transition: opacity .6s ease 2.3s; }
.rem-line { stroke-opacity: .35; }
.step.in .cutlines { opacity: 0; transition: opacity .4s linear 2.4s; }
.step.in .strip { transform: translateY(var(--dy)); transition: transform .85s cubic-bezier(.2, .8, .2, 1) 2.3s; }
.step.in .lift { transform: translateY(var(--ly)); transition: transform .95s cubic-bezier(.5, 0, .2, 1) 3.3s; }
.bl { fill: none; stroke: var(--c-line); stroke-width: .45; stroke-opacity: .8; opacity: 0; }
.bl-imame { fill: var(--maroon); fill-opacity: .84; stroke: #fff; }
.bl-divider { fill: var(--ink); fill-opacity: .82; stroke: #fff; }
.step.in .bl { opacity: 1; transition: opacity .5s ease 4.2s; }
.step.in .lift .strip-body { opacity: 0; transition: opacity .3s linear 4.2s; }
.piece { opacity: 0; }
.piece path { stroke: rgba(21, 23, 28, .5); stroke-width: .3; }
.step.in .piece { opacity: 1; transform: translateX(var(--px)); transition: opacity .2s linear 4.15s, transform .6s cubic-bezier(.2, .8, .2, 1) 4.3s; }
.seq text { opacity: 0; }
.step.in .seq text { opacity: 1; transition: opacity .4s ease var(--d, 3s); }
.step.in .seq .seq-a { opacity: .5; }
.seq [data-i18n] { fill: var(--ink); }

.tally { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 6px 16px; margin-block-start: 12px; padding-block-start: 12px; border-block-start: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.tally-main { display: flex; align-items: baseline; gap: 8px; }
.tally-main b { font-size: 44px; line-height: 1; font-weight: 300; letter-spacing: -.03em; }
.tally-main span { font-size: 14px; color: var(--ink-2); }
.tally-sub { display: flex; gap: 6px; padding-block-end: 2px; }
.tally-sub li { height: 26px; padding-inline: 10px; border-radius: 999px; font-size: var(--fs-xs); line-height: 26px; white-space: nowrap; color: var(--ink-2); box-shadow: inset 0 0 0 1px var(--line); }
.tally-sub b { color: var(--ink); font-weight: 500; }
/* Arabic counts read label first, then the number ("الشاهد: 3") */
html[lang="ar"] .tally-sub li { display: inline-flex; flex-direction: row-reverse; gap: 4px; }
html[lang="ar"] .tally-sub li span::after { content: ":"; }

/* 03 misbaha */
.bd { stroke: rgba(21, 23, 28, .55); stroke-width: .3; }
.cord { stroke-opacity: .5; }
.fig-m { max-width: 760px; }
.fig-m .t-huge { font-size: 34px; }
.fig-m .detail { margin-block-start: 10px; }
.fig-m .detail .bd { stroke-width: .22; }
.fig-m .lab-main { display: none; }
.terms { display: grid; margin-block-start: 10px; max-width: 380px; }
.terms li { display: grid; grid-template-columns: 22px 26px minmax(0, 1fr); align-items: center; gap: 8px; min-height: 38px; padding-block: 6px; border-block-start: 1px solid var(--line); font-size: var(--fs-body); }
.terms li:last-child { border-block-end: 1px solid var(--line); }
.terms li.terms-h { display: block; min-height: 0; padding-block: 0 6px; border: 0; font-size: var(--fs-xs); font-weight: 500; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-2); }
.terms-tam { margin-block-start: 18px; }
.tag-n { display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; box-shadow: inset 0 0 0 1px var(--maroon); color: var(--maroon); font-size: 11px; font-style: normal; font-weight: 500; font-variant-numeric: tabular-nums; }
.tag-dot { width: 5px; height: 5px; margin-inline: 7.5px; background: var(--maroon); box-shadow: none; }
.terms li > b { font-weight: 400; font-size: 17px; font-variant-numeric: tabular-nums; text-align: center; }
.term { display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 10px; }
.term b { font-weight: 500; }
.term span { color: var(--ink-2); }
.term .tr { font-size: var(--fs-s); letter-spacing: .02em; }

/* phones: the drawing comes straight after the heading, the glossary after it */
@media (max-width: 699px) {
  .step-wide .cap { display: contents; }
  .step-wide .cap > .sec-head { margin-block-end: -12px; }
  .step-wide .fig-m { order: 1; }
  .step-wide .terms { order: 2; margin-block-start: 0; }
  .step-wide .terms-tam { margin-block-start: 6px; }
}

/* ───────── notes + calculator call ───────── */
.notes { display: grid; gap: 6px; padding-block: 20px 0; }
.cta { display: grid; gap: 18px; margin-block: 28px 56px; }
.cta-t { display: grid; gap: 6px; }
.cta .row .btn { flex: 1 1 auto; }

/* ───────── tablet: caption beside the drawing ───────── */
@media (min-width: 700px) {
  .steps { gap: 16px; padding-block-start: 32px; }
  .step { padding: 28px; grid-template-columns: minmax(0, 220px) minmax(0, 1fr); column-gap: 32px; align-items: start; }
  .step-wide { grid-template-columns: minmax(0, 1fr); }
  .step-wide .cap { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: 32px; }
  .step-wide .cap > .sec-head, .step-wide .cap > .muted { grid-column: 1 / -1; }
  .step-wide .terms-tam { margin-block-start: 10px; }
  .step-wide .terms { align-content: start; }
  .cutface-band { height: 76px; }
  .fig-m .detail { max-width: 460px; margin-inline: auto; }
  .notes { padding-block-start: 28px; }
  .cta { grid-template-columns: minmax(0, 1fr) auto; align-items: center; column-gap: 32px; margin-block: 40px 88px; }
  .cta .row .btn { flex: none; }
}
/* ───────── desktop: size and cutting side by side, the misbaha across ───────── */
@media (min-width: 900px) {
  .steps { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; padding-block-start: 40px; }
  .step { grid-template-columns: minmax(0, 1fr); gap: 20px; padding: 32px; }
  .step-wide { grid-column: 1 / -1; grid-template-columns: minmax(0, 300px) minmax(0, 1fr); column-gap: 48px; align-items: center; }
  .step-wide .cap { grid-template-columns: minmax(0, 1fr); }
  .step-wide .terms-tam { margin-block-start: 18px; }
  .cap .muted { font-size: var(--fs-m); font-weight: 300; }
  .cutface-band { height: 84px; }
  .fig-size { max-width: 380px; }
  .cta { margin-block: 48px 112px; padding: 36px 40px; }
}
@media (min-width: 1180px) {
  .step-wide { grid-template-columns: minmax(0, 320px) minmax(0, 1fr); column-gap: 64px; padding: 40px; }
  .fig-m .detail { display: none; }
  .fig-m .lab-main { display: inline; }
}

/* ───────── static fallback: reduced motion, no IntersectionObserver, or ?static=1 ───────── */
html.static { scroll-behavior: auto !important; }
.static *, .static *::before, .static *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
.static .ka-js .reveal > *, .static.ka-js .reveal > * { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .step *, .step *::before, .step *::after { transition: none !important; animation: none !important; }
}
