/**
 * bells.css — Styles for the Bells web application.
 *
 * Design philosophy:
 *   - Pure black background, bells only — no chrome or decoration
 *   - 3×4 CSS Grid fits 12 bells within the mobile viewport
 *   - SVG bells scale subtly to convey size progression
 *   - Touch feedback via golden glow pulse and swing animation
 *   - Horizontal swipe transitions between five bell sets
 *   - Minimal dot indicators and set name label show active set
 *
 * Organized in sections:
 *   1. Custom Properties (design tokens)
 *   2. Reset & Base
 *   3. Swipe Container (set navigation)
 *   4. Bell Grid
 *   5. Bell Buttons & SVG
 *   6. Bell Labels
 *   7. Touch Feedback Animations
 *   8. Set Name Label
 *   9. Set Dot Indicators
 *  10. Responsive Breakpoints
 */

/* ═══════════════════════════════════════════════════════════════════
   1. CUSTOM PROPERTIES
   ═══════════════════════════════════════════════════════════════════ */
:root {
    --bg-color: #000000;
    --bell-gap: 4px;
    --grid-cols: 3;
    --grid-rows: 4;
    --grid-padding: 6px;
    --dot-size: 8px;
    --dot-gap: 10px;
    --dot-bottom: 8px;
    --dot-color-inactive: rgba(255, 255, 255, 0.25);
    --dot-color-active: rgba(255, 255, 255, 0.85);
    --label-color: rgba(255, 255, 255, 0.8);
    --label-font-size: 10px;
    --glow-duration: 300ms;
    --swing-duration: 400ms;
    --transition-speed: 350ms;
    /* Space reserved below the grid for dots + set name label */
    --bottom-controls-height: 42px;
}

/* ═══════════════════════════════════════════════════════════════════
   2. RESET & BASE
   ═══════════════════════════════════════════════════════════════════ */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: var(--bg-color);
    /* Prevent text selection and callouts on mobile */
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    /* Prevent pull-to-refresh on mobile Chrome */
    overscroll-behavior: none;
}

body {
    font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
    position: relative;
}

/* ═══════════════════════════════════════════════════════════════════
   3. SWIPE CONTAINER
   ═══════════════════════════════════════════════════════════════════
   Five sets sit side-by-side in a 500vw-wide container.
   translateX shifts to show the active set.
   ═══════════════════════════════════════════════════════════════════ */
.bells-viewport {
    width: 100vw;
    height: 100vh;
    height: 100dvh; /* Dynamic viewport height — excludes mobile browser chrome */
    overflow: hidden;
    position: relative;
}

.bells-track {
    display: flex;
    width: 500vw; /* 5 sets × 100vw each */
    height: 100%;
    transform: translateX(0);
    transition: transform var(--transition-speed) cubic-bezier(0.25, 0.46, 0.45, 0.94);
    will-change: transform;
}

/* Remove transition during active drag for responsive feel */
.bells-track--dragging {
    transition: none;
}

.bells-set {
    width: 100vw;
    height: 100%;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--grid-padding);
    /* Reserve space at bottom for dot indicators + set name */
    padding-bottom: var(--bottom-controls-height);
    /* Reserve a small top safe area */
    padding-top: max(var(--grid-padding), env(safe-area-inset-top, 4px));
}

/* ═══════════════════════════════════════════════════════════════════
   4. BELL GRID
   ═══════════════════════════════════════════════════════════════════ */
.bell-grid {
    display: grid;
    grid-template-columns: repeat(var(--grid-cols), 1fr);
    grid-template-rows: repeat(var(--grid-rows), 1fr);
    gap: var(--bell-gap);
    width: 100%;
    height: 100%;
    max-width: 420px;  /* Cap width on tablets */
    /* No max-height — let the grid fill the available space */
}

/* ═══════════════════════════════════════════════════════════════════
   5. BELL BUTTONS & SVG
   ═══════════════════════════════════════════════════════════════════ */
.bell-btn {
    /* Reset button defaults */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    appearance: none;
    -webkit-appearance: none;
    background: none;
    border: none;
    outline: none;
    cursor: pointer;
    padding: 2px;
    position: relative;
    overflow: hidden;
    /* Prevent iOS tap highlight */
    -webkit-tap-highlight-color: transparent;
    /* Allow touch events for swipe detection on parent */
    touch-action: manipulation;
    /* Smooth scale transitions */
    transition: filter var(--glow-duration) ease-out;
    transform-origin: top center;
    /* Contain the SVG within the cell */
    min-height: 0;
    min-width: 0;
}

.bell-btn svg {
    width: 100%;
    height: auto;
    max-height: 100%;
    display: block;
    /* Apply per-bell scale via inline style */
    transition: transform var(--swing-duration) ease-out;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5));
    /* Prevent SVG from overflowing its cell */
    flex-shrink: 1;
    object-fit: contain;
}

/* ═══════════════════════════════════════════════════════════════════
   6. BELL LABELS
   ═══════════════════════════════════════════════════════════════════ */
.bell-label {
    color: var(--label-color);
    font-size: var(--label-font-size);
    font-weight: 500;
    letter-spacing: 0.5px;
    margin-top: 1px;
    text-align: center;
    pointer-events: none; /* Don't interfere with bell taps */
    line-height: 1;
    flex-shrink: 0;
}

/* ═══════════════════════════════════════════════════════════════════
   7. TOUCH FEEDBACK ANIMATIONS
   ═══════════════════════════════════════════════════════════════════ */

/* Golden glow on tap */
.bell-btn--active svg {
    filter: drop-shadow(0 0 12px var(--glow-color, #FFD700))
            drop-shadow(0 0 24px var(--glow-color, #FFD700));
}

/* Swing animation on tap */
@keyframes bellSwing {
    0%   { transform: rotate(0deg); }
    20%  { transform: rotate(4deg); }
    40%  { transform: rotate(-3deg); }
    60%  { transform: rotate(2deg); }
    80%  { transform: rotate(-1deg); }
    100% { transform: rotate(0deg); }
}

.bell-btn--active svg {
    animation: bellSwing var(--swing-duration) ease-out;
}

/* ═══════════════════════════════════════════════════════════════════
   8. SET NAME LABEL
   ═══════════════════════════════════════════════════════════════════ */
.set-name-label {
    position: fixed;
    bottom: calc(var(--dot-bottom) + var(--dot-size) + 8px);
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255, 255, 255, 0.55);
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 1px;
    text-transform: uppercase;
    white-space: nowrap;
    z-index: 10;
    pointer-events: none;
    transition: opacity 200ms ease;
}

/* ═══════════════════════════════════════════════════════════════════
   9. SET DOT INDICATORS
   ═══════════════════════════════════════════════════════════════════ */
.set-dots {
    position: fixed;
    bottom: var(--dot-bottom);
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: var(--dot-gap);
    z-index: 10;
    padding: 4px 8px;
}

.set-dot {
    width: var(--dot-size);
    height: var(--dot-size);
    border-radius: 50%;
    background-color: var(--dot-color-inactive);
    transition: background-color var(--transition-speed) ease,
                transform var(--transition-speed) ease;
}

.set-dot--active {
    background-color: var(--dot-color-active);
    transform: scale(1.3);
}

/* ═══════════════════════════════════════════════════════════════════
   10. RESPONSIVE BREAKPOINTS
   ═══════════════════════════════════════════════════════════════════ */

/* Very small phones (iPhone SE, 320px) */
@media screen and (max-width: 340px) {
    :root {
        --bell-gap: 2px;
        --grid-padding: 3px;
        --label-font-size: 7px;
        --bottom-controls-height: 36px;
    }
}

/* Small phones (375px) */
@media screen and (max-width: 380px) {
    :root {
        --bell-gap: 3px;
        --grid-padding: 4px;
        --label-font-size: 8px;
    }
}

/* Short phones / landscape */
@media screen and (max-height: 600px) {
    :root {
        --bell-gap: 2px;
        --grid-padding: 3px;
        --label-font-size: 7px;
        --dot-bottom: 3px;
        --dot-size: 6px;
        --bottom-controls-height: 28px;
    }

    .bell-label {
        display: none; /* Hide labels to save vertical space */
    }

    .set-name-label {
        display: none;
    }
}

/* Tablets and larger */
@media screen and (min-width: 768px) {
    :root {
        --bell-gap: 10px;
        --grid-padding: 16px;
        --label-font-size: 12px;
        --dot-size: 10px;
    }
}

/* Prefers reduced motion — disable animations */
@media (prefers-reduced-motion: reduce) {
    .bells-track {
        transition: none;
    }

    .bell-btn--active svg {
        animation: none;
    }

    .set-dot {
        transition: none;
    }
}
