/*
 * Coding Ireland proprietary interactive activity
 * Copyright (c) 2017-2026 Coding Ireland. All rights reserved.
 *
 * Part of the Coding Ireland online learning platform. Licensed for use only
 * as delivered on the platform. Copying, redistributing, or adapting this
 * file, in whole or in part, for use in any other product or service is not
 * permitted. Ref: CI-maths-angle-tool
 */
/*
 * angle-tool — half-circle protractor with a draggable ray. Live degree
 * readout and classification (acute / right / obtuse / straight / reflex);
 * optional dual scale and optional turn description for the introductory
 * "what is an angle" lesson.
 */

.maths-activity .ang-mode-chip {
    display: inline-block;
    margin-top: 0.4rem;
    padding: 0.3rem 0.75rem;
    background: var(--maths-surface-alt);
    color: var(--maths-primary-dark);
    border-radius: 999px;
    font-weight: 700;
    font-size: 0.9rem;
}

/* Stage layout: protractor SVG + side readout */
.maths-activity .ang-stage {
    display: grid;
    grid-template-columns: minmax(320px, 1fr) minmax(220px, 280px);
    gap: 1rem;
    align-items: start;
}

.maths-activity .ang-svg {
    width: 100%;
    height: auto;
    max-height: 460px;
    background: var(--maths-surface);
    border: 1px solid var(--maths-border);
    border-radius: 10px;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

.maths-activity .ang-svg.is-draggable { cursor: grab; }
.maths-activity .ang-svg.is-dragging { cursor: grabbing; }

/* −1° / +1° under the readout: big enough for a fingertip on a board. */
.maths-activity .ang-nudge {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.maths-activity .ang-nudge[hidden] { display: none; }

.maths-activity .ang-nudge-btn {
    flex: 1 1 0;
    min-height: 3rem;
    padding: 0.25rem 0.5rem;
    font-family: "Nunito", sans-serif;
    font-weight: 800;
    font-size: 1.2rem;
    color: var(--maths-primary);
    background: var(--maths-surface-alt);
    border: 2px solid var(--maths-border);
    border-radius: 10px;
    cursor: pointer;
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
}

.maths-activity .ang-nudge-btn:hover:not(:disabled) { border-color: var(--maths-primary); }
.maths-activity .ang-nudge-btn:active:not(:disabled) { background: #DCE8F5; }
.maths-activity .ang-nudge-btn:disabled { opacity: 0.4; cursor: default; }

/* Readout panel */
.maths-activity .ang-readout {
    background: var(--maths-surface);
    border: 1px solid var(--maths-border);
    border-radius: 10px;
    padding: 1rem 1.1rem;
}

.maths-activity .ang-readout-title {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--maths-ink-muted);
    margin-bottom: 0.55rem;
}

/* MEASURE mode: shown in place of the live readout so the pupil types the angle
   they read off the scale instead of being handed it. */
.maths-activity .ang-measure {
    background: var(--maths-surface);
    border: 1px solid var(--maths-border);
    border-radius: 10px;
    padding: 1rem 1.1rem;
}

.maths-activity .ang-measure-title {
    display: block;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--maths-ink-muted);
    margin-bottom: 0.55rem;
}

.maths-activity .ang-measure-row {
    display: flex;
    align-items: baseline;
    gap: 0.3rem;
}

.maths-activity .ang-measure-input {
    width: 5.5rem;
    font-family: "Nunito", sans-serif;
    font-weight: 800;
    font-size: 2rem;
    color: var(--maths-primary);
    text-align: center;
    border: 2px solid var(--maths-border);
    border-radius: 8px;
    padding: 0.1rem 0.3rem;
    font-variant-numeric: tabular-nums;
}

.maths-activity .ang-measure-input:focus {
    outline: none;
    border-color: var(--maths-primary);
}

.maths-activity .ang-measure-unit {
    font-weight: 800;
    font-size: 1.6rem;
    color: var(--maths-primary);
}

.maths-activity .ang-measure-hint {
    margin-top: 0.6rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--maths-accent);
    line-height: 1.35;
}

.maths-activity .ang-readout-value {
    display: flex;
    align-items: baseline;
    gap: 0.15rem;
    margin-bottom: 0.4rem;
}

.maths-activity .ang-readout-number {
    font-weight: 800;
    font-size: 2.6rem;
    color: var(--maths-primary);
    font-variant-numeric: tabular-nums;
    line-height: 1;
}

.maths-activity .ang-readout-unit {
    font-weight: 800;
    font-size: 1.6rem;
    color: var(--maths-primary);
}

.maths-activity .ang-readout-classify {
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--maths-accent);
    text-transform: lowercase;
    margin-bottom: 0.55rem;
}

.maths-activity .ang-readout-turn {
    margin-top: 0.45rem;
    padding-top: 0.45rem;
    border-top: 1px solid var(--maths-border);
    font-size: 0.95rem;
    color: var(--maths-ink-muted);
}

.maths-activity .ang-readout-turn i {
    margin-right: 0.45rem;
    color: var(--maths-success);
}

/* Target panel label-and-prompt layout (the shared .maths-target-panel
 * handles the yellow banner styling; this just colours the inner label
 * and prompt to match the rest of the activity). */
.maths-activity .ang-target-label {
    font-weight: 800;
    color: var(--maths-primary-dark);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-size: 0.85rem;
}

.maths-activity .ang-target-label i {
    margin-right: 0.35rem;
    color: var(--maths-accent);
}

.maths-activity .ang-target-prompt {
    font-weight: 700;
    color: var(--maths-ink);
    font-size: 1.05rem;
    flex: 1 1 auto;
}

/* SVG element classes used by the JS renderer */
.ang-protractor-arc {
    fill: rgba(31, 111, 178, 0.06);
    stroke: var(--maths-primary, #1F6FB2);
    stroke-width: 2;
}

.ang-tick {
    stroke: var(--maths-primary, #1F6FB2);
    stroke-width: 1;
}

.ang-tick.is-major {
    stroke-width: 1.8;
}

.ang-tick.is-five {
    stroke-width: 0.8;
}

.ang-tick-label {
    font: 600 12px Nunito, sans-serif;
    fill: var(--maths-ink, #1F2933);
    text-anchor: middle;
    dominant-baseline: middle;
}

.ang-tick-label.is-outer {
    fill: var(--maths-primary, #1F6FB2);
}

.ang-tick-label.is-inner {
    fill: var(--maths-accent, #E86A33);
}

.ang-ray {
    stroke: var(--maths-accent, #E86A33);
    stroke-width: 4;
    stroke-linecap: round;
}

.ang-ray.is-fixed {
    stroke: var(--maths-primary, #1F6FB2);
}

.ang-sweep {
    fill: rgba(232, 106, 51, 0.18);
    stroke: var(--maths-accent, #E86A33);
    stroke-width: 1.5;
    stroke-dasharray: 4 3;
}

.ang-vertex {
    fill: var(--maths-ink, #1F2933);
}

.ang-handle {
    fill: #fff;
    stroke: var(--maths-accent, #E86A33);
    stroke-width: 2.5;
    cursor: grab;
}

.ang-handle:active {
    cursor: grabbing;
}

/* Taken hold of: the pupil at the board can see the ray is theirs. */
.ang-svg.is-dragging .ang-handle {
    fill: #FDE3D6;
    stroke-width: 3.5;
}

@media (max-width: 760px) {
    .maths-activity .ang-stage {
        grid-template-columns: 1fr;
    }
    .maths-activity .ang-readout-number {
        font-size: 2rem;
    }
}

/* Display mode strips drag handles + the challenge target panel. The
 * draggable ray remains visible as a static labelled snapshot. */
body.display-mode .ang-handle,
body.display-mode .ang-nudge,
body.display-mode .ang-target-panel {
    display: none !important;
}

body.display-mode .ang-svg {
    pointer-events: none;
}
