/* ================================================================
   perimeter-measuring.css
   ----------------------------------------------------------------
   Styling for the "Measuring & Tracing Perimeter" skill quizzes on
   the Class 5 Math page:

     - B.1 String It Up               (.meas-string-path / .meas-ruler-*)
     - B.2 Perimeter on Grid Paper    (.meas-grid-bg / .meas-grid-line / .meas-grid-boundary)
     - B.3 Label the Sides            (.meas-side-label* / .meas-shape-outline)
     - B.4 Add All the Sides (Any Shape) (.meas-side-label*, irregular shapes)

   All four share one visual "stage" card (.meas-stage, styled like
   perimeter-foundations.css's .perim-stage: a bordered box that rings
   green/red via .is-correct/.is-wrong once a question is graded) and
   one answer-chip row (.meas-options / .meas-opt). The chip row is a
   4-column CSS Grid \u2014 not a wrapping flex row \u2014 specifically so all
   four answers are FORCED onto a single line at every viewport width
   down to small Android phones; text inside a chip shrinks (via
   clamp()) and may wrap to a second line inside its own cell, but the
   row itself never breaks into two rows. This file is fully
   self-contained (its own "meas-" class prefix) and is loaded as a
   plain stylesheet link, independent of perimeter-foundations.css.
   ================================================================ */

/* ---------- shared visual "stage" (shape / grid / ruler live here) ---------- */
.meas-stage {
    width: clamp(220px, 70vw, 320px);
    aspect-ratio: 1 / 1;
    margin: 14px auto 6px;
    border: 3px solid var(--line);
    border-radius: 20px;
    background: var(--bg-light);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 0 rgba(0,0,0,0.06);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    overflow: hidden;
}
.meas-stage.is-correct {
    border-color: #22c08d;
    box-shadow: 0 0 0 4px rgba(34,192,141,0.18);
}
.meas-stage.is-wrong {
    border-color: #f5427d;
    box-shadow: 0 0 0 4px rgba(245,66,125,0.15);
}
.meas-stage svg {
    width: 92%;
    height: 92%;
    display: block;
}

/* ---------- shape shell shared by B.1 / B.3 / B.4 ---------- */
.meas-shape-fill {
    fill: #fff8ec;
    stroke: none;
}
.meas-shape-outline {
    fill: none;
    stroke: var(--line);
    stroke-width: 3;
    stroke-linejoin: round;
}

/* ---------- B.1 String It Up: rope-styled boundary + ruler ---------- */
.meas-string-path {
    fill: none;
    stroke: #a9713f;
    stroke-width: 5;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-dasharray: 3 7;
}
.meas-ruler-bar {
    fill: #fdf3da;
    stroke: #c9a35a;
    stroke-width: 2;
}
.meas-ruler-tick {
    stroke: #8a6a2e;
    stroke-width: 1.5;
}
.meas-ruler-num {
    font-size: 9px;
    font-weight: 700;
    fill: #8a6a2e;
    text-anchor: middle;
}

/* ---------- B.2 Perimeter on Grid Paper: graph-paper backdrop ---------- */
.meas-grid-bg {
    fill: #f4f9ff;
    stroke: #b9cee6;
    stroke-width: 2;
}
.meas-grid-line {
    stroke: #cfe0f2;
    stroke-width: 1;
}
.meas-grid-boundary {
    fill: none;
    stroke: #2f8f5b;
    stroke-width: 5;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* ---------- B.1 / B.3 / B.4 side-length labels ----------
   Rendered as plain bold text with a white "halo" stroke (paint-order
   puts the stroke behind the fill) instead of a background bubble \u2014
   this keeps every number fully readable directly against the stage
   background with no box edge that could ever get clipped by the
   stage's rounded border. */
.meas-side-label-text {
    font-size: 16px;
    font-weight: 800;
    fill: #3a2c1f;
    text-anchor: middle;
    dominant-baseline: middle;
    paint-order: stroke fill;
    stroke: #ffffff;
    stroke-width: 4px;
    stroke-linejoin: round;
}

/* ---------- shared answer-chip row (all four skills' numeric chips) ----------
   4-column grid = guaranteed single line at every width; never
   switches to flex-wrap, so the four chips can't stack. */
.meas-options {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: clamp(6px, 2vw, 14px);
    width: 100%;
    max-width: 560px;
    margin: 18px auto 4px;
}
.meas-opt {
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 58px;
    padding: 8px 4px;
    border-radius: 14px;
    border: 3px solid var(--line);
    background: #fff;
    font-family: inherit;
    font-weight: 800;
    color: #3a2c1f;
    font-size: clamp(13px, 3.6vw, 18px);
    line-height: 1.15;
    text-align: center;
    word-break: break-word;
    cursor: pointer;
    transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease, background 0.12s ease;
}
.meas-opt:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 0 rgba(0,0,0,0.08);
}
.meas-opt:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: none;
}
.meas-opt:focus-visible {
    outline: 3px solid #4a90e2;
    outline-offset: 2px;
}
.meas-opt:disabled { cursor: default; }
.meas-opt.is-correct {
    border-color: #22c08d;
    background: #eafff6;
    box-shadow: 0 0 0 4px rgba(34,192,141,0.18);
}
.meas-opt.is-wrong {
    border-color: #f5427d;
    background: #fff0f4;
    box-shadow: 0 0 0 4px rgba(245,66,125,0.15);
}

/* ---------- helper caption under the stage (units reminder) ---------- */
.meas-unit-hint {
    text-align: center;
    font-size: clamp(11px, 3vw, 13px);
    font-weight: 700;
    color: #8a7a68;
    margin: 2px auto 0;
}

/* ---------- responsive tuning (mirrors perimeter-foundations.css) ---------- */
@media (max-width: 380px) {
    .meas-stage { width: clamp(180px, 78vw, 260px); margin: 10px auto 4px; }
    .meas-options { gap: 5px; margin: 12px auto 4px; }
    .meas-opt { min-height: 50px; padding: 6px 3px; font-size: clamp(12px, 3.8vw, 15px); border-width: 2px; border-radius: 12px; }
    .meas-side-label-text { font-size: 13px; stroke-width: 3px; }
}

@media (min-width: 480px) {
    .meas-opt { min-height: 64px; }
}

@media (min-width: 700px) {
    .meas-options { gap: 16px; }
    .meas-opt { min-height: 74px; font-size: 19px; }
}

@media (min-width: 900px) {
    .meas-stage { width: clamp(260px, 34vw, 340px); }
    .meas-opt { min-height: 80px; }
}

@media (max-height: 700px) {
    .meas-stage { width: clamp(180px, 46vw, 240px); margin: 8px auto 4px; }
    .meas-options { margin: 10px auto 4px; }
    .meas-opt { min-height: 48px; }
}