/* MecanUSA - AR film reflection comparisons: the two animated figures of
   Anti-Reflective-Glare-AR-AGAR-Film/Anti-Reflective-Mechanism.htm (.arr, single sheet and double-pane unit);
   no other page links this file. Every rule starts at .arr, so nothing here reaches the rest of the page. The controls
   and the numbers follow the site's design tokens (--mu-*); the stage keeps the drawing's own dark ground and colors,
   so that the beam reads as light. */

.arr {
  /* the drawing */
  --arr-stage: #0e1d29; --arr-stage-ink: #e7eef3; --arr-stage-muted: #93a7b5;
  --arr-beam: #ffc533; --arr-beam-hi: #fff5d1; --arr-glass: #86e0d0; --arr-film: #a993ff;
  /* the numbers beside it */
  --arr-amber: #a86a00; --arr-track: #e3e9ee;
  --arr-ink: var(--mu-ink, #1b2028); --arr-ink-2: var(--mu-ink-2, #3f4651); --arr-muted: var(--mu-ink-3, #5a6270);
  --arr-line: var(--mu-line, #dcdcd7); --arr-blue: var(--mu-brand-600, #2347c2); --arr-blue-dark: var(--mu-brand-700, #1b3a9a);
  --arr-soft: var(--mu-brand-50, #f6f6f3);
  container-type: inline-size;
  margin: 24px 0;
}
.arr p, .arr figure { margin: 0; }
.arr button { font: inherit; cursor: pointer; }
.arr button:focus-visible { outline: 2px solid var(--arr-blue-dark); outline-offset: 2px; }

/* stage and controls on the left, the arithmetic on the right; one column where the figure is narrow */
.arr-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 22px; align-items: start; }
.arr-left, .arr-right { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.arr-right { gap: 20px; }
@container (min-width: 760px) {
  .arr-grid { grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 28px; }
  .arr-right { padding-top: 4px; }
}

.arr-controls { display: flex; flex-wrap: wrap; gap: 10px; align-items: stretch; }
.arr-seg { display: flex; flex: 1 1 300px; gap: 3px; padding: 3px; border: 1px solid var(--arr-line); border-radius: 4px; background: #fff; }
.arr-seg button { flex: 1 1 0; min-width: 0; min-height: 44px; padding: 6px 8px; border: 0; border-radius: 3px; background: transparent;
  font-size: .9375rem; font-weight: 600; line-height: 1.25; color: var(--arr-ink-2); }
.arr-seg button:hover { background: var(--arr-soft); }
.arr-seg button[aria-pressed="true"] { background: var(--arr-blue); color: #fff; }
.arr-play { min-width: 80px; min-height: 44px; padding: 0 16px; border: 1px solid #9aa6c9; border-radius: 3px; background: #fff;
  font-size: .9375rem; font-weight: 600; color: var(--arr-blue-dark); }
.arr-play:hover { background: var(--arr-soft); }

.arr-stage { overflow: hidden; border: 1px solid var(--arr-stage); border-radius: 4px; background: var(--arr-stage); }
.arr-stage svg { display: block; width: 100%; height: auto; }
.arr-figure figcaption { margin-top: 8px; font-size: .8125rem; line-height: 1.5; color: var(--arr-muted); }

/* the arithmetic */
.arr-h { margin-bottom: 10px; font-size: .75rem; font-weight: 700; letter-spacing: .08em; line-height: 1.4; text-transform: uppercase; color: var(--arr-muted); }
.arr .arr-h { margin: 0 0 10px; }
.arr-sum { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 6px 14px; }
.arr-term { display: flex; flex-direction: column; gap: 2px; }
.arr-term__k { font-size: .8125rem; line-height: 1.4; color: var(--arr-muted); }
.arr-term__v { font-size: 1.625rem; font-weight: 600; line-height: 1; font-variant-numeric: tabular-nums; color: var(--arr-ink); }
.arr-term--total .arr-term__v { font-size: 2.375rem; font-weight: 700; letter-spacing: -.02em; color: var(--arr-amber); }
.arr-op { font-size: 1.375rem; font-weight: 500; line-height: 1.2; color: var(--arr-muted); }
.arr-note { max-width: 46ch; min-height: 4.8em; }
@container (min-width: 760px) {
  .arr-term--total .arr-term__v { font-size: 2.75rem; }
  .arr-note { min-height: 6.4em; }
}

.arr-rows { display: flex; flex-direction: column; gap: 10px; }
.arr-row { display: grid; grid-template-columns: 92px minmax(0, 1fr) 52px; align-items: center; gap: 12px; font-size: .875rem; line-height: 1.4; color: var(--arr-muted); transition: color .3s; }
.arr[data-arr="double"] .arr-row { grid-template-columns: 112px minmax(0, 1fr) 52px; }
.arr-bar { height: 10px; overflow: hidden; border-radius: 5px; background: var(--arr-track); }
.arr-bar i { display: block; height: 100%; border-radius: 5px; background: var(--arr-amber); opacity: .4; transition: opacity .3s; }
.arr-row__n { text-align: right; font-variant-numeric: tabular-nums; }
.arr-row--on { font-weight: 600; color: var(--arr-ink); }
.arr-row--on .arr-bar i { opacity: 1; }
.arr-fine { max-width: 60ch; font-size: .8125rem; line-height: 1.5; color: var(--arr-muted); }

/* What the script writes (the note, and for the double-pane figure its sums) keeps its room but shows only once the
   script runs; where scripting is off, those parts and the buttons are left out and the figure stands as a still. */
.arr:not(.arr--on) [data-arr-wait] { visibility: hidden; }
@media (scripting: none) {
  .arr .arr-controls, .arr [data-arr-wait] { display: none; }
  .arr[data-arr="double"] .arr-grid { grid-template-columns: minmax(0, 1fr); max-width: 560px; }
}

/* the drawing (classes of the animation, inside the stage only) */
.arr-stage .s-ink { fill: var(--arr-stage-ink); }
.arr-stage .s-muted { fill: var(--arr-stage-muted); }
.arr-stage .lbl { font-weight: 500; font-size: 16px; font-family: inherit; }
.arr-stage .lbl .v { font-weight: 600; fill: var(--arr-stage-ink); transition: fill .5s ease; }
.arr-stage .lbl .k { fill: var(--arr-stage-muted); }
.arr-stage .cap { font-weight: 600; font-size: 12px; font-family: inherit; letter-spacing: .08em; text-transform: uppercase; }
.arr-stage .pane { fill: var(--arr-glass); fill-opacity: .17; stroke: var(--arr-glass); stroke-width: 1.5; }
.arr-stage .spacer { fill: var(--arr-stage-muted); fill-opacity: .28; stroke: var(--arr-stage-muted); stroke-opacity: .6; stroke-width: 1; }
.arr-stage .tick { stroke: var(--arr-stage-muted); stroke-width: 1; }
.arr-stage .stop-beam { stop-color: var(--arr-beam); }
.arr-stage .stop-hi { stop-color: var(--arr-beam-hi); }
.arr-stage .main { fill: none; stroke-width: 14; stroke-linejoin: round; }
.arr-stage .main-flow { fill: none; stroke-width: 4; stroke-linejoin: round; stroke-dasharray: 14 30; opacity: .85; animation: arr-flow-a 1s linear infinite; }
.arr-stage .head { fill: var(--arr-beam); }
.arr-stage .ah { fill: var(--arr-beam); }
.arr-stage .refl { transition: opacity .7s ease; }
.arr-stage .refl .base { fill: none; stroke: var(--arr-beam); stroke-width: 6px; stroke-linejoin: round; transition: stroke-width .7s ease; }
.arr-stage .refl .flow { fill: none; stroke: var(--arr-beam-hi); stroke-width: 2px; stroke-dasharray: 8 18; opacity: .9; animation: arr-flow-b .8s linear infinite; transition: stroke-width .7s ease; }
@keyframes arr-flow-a { to { stroke-dashoffset: -44; } }
@keyframes arr-flow-b { to { stroke-dashoffset: -26; } }
.arr-stage .film { fill: var(--arr-film); transform-box: fill-box; transform-origin: 50% 0; transform: scaleY(0); opacity: 0;
  transition: transform .65s cubic-bezier(.3, .7, .2, 1), opacity .25s ease; }
.arr-stage .film-tag { opacity: 0; transition: opacity .4s ease; }
.arr-stage .film-tag text { font-weight: 600; font-size: 14px; font-family: inherit; fill: var(--arr-film); }
.arr-stage .film-tag line { stroke: var(--arr-film); stroke-width: 1.5; }

/* on a phone the drawing is about 300 px wide: its lettering is set larger there (positions and shapes stay) */
@container (max-width: 479px) {
  .arr-stage .lbl { font-size: 20px; }
  .arr-stage .cap { font-size: 14px; }
  .arr-stage .film-tag text { font-size: 17px; }
}

/* single sheet: 1 = film on the front, 2 = film on both sides */
.arr[data-arr="single"][data-state="1"] .arr-stage .film.front, .arr[data-arr="single"][data-state="2"] .arr-stage .film.front, .arr[data-arr="single"][data-state="2"] .arr-stage .film.back { transform: scaleY(1); opacity: 1; }
.arr[data-arr="single"][data-state="1"] .arr-stage .film-tag.front, .arr[data-arr="single"][data-state="2"] .arr-stage .film-tag.front, .arr[data-arr="single"][data-state="2"] .arr-stage .film-tag.back { opacity: 1; transition-delay: .35s; }
.arr[data-arr="single"][data-state="1"] .arr-stage .refl.front, .arr[data-arr="single"][data-state="2"] .arr-stage .refl.front, .arr[data-arr="single"][data-state="2"] .arr-stage .refl.back { opacity: .6; transition-delay: .45s; }
.arr[data-arr="single"][data-state="1"] .arr-stage .refl.front .base, .arr[data-arr="single"][data-state="2"] .arr-stage .refl.front .base, .arr[data-arr="single"][data-state="2"] .arr-stage .refl.back .base { stroke-width: 1.75px; transition-delay: .45s; }
.arr[data-arr="single"][data-state="1"] .arr-stage .refl.front .flow, .arr[data-arr="single"][data-state="2"] .arr-stage .refl.front .flow, .arr[data-arr="single"][data-state="2"] .arr-stage .refl.back .flow { stroke-width: .75px; transition-delay: .45s; }

/* double-pane unit: 1 = film on the two outer surfaces */
.arr[data-arr="double"][data-state="1"] .arr-stage .film { transform: scaleY(1); opacity: 1; }
.arr[data-arr="double"][data-state="1"] .arr-stage .film-tag { opacity: 1; transition-delay: .35s; }
.arr[data-arr="double"][data-state="1"] .arr-stage .refl.outer { opacity: .6; transition-delay: .45s; }
.arr[data-arr="double"][data-state="1"] .arr-stage .refl.outer .base { stroke-width: 1.75px; transition-delay: .45s; }
.arr[data-arr="double"][data-state="1"] .arr-stage .refl.outer .flow { stroke-width: .75px; transition-delay: .45s; }
.arr[data-arr="double"][data-state="1"] .arr-stage .lbl.sealed .v { fill: var(--arr-beam); transition-delay: .9s; }

@media (prefers-reduced-motion: reduce) {
  .arr-stage .main-flow, .arr-stage .refl .flow { animation: none; }
  .arr-stage .film, .arr-stage .film-tag, .arr-stage .refl, .arr-stage .refl .base, .arr-stage .refl .flow, .arr-stage .lbl .v, .arr-row, .arr-bar i { transition: none; }
}
