/* Wildwood Live Cams - Styles */

*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

:root {
    --bg-primary: #fafafa;
    --bg-secondary: #ffffff;
    --card-bg: #ffffff;
    --card-border: #e5e5e5;
    --card-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    --card-shadow-hover: 0 4px 12px rgba(0, 0, 0, 0.12);
    --text-primary: #171717;
    --text-secondary: #525252;
    --text-muted: #737373;
    --accent: #0ea5e9;
    --accent-hover: #0284c7;
    --video-bg: #e5e5e5;
    --divider: #e5e5e5;
}

[data-theme="dark"] {
    --bg-primary: #0a0a0a;
    --bg-secondary: #171717;
    --card-bg: #171717;
    --card-border: #262626;
    --card-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    --card-shadow-hover: 0 4px 12px rgba(0, 0, 0, 0.4);
    --text-primary: #fafafa;
    --text-secondary: #a3a3a3;
    --text-muted: #8a8a8a;
    --accent: #38bdf8;
    --accent-hover: #7dd3fc;
    --video-bg: #262626;
    --divider: #262626;
    --logo-glow: rgba(56, 189, 248, 0.3);
    --logo-glow-hover: rgba(56, 189, 248, 0.45);
}

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.5;
    transition: background-color 0.3s ease, color 0.3s ease;
}

a {
    color: var(--accent);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
    transition: color 0.2s ease;
}

a:hover {
    color: var(--accent-hover);
}

/* Header */
header {
    padding: 2rem 1rem 1.5rem;
    text-align: center;
    position: relative;
    border-bottom: 1px solid var(--divider);
    background: var(--bg-secondary);
}

.header-content {
    max-width: 600px;
    margin: 0 auto;
    padding: 0 2.5rem;
}

.header-logo {
    max-width: 420px;
    width: 90%;
    height: auto;
    margin-bottom: 0.5rem;
    filter: drop-shadow(0 0 8px var(--logo-glow, rgba(14, 165, 233, 0.25)));
    transition: filter 0.4s ease;
}

.header-logo:hover {
    filter: drop-shadow(0 0 12px var(--logo-glow-hover, rgba(14, 165, 233, 0.4)));
}

@media (min-width: 640px) {
    .header-logo {
        max-width: 540px;
        width: auto;
    }
}

.theme-toggle {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 44px;
    height: 44px;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.theme-toggle:active {
    transform: scale(0.95);
}

.theme-toggle svg {
    width: 20px;
    height: 20px;
    color: var(--text-secondary);
}

.theme-toggle .sun-icon { display: none; }
.theme-toggle .moon-icon { display: block; }
[data-theme="dark"] .theme-toggle .sun-icon { display: block; }
[data-theme="dark"] .theme-toggle .moon-icon { display: none; }

.subtitle {
    font-size: 1rem;
    color: var(--text-secondary);
}

/* Camera Grid */
.camera-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    padding: 1rem;
    max-width: 1400px;
    margin: 0 auto;
}

@media (min-width: 640px) {
    .camera-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.25rem;
        padding: 1.5rem;
    }
}

@media (min-width: 768px) {
    .camera-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

.camera-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--card-shadow);
    transition: all 0.2s ease;
}

@media (hover: hover) {
    .camera-card:hover {
        box-shadow: var(--card-shadow-hover);
    }
}

.video-container {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    background: var(--video-bg);
    cursor: pointer;
}

.video-container video,
.video-container iframe {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border: none;
    display: block;
}

.video-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-muted);
    font-size: 0.8rem;
}

.loading-spinner {
    width: 24px;
    height: 24px;
    border: 2px solid var(--card-border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.video-error {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: var(--text-muted);
    font-size: 0.8rem;
}

.expand-btn {
    position: absolute;
    bottom: 8px;
    right: 8px;
    width: 36px;
    height: 36px;
    background: rgba(0, 0, 0, 0.6);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.video-container:hover .expand-btn,
.video-container:active .expand-btn {
    opacity: 1;
}

.expand-btn svg {
    width: 18px;
    height: 18px;
    color: white;
}

/* Camera info */
.camera-info {
    padding: 1rem;
}

.camera-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.camera-name {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-primary);
}

.live-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.2rem 0.5rem;
    background: #15803d;
    border-radius: 4px;
    font-size: 0.65rem;
    font-weight: 600;
    color: white;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    flex-shrink: 0;
}

.live-badge::before {
    content: '';
    width: 5px;
    height: 5px;
    background: white;
    border-radius: 50%;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.camera-description {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 0.5rem;
}

.camera-provider {
    font-size: 0.7rem;
    color: var(--text-muted);
    opacity: 0.85;
}

.camera-provider a {
    color: var(--text-muted);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
}

.camera-provider a:hover {
    color: var(--accent);
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    flex-shrink: 0;
}

.modal-title {
    color: white;
    font-weight: 600;
    font-size: 1rem;
}

.modal-close {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close svg {
    width: 24px;
    height: 24px;
    color: white;
}

.modal-video-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 0;
    position: relative;
}

.modal-video-container video,
.modal-video-container iframe {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border: none;
}

/* Footer */
footer {
    text-align: center;
    padding: 2rem 1rem;
    border-top: 1px solid var(--divider);
    background: var(--bg-secondary);
}

.footer-copy {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin: 0.25rem 0;
}

.footer-copy a {
    color: var(--text-secondary);
}

/* Safe areas */
@supports (padding: max(0px)) {
    header { padding-top: max(2rem, env(safe-area-inset-top)); }
    .theme-toggle { top: max(1rem, env(safe-area-inset-top)); }
    footer { padding-bottom: max(2rem, env(safe-area-inset-bottom)); }
    .modal-header { padding-top: max(1rem, env(safe-area-inset-top)); }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

/* CCTV Toggle Button */
.cctv-toggle {
    position: absolute;
    top: 1rem;
    left: 1rem;
    min-height: 44px;
    padding: 0 0.85rem;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    transition: all 0.2s ease;
    font-family: inherit;
}

.cctv-toggle:active {
    transform: scale(0.95);
}

.cctv-toggle svg {
    width: 18px;
    height: 18px;
    color: var(--text-secondary);
}

.cctv-toggle span {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: var(--text-secondary);
    text-transform: uppercase;
}

@supports (padding: max(0px)) {
    .cctv-toggle { top: max(1rem, env(safe-area-inset-top)); }
}

/* CCTV Overlay */
.cctv-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.cctv-overlay.active {
    opacity: 1;
    visibility: visible;
}

.cctv-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0.75rem;
    background: #111;
    border-bottom: 1px solid #222;
    flex-shrink: 0;
    z-index: 10;
}

.cctv-header-left,
.cctv-header-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.cctv-title {
    font-size: 0.75rem;
    font-weight: 700;
    color: #888;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.cctv-rec {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.65rem;
    font-weight: 700;
    color: #ef4444;
    letter-spacing: 0.1em;
}

.cctv-rec::before {
    content: '';
    width: 6px;
    height: 6px;
    background: #ef4444;
    border-radius: 50%;
    animation: pulse 2s ease-in-out infinite;
}

.cctv-time {
    font-size: 0.7rem;
    font-weight: 600;
    color: #666;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.05em;
}

.cctv-layout-btn,
.cctv-close-btn {
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid #333;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
}

.cctv-layout-btn:hover,
.cctv-close-btn:hover {
    background: rgba(255, 255, 255, 0.12);
}

.cctv-layout-btn svg,
.cctv-close-btn svg {
    width: 18px;
    height: 18px;
    color: #999;
}

/* CCTV Grid */
.cctv-grid {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    grid-auto-rows: 1fr;
    gap: 2px;
    padding: 2px;
    min-height: 0;
    background: #000;
}

/* Auto layout: responsive columns */
@media (min-width: 768px) {
    .cctv-grid:not([data-layout]) {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (min-width: 1200px) {
    .cctv-grid:not([data-layout]) {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* 2x2 layout */
.cctv-grid[data-layout="2x2"] {
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: repeat(2, 1fr);
}

/* CCTV Cell */
.cctv-cell {
    position: relative;
    background: #0a0a0a;
    overflow: hidden;
    border: 1px solid #1a1a1a;
}

.cctv-cell video,
.cctv-cell iframe {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border: none;
    display: block;
}

.cctv-label {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 0.4rem 0.5rem;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    pointer-events: none;
}

.cctv-cam-number {
    font-size: 0.6rem;
    font-weight: 700;
    color: #555;
    letter-spacing: 0.08em;
}

.cctv-cam-name {
    font-size: 0.7rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.7);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cctv-live-dot {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    width: 8px;
    height: 8px;
    background: #22c55e;
    border-radius: 50%;
    box-shadow: 0 0 6px rgba(34, 197, 94, 0.6);
    animation: pulse 2s ease-in-out infinite;
}

/* CCTV Hide/Show Button */
.cctv-hide-btn {
    position: absolute;
    top: 0.4rem;
    left: 0.4rem;
    width: 28px;
    height: 28px;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s ease, background 0.2s ease;
    z-index: 5;
}

.cctv-cell:hover .cctv-hide-btn,
.cctv-cell-hidden .cctv-hide-btn {
    opacity: 1;
}

.cctv-hide-btn:hover {
    background: rgba(0, 0, 0, 0.7);
}

.cctv-hide-btn svg {
    width: 16px;
    height: 16px;
    color: rgba(255, 255, 255, 0.7);
}

.cctv-hide-btn .eye-closed { display: none; }
.cctv-hide-btn .eye-open { display: block; }
.cctv-cell-hidden .cctv-hide-btn .eye-closed { display: block; }
.cctv-cell-hidden .cctv-hide-btn .eye-open { display: none; }

/* Hidden camera state */
.cctv-cell-hidden video,
.cctv-cell-hidden iframe {
    opacity: 0;
}

.cctv-cell-hidden .cctv-live-dot {
    background: #666;
    box-shadow: none;
    animation: none;
}

.cctv-cell-hidden .cctv-label {
    background: none;
}

.cctv-cell-hidden .cctv-cam-name {
    color: rgba(255, 255, 255, 0.3);
}

/* Mobile: scrollable vertical list */
@media (max-width: 767px) and (orientation: portrait) {
    .cctv-overlay {
        overflow: hidden;
    }
    .cctv-grid,
    .cctv-grid[data-layout="2x2"] {
        display: flex;
        flex-direction: column;
        gap: 0;
        padding: 0;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    .cctv-cell {
        aspect-ratio: 16 / 9;
        flex-shrink: 0;
        border: none;
        border-bottom: 1px solid #111;
    }
    .cctv-header {
        padding: 0.4rem 0.5rem;
    }
    .cctv-title {
        font-size: 0.65rem;
    }
}

/* Mobile landscape: 2-up grid filling screen */
@media (max-width: 767px) and (orientation: landscape) {
    .cctv-grid,
    .cctv-grid[data-layout="2x2"] {
        grid-template-columns: repeat(2, 1fr);
        grid-auto-rows: 1fr;
    }
    .cctv-cell {
        border: none;
        border-right: 1px solid #111;
        border-bottom: 1px solid #111;
    }
    .cctv-header {
        padding: 0.3rem 0.5rem;
    }
}

/* Screen reader only */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ============================================================ */
/* Per-Cam Landing Pages                                          */
/* ============================================================ */

.cam-page-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--divider);
    background: var(--bg-secondary);
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
}

.cam-page-header .header-logo-link {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    text-decoration: none;
    color: var(--text-primary);
}

.cam-page-header .header-logo-small {
    height: 32px;
    width: auto;
    filter: drop-shadow(0 0 6px var(--logo-glow, rgba(14, 165, 233, 0.2)));
}

.back-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    padding: 0.4rem 0.6rem;
    border-radius: 6px;
    transition: background 0.15s ease, color 0.15s ease;
}

.back-link:hover {
    background: var(--card-bg);
    color: var(--text-primary);
}

.cam-page-header .theme-toggle {
    position: static;
}

.cam-main {
    max-width: 960px;
    margin: 0 auto;
    padding: 1.5rem 1rem 3rem;
}

@media (min-width: 768px) {
    .cam-main {
        padding: 2rem 1.5rem 4rem;
    }
}

.cam-title {
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1.25;
    color: var(--text-primary);
    margin-bottom: 0.4rem;
}

@media (min-width: 768px) {
    .cam-title {
        font-size: 2.25rem;
    }
}

.cam-tagline {
    color: var(--text-secondary);
    font-size: 1rem;
    margin-bottom: 1.5rem;
}

.cam-tagline .live-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    margin-left: 0.5rem;
    padding: 0.15rem 0.55rem;
    background: #16a34a;
    color: white;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    border-radius: 999px;
    vertical-align: 0.15em;
}

.featured-player {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    background: var(--video-bg);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--card-shadow);
    margin-bottom: 1.5rem;
}

.featured-player video,
.featured-player iframe {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border: none;
    display: block;
}

.cam-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem 1.25rem;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--divider);
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.cam-meta strong {
    color: var(--text-primary);
    font-weight: 600;
}

.cam-section {
    margin-bottom: 2rem;
}

.cam-section h2 {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
}

.cam-section p {
    color: var(--text-secondary);
    line-height: 1.65;
    margin-bottom: 0.85rem;
}

.cam-section p:last-child {
    margin-bottom: 0;
}

/* FAQ disclosure */
.cam-faq details {
    border-top: 1px solid var(--divider);
    padding: 0.85rem 0;
}

.cam-faq details:last-child {
    border-bottom: 1px solid var(--divider);
}

.cam-faq summary {
    cursor: pointer;
    font-weight: 600;
    color: var(--text-primary);
    list-style: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.cam-faq summary::-webkit-details-marker {
    display: none;
}

.cam-faq summary::after {
    content: "+";
    font-size: 1.25rem;
    color: var(--text-muted);
    font-weight: 400;
    transition: transform 0.2s ease;
}

.cam-faq details[open] summary::after {
    content: "−";
}

.cam-faq details p {
    margin-top: 0.65rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* "More cams" mini-grid at bottom of cam page */
.more-cams {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid var(--divider);
}

.more-cams h2 {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 1rem;
}

.mini-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 0.6rem;
}

.mini-card {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    padding: 0.75rem 0.85rem;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    text-decoration: none;
    color: var(--text-primary);
    transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.mini-card:hover {
    border-color: var(--accent);
    box-shadow: var(--card-shadow);
    transform: translateY(-1px);
}

.mini-card-name {
    font-weight: 600;
    font-size: 0.9rem;
    line-height: 1.3;
}

.mini-card-loc {
    font-size: 0.78rem;
    color: var(--text-muted);
}

/* Visible homepage H1 (was sr-only). Promotes the keyword for SEO. */
.page-headline {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0.5rem 0 0.25rem;
    line-height: 1.25;
}

@media (min-width: 768px) {
    .page-headline {
        font-size: 1.85rem;
    }
}

.page-intro {
    max-width: 720px;
    margin: 1rem auto 0;
    padding: 0 1rem;
    font-size: 0.95rem;
    color: var(--text-secondary);
    text-align: center;
    line-height: 1.6;
}

/* ============================================================ */
/* UX Audit Pass — Tier 1/2/3 fixes                              */
/* ============================================================ */

/* Tighten phone hero padding so the first cam isn't pushed below the fold. */
@media (max-width: 480px) {
    header {
        padding: 1.25rem 1rem 1rem;
    }
    .header-logo {
        max-width: 320px;
    }
    .page-headline {
        font-size: 1.25rem;
        margin-top: 0.35rem;
    }
    .subtitle {
        font-size: 0.9rem;
    }
    .page-intro {
        font-size: 0.9rem;
        margin-top: 0.75rem;
    }
}

/* Cam page: let the featured player breathe on large monitors so the
   actual cam — the reason visitors are here — isn't dwarfed by the page. */
.cam-main {
    max-width: 100%;
}
.cam-main > * {
    max-width: 960px;
    margin-left: auto;
    margin-right: auto;
}
.cam-main > .featured-player,
.cam-main > .cam-meta {
    max-width: clamp(960px, 78vw, 1280px);
}

/* Featured-player aspect-ratio is forced 16:9. Switch object-fit from
   `cover` (crops) to `contain` (letterboxes on black) so non-16:9 streams
   don't lose top/bottom content. */
.featured-player {
    aspect-ratio: 16 / 9;
    background: #000;
}
.featured-player video,
.featured-player iframe {
    object-fit: contain;
    background: #000;
}

/* Cam-page header — safe-area handling for notched devices. */
@supports (padding: max(0px)) {
    .cam-page-header {
        padding-top: max(1rem, env(safe-area-inset-top));
        padding-left: max(1.25rem, env(safe-area-inset-left));
        padding-right: max(1.25rem, env(safe-area-inset-right));
    }
}

/* Homepage header bottom divider already exists; just make sure it's
   consistent (visual audit flagged inconsistency between the two pages).
   Header already has `border-bottom: 1px solid var(--divider)` — leaving
   it as-is per code; visual flag was a misread. */

/* Tap-to-play overlay surfaced when iOS Low Power Mode (or strict autoplay
   settings) refuse muted autoplay. Big, obvious, easy to hit. */
.tap-to-play {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    background: rgba(0, 0, 0, 0.55);
    color: white;
    border: none;
    cursor: pointer;
    z-index: 6;
    font: inherit;
    font-weight: 600;
}
.tap-to-play svg {
    width: 64px;
    height: 64px;
}
.tap-to-play:hover {
    background: rgba(0, 0, 0, 0.65);
}

/* Retry button rendered inside the .video-error state */
.retry-btn {
    margin-top: 0.6rem;
    padding: 0.5rem 1rem;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 8px;
    font: inherit;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    min-height: 36px;
    transition: background 0.15s ease, transform 0.15s ease;
}
.retry-btn svg {
    width: 16px;
    height: 16px;
}
.retry-btn:hover {
    background: var(--accent-hover);
}
.retry-btn:active {
    transform: scale(0.97);
}
.video-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
}

/* Player action buttons (Share, PiP) below the featured player */
.player-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 0.85rem auto 0;
    max-width: clamp(960px, 78vw, 1280px);
}
.player-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    min-height: 40px;
    padding: 0 0.85rem;
    background: var(--card-bg);
    color: var(--text-primary);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    font: inherit;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;
}
.player-action-btn:hover {
    border-color: var(--accent);
}
.player-action-btn:active {
    transform: scale(0.97);
}
.player-action-btn svg {
    width: 18px;
    height: 18px;
    color: var(--text-secondary);
}

/* Skip-to-content link (keyboard a11y) */
.skip-link {
    position: absolute;
    top: -100px;
    left: 0;
    z-index: 100;
    padding: 0.6rem 1rem;
    background: var(--accent);
    color: white;
    font-weight: 600;
    text-decoration: none;
    border-bottom-right-radius: 8px;
    transition: top 0.15s ease;
}
.skip-link:focus {
    top: 0;
}

/* Focus indicators — keyboard users currently get whatever the browser
   defaults to (often nothing on links/buttons). Make focus visible
   everywhere using :focus-visible so mouse users aren't pelted with rings. */
a:focus-visible,
button:focus-visible,
summary:focus-visible,
[role="button"]:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: 4px;
}
.featured-player video:focus-visible,
.featured-player iframe:focus-visible {
    outline: 3px solid var(--accent);
    outline-offset: -3px;
}

/* Reduce-motion users get static visuals: no spinner rotation, no LIVE
   pulse, no transform-based hover effects. */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
        scroll-behavior: auto !important;
    }
    .loading-spinner {
        animation: none;
        border-top-color: var(--text-muted);
    }
}

/* Mini-card thumbnails — adds posters to the "More Wildwood Live Cams"
   grid so it stops looking like a placeholder. Falls back gracefully if
   the poster file is missing. */
.mini-card {
    padding: 0;
    overflow: hidden;
    background: var(--card-bg);
}
.mini-card-thumb {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 9;
    background: var(--video-bg);
    overflow: hidden;
    position: relative;
}
.mini-card-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}
.mini-card:hover .mini-card-thumb img {
    transform: scale(1.04);
}
.mini-card-meta {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    padding: 0.6rem 0.75rem 0.7rem;
}

/* FAQ row hover — visual affordance that the row is clickable. */
.cam-faq summary {
    padding: 0.15rem 0.4rem;
    margin: -0.15rem -0.4rem;
    border-radius: 6px;
    transition: background 0.12s ease;
}
.cam-faq summary:hover {
    background: var(--bg-secondary);
}
.cam-faq details[open] > summary {
    margin-bottom: 0.25rem;
}

/* Wider tap target on the small back link (keyboard + thumb friendly) */
.back-link {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
}

/* Cam-page tagline LIVE badge — gets a pulsing dot. Scoped to .cam-tagline
   so the homepage's card .live-badge (with its own styling) is untouched. */
.cam-tagline .live-badge {
    /* hide the literal '●' character we render via ::before for animation */
    font-size: 0;
}
.cam-tagline .live-badge::before {
    content: "";
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: white;
    margin-right: 0.35rem;
    box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.7);
    animation: live-pulse 1.6s ease-out infinite;
    vertical-align: 0.1em;
}
.cam-tagline .live-badge::after {
    content: "LIVE";
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: white;
}
@keyframes live-pulse {
    0%   { box-shadow: 0 0 0 0   rgba(255, 255, 255, 0.6); }
    70%  { box-shadow: 0 0 0 7px rgba(255, 255, 255, 0); }
    100% { box-shadow: 0 0 0 0   rgba(255, 255, 255, 0); }
}

/* Cam-page header on phones: stack neatly, shrink logo, keep tap targets */
@media (max-width: 480px) {
    .cam-page-header {
        gap: 0.25rem;
        padding-left: 0.85rem;
        padding-right: 0.85rem;
    }
    .cam-page-header .header-logo-small {
        height: 26px;
    }
    .back-link {
        font-size: 0.85rem;
        padding-left: 0.4rem;
        padding-right: 0.4rem;
    }
    .cam-title {
        font-size: 1.5rem;
    }
    .cam-tagline {
        font-size: 0.95rem;
    }
}

/* Player actions: align with the (now wider) player container; on phones,
   make share/PiP buttons full-width-distributed. */
@media (max-width: 600px) {
    .player-actions {
        padding: 0 1rem;
    }
    .player-action-btn {
        flex: 1 1 auto;
        justify-content: center;
    }
}

/* Mini pill badge that doubles as credit and "hire me" CTA. Sits below
   the hero on homepage and below the tagline on cam pages. */
.builder-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    margin-top: 0.65rem;
    padding: 0.3rem 0.75rem;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 9999px;
    font-size: 0.72rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-decoration: none;
    line-height: 1.4;
    white-space: nowrap;
    transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;
}
.builder-badge:hover {
    border-color: var(--accent);
    background: var(--bg-secondary);
    transform: translateY(-1px);
    text-decoration: none;
    color: var(--text-secondary);
}
.builder-badge-credit {
    color: var(--text-muted);
}
.builder-badge-dot {
    color: var(--text-muted);
    opacity: 0.5;
}
.builder-badge-cta {
    color: var(--accent);
    font-weight: 600;
}
.builder-badge-arrow {
    width: 11px;
    height: 11px;
    color: var(--accent);
    transition: transform 0.15s ease;
}
.builder-badge:hover .builder-badge-arrow {
    transform: translate(1px, -1px);
}
/* On phones, drop the credit half so the pill stays one comfortable line */
@media (max-width: 520px) {
    .builder-badge-credit,
    .builder-badge-dot {
        display: none;
    }
}
.cam-tagline + .builder-badge {
    margin-top: 0.35rem;
    margin-bottom: 1rem;
}
