/* Main site styles for Band of Echoes */
:root {
    --bg: #0c0c0c;
    --fg: #e7e7e7;
    --muted: #9a9a9a;
    --accent: #d4af37;
    --card: #141414;
    --border: #262626;
    --maxw: 1120px;
}

* {
    box-sizing: border-box;
}

html,
body {
    height: 100%;
}

body {
    margin: 0;
    font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg);
    color: var(--fg);
    line-height: 1.45;
}

/* Portrait lock overlay (shown when user rotates phone to landscape) */
.rotate-lock-overlay {
    position: fixed;
    inset: 0;
    background: #000;
    color: #fff;
    display: none;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    text-align: center;
    padding: 40px 24px;
    z-index: 999999;
    font-family: inherit;
}

.rotate-lock-overlay .icon {
    font-size: 72px;
    line-height: 1;
    margin-bottom: 28px;
    opacity: .85;
}

.rotate-lock-overlay p {
    margin: 0;
    font-size: 18px;
    letter-spacing: .5px;
}

/* Only activate on small touch screens */
@media (max-width: 900px) and (orientation: landscape) {
    body.portrait-only .rotate-lock-overlay {
        display: flex;
    }

    body.portrait-only main,
    body.portrait-only header,
    body.portrait-only footer {
        filter: blur(4px);
        pointer-events: none;
        user-select: none;
    }
}

a {
    color: var(--fg);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* Buttons: highlight the button, never underline the text */
.btn:hover,
.btn:focus {
    text-decoration: none;
}

.btn {
    cursor: pointer;
}

.btn:hover {
    background: #202020;
    border-color: #333;
}

header {
    position: sticky;
    top: 0;
    z-index: 50000;
    backdrop-filter: blur(6px);
    background: color-mix(in oklab, var(--bg) 80%, transparent);
    border-bottom: 1px solid var(--border);
}

.wrap {
    max-width: var(--maxw);
    margin: 0 auto;
    padding: 0 clamp(32px, 6vw, 96px);
}

/* Give the header extra breathing room on all screens */
header .wrap {
    padding: 0 clamp(40px, 6vw, 96px);
}

.bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 0;
    min-height: 56px;
}

.brand {
    display: flex;
    align-items: baseline;
    gap: 10px;
}

.brand h1 {
    margin: 0;
    font-weight: 400;
    letter-spacing: .01em;
}

.brand small {
    color: var(--muted);
    font-size: 12px;
    letter-spacing: .4px;
}

/* legacy inline nav (kept minimal) */
nav a {
    margin-left: 16px;
    color: var(--muted);
}

nav a.active,
nav a:hover {
    color: var(--fg);
}

/* hamburger dropdown nav */
.nav {
    position: relative;
}

.hamburger {
    display: flex;
    flex-direction: column;
    gap: 4px;
    align-items: center;
    justify-content: center;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: transparent;
    color: var(--fg);
    cursor: pointer;
    transition: background .15s ease, border-color .15s ease, transform .15s ease;
}

.hamburger span {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--fg);
}

.hamburger:hover,
.hamburger:focus-visible {
    background: #1b1b1b;
    border-color: #333;
    transform: translateY(-1px);
}

.hamburger:hover span,
.hamburger:focus-visible span {
    opacity: 0.95;
}

.menu {
    position: absolute;
    right: 0;
    top: calc(100% + 10px);
    background: #111;
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, .5);
    min-width: 180px;
    padding: 8px;
    display: none;
    z-index: 60000;
}

.menu.open {
    display: block;
}

.menu a {
    display: block;
    padding: 10px 12px;
    border-radius: 8px;
    color: var(--fg);
}

.menu a:hover {
    background: #1b1b1b;
    text-decoration: none;
}

.hero {
    padding: 24px 0 0;
}

.grid {
    display: grid;
}

.video-card,
.card {
    background: transparent;
    border: 0;
    border-radius: 0;
    overflow: hidden;
    width: 100%;
}

.pad {
    padding: 16px;
}

.section {
    padding: 24px 0;
    scroll-margin-top: 80px;
}

/* Tighter spacing between About → Support → Contact */
#about.section {
    padding-top: 6px;
    padding-bottom: 6px;
}

#support.section {
    padding-top: 6px;
    padding-bottom: 12px;
}

#contact.section {
    padding-top: 12px;
}

/* Keep collage from overlapping the hero */
#watch {
    overflow: visible;
    padding-bottom: 40px;
}

/* Tighten gap between About (quote) and Polaroids */
#about .pad {
    padding-bottom: 8px;
}

#about .pad>*:last-child {
    margin-bottom: 0;
}

#watch.section {
    padding-top: 8px;
}

.video-frame {
    aspect-ratio: 16/9;
    width: 100%;
    display: block;
    border: 0;
}

.video-title {
    margin: 8px 0 0;
    font-size: 16px;
    color: var(--muted);
}

.cols {
    display: grid;
    grid-template-columns: 1fr;
}

.list {
    display: grid;
    gap: 12px;
    align-content: start;
}

.list>* {
    width: 100%;
}

.muted {
    color: var(--muted);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 14px;
    border-radius: 10px;
    border: 0;
    background: #1b1b1b;
    color: var(--fg);
    text-decoration: none;
    font-weight: 600;
}

.btn:hover {
    background: #202020;
}

.btn.primary {
    background: var(--fg);
    color: #111;
}

.btn.primary:hover {
    filter: brightness(0.95);
}

footer {
    border-top: 1px solid var(--border);
    margin-top: 40px;
}

.foot {
    padding: 22px 0;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    justify-content: space-between;
}

.quote {
    font-style: italic;
    color: var(--fg);
    border-left: 3px solid var(--border);
    padding-left: 12px;
}

/* Title face in header */
header .wrap> :first-child,
header .brand,
header .brand a,
header h1,
header h1 a,
header .site-title,
header .logo {
    font-family: 'Optimus Princeps', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
    font-weight: 400;
    letter-spacing: .02em;
}

.kpi {
    display: flex;
    gap: 14px;
    align-items: center;
    flex-wrap: wrap;
}

.kpi .pill {
    border: 0;
    border-radius: 999px;
    padding: 6px 10px;
    color: var(--muted);
}

@font-face {
    font-family: 'Optimus Princeps';
    src: url('../fonts/OptimusPrinceps.ttf') format('opentype');
    font-weight: 400;
    font-style: normal;
    font-display: swap
}

/* Global focus & skip */
.skip {
    position: absolute;
    left: -9999px;
    top: auto;
    width: auto;
    height: auto;
    overflow: hidden;
}

.skip:focus {
    left: 16px;
    top: 16px;
    background: #111;
    border: 1px solid var(--border);
    padding: 8px 10px;
    border-radius: 8px;
    z-index: 100000;
}

/* Visually hide headings but keep for a11y/SEO */
.visually-hidden {
    position: absolute !important;
    clip: rect(1px, 1px, 1px, 1px);
    clip-path: inset(50%);
    width: 1px;
    height: 1px;
    overflow: hidden;
    white-space: nowrap;
    border: 0;
    padding: 0;
    margin: -1px;
}

/* Header shadow on scroll */
body.scrolled header {
    box-shadow: 0 1px 0 rgba(255, 255, 255, .06), 0 8px 20px rgba(0, 0, 0, .35);
}

/* Click-to-play hero */
.player {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    background: #111
}

.poster {
    position: relative;
    display: block;
    aspect-ratio: 16/9;
    width: 100%;
}

.poster img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block
}

.play-btn {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center
}

.play-btn .triangle {
    width: 0;
    height: 0;
    border-left: 26px solid #fff;
    border-top: 16px solid transparent;
    border-bottom: 16px solid transparent;
    filter: drop-shadow(0 6px 16px rgba(0, 0, 0, .5))
}

.poster:hover .triangle {
    filter: drop-shadow(0 8px 22px rgba(0, 0, 0, .7))
}

.hero-cta {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 12px
}

.menu a:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px
}

/* Collage (polaroid-style) */
.collage {
    position: relative;
    display: grid;
    --ps: 1;
    /* smaller, back to original scale */
    grid-template-columns: repeat(5, minmax(0, 1fr));
    /* 5 per row */
    gap: 0;
    /* no grid gaps; overlap via transforms */
    border: 0;
    border-radius: 0;
    padding: 0;
    background: transparent;
    overflow: visible;
    /* allow overlap from transforms */
}

.polaroid {
    position: relative;
    margin: 2px;
    background: transparent;
    color: inherit;
    border-radius: 0;
    padding: 0;
    box-shadow: 0 14px 36px rgba(0, 0, 0, .35);
    will-change: transform, filter;
    /* JS sets scatter to --tx/--ty; user drag adds --ux/--uy */
    --tx: 0px;
    --ty: 0px;
    --ux: 0px;
    --uy: 0px;
    --rot: 0deg;
    transform-origin: 50% 60%;
    transform: translate3d(calc(var(--tx) + var(--ux)), calc(var(--ty) + var(--uy)), 0) rotate(var(--rot)) scale(var(--ps, 1));
    transition: transform .18s ease, box-shadow .18s ease, filter .18s ease;
    cursor: grab;
    user-select: none;
    touch-action: none;
}

.polaroid.dragging {
    cursor: grabbing;
    transition: none !important;
}

.polaroid.rotating {
    transition: none !important;
}

.polaroid:focus-visible {
    transform: translate3d(calc(var(--tx) + var(--ux)), calc(var(--ty) + var(--uy)), 0) rotate(var(--rot)) scale(calc(var(--ps, 1) * 1.02));
    filter: brightness(1.03);
    box-shadow: 0 18px 44px rgba(0, 0, 0, .45);
}

.polaroid img {
    width: 100%;
    height: auto;
    aspect-ratio: 1500 / 1844;
    object-fit: cover;
    border-radius: 4px;
    display: block;
    -webkit-user-drag: none;
    user-select: none;
    -webkit-touch-callout: none;
}

/* rotation knob */
.polaroid .rotor {
    position: absolute;
    right: -6px;
    top: -6px;
    width: 28px;
    height: 28px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: #111;
    color: var(--fg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    line-height: 1;
    opacity: 0;
    pointer-events: none;
    transition: opacity .15s ease, transform .15s ease, background .15s ease;
    cursor: grab;
    touch-action: none;
    user-select: none;
}

.polaroid:hover .rotor {
    opacity: .9;
    pointer-events: auto;
}

.polaroid .rotor:active {
    cursor: grabbing;
}

/* Hide controls while interacting (dragging/rotating) even if hovered */
.polaroid.dragging .rotor,
.polaroid.rotating .rotor {
    opacity: 0 !important;
    pointer-events: none;
}

/* Invisible rotor for grouped segments (JS sets aria-hidden="true") */
.polaroid .rotor[aria-hidden="true"] {
    opacity: 0 !important;
    pointer-events: none !important;
}

/* flip button */
.polaroid .flipper {
    position: absolute;
    left: -10px;
    bottom: -10px;
    transform: none;
    width: 28px;
    height: 28px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: #111;
    color: var(--fg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    line-height: 1;
    opacity: 0;
    pointer-events: none;
    transition: opacity .15s ease, background .15s ease;
    cursor: pointer;
    touch-action: none;
    user-select: none;
    z-index: 5;
    /* keep above polaroid inner content */
}

.polaroid:hover .flipper {
    opacity: .9;
    pointer-events: auto;
}

/* Center the cut icon (scissors) when tile is grouped */
.polaroid .flipper.is-cut {
    left: 50%;
    top: 50%;
    bottom: auto;
    transform: translate(-50%, -50%);
}

.polaroid .flipper:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* Hide flipper while interacting */
.polaroid.dragging .flipper,
.polaroid.rotating .flipper {
    opacity: 0 !important;
    pointer-events: none;
}

/* Persist controls when JS adds .touch-show-controls (used on touch devices) */
.polaroid.touch-show-controls .rotor,
.polaroid.touch-show-controls .flipper {
    opacity: .9;
    pointer-events: auto;
}

/* flip structure */
.polaroid-inner {
    position: relative;
    perspective: 900px;
    display: block;
}

.polaroid-inner .stage {
    position: relative;
    width: 100%;
    aspect-ratio: 1500 / 1844;
    transform-style: preserve-3d;
    transition: transform .35s ease;
}

.polaroid[data-flipped="1"] .polaroid-inner .stage {
    transform: rotateY(180deg);
}

.polaroid .face {
    position: absolute;
    inset: 0;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    border-radius: 4px;
    overflow: hidden;
}

.polaroid .face.front {
    transform: rotateY(0deg);
    z-index: 2;
}

.polaroid .face.back {
    transform: rotateY(180deg);
    background: #f3f1e7;
}

.polaroid .face.back img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    image-rendering: auto;
}

/* slight rotation variation without JS */
.polaroid:nth-child(6n+1) {
    --rot: -2.2deg;
}

.polaroid:nth-child(6n+2) {
    --rot: 1.2deg;
}

.polaroid:nth-child(6n+3) {
    --rot: -1.4deg;
}

.polaroid:nth-child(6n+4) {
    --rot: .8deg;
}

.polaroid:nth-child(6n+5) {
    --rot: -0.6deg;
}

.polaroid:nth-child(6n) {
    --rot: 1.6deg;
}

/* Lightbox */
.lightbox {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .8);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2147483000;
    padding: 24px;
}

.lightbox.open {
    display: flex;
}

.lightbox img {
    max-width: min(92vw, var(--maxw));
    max-height: 90vh;
    border-radius: 8px;
    box-shadow: 0 18px 64px rgba(0, 0, 0, .6);
}

.lightbox-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: rgba(0, 0, 0, .6);
    border: 1px solid var(--border);
    color: var(--fg);
    padding: 8px 12px;
    border-radius: 10px;
    font-size: 20px;
    cursor: pointer;
}

.lightbox-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, .6);
    border: 1px solid var(--border);
    color: var(--fg);
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 26px;
    cursor: pointer
}

.lightbox-arrow:hover {
    background: rgba(0, 0, 0, .8)
}

.lightbox-arrow.prev {
    left: 16px
}

.lightbox-arrow.next {
    right: 16px
}

.lightbox-close:hover {
    background: rgba(0, 0, 0, .8);
}

/* Email form */
form {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px;
}

input[type=email] {
    padding: 10px 12px;
    border-radius: 10px;
    border: 0;
    background: #0f0f0f;
    color: var(--fg);
}

.fine {
    font-size: 12px;
    color: var(--muted);
}

/* Mobile: tighter side gutters + align collage */
@media (max-width: 520px) {
    .wrap {
        padding-left: 12px;
        padding-right: 12px;
    }

    header .wrap {
        padding-left: 12px;
        padding-right: 12px;
    }

    /* Remove inner horizontal padding so cards align with hero edges */
    .pad {
        padding-block: 16px;
        padding-left: 0;
        padding-right: 0;
    }

    /* Collage: left-align and drop any JS scatter on small screens */
    #watch .collage {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        justify-content: start;
    }

    /* Allow dragging: don't freeze custom properties with !important.
         We just set a tighter base margin; JS will manage --tx/--ty/--ux/--uy/--rot */
    #watch .polaroid {
        margin: 2px 2px;
    }
}

/* Utility classes */
.text-justify {
    text-align: justify;
    text-justify: inter-word;
}