@font-face {
  font-family: "Noto Sans Arabic";
  src: url("fonts/noto-sans-arabic.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: Montserrat;
  src: url("fonts/montserrat-light.woff2") format("woff2");
  font-weight: 300;
  font-display: swap;
}
@font-face {
  font-family: Montserrat;
  src: url("fonts/montserrat-regular.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: Montserrat;
  src: url("fonts/montserrat-bold.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}
@font-face {
  font-family: Montserrat;
  src: url("fonts/montserrat-black.woff2") format("woff2");
  font-weight: 900;
  font-display: swap;
}

:root {
  --background: #F2F2F2;
  --ink: #000000;
  --paper: #FFFFFF;
  --secondary-text: #595959;
  --rule: #D9D9D9;
  --step-blue: #205F8D;
  color-scheme: light;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--background);
  color: var(--ink);
  font: 400 1rem/1.5 Montserrat, Arial, sans-serif;
}
[hidden] { display: none !important; }
h1, h2, h3, p, figure { margin: 0; }
button, a, label, input { color: inherit; font: inherit; }
button { cursor: pointer; }
a { text-underline-offset: .22em; }
button:focus-visible, a:focus-visible, [tabindex="0"]:focus-visible,
.file:focus-within, #point-guide:focus {
  outline: 3px solid var(--ink);
  outline-offset: 3px;
  box-shadow: 0 0 0 3px var(--paper);
}
h1, h2, h3, .objects strong {
  font-size: 1.3rem;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -.018em;
}
h1, h2, h3 { text-wrap: balance; }
.wrap { width: min(1080px, 91%); margin-inline: auto; }
.mast {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
  padding: 14px 4px;
}
.brand-logo { grid-column: 2; display: block; width: clamp(96px, 10vw, 120px); height: auto; }
.mast .guide-link { grid-column: 3; justify-self: end; }
.guide-link, .text-button {
  color: var(--ink);
  font-size: .89rem;
  font-weight: 700;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: .25em;
}
.guide-link:hover, .text-button:hover { text-decoration-thickness: 2px; }
.guide-link { display: inline-flex; align-items: center; min-height: 44px; }
.text-button { min-height: 44px; padding: 9px 0; border: 0; background: none; text-align: start; }
.eyebrow { margin: 0; color: var(--secondary-text); font-size: 1rem; }

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, .9fr);
  align-items: center;
  gap: clamp(26px, 6vw, 90px);
  margin-block: clamp(16px, 3vw, 44px);
}
.hero-copy { display: grid; gap: .8rem; max-width: 27rem; }
.hero-copy h1 {
  font-size: clamp(2rem, 3.6vw, 2.875rem);
  font-weight: 900;
  letter-spacing: -.045em;
  line-height: 1.08;
}
.intro { font-size: 1.1rem; line-height: 1.4; }
.step-list {
  margin: 0;
  padding-inline-start: 1.95rem;
  list-style-type: decimal;
}
.step-list > li {
  position: relative;
  padding-block: .08rem;
  line-height: 1.45;
}
.step-list > li + li { margin-top: .5rem; }
.step-list > li::marker { font-size: 0; }
.step-list > li::before {
  content: counter(list-item);
  content: counter(list-item) / "";
  position: absolute;
  inset-inline-start: -1.95rem;
  inset-block-start: .18rem;
  display: grid;
  place-items: center;
  width: 1.28rem;
  height: 1.28rem;
  border: 1px solid currentColor;
  border-radius: 50%;
  color: var(--step-blue);
  font-size: .8rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.hero-copy .step-list { margin-top: .25rem; }
.editorial { display: grid; justify-items: end; }
.editorial img {
  display: block;
  width: 100%;
  max-width: 24.25rem;
  height: auto;
  object-fit: contain;
}
.mark-example figcaption {
  color: var(--secondary-text);
  font-size: .875rem;
  line-height: 1.4;
}
.choose { padding: 22px 0 40px; }
.section-head { text-align: center; }
.section-head p { margin-top: 7px; }
.objects {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(14px, 3vw, 44px);
  margin: 22px 0 12px;
}
.objects button {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-height: 84px;
  padding: 14px 18px;
  border: 0;
  background: var(--rule);
  color: var(--ink);
  text-align: center;
}
.objects strong {
  display: block;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: .2em;
}
.objects button:hover, .objects button:focus-visible { background: #D1D1D1; }
.objects button:hover strong, .objects button:focus-visible strong { text-decoration-thickness: 2px; }
.objects small { display: block; margin-top: 4px; color: inherit; font-size: 1rem; line-height: 1.4; }
.choose > .text-button { display: block; margin-inline: auto; }
.objects img { display: block; width: min(100%, 182px); height: auto; }
footer {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding: 18px 0 24px;
  border-top: 1px solid var(--rule);
  color: var(--secondary-text);
  font-size: .82rem;
}

.work { max-width: 740px; margin-inline: auto; padding: 32px 0 48px; }
.work > .eyebrow { margin: 4px 0 10px; }
.work > .back { display: block; margin-bottom: 18px; }
.setup-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; margin: 22px 0; }
.setup-grid img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 2.12;
  object-fit: contain;
}
.setup-grid figcaption { padding-block: 10px; }
#pose-demo { position: relative; }
#pose-animation { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
#pose-demo.showing-gesture #pose-drawing { opacity: 0; }
#gesture-status { color: var(--secondary-text); }
#gesture-status, .error { white-space: pre-line; }
.setup-grid h3, .check-figure h3 { margin-bottom: .7rem; }
details { margin-top: .6rem; }
summary {
  width: fit-content;
  padding-block: .2rem;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: .18em;
}
summary::marker { color: var(--step-blue); }
summary:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
details[open] > summary { margin-bottom: .4rem; }
#keyboard-guide { margin: 0; padding-inline-start: 1.3rem; }
#keyboard-guide li + li { margin-top: .3rem; }
#keyboard-guide li::marker { color: var(--step-blue); }
.setup-grid p, .check-figure p { line-height: 1.48; }
.check-figure {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.16fr);
  align-items: center;
  gap: 22px;
  margin: 22px 0;
}
.check-figure img { display: block; width: 100%; height: auto; }

.primary, .secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  max-width: 100%;
  min-height: 48px;
  padding: 12px 18px;
  border: 1px solid var(--ink);
  border-radius: 0;
  font-size: .94rem;
  font-weight: 700;
  line-height: 1.35;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}
.primary { background: var(--ink); color: var(--paper); }
.primary:hover { background: var(--secondary-text); }
.secondary {
  border-color: transparent;
  background: transparent;
  color: var(--ink);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: .23em;
}
.secondary:hover { text-decoration-thickness: 2px; }
button:disabled, button:disabled:hover {
  border-color: transparent;
  background: transparent;
  text-decoration: none;
  color: var(--secondary-text);
  cursor: default;
}
.file-controls, .actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 18px 0; }
.file { position: relative; overflow: hidden; }
.file input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.file input::file-selector-button { cursor: pointer; }
#point-head { margin: 20px 0 12px; scroll-margin-block-start: 12px; }
#point-overview { margin-top: 3px; }
.point-progress { display: flex; gap: 6px; width: min(100%, 240px); margin: 14px 0 6px; }
.point-progress i { flex: 1; height: 4px; background: var(--rule); }
.point-progress i.current { outline: 1px solid var(--ink); }
.point-progress i.placed { background: var(--ink); }
#point-count { display: block; font-weight: 700; font-variant-numeric: tabular-nums; }
#point-guide { margin-top: 2px; font-weight: 700; }
#ruler-help { margin-top: 5px; }
.annotation-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(180px, 30%); align-items: start; gap: 20px; }
.annotation-grid .actions { margin: 8px 0; }
.replace-controls { margin: 9px 0; }
.replace-controls .primary {
  border-color: transparent;
  background: transparent;
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: .23em;
}
#photo-stage {
  position: relative;
  width: min(100%, calc(56vh * var(--image-ratio,1)));
  aspect-ratio: var(--image-ratio);
  margin-inline: auto;
  overflow: hidden;
  cursor: crosshair;
}
#photo { display: block; width: 100%; height: auto; }
#photo-zoom-hint { display: none; }
@media (max-width: 640px) and (pointer: coarse) {
  #photo-zoom-hint:not([hidden]) {
    display: block;
    margin-top: .4rem;
    color: var(--secondary-text);
    font-size: .875rem;
  }
}
#markers { position: absolute; inset: 0; pointer-events: none; }
.point-marker {
  position: absolute;
  display: grid;
  place-items: center;
  transform: translate(-50%,-50%);
  width: 1.5rem;
  height: 1.5rem;
  border: 2px solid var(--paper);
  border-radius: 50%;
  box-shadow: 0 0 0 1.5px var(--ink);
  background: var(--ink);
  color: var(--paper);
  font-size: .82rem;
  font-weight: 700;
  line-height: 1;
}
.point-marker.wrist {
  border-color: var(--ink);
  border-radius: 2px;
  box-shadow: 0 0 0 1.5px var(--paper);
  background: var(--paper);
  color: var(--ink);
}
.point-cursor {
  width: 1.8rem;
  height: 1.8rem;
  border-style: dashed;
  font-size: 1.25rem;
}
.mark-example { cursor: default; }
.mark-example img { display: block; width: 100%; height: auto; }
.mark-example figcaption { padding-bottom: 3px; }
.mark-example figcaption strong { display: block; color: var(--ink); }
.mark-example figcaption span { display: block; }
.privacy { margin-top: 22px; color: var(--secondary-text); }
.error {
  margin: 10px 0;
  padding-block: 3px;
  padding-inline: 12px 0;
  border-inline-start: 3px solid var(--ink);
  font-weight: 700;
}

.result-box { margin-bottom: clamp(1.5rem, 3vw, 2.5rem); }
.reading {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  column-gap: .14em;
  margin: .12em 0 .18em;
  font-size: clamp(4rem, 11vw, 6.25rem);
  font-weight: 700;
  font-variant-numeric: lining-nums tabular-nums;
  letter-spacing: -.045em;
  line-height: 1.1;
}
.reading .unit { font-size: .46em; font-weight: 400; letter-spacing: -.025em; }
.details {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem 1.5rem;
  margin: 0;
  padding-top: .65rem;
  border-top: 1px solid var(--rule);
  color: var(--secondary-text);
  font-size: .94rem;
}
.details div { display: flex; align-items: baseline; gap: .35em; }
.details dd { margin: 0; color: var(--ink); white-space: nowrap; }
.more { margin-top: 30px; padding-top: 20px; border-top: 1px solid var(--rule); }
.more p { margin: 7px 0; }

@media (max-width: 640px) {
  .hero { grid-template-columns: 1fr; gap: 20px; margin: 16px auto 22px; }
  .hero-copy { gap: 9px; }
  .editorial img { max-width: none; }
  .choose { padding: 12px 0 24px; }
  .section-head { text-align: start; }
  .objects { grid-template-columns: 1fr; gap: 10px; margin: 14px 0 4px; }
  .objects button {
    display: grid;
    grid-template-columns: minmax(76px,32%) 1fr;
    align-items: center;
    min-height: 72px;
    padding: 8px 14px;
    gap: 16px;
    text-align: start;
  }
  .objects small { margin-top: 2px; }
  .choose > .text-button { margin-inline: 0; }
  .work { padding: 16px 0 32px; }
  .work > .back { margin-bottom: 8px; }
  .setup-grid { grid-template-columns: 1fr; gap: 13px; margin: 16px 0; }
  .file-controls, .actions { gap: 8px; }
  .primary, .secondary { padding: 11px 12px; }
  #photo-stage { width: min(100%, calc(48vh * var(--image-ratio,1))); }
  .annotation-grid { grid-template-columns: 1fr; gap: 8px; }
  .mark-example { width: clamp(215px,60vw,260px); max-width: 100%; }
  .check-figure { grid-template-columns: 1fr; gap: 10px; }
  .check-figure img { max-width: 410px; }
}
@media (max-width: 510px) {
  .mast { display: flex; flex-direction: column; gap: 2px; padding: 14px 0 2px; }
  .mast .guide-link { min-height: 44px; }
}

/* Locale navigation stays usable before JavaScript loads. */
.languages { grid-column: 1; grid-row: 1; display: flex; flex-wrap: wrap; gap: 4px; justify-self: start; }
.languages a { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; padding-inline: 6px; font-size: .9rem; text-decoration: none; }
.languages a[aria-current="page"] { font-weight: 700; text-decoration: underline; }
.languages a:lang(ar) { font-family: "Noto Sans Arabic", sans-serif; }
.mast .brand-logo, .mast .guide-link { grid-row: 1; }
.mast > * { min-width: 0; }
footer { flex-wrap: wrap; }
html:lang(ar) body { font-family: "Noto Sans Arabic", Arial, sans-serif; line-height: 1.7; }
html:lang(ar) h1, html:lang(ar) h2, html:lang(ar) h3,
html:lang(ar) .objects strong, html:lang(ar) .intro { letter-spacing: 0; line-height: 1.5; }
html:lang(ar) .hero-copy h1 { font-family: Montserrat, sans-serif; text-align: right; line-height: 1.15; letter-spacing: -.035em; }
html:lang(ar) kbd { direction: ltr; unicode-bidi: isolate; }
/* Never mirror the measurement plane: pointer coordinates remain physical. */
#photo-stage, #markers, .reading { direction: ltr; }
[dir="ltr"][id$="-cm"] { unicode-bidi: isolate; }
html:lang(ar) .reading { justify-content: flex-end; }
@media (max-width: 700px) {
  .mast { grid-template-columns: 1fr auto; gap: 2px 12px; }
  .mast .brand-logo { grid-column: 1; grid-row: 1; }
  .languages { grid-column: 2; grid-row: 1; justify-self: end; }
  .mast .guide-link { grid-column: 1 / -1; grid-row: 2; justify-self: end; }
}
@media (max-width: 510px) {
  .mast { display: grid; padding-block: 12px 2px; }
}
