:root {
    /* Brand palette — becomes the free Bootstrap theme's tokens (see scope Maybe/Future). */
    --gum-red: #b23446;       /* gum red — background */
    --tooth-pearl: #EAE0C8;  /* pearl — every tooth (the active tooth is shown by being clean, not by color) */
    --toothpaste-mint: #A1FBE9; /* logo/accent — used to tint the brushing suds */
}

html, body {
    margin: 0;
    padding: 0;
    overflow-x: hidden;
}

html {
    font-size: 14px;
    position: relative;
    min-height: 100%;
    background-color: var(--gum-red);
}

@media (min-width: 768px) {
    html {
        font-size: 16px;
    }
}

body {
    background-color: transparent;
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
    box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
    color: var(--bs-secondary-color);
    text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
    text-align: start;
}

#menu-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background-image: url("../images/background.png");
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    z-index: 100;
    transition: transform 500ms ease-in-out;
}

#menu-container.menu-hidden {
    transform: translateY(-100vh);
}

body.menu-open {
    overflow: hidden;
}

#menu-spacer {
    height: 100vh;
    transition: height 500ms ease-in-out;
}

.menu-hidden ~ #menu-spacer {
    height: 0;
}

#teeth-btn {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 44px;
    z-index: 90;
    border: none;
    background-color: var(--tooth-pearl);
    color: var(--gum-red);
    font-size: 0.875rem;
    font-weight: bold;
    letter-spacing: 0.15em;
    cursor: pointer;
    opacity: 0;
    pointer-events: none;
    transition: opacity 300ms ease;
}

#teeth-btn.visible {
    opacity: 1;
    pointer-events: auto;
}

#teeth-btn:hover {
    filter: brightness(1.15);
}

#teeth-btn:focus-visible {
    outline: 2px solid var(--tooth-pearl);
    outline-offset: -2px;
}

.menu-section {
    position: relative;
    width: 100%;
    height: 50%;
    overflow: hidden;
}

#closed-top,
#closed-bottom,
#open-top,
#open-bottom {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    display: block;
}

#open-top,
#open-bottom {
    display: none;
}

@media (max-width: 700px) {
    #closed-top,
    #closed-bottom {
        display: none;
    }
    #open-top,
    #open-bottom {
        display: block;
    }
}

.tooth {
    cursor: pointer;
    color: var(--tooth-pearl);
    touch-action: manipulation;   /* no double-tap zoom — keeps the two-tap a clean two-tap */
}

.tooth-inner {
    transition: filter 120ms ease-out;
}

.tooth:hover .tooth-inner,
.tooth:focus-visible .tooth-inner {
    filter: brightness(1.15) drop-shadow(0 0 6px rgba(255, 255, 255, 0.6));
}

.tooth:focus {
    outline: none;
}

/* While the brushing beat plays, lock out further tooth clicks/hover (incl. htmx). */
#menu-container.is-brushing .tooth {
    pointer-events: none;
}

.dirt-overlay {
    image-rendering: pixelated;
    pointer-events: none;
}

#brush-container {
    position: fixed;
    pointer-events: none;
    z-index: 50;
    transform-origin: 0% 100%;
}

/* Bob wrapper carries the bounce so the sprite AND label move together; the label
   positions/sizes against it (longest viewport axis, height from the sprite). */
#brush-bob {
    position: relative;
    width: max(100vw, 100vh);   /* longest axis keeps the brush proportional in portrait */
}

#brush-sprite {
    display: block;
    width: 100%;
    height: auto;
    image-rendering: pixelated;
}

#brush-label {
    position: absolute;
    /* left/top set per-hover from BRUSH_ANCHOR (menu.js); transform keeps it
       upright + centers it on that point. */
    z-index: 51;
    transform-origin: center;
    color: var(--tooth-pearl);
    font-size: 2rem;
    font-weight: bold;
    letter-spacing: 0.1em;
    opacity: 0.85;
    white-space: nowrap;
}

#brush-container.bouncing #brush-bob {
    animation: brush-bounce 600ms ease-in-out infinite;
}

@keyframes brush-bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(var(--bounce-amp, -15px)); }
}

/* Brushing: the horizontal cousin of the bounce — a tight in-place L-R scrub.
   Symmetric, so the container's X flip needs no sign correction. */
#brush-container.brushing #brush-bob {
    animation: brush-scrub 200ms ease-in-out infinite;
}

@keyframes brush-scrub {
    0%, 100% { transform: translateX(calc(-1 * var(--scrub-amp, 10px))); }
    50% { transform: translateX(var(--scrub-amp, 10px)); }
}

.suds-sprite {
    position: fixed;
    width: 200px;
    height: 200px;
    pointer-events: none;
    /* Below the brush (#brush-container z 50), above the teeth — suds foam under
       the brush. Requires the suds to live inside #menu-container (see playSuds). */
    z-index: 40;
    transform: translate(-50%, -50%);
    background-color: var(--toothpaste-mint);
    -webkit-mask: url("../images/suds.png") center / contain no-repeat;
    mask: url("../images/suds.png") center / contain no-repeat;
}

.suds-sprite.sweeping {
    animation: suds-sweep 500ms ease-out forwards;
}

@keyframes suds-sweep {
    0% { opacity: 0; transform: translate(-50%, -50%) scale(0.4); }
    40% { opacity: 1; }
    100% { opacity: 0; transform: translate(-50%, -50%) scale(1.3); }
}

@media (prefers-reduced-motion: reduce) {
    #menu-container { transition-duration: 0ms; }
    #menu-spacer { transition-duration: 0ms; }
    #teeth-btn { transition-duration: 0ms; }
    #brush-container.bouncing #brush-bob { animation: none; }
    #brush-container.brushing #brush-bob { animation: none; }
    .suds-sprite.sweeping { animation: none; opacity: 1; }
}

#main-content-container {
    position: relative;
    background-color: transparent;
}

/* ---- Page sections ---- */

.ts-hero {
    padding: 4rem 1rem;
    text-align: left;
    color: var(--tooth-pearl);
}

.ts-hero-title {
    /* 50% larger than the previous 2.5rem */
    font-size: 3.75rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
}

.ts-hero-desc {
    font-size: 1.25rem;
    opacity: 0.85;
    max-width: 600px;
    margin: 0; /* left-aligned */
}

.ts-section {
    padding: 3rem 1rem;
    color: var(--tooth-pearl);
    max-width: 800px;
    margin: 0 auto;
}

.ts-section h2 {
    font-size: 1.75rem;
    margin-bottom: 1.5rem;
}

.ts-interactive {
    padding: 3rem 1rem;
    color: var(--tooth-pearl);
    max-width: 1000px;
    margin: 0 auto;
}

.ts-interactive h2 {
    text-align: center;
    font-size: 1.75rem;
    margin-bottom: 1.5rem;
}

/* ---- Gallery ---- */

.ts-gallery {
    padding: 3rem 1rem;
    color: var(--tooth-pearl);
}

.ts-gallery h2 {
    text-align: center;
    font-size: 1.75rem;
    margin-bottom: 1.5rem;
}

.ts-gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
    max-width: 1000px;
    margin: 0 auto;
}

.ts-gallery-thumb {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    border-radius: 4px;
    cursor: pointer;
    transition: transform 150ms ease, box-shadow 150ms ease;
}

.ts-gallery-thumb:hover,
.ts-gallery-thumb:focus-visible {
    transform: scale(1.03);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.ts-gallery-thumb:focus {
    outline: none;
}

.ts-carousel {
    max-width: 900px;
    margin: 0 auto;
}

.ts-carousel .carousel-inner img {
    max-height: 500px;
    object-fit: contain;
}

/* ---- Lightbox ---- */

#ts-lightbox .modal-content {
    background: rgba(0, 0, 0, 0.92);
    border: none;
    position: relative;
    padding: 1rem;
}

#ts-lightbox .btn-close {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    z-index: 3;
}

#ts-lightbox .ts-lightbox-img {
    max-height: 80vh;
    width: 100%;
    object-fit: contain;
}

#ts-lightbox .ts-lightbox-prev,
#ts-lightbox .ts-lightbox-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.15);
    color: white;
    border: none;
    font-size: 2rem;
    padding: 0.5rem 1rem;
    cursor: pointer;
    border-radius: 4px;
    transition: background 150ms;
}

#ts-lightbox .ts-lightbox-prev:hover,
#ts-lightbox .ts-lightbox-next:hover {
    background: rgba(255, 255, 255, 0.3);
}

#ts-lightbox .ts-lightbox-prev { left: 0.5rem; }
#ts-lightbox .ts-lightbox-next { right: 0.5rem; }

#ts-lightbox .ts-lightbox-caption {
    text-align: center;
    color: var(--tooth-pearl);
    opacity: 0.8;
    padding: 0.75rem 0 0;
    margin: 0;
}

/* ---- Video ---- */

.ts-video {
    padding: 3rem 1rem;
    color: var(--tooth-pearl);
}

.ts-video h2 {
    text-align: center;
    font-size: 1.75rem;
    margin-bottom: 1.5rem;
}

.ts-video-wrap {
    max-width: 800px;
    margin: 0 auto;
}

.ts-video-caption {
    text-align: center;
    opacity: 0.7;
    margin-top: 0.75rem;
}
