/* ========================================
   Андрей Коротеев — Personal Site
   Two-screen layout: Hero + Tabbed Content
   ======================================== */

*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg:             #1a1918;
    --bg-panel:       #1e1c1b;
    --bg-card:        #23211f;
    --bg-card-hover:  #2a2826;
    --text:           #f0eee6;
    --text-muted:     #b8b5ac;
    --text-dim:       #8a877d;
    --accent:         #c98a6c;
    --accent-light:   #e0b196;
    --accent-glow:    rgba(201, 138, 108, 0.1);
    --border:         rgba(255, 255, 255, 0.08);
    --border-hover:   rgba(201, 138, 108, 0.4);
    --radius:         2px;
    --radius-sm:      2px;
    --ease:           cubic-bezier(0.2, 0.8, 0.2, 1);
    --tab-h:          70px;
    --bg-nav-fixed:   rgba(26, 25, 24, 0.9);
    --font-heading:   'Playfair Display', serif;
    --font-body:      'Inter', sans-serif;
}

/* ── Light theme ── */
[data-theme="light"] {
    --bg:             #f7f5f0;
    --bg-panel:       #f2efe8;
    --bg-card:        #ffffff;
    --bg-card-hover:  #faf8f5;
    --text:           #2a2826;
    --text-muted:     #6e6a64;
    --text-dim:       #96928b;
    --accent:         #b3593b;
    --accent-light:   #c98a6c;
    --accent-glow:    rgba(179, 89, 59, 0.08);
    --border:         rgba(0, 0, 0, 0.08);
    --border-hover:   rgba(179, 89, 59, 0.4);
    --bg-nav-fixed:   rgba(247, 245, 240, 0.9);
}

html {
}

body {
    font-family: var(--font-body);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

::selection {
    background: rgba(124, 110, 240, 0.3);
    color: #fff;
}

/* ── Theme toggle button ── */
.theme-toggle {
    position: fixed;
    bottom: 28px;
    right: 28px;
    z-index: 200;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .3s var(--ease), border-color .3s var(--ease), transform .2s var(--ease);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.theme-toggle:hover {
    border-color: var(--border-hover);
    background: var(--bg-card-hover);
    transform: scale(1.08);
}

.theme-toggle svg {
    width: 22px;
    height: 22px;
    transition: transform .4s var(--ease);
}

.theme-toggle:hover svg {
    transform: rotate(30deg);
}

/* Hide moon/sun based on theme */
.theme-toggle .icon-moon { display: block; }
.theme-toggle .icon-sun  { display: none; }
[data-theme="light"] .theme-toggle .icon-moon { display: none; }
[data-theme="light"] .theme-toggle .icon-sun  { display: block; }

/* Light theme extras */
[data-theme="light"] .card {
    /* No shadow for editorial */
}

[data-theme="light"] .card:hover {
    /* No shadow for editorial */
}

[data-theme="light"] ::selection {
    background: rgba(179, 89, 59, 0.2);
    color: #1a1918;
}

/* ========================================
   HERO — Screen 1
   ======================================== */
.hero {
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: visible;
}

.hero-content {
    text-align: center;
    position: relative;
    z-index: 2;
    padding: 0 20px;
}

.hero-name {
    margin-bottom: 16px;
    font-family: var(--font-heading);
    font-weight: 400;
}

.hero-first,
.hero-last {
    display: block;
    line-height: 1.1;
    letter-spacing: 0.02em;
}

.hero-first {
    font-size: clamp(3rem, 7vw, 4.5rem);
    color: var(--text-muted);
    font-style: italic;
    animation: fadeUp .8s var(--ease) both;
    animation-delay: .1s;
}

.hero-last {
    font-size: clamp(3.5rem, 9vw, 6rem);
    color: var(--text);
    animation: fadeUp .8s var(--ease) both;
    animation-delay: .25s;
}

.hero-subtitle {
    font-size: 0.95rem;
    color: var(--text-muted);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    font-weight: 400;
    margin-bottom: 48px;
    animation: fadeUp .8s var(--ease) both;
    animation-delay: .4s;
}

@keyframes fadeUp {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ========================================
   SITE NAV — single sticky navigation
   ======================================== */
.site-nav {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: var(--tab-h);
    animation: fadeUp .8s var(--ease) both;
    animation-delay: .5s;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}

.nav-name {
    display: none;
    font-family: var(--font-heading);
    font-size: 1.2rem;
    color: var(--text);
    margin-bottom: 6px;
    letter-spacing: 0.02em;
}

.nav-links {
    display: flex;
    gap: 40px;
    align-items: center;
}

/* Fixed state — applied by JS when scrolled past hero */
.site-nav.fixed {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background: var(--bg-nav-fixed);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-top: none;
    animation: none;
}

.site-nav.fixed .nav-name {
    display: block;
}

.site-nav.fixed + .nav-placeholder {
    display: block;
}

.nav-link {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    cursor: pointer;
    position: relative;
    padding-bottom: 4px;
    transition: color .3s var(--ease);
    user-select: none;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 0;
    height: 1px;
    background: var(--accent);
    transition: width .4s var(--ease);
}

.nav-link:hover {
    color: var(--text);
}

.site-nav.fixed .nav-link.active {
    color: var(--text);
}

.site-nav.fixed .nav-link.active::after {
    width: 100%;
}

/* ========================================
   CONTENT SCREEN
   ======================================== */
.content-screen {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
}

/* ── Page sections ── */
.page-section {
    scroll-margin-top: calc(var(--tab-h) + 20px);
    position: relative;
    border-bottom: 1px solid var(--border);
}

.page-section:last-child {
    border-bottom: none;
}

/* ── Carousel (horizontal scroll) ── */
.carousel {
    display: flex;
    gap: 24px;
    padding: 40px 48px;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    width: 100%;
    height: 100%;
    align-items: center;
}

.carousel::-webkit-scrollbar {
    height: 6px;
}

.carousel::-webkit-scrollbar-track {
    background: transparent;
}

.carousel::-webkit-scrollbar-thumb {
    background: var(--text-dim);
    border-radius: 3px;
}

.carousel::-webkit-scrollbar-thumb:hover {
    background: var(--accent);
}

.carousel-center {
    justify-content: center;
}

/* ========================================
   CARDS — Shared
   ======================================== */
.card {
    flex-shrink: 0;
    scroll-snap-align: center;
    background: transparent;
    border: none;
    border-top: 1px solid var(--border);
    border-radius: 0;
    padding: 32px 0;
    transition: transform .3s var(--ease);
}

.card:hover {
    transform: translateY(-2px);
}

.card-title {
    font-family: var(--font-heading);
    font-size: 1.6rem;
    font-weight: 400;
    letter-spacing: 0.01em;
    margin-bottom: 12px;
}

.card-text {
    color: var(--text-muted);
    font-size: 0.95rem;
    line-height: 1.8;
}

/* ── Cinema cards ── */
.card-cinema {
    width: auto;
    min-height: auto;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

.card-badge {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--text);
    border: 1px solid var(--border);
    padding: 4px 10px;
    border-radius: 2px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-bottom: 24px;
    align-self: flex-start;
}

.card-icon {
    display: none;
}

.card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: auto;
    padding-top: 20px;
}

.tag {
    padding: 0;
    background: transparent;
    color: var(--text-dim);
    border-radius: 0;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.card-date {
    display: block;
    font-size: 0.78rem;
    color: var(--text-dim);
    margin-bottom: 8px;
    letter-spacing: 0.02em;
}

.card-quote {
    margin: 14px 0;
    padding: 12px 16px;
    border-left: 2px solid var(--accent);
    background: rgba(124, 110, 240, 0.04);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    font-size: 0.88rem;
    color: var(--text-muted);
    line-height: 1.6;
    font-style: italic;
}

.card-org {
    font-size: 0.85rem;
    color: var(--text-dim);
    margin-top: 6px;
}

.card-org a {
    color: var(--accent-light);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-color .2s var(--ease);
}

.card-org a:hover {
    border-bottom-color: var(--accent-light);
}

.card-details {
    margin-top: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.card-details summary {
    padding: 10px 14px;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    transition: color .2s var(--ease);
    user-select: none;
}

.card-details summary:hover {
    color: var(--text);
}

.card-details p {
    padding: 0 14px 14px;
    font-size: 0.82rem;
    color: var(--text-dim);
    line-height: 1.65;
}

/* ── Script cover (Image or CSS) ── */
.script-cover-link {
    display: block;
    margin-bottom: 16px;
    text-decoration: none;
    border-radius: var(--radius-sm);
    overflow: hidden;
    position: relative;
    background: var(--bg-card);
    transition: transform 0.3s var(--ease);
    aspect-ratio: 16 / 9; /* Matched to video blocks */
}

.script-cover-link:hover {
    transform: translateY(-4px);
}

.script-cover-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    border-radius: inherit;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    transition: opacity 0.3s var(--ease);
}

.script-cover {
    aspect-ratio: 16 / 9;
    background: #fdfdfd;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(0,0,0,0.1);
    color: #1a1a1a;
    padding: 24px;
    text-align: center;
    box-shadow: 0 8px 24px rgba(0,0,0,0.1);
}

.script-title {
    font-family: var(--font-heading);
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 8px;
    text-transform: uppercase;
    line-height: 1.2;
}

.script-subtitle {
    font-size: 0.8rem;
    margin-bottom: 4px;
    opacity: 0.8;
}

.script-author {
    font-weight: 600;
    font-size: 1rem;
}

/* ── Video cards ── */
.card-video {
    width: 560px;
    min-height: 380px;
    display: flex;
    flex-direction: column;
}

.video-frame {
    width: 100%;
    aspect-ratio: 16 / 9;
    border-radius: var(--radius-sm);
    overflow: hidden;
    margin-bottom: 16px;
    background: #0e0e18;
}

.video-frame iframe {
    width: 100%;
    height: 100%;
    border: none;
}

.video-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    background: linear-gradient(135deg, #14142a, #1a1a35);
}

.placeholder-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--accent-glow);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-light);
}

.placeholder-icon svg {
    margin-left: 3px;
}

.placeholder-label {
    font-size: 0.8rem;
    color: var(--text-dim);
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

/* ── Page content (shared for all scrollable tabs) ── */
.page-content {
    max-width: 1100px;
    margin: 0 auto;
    padding: 48px 40px 80px;
}

.page-title {
    font-family: var(--font-heading);
    font-size: 2.2rem;
    font-weight: 400;
    letter-spacing: 0.01em;
    margin-bottom: 12px;
    font-style: italic;
}

.page-desc {
    color: var(--text-muted);
    font-size: 0.95rem;
    line-height: 1.7;
    margin-bottom: 40px;
    max-width: 540px;
}

.grid {
    display: grid;
    gap: 24px;
}

.grid-3 {
    grid-template-columns: repeat(3, 1fr);
}

.grid-2 {
    grid-template-columns: repeat(2, 1fr);
}

.video-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 24px;
}

.video-card {
    background: transparent;
    border: none;
    border-radius: 0;
    overflow: hidden;
    transition: transform .3s var(--ease);
}

.video-card:hover {
    transform: translateY(-2px);
}

.video-card .video-frame {
    margin-bottom: 0;
    border-radius: var(--radius-sm);
}

.video-card-title {
    font-size: 1rem;
    font-weight: 500;
    padding: 16px 20px;
    color: var(--text-muted);
}

/* ── App cards ── */
.card-app {
    width: auto;
    min-height: auto;
    display: flex;
    flex-direction: column;
}

.app-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 22px;
}

.app-card-body {
    display: grid;
    grid-template-columns: 120px minmax(0, 1fr);
    grid-template-areas: "visual copy";
    gap: 28px;
    align-items: center;
    min-height: 120px;
}

.app-copy {
    grid-area: copy;
    min-width: 0;
}

.app-copy .card-title {
    margin-bottom: 12px;
}

.app-visual {
    grid-area: visual;
    width: 120px;
    height: 120px;
    min-width: 0;
    align-self: center;
    position: relative;
    display: flex;
    align-items: stretch;
    justify-content: flex-end;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 50%;
    background: var(--bg-card);
}

.app-mark {
    position: absolute;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
}

.app-visual-loknot,
.app-visual-fonograf,
.app-visual-kinodramaturg {
    background: #fff;
}

.app-visual-loknot .app-mark {
    inset: 8%;
    width: 84%;
    height: 84%;
    transform: translateX(-4px);
}

.app-visual-vidak .app-mark {
    inset: 10%;
    width: 80%;
    height: 80%;
}

.app-visual-fonograf .app-mark {
    inset: 10%;
    width: 80%;
    height: 80%;
    transform: translateX(7px);
}

.app-visual-camback {
    background: #000;
}

.app-visual-camback .app-mark {
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.app-visual-blokno {
    color: var(--text);
}

.app-visual-blokno .app-mark {
    inset: 12%;
    width: 76%;
    height: 76%;
}

.app-platform {
    font-size: 0.72rem;
    font-weight: 500;
    color: var(--text-dim);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 5px 11px;
    border: 1px solid var(--border);
    border-radius: 20px;
}

.clickable-card {
    text-decoration: none;
    color: inherit;
    cursor: pointer;
    position: relative;
}

.clickable-card .contact-arrow {
    position: static;
    opacity: 0.3;
}

.clickable-card:hover .contact-arrow {
    color: var(--accent);
    opacity: 1;
    transform: translateX(6px);
}

.app-features {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 20px;
}

.app-features li {
    font-size: 0.88rem;
    color: var(--text-muted);
    padding-left: 18px;
    position: relative;
}

.app-features li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 8px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent);
}

.card-app:nth-child(2) .app-features li::before {
    background: var(--pink);
}

.card-contact {
    width: auto;
    min-height: 180px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    text-decoration: none;
    color: var(--text);
    gap: 12px;
    cursor: pointer;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    padding: 32px;
}

.contact-icon {
    display: none;
}

.contact-value {
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--text-muted);
}

.contact-arrow {
    font-size: 1.3rem;
    color: var(--text-dim);
    transition: color .3s var(--ease), transform .3s var(--ease);
}

.card-contact:hover .contact-arrow {
    color: var(--accent);
    transform: translateX(6px);
}

/* ========================================
   RESPONSIVE
   ======================================== */
@media (max-width: 768px) {
    .site-nav {
        padding: 0 12px;
    }

    .nav-links {
        gap: 20px;
    }

    .nav-link {
        font-size: 0.85rem;
    }

    .page-content {
        padding: 32px 20px 60px;
    }

    .video-grid {
        grid-template-columns: 1fr;
    }

    .grid-3 {
        grid-template-columns: 1fr;
    }

    .grid-2 {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .hero-first {
        font-size: 2.6rem;
    }

    .hero-last {
        font-size: 2.8rem;
    }

    .site-nav {
        gap: 14px;
    }

    .nav-link {
        font-size: 0.82rem;
    }

    .card {
        padding: 24px;
    }

    .app-card-body {
        grid-template-columns: 96px minmax(0, 1fr);
        gap: 18px;
        min-height: 96px;
    }

    .app-visual {
        width: 96px;
        height: 96px;
    }

    .app-meta {
        margin-bottom: 18px;
    }

}
