/*
 * 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-arts-artwork-explorer
 */
/*
 * artwork-explorer — close looking at an artwork on the whiteboard.
 * The picture zooms and pans on a gallery-dark viewport; a numbered
 * looking route glides between talking points; compare mode sets two
 * works side by side. Warm, calm and big for little hands at the board.
 */

/* The hidden attribute must always win, even over display:flex/grid below
   (guided cards, caption, controls and compare panes toggle via hidden). */
.ae-activity [hidden] {
    display: none !important;
}

.ae-activity .ae-stage {
    background: #fffaf0;
    border: 1px solid var(--maths-border, #e0e7ef);
    border-radius: 14px;
    padding: 1.25rem 1rem;
    margin-bottom: 1rem;
    box-shadow: 0 2px 10px rgba(20, 40, 80, 0.05);
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.ae-activity .ae-title {
    margin: 0;
    text-align: center;
    font-size: 1.5rem;
    font-weight: 800;
    color: #4a3520;
}

.ae-activity .ae-single {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

/* ------ Viewport (zoom/pan window) ------ */

.ae-activity .ae-viewport {
    position: relative;
    width: 100%;
    height: clamp(320px, 56vh, 640px);
    overflow: hidden;
    border-radius: 12px;
    background: #37322c;
    cursor: grab;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    outline-offset: 3px;
}

.ae-activity .ae-viewport:active {
    cursor: grabbing;
}

.ae-activity .ae-viewport--empty {
    background: #fffdf8;
    border: 2px dashed #e8d9b8;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: default;
}

.ae-activity .ae-viewport--compact {
    height: clamp(240px, 40vh, 460px);
}

.ae-activity .ae-world {
    position: absolute;
    left: 0;
    top: 0;
    transform-origin: 0 0;
    will-change: transform;
}

/* Guided stops glide; manual gestures move instantly (class toggled in JS). */
.ae-activity .ae-world.ae-anim {
    transition: transform 650ms cubic-bezier(0.22, 1, 0.36, 1);
}

.ae-activity .ae-world.ae-anim .ae-hotspot {
    transition: transform 650ms cubic-bezier(0.22, 1, 0.36, 1);
}

.ae-activity .ae-image {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
    max-width: none;
    pointer-events: none;
}

.ae-activity .ae-hotspots {
    position: absolute;
    inset: 0;
}

/* ------ Hotspot markers ------
   Counter-scaled by --ae-inv (set on the world) so they stay the same
   tappable size no matter how far the picture is zoomed. */

.ae-activity .ae-hotspot {
    position: absolute;
    width: 54px;
    height: 54px;
    margin: 0;
    padding: 0;
    border: 3px solid #fff;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, #ffb347, #e07b00);
    color: #fff;
    font-family: inherit;
    font-size: 1.35rem;
    font-weight: 800;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.35);
    transform: translate(-50%, -50%) scale(var(--ae-inv, 1));
    transform-origin: center;
    pointer-events: auto;
    touch-action: manipulation;
}

.ae-activity .ae-hotspot:hover {
    transform: translate(-50%, -50%) scale(calc(var(--ae-inv, 1) * 1.1));
}

.ae-activity .ae-hotspot--current {
    animation: ae-pulse 1.6s ease-in-out infinite;
}

@keyframes ae-pulse {
    0%, 100% {
        box-shadow: 0 3px 10px rgba(0, 0, 0, 0.35), 0 0 0 0 rgba(255, 179, 71, 0.7);
    }
    50% {
        box-shadow: 0 3px 10px rgba(0, 0, 0, 0.35), 0 0 0 14px rgba(255, 179, 71, 0);
    }
}

/* ------ Zoom controls (fat targets for the touch board) ------ */

.ae-activity .ae-zoom-controls {
    position: absolute;
    right: 0.75rem;
    bottom: 0.75rem;
    display: flex;
    gap: 0.5rem;
    background: rgba(20, 16, 12, 0.55);
    border-radius: 999px;
    padding: 0.4rem;
}

.ae-activity .ae-zoom-btn {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: none;
    background: #fffaf0;
    color: #6a4a10;
    font-size: 1.3rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
    transition: transform 120ms ease, background 120ms ease;
    touch-action: manipulation;
}

.ae-activity .ae-zoom-btn:hover:not(:disabled) {
    background: #ffedc9;
    transform: scale(1.06);
}

.ae-activity .ae-zoom-btn:active:not(:disabled) {
    transform: scale(0.95);
}

.ae-activity .ae-zoom-btn:disabled {
    opacity: 0.4;
    cursor: default;
}

.ae-activity .ae-viewport--compact .ae-zoom-btn {
    width: 46px;
    height: 46px;
    font-size: 1.1rem;
}

/* ------ Placeholder (missing / broken picture) ------ */

.ae-activity .ae-placeholder {
    text-align: center;
    padding: 2.25rem 1.5rem;
    max-width: 460px;
}

.ae-activity .ae-placeholder-icon {
    font-size: 3rem;
    color: #e0a33a;
    margin-bottom: 0.75rem;
    display: block;
}

.ae-activity .ae-placeholder-title {
    font-size: 1.4rem;
    font-weight: 800;
    color: #4a3520;
    margin-bottom: 0.4rem;
}

.ae-activity .ae-placeholder-text {
    margin: 0;
    font-size: 1.1rem;
    color: #6b5b3e;
}

/* ------ Caption bar ------ */

.ae-activity .ae-caption {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    padding: 0.6rem 0.9rem;
    background: #fff;
    border: 1px solid #eee1c8;
    border-left: 6px solid #e0a33a;
    border-radius: 10px;
}

.ae-activity .ae-caption-line {
    font-size: 1.2rem;
    color: #3d2f1c;
}

.ae-activity .ae-caption-title {
    font-weight: 800;
}

.ae-activity .ae-caption-meta {
    font-weight: 600;
    color: #7a6642;
}

.ae-activity .ae-caption-note {
    margin: 0;
    font-size: 1.05rem;
    font-style: italic;
    color: #6b5b3e;
}

/* ------ Guided looking route cards ------ */

.ae-activity .ae-guided {
    display: flex;
    justify-content: center;
}

.ae-activity .ae-start-card,
.ae-activity .ae-done-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.8rem;
    text-align: center;
    background: linear-gradient(135deg, #fff3d6, #ffe7b8);
    border: 2px solid #f0c36d;
    border-radius: 14px;
    padding: 1rem 1.5rem;
    max-width: 640px;
    width: 100%;
}

.ae-activity .ae-start-text,
.ae-activity .ae-done-text {
    font-size: 1.3rem;
    font-weight: 700;
    color: #7a4a00;
}

.ae-activity .ae-prompt-card {
    width: 100%;
    max-width: 720px;
    background: #fff;
    border: 2px solid #f0c36d;
    border-radius: 14px;
    padding: 1rem 1.25rem;
    box-shadow: 0 4px 14px rgba(180, 120, 20, 0.14);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.ae-activity .ae-prompt-kicker {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #b26a00;
}

.ae-activity .ae-prompt-label {
    font-size: 1.05rem;
    font-weight: 800;
    color: #4a3520;
}

.ae-activity .ae-prompt-text {
    font-size: 1.4rem;
    font-weight: 700;
    color: #33281a;
    line-height: 1.35;
}

.ae-activity .ae-prompt-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    margin-top: 0.25rem;
}

.ae-activity .ae-prompt-actions .ae-btn-primary {
    margin-left: auto;
}

/* ------ Buttons ------ */

.ae-activity .ae-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    border-radius: 999px;
    font-family: inherit;
    font-size: 1.15rem;
    font-weight: 800;
    padding: 0.7rem 1.5rem;
    cursor: pointer;
    border: none;
    transition: transform 120ms ease, box-shadow 120ms ease;
    touch-action: manipulation;
}

.ae-activity .ae-btn:hover {
    transform: translateY(-1px);
}

.ae-activity .ae-btn:active {
    transform: scale(0.97);
}

.ae-activity .ae-btn-primary {
    background: linear-gradient(135deg, #f4a92e, #e07b00);
    color: #fff;
    box-shadow: 0 3px 10px rgba(224, 123, 0, 0.35);
}

.ae-activity .ae-btn-secondary {
    background: #fff;
    color: #8a5a10;
    border: 2px solid #f0c36d;
}

/* ------ Compare mode ------ */

.ae-activity .ae-compare {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.ae-activity .ae-compare-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

@media (max-width: 720px) {
    .ae-activity .ae-compare-grid {
        grid-template-columns: 1fr;
    }
}

.ae-activity .ae-compare-cell {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    min-width: 0;
}

.ae-activity .ae-discuss {
    background: #fff;
    border: 1px solid #eee1c8;
    border-radius: 12px;
    padding: 0.9rem 1.2rem;
}

.ae-activity .ae-discuss-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #b26a00;
    margin-bottom: 0.5rem;
}

.ae-activity .ae-discuss-list {
    margin: 0;
    padding-left: 1.4rem;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    font-size: 1.2rem;
    font-weight: 600;
    color: #33281a;
}

/* ------ Display mode: artwork big + caption, chrome hidden ------ */

body.display-mode.ae-activity .ae-stage {
    padding: 0.75rem;
}

body.display-mode.ae-activity .ae-viewport {
    /* px-fixed: vh here shrink-loops with the display-mode iframe
       auto-height; 620px + caption sits inside the embed's 700px clamp */
    height: 620px;
}

body.display-mode.ae-activity .ae-viewport--compact {
    height: 470px;
}

body.display-mode.ae-activity .ae-caption-line {
    font-size: 1.5rem;
}

body.display-mode.ae-activity .ae-caption-note {
    font-size: 1.25rem;
}

/* ------ Screen-reader-only live region ------ */

.ae-activity .ae-visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}
