/* Panel of the calculator side (Computer) of the CR3, built by js/cr3_computer.js. It
   takes the place of the wind data in the same panel; Calculate, the result and the
   explanation are shared. */
body:not(.cr3-face-a) #cr3c_panel { display: none; }
body.cr3-face-a #tool_calc_container > .cr3-data-heading,
body.cr3-face-a #tool_calc_container > .cr3-mode-label,
body.cr3-face-a #tool_calc_container > #tool_calc_selec,
body.cr3-face-a #tool_calc_container > #tool_calc_param_container { display: none !important; }

.cr3c-panel {
    display: flex;
    min-height: 0;
    flex-direction: column;
    gap: 15px;
    padding: 22px 24px 10px;
    overflow-y: auto;
}
.cr3c-heading .aero-tool-title { font-size: clamp(22px, 1.7vw, 28px); }
.cr3c-block { display: flex; min-width: 0; flex-direction: column; gap: 7px; }
.cr3c-block[hidden] { display: none; }

/* What to work out: pills. Find: a segmented control under them. */
.cr3c-choices { display: flex; flex-wrap: wrap; gap: 6px; }
.cr3c-choice {
    min-height: 36px;
    padding: 0 13px;
    color: var(--tool-text);
    background: var(--tool-surface);
    border: 1px solid var(--tool-line);
    border-radius: 999px;
    font: 700 12px Inter, "Open Sans", sans-serif;
    cursor: pointer;
    transition: color .16s ease, background-color .16s ease, border-color .16s ease;
}
.cr3c-choice:hover { color: var(--tool-accent); border-color: var(--tool-accent); }
.cr3c-choice[aria-checked="true"] { color: #fff; background: var(--tool-accent-fill); border-color: transparent; }
.cr3c-choice:focus-visible { outline: 2px solid var(--tool-focus); outline-offset: 2px; }
.cr3c-find {
    gap: 2px;
    padding: 3px;
    background: var(--tool-accent-soft);
    border-radius: 12px;
}
.cr3c-find .cr3c-choice {
    flex: 1 1 auto;
    min-height: 34px;
    padding: 0 10px;
    color: var(--tool-muted);
    background: transparent;
    border: 0;
    border-radius: 9px;
}
.cr3c-find .cr3c-choice:hover { color: var(--tool-accent); }
.cr3c-find .cr3c-choice[aria-checked="true"] {
    color: var(--tool-accent);
    background: var(--tool-surface);
    box-shadow: 0 1px 3px rgba(13, 31, 74, .16);
}

/* The data of the exercise. */
.cr3c-fields {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px 14px;
    margin-top: 2px;
}
.cr3c-field { display: flex; min-width: 0; flex-direction: column; gap: 5px; }
.cr3c-field > label { color: var(--cr3-muted); font-size: 10px; font-weight: 650; }
.cr3c-input-row {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 4px;
    border-bottom: 1px solid var(--cr3-line);
}
.cr3c-input-row:focus-within { border-bottom-color: var(--tool-accent); box-shadow: 0 1px 0 var(--tool-accent); }
.cr3c-input-row input {
    width: 100%;
    min-width: 0;
    min-height: 40px;
    flex: 1 1 auto;
    margin: 0;
    padding: 0 4px;
    color: var(--cr3-text);
    background: transparent;
    border: 0;
    outline: 0;
    font-size: 22px;
    font-variant-numeric: tabular-nums;
}
.cr3c-time-row input { flex: 1 1 0; }
.cr3c-suffix { flex: 0 0 auto; color: var(--cr3-muted); font-size: 12px; font-weight: 700; white-space: nowrap; }
/* A unit that can be changed: a menu that reads like the unit, with its caret. */
.cr3c-unit {
    flex: 0 0 auto;
    max-width: 58%;
    min-height: 30px;
    padding: 0 20px 0 7px;
    color: var(--tool-accent);
    background: var(--tool-accent-soft) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%23596a96' stroke-width='1.6'/%3E%3C/svg%3E") no-repeat right 6px center / 9px 6px;
    border: 0;
    border-radius: 8px;
    font: 750 12px Inter, "Open Sans", sans-serif;
    appearance: none;
    cursor: pointer;
}
.cr3c-unit:focus-visible { outline: 2px solid var(--tool-focus); outline-offset: 1px; }
.cr3c-sign {
    flex: 0 0 auto;
    min-width: 34px;
    min-height: 30px;
    color: var(--tool-accent);
    background: transparent;
    border: 1px solid var(--tool-line);
    border-radius: 8px;
    font-size: 15px;
    font-weight: 800;
    cursor: pointer;
}
.cr3c-sign:hover { border-color: var(--tool-accent); }
.cr3c-hint { color: var(--cr3-muted); font-size: 10px; line-height: 1.3; }

/* Conversion: value, then from ⇄ to on one line. */
/* The value takes the whole line, unless the liquid of a fuel weight goes beside it. */
.cr3c-fields[data-mode="conv"] > .cr3c-field:first-child:nth-last-child(2) { grid-column: 1 / -1; }
.cr3c-pair {
    display: grid;
    grid-column: 1 / -1;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: end;
    gap: 8px;
}
.cr3c-select { min-height: 42px; }
.cr3c-swap {
    width: 42px;
    height: 42px;
    color: var(--tool-accent);
    background: var(--tool-surface);
    border: 1px solid var(--tool-line);
    border-radius: 50%;
    font-size: 18px;
    font-weight: 800;
    cursor: pointer;
}
.cr3c-swap:hover { border-color: var(--tool-accent); background: var(--tool-accent-soft); }

@media (max-width: 900px), (max-height: 560px) {
    .cr3c-panel { gap: 8px; padding: 10px 14px 4px; }
    .cr3c-heading { display: none; }
    /* The choices say what they are: their titles give way to the data. */
    .cr3c-block > .aero-field-label { display: none; }
    .cr3c-choices { gap: 4px; }
    .cr3c-categories { flex-wrap: nowrap; margin: 0 -14px; padding: 0 14px 2px; overflow-x: auto; scrollbar-width: none; }
    .cr3c-categories::-webkit-scrollbar { display: none; }
    .cr3c-categories .cr3c-choice { flex: 0 0 auto; }
    .cr3c-choice { min-height: 32px; padding: 0 11px; font-size: 11px; }
    .cr3c-find .cr3c-choice { min-height: 30px; padding: 0 7px; }
    .cr3c-unit { min-height: 26px; font-size: 11px; }
    .cr3c-fields { gap: 7px 10px; }
    .cr3c-field > label { font-size: 9px; }
    .cr3c-input-row input { min-height: 34px; font-size: 18px; }
    .cr3c-select { min-height: 36px; }
    .cr3c-swap { width: 36px; height: 36px; }
    .cr3c-hint { display: none; }
}

/* Stacked under the rule (phones and tablets upright), the Computer panel needs more
   height than the wind one to show its data without scrolling: half the screen, up to
   400px, unless the student has sized it with the separator. :has() matches the
   specificity of the wind rule for a panel with a result (study.css). */
@media (max-width: 900px) and (min-height: 561px), (max-width: 599px) and (orientation: portrait) {
    body.cr3-study.cr3-face-a:not(.cr3-reading):not(.cr3-data-collapsed):has(#cr3c_panel) #cr3tool_container {
        grid-template-rows: minmax(100px, 1fr) var(--cr3-panel-height, min(400px, 50vh));
        grid-template-rows: minmax(100px, 1fr) var(--cr3-panel-height, min(400px, 50dvh));
    }
}

/* The names of windows and scales in the explanation: pressed, their band flashes on the
   rule (pulse() in cr3_computer.js). */
.tool_calc_expl_text button[data-ref] {
    padding: 0;
    font: inherit;
    font-weight: 600;
    color: inherit;
    background: none;
    border: 0;
    border-bottom: 1.5px dotted var(--cr3-tutorial-mark, currentColor);
    cursor: pointer;
}
.tool_calc_expl_text button[data-ref]:hover { color: var(--cr3-tutorial-mark, inherit); }
.tool_calc_expl_text button[data-ref]:focus-visible { outline: 2px solid var(--tool-accent); outline-offset: 2px; }
#CR3_obj .cr3c-pulse { animation: cr3c-pulse 0.6s ease-in-out 3 both; }
@keyframes cr3c-pulse {
    0%, 100% { fill-opacity: 0; stroke-opacity: 0; }
    50% { fill-opacity: 0.45; stroke-opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
    #CR3_obj .cr3c-pulse { animation: cr3c-pulse 1.8s ease-in-out 1 both; }
}
