/* =========================================================
   filmmaking page: hero, explore grid, about, reels viewer
   ========================================================= */

.film-hero {
    padding: 40px 0 36px;
}

.film-logo {
    width: min(420px, 80vw);
    height: auto;
    margin-bottom: 8px;
    animation: logo-float 5s ease-in-out infinite;
}

.film-headline {
    font-size: clamp(28px, 5vw, 48px);
    font-weight: 800;
    margin-bottom: 8px;
}

.film-tagline {
    color: #aaaaaa;
    max-width: 620px;
    margin: 0 auto 22px;
    line-height: 1.9;
}

/* ---------- camera viewfinder (recording) around the hero ---------- */

.rec-frame {
    position: relative;
    max-width: 840px;
    margin: 0 auto 28px;
    padding: 70px 56px 64px;
    border-radius: 22px;
    background:
        radial-gradient(ellipse at center, rgba(255, 107, 71, 0.07), transparent 70%),
        rgba(255, 255, 255, 0.015);
    overflow: hidden;
    transition: box-shadow 0.6s ease;
}

.rec-frame.is-recording {
    animation: rec-glow 2s ease-in-out infinite;
}

@keyframes rec-glow {
    0%, 100% { box-shadow: inset 0 0 0 1px rgba(255, 59, 59, 0.15); }
    50% { box-shadow: inset 0 0 0 1px rgba(255, 59, 59, 0.45), 0 0 40px -12px rgba(255, 59, 59, 0.35); }
}

/* shutter flash when "recording" starts */
.rec-flash {
    position: absolute;
    inset: 0;
    z-index: 5;
    background: #ffffff;
    opacity: 0;
    pointer-events: none;
}

.rec-frame.is-recording .rec-flash {
    animation: rec-flash 0.7s ease-out;
}

@keyframes rec-flash {
    0% { opacity: 0.55; }
    100% { opacity: 0; }
}

/* rule-of-thirds grid */
.rec-grid {
    position: absolute;
    inset: 0;
    pointer-events: none;
    background:
        linear-gradient(90deg, transparent calc(33.33% - 0.5px), rgba(255, 255, 255, 0.07) calc(33.33% - 0.5px), rgba(255, 255, 255, 0.07) calc(33.33% + 0.5px), transparent calc(33.33% + 0.5px),
                               transparent calc(66.66% - 0.5px), rgba(255, 255, 255, 0.07) calc(66.66% - 0.5px), rgba(255, 255, 255, 0.07) calc(66.66% + 0.5px), transparent calc(66.66% + 0.5px)),
        linear-gradient(0deg, transparent calc(33.33% - 0.5px), rgba(255, 255, 255, 0.07) calc(33.33% - 0.5px), rgba(255, 255, 255, 0.07) calc(33.33% + 0.5px), transparent calc(33.33% + 0.5px),
                              transparent calc(66.66% - 0.5px), rgba(255, 255, 255, 0.07) calc(66.66% - 0.5px), rgba(255, 255, 255, 0.07) calc(66.66% + 0.5px), transparent calc(66.66% + 0.5px));
    animation: rec-fade-in 1s ease 0.4s backwards;
}

@keyframes rec-fade-in {
    from { opacity: 0; }
}

.rec-corner {
    position: absolute;
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.8);
    transition: border-color 0.5s ease;
    animation: rec-corner-in 1.2s var(--ease-spring) 0.2s backwards;
}

.rec-corner.tl { top: 16px; right: 16px; border-left: 0; border-bottom: 0; border-top-right-radius: 10px; }
.rec-corner.tr { top: 16px; left: 16px; border-right: 0; border-bottom: 0; border-top-left-radius: 10px; }
.rec-corner.bl { bottom: 16px; right: 16px; border-left: 0; border-top: 0; border-bottom-right-radius: 10px; }
.rec-corner.br { bottom: 16px; left: 16px; border-right: 0; border-top: 0; border-bottom-left-radius: 10px; }

.rec-frame.is-recording .rec-corner {
    border-color: rgba(255, 82, 82, 0.9);
}

@keyframes rec-corner-in {
    from { opacity: 0; transform: scale(2.4); }
}

.rec-hud {
    position: absolute;
    right: 70px;
    left: 70px;
    z-index: 2;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    direction: ltr;
    color: rgba(255, 255, 255, 0.78);
    font-family: Consolas, 'Courier New', monospace;
    font-size: 13px;
    letter-spacing: 1px;
    animation: rec-fade-in 0.8s ease 0.8s backwards;
}

.rec-top { top: 22px; }
.rec-bottom { bottom: 22px; color: rgba(255, 255, 255, 0.55); font-size: 12px; }

.rec-state {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-width: 72px;
    font-weight: 700;
    color: #b5b5b5;
}

.rec-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #6b6b6b;
    transition: background 0.3s ease, box-shadow 0.3s ease;
}

.rec-frame.is-recording .rec-state {
    color: #ff5252;
}

.rec-frame.is-recording .rec-dot {
    background: #ff3b3b;
    box-shadow: 0 0 12px #ff3b3b;
    animation: rec-blink 1s steps(1) infinite;
}

@keyframes rec-blink {
    50% { opacity: 0.15; }
}

.rec-time {
    padding: 3px 10px;
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.45);
    font-variant-numeric: tabular-nums;
}

.rec-frame.is-recording .rec-time {
    color: #ffffff;
}

.rec-battery i {
    color: #4ade80;
}

/* audio level meters */
.rec-meter {
    position: absolute;
    top: 50%;
    left: 26px;
    z-index: 2;
    display: grid;
    grid-template-columns: auto auto;
    gap: 4px;
    translate: 0 -50%;
    direction: ltr;
    animation: rec-fade-in 0.8s ease 1s backwards;
}

.rec-meter small {
    grid-column: 1 / -1;
    color: rgba(255, 255, 255, 0.45);
    font-family: Consolas, monospace;
    font-size: 10px;
    text-align: center;
    word-spacing: 2px;
}

.rec-meter-col {
    position: relative;
    display: flex;
    flex-direction: column-reverse;
    gap: 3px;
}

.rec-meter-col i {
    display: block;
    width: 8px;
    height: 6px;
    border-radius: 2px;
    background: #4ade80;
}

.rec-meter-col i:nth-child(n + 5) { background: #facc15; }
.rec-meter-col i:nth-child(n + 7) { background: #ef4444; }

/* a dark curtain hides the top bars; its height jumps around like real audio */
.rec-meter-col::after {
    content: '';
    position: absolute;
    top: -1px;
    left: -1px;
    right: -1px;
    height: 70%;
    background: rgba(11, 11, 11, 0.86);
    animation: rec-level 1.3s steps(1) infinite;
}

.rec-meter-col:nth-child(2)::after {
    animation-duration: 1.1s;
    animation-delay: -0.4s;
}

.rec-frame:not(.is-recording) .rec-meter-col::after {
    height: 100%;
    animation: none;
}

@keyframes rec-level {
    0% { height: 55%; }
    12% { height: 30%; }
    25% { height: 45%; }
    37% { height: 12%; }
    50% { height: 38%; }
    62% { height: 22%; }
    75% { height: 50%; }
    87% { height: 8%; }
}

/* autofocus box: hunts around, then locks (turns green) */
.rec-focus {
    position: absolute;
    z-index: 2;
    width: 130px;
    height: 100px;
    top: 30%;
    left: 50%;
    translate: -50% -50%;
    pointer-events: none;
    opacity: 0;
    --c: rgba(255, 255, 255, 0.9);
    background:
        linear-gradient(var(--c), var(--c)) top left / 18px 2px,
        linear-gradient(var(--c), var(--c)) top left / 2px 18px,
        linear-gradient(var(--c), var(--c)) top right / 18px 2px,
        linear-gradient(var(--c), var(--c)) top right / 2px 18px,
        linear-gradient(var(--c), var(--c)) bottom left / 18px 2px,
        linear-gradient(var(--c), var(--c)) bottom left / 2px 18px,
        linear-gradient(var(--c), var(--c)) bottom right / 18px 2px,
        linear-gradient(var(--c), var(--c)) bottom right / 2px 18px;
    background-repeat: no-repeat;
}

.rec-frame.is-recording .rec-focus {
    animation: rec-autofocus 9s var(--ease-out) infinite;
}

@keyframes rec-autofocus {
    0% { opacity: 0; top: 38%; left: 30%; transform: scale(1.4); --c: rgba(255, 255, 255, 0.9); }
    8% { opacity: 1; }
    16% { top: 30%; left: 64%; transform: scale(1.1); }
    26% { top: 42%; left: 44%; transform: scale(1.25); }
    34% { top: 33%; left: 50%; transform: scale(1); --c: rgba(255, 255, 255, 0.9); }
    38% { transform: scale(0.92); --c: #4ade80; }
    42%, 70% { opacity: 1; top: 33%; left: 50%; transform: scale(1); --c: #4ade80; }
    80%, 100% { opacity: 0; top: 33%; left: 50%; --c: #4ade80; }
}

@property --c {
    syntax: '<color>';
    inherits: false;
    initial-value: rgba(255, 255, 255, 0.9);
}

@media (max-width: 767.98px) {
    .rec-frame {
        padding: 62px 18px 56px;
    }

    .rec-hud {
        right: 46px;
        left: 46px;
        font-size: 11px;
    }

    .rec-spec,
    .rec-bottom span:nth-child(2),
    .rec-bottom span:nth-child(3),
    .rec-meter {
        display: none;
    }
}

.film-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
}

.film-count {
    margin-top: 14px;
    color: #8a8a8a;
    font-size: 14px;
}

/* ---------- explore grid (Instagram-style) ---------- */

.explore-container {
    max-width: 980px;
}

.explore-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-auto-flow: dense;
    gap: 4px;
}

/* every block of five: one tall tile, alternating sides */
.explore-tile:nth-child(10n + 3) {
    grid-column: 3;
    grid-row: span 2;
}

.explore-tile:nth-child(10n + 6) {
    grid-column: 1;
    grid-row: span 2;
}

.explore-tile {
    position: relative;
    display: block;
    aspect-ratio: 3 / 4;
    padding: 0;
    border: none;
    overflow: hidden;
    background: #141414;
    cursor: pointer;
    border-radius: 4px;
}

.explore-tile:nth-child(10n + 3),
.explore-tile:nth-child(10n + 6) {
    aspect-ratio: auto;
}

.explore-tile video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.8s var(--ease-out), filter 0.4s ease;
}

.explore-tile:hover video,
.explore-tile:focus-visible video {
    transform: scale(1.08);
}

.tile-icon {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 2;
    color: #ffffff;
    font-size: 16px;
    text-shadow: 0 1px 6px rgba(0, 0, 0, 0.7);
}

.tile-overlay {
    position: absolute;
    inset: 0;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 12px;
    color: #ffffff;
    text-align: center;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.1), rgba(0, 0, 0, 0.65));
    opacity: 0;
    transition: opacity 0.35s ease;
}

.tile-overlay strong {
    font-size: 15px;
    transform: translateY(12px);
    transition: transform 0.45s var(--ease-out);
}

.tile-overlay small {
    color: var(--accent-2);
    transform: translateY(12px);
    transition: transform 0.45s var(--ease-out) 0.05s;
}

.tile-play {
    font-size: 28px;
    transform: scale(0.4);
    transition: transform 0.45s var(--ease-spring);
}

.explore-tile:hover .tile-overlay,
.explore-tile:focus-visible .tile-overlay {
    opacity: 1;
}

.explore-tile:hover .tile-overlay strong,
.explore-tile:hover .tile-overlay small,
.explore-tile:focus-visible .tile-overlay strong {
    transform: none;
}

.explore-tile:hover .tile-play,
.explore-tile:focus-visible .tile-play {
    transform: scale(1);
}

.explore-tile.is-playing .tile-icon {
    animation: rec-blink 1.4s ease-in-out infinite;
}

@keyframes rec-blink {
    50% { opacity: 0.35; }
}

.film-empty {
    padding: 70px 20px;
    text-align: center;
    color: #8a8a8a;
    border: 1px dashed rgba(255, 255, 255, 0.12);
    border-radius: 24px;
}

.film-empty i {
    display: inline-block;
    font-size: 48px;
    color: var(--accent);
    margin-bottom: 12px;
    animation: float 4s ease-in-out infinite;
}

/* ---------- about ---------- */

.film-about {
    padding: 70px 0 30px;
}

.film-about-card {
    max-width: 860px;
    margin: 0 auto;
}

.film-about-text {
    color: #d0d0d0;
    line-height: 2.1;
}

.film-services {
    list-style: none;
    padding: 0;
    margin: 22px 0;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.film-services li {
    padding: 8px 16px;
    border-radius: 999px;
    background: rgba(255, 107, 71, 0.1);
    border: 1px solid rgba(255, 107, 71, 0.25);
    color: #ffd3c7;
    font-size: 14px;
}

.film-services li i {
    color: var(--accent);
    margin-inline-end: 4px;
}

.film-services.compact {
    justify-content: center;
    margin: 14px 0;
}

.film-services.compact li {
    padding: 5px 12px;
    font-size: 12px;
}

.film-contact {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px 20px;
    margin-top: 24px;
}

.film-contact-item {
    color: #d6d6d6;
}

.film-contact-item i {
    color: var(--accent);
    margin-inline-end: 4px;
}

/* ---------- reels viewer ---------- */

body.reels-open {
    overflow: hidden;
}

.reels {
    position: fixed;
    inset: 0;
    z-index: 2000;
    background: #000000;
    animation: reels-in 0.45s var(--ease-out);
}

.reels.closing {
    animation: reels-out 0.3s ease forwards;
}

@keyframes reels-in {
    from { opacity: 0; transform: scale(1.04); }
}

@keyframes reels-out {
    to { opacity: 0; transform: scale(0.97); }
}

.reels-topbar {
    position: absolute;
    top: env(safe-area-inset-top, 0px);
    right: 0;
    left: 0;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.6), transparent);
    pointer-events: none;
}

.reels-topbar > * {
    pointer-events: auto;
}

.reels-btn {
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
    font-size: 18px;
    backdrop-filter: blur(10px);
    transition: background 0.2s ease, transform 0.25s var(--ease-spring);
}

.reels-btn:hover {
    background: rgba(255, 107, 71, 0.8);
    transform: scale(1.08);
}

.reels-counter {
    padding: 6px 14px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.12);
    font-size: 13px;
    backdrop-filter: blur(10px);
}

.reels-feed {
    height: 100%;
    overflow-y: auto;
    scroll-snap-type: y mandatory;
    overscroll-behavior: contain;
    scrollbar-width: none;
}

.reels-feed::-webkit-scrollbar {
    display: none;
}

.reel {
    position: relative;
    height: 100vh;
    height: 100dvh;
    scroll-snap-align: start;
    scroll-snap-stop: always;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.reel-media {
    position: relative;
    width: 100%;
    height: 100%;
    max-width: min(100vw, 1100px);
}

.reel-media video {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #000000;
}

.reel-flash,
.reel-heart {
    position: absolute;
    top: 50%;
    left: 50%;
    pointer-events: none;
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.5);
}

.reel-flash {
    width: 84px;
    height: 84px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 30px;
    background: rgba(0, 0, 0, 0.45);
}

.reel-flash.show {
    animation: flash 0.7s ease;
}

@keyframes flash {
    30% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
    100% { opacity: 0; transform: translate(-50%, -50%) scale(1.3); }
}

.reel-heart {
    font-size: 110px;
    color: #ff3b5c;
    filter: drop-shadow(0 6px 24px rgba(255, 59, 92, 0.7));
}

.reel-heart.show {
    animation: heart 0.9s var(--ease-spring);
}

@keyframes heart {
    20% { opacity: 1; transform: translate(-50%, -50%) scale(1.15); }
    40% { transform: translate(-50%, -50%) scale(0.95); }
    70% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
    100% { opacity: 0; transform: translate(-50%, -80%) scale(0.9); }
}

.reel-info {
    position: absolute;
    right: 0;
    left: 0;
    bottom: 0;
    z-index: 3;
    padding: 80px 20px calc(28px + env(safe-area-inset-bottom, 0px));
    background: linear-gradient(0deg, rgba(0, 0, 0, 0.85), transparent);
    pointer-events: none;
}

.reel-info > * {
    max-width: 640px;
    pointer-events: auto;
}

.reel.is-active .reel-info > * {
    animation: info-up 0.6s var(--ease-out) backwards;
}

.reel.is-active .reel-info > *:nth-child(2) { animation-delay: 0.08s; }
.reel.is-active .reel-info > *:nth-child(3) { animation-delay: 0.16s; }
.reel.is-active .reel-info > *:nth-child(4) { animation-delay: 0.24s; }

@keyframes info-up {
    from { opacity: 0; transform: translateY(20px); }
}

.reel-category {
    display: inline-block;
    padding: 3px 12px;
    margin-bottom: 8px;
    border-radius: 999px;
    background: var(--accent);
    font-size: 12px;
    font-weight: 700;
}

.reel-info h3 {
    font-size: 20px;
    font-weight: 800;
    margin-bottom: 6px;
}

.reel-info p {
    color: #d6d6d6;
    font-size: 14px;
    line-height: 1.9;
    margin-bottom: 8px;
    max-height: 7.6em;
    overflow-y: auto;
}

.reel-link {
    color: #ffffff;
    font-size: 14px;
    text-decoration: none;
}

.reel-link:hover {
    color: var(--accent-2);
}

.reel-progress {
    position: absolute;
    right: 0;
    left: 0;
    bottom: 0;
    z-index: 4;
    height: 3px;
    background: rgba(255, 255, 255, 0.15);
}

.reel-progress span {
    display: block;
    height: 100%;
    width: 100%;
    background: linear-gradient(270deg, var(--accent), var(--accent-3));
    transform: scaleX(0);
    transform-origin: right;
}

/* final card: about my work */

.reel-end {
    padding: 80px 20px 40px;
    background:
        radial-gradient(circle at 30% 20%, rgba(255, 107, 71, 0.25), transparent 50%),
        radial-gradient(circle at 70% 80%, rgba(139, 92, 246, 0.2), transparent 50%),
        #050505;
}

.reel-end-card {
    max-width: 560px;
    text-align: center;
}

.reel-end.is-active .reel-end-card > * {
    animation: info-up 0.7s var(--ease-out) backwards;
}

.reel-end.is-active .reel-end-card > *:nth-child(2) { animation-delay: 0.1s; }
.reel-end.is-active .reel-end-card > *:nth-child(3) { animation-delay: 0.2s; }
.reel-end.is-active .reel-end-card > *:nth-child(4) { animation-delay: 0.3s; }
.reel-end.is-active .reel-end-card > *:nth-child(5) { animation-delay: 0.4s; }
.reel-end.is-active .reel-end-card > *:nth-child(6) { animation-delay: 0.5s; }

.reel-end-logo {
    width: min(300px, 70vw);
    margin-bottom: 10px;
    animation: logo-float 5s ease-in-out infinite;
}

.reel-end-card h3 {
    font-weight: 800;
    margin-bottom: 12px;
}

.reel-end-card p {
    color: #cfcfcf;
    line-height: 2;
}

.reel-end-card .film-contact {
    justify-content: center;
}

.reel-end-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin-top: 22px;
}

.reels-hint {
    position: absolute;
    bottom: 110px;
    left: 50%;
    z-index: 6;
    padding: 8px 16px;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.6);
    font-size: 13px;
    transform: translateX(-50%);
    pointer-events: none;
    animation: hint 3.2s ease forwards;
}

@keyframes hint {
    0% { opacity: 0; transform: translate(-50%, 10px); }
    15%, 75% { opacity: 1; transform: translate(-50%, 0); }
    100% { opacity: 0; transform: translate(-50%, -10px); }
}

@media (max-width: 575.98px) {
    .explore-grid {
        gap: 2px;
    }

    .explore-tile {
        border-radius: 0;
    }

    .tile-overlay {
        display: none;
    }
}
