/* ===================================
   STAS ETVESH | Portfolio Website
   Единый файл стилей
   =================================== */

:root {
    --bg: #ffffff;
    --surface: #f3f3f3;
    --text: #111111;
    --muted: #696969;
    --line: #d7d7d7;
    --overlay: rgba(255, 255, 255, 0.96);
    --lightbox-btn: rgba(0, 0, 0, 0.4);
    --lightbox-btn-hover: rgba(0, 0, 0, 0.7);
}

[data-theme="dark"] {
    --bg: #2b2b2b;
    --surface: #3a3a3a;
    --text: #f1f1f1;
    --muted: #bcbcbc;
    --line: #4a4a4a;
    --overlay: rgba(35, 35, 35, 0.97);
    --lightbox-btn: rgba(255, 255, 255, 0.25);
    --lightbox-btn-hover: rgba(255, 255, 255, 0.5);
}

body {
    background: var(--bg);
    color: var(--text);
    transition: background-color 0.25s ease, color 0.25s ease;
}

/* ===================================
   HEADER
   =================================== */
.topbar {
    background: var(--bg);
    border-bottom: 1px solid var(--line);
}

.menu-item {
    color: var(--muted);
    transition: color 0.2s ease;
}

.menu-item:hover {
    color: var(--text);
}

.menu-item.active {
    color: var(--text);
    border-bottom: 2px solid var(--text);
    padding-bottom: 2px;
}

.menu-item.active-page {
    color: var(--text);
    opacity: 1;
}

.logo-mark {
    color: #111111;
}

[data-theme="dark"] .logo-mark {
    color: #f1f1f1;
}

.dropdown-menu {
    display: none;
    background: var(--bg);
    border: 1px solid var(--line);
}

.dropdown:hover .dropdown-menu {
    display: block;
}

.dropdown {
    padding-bottom: 8px;
    margin-bottom: -8px;
}

/* ===================================
   THEME TOGGLE
   =================================== */
.theme-toggle {
    width: 66px;
    height: 34px;
    border: 1px solid var(--line);
    background: var(--surface);
    position: relative;
    cursor: pointer;
    border-radius: 9999px;
}

.theme-toggle::after {
    content: "";
    position: absolute;
    width: 28px;
    height: 28px;
    left: 2px;
    top: 2px;
    background: var(--text);
    transition: transform 0.2s ease;
    border-radius: 9999px;
    z-index: 2;
}

[data-theme="dark"] .theme-toggle::after {
    transform: translateX(32px);
}

.theme-icon {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 15px;
    height: 15px;
    color: var(--muted);
    z-index: 1;
    transition: color 0.2s ease;
}

.theme-icon.sun {
    right: 8px;
}

.theme-icon.moon {
    left: 8px;
}

[data-theme="dark"] .theme-icon.sun {
    color: var(--text);
}

[data-theme="light"] .theme-icon.moon {
    color: var(--text);
}

/* ===================================
   MASONRY GRID (Portfolio)
   =================================== */
.filter-link {
    border: none;
    background: transparent;
    color: var(--muted);
    font-size: 0.93rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    cursor: pointer;
    padding: 0;
    transition: color 0.2s ease;
}

.filter-link:hover,
.filter-link.active {
    color: var(--text);
}

.filter-link.active {
    text-decoration: underline;
    text-underline-offset: 0.32rem;
    text-decoration-thickness: 1px;
}

.masonry {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

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

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

.photo-item {
    display: block;
    opacity: 1;
    transition: opacity 0.25s ease;
    cursor: pointer;
}

.photo-item.hidden {
    display: none;
}

.photo-item img {
    width: 100%;
    height: auto;
    display: block;
    filter: grayscale(8%);
    transition: filter 0.25s ease;
}

.photo-item:hover img {
    filter: grayscale(0%);
}

/* ===================================
   LIGHTBOX
   =================================== */
.lightbox {
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
    background: var(--overlay);
}

.lightbox.active {
    opacity: 1;
    pointer-events: auto;
}

.lightbox-btn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--lightbox-btn);
    color: var(--text);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s ease;
}

.lightbox-btn:hover {
    background: var(--lightbox-btn-hover);
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 20px;
}

.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
}

.lightbox-nav.prev {
    left: 20px;
}

.lightbox-nav.next {
    right: 20px;
}

.photo-caption {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    color: var(--text);
    max-width: 600px;
}

.photo-caption h3 {
    font-size: 1.1rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    margin-bottom: 6px;
}

.photo-caption p {
    font-size: 0.9rem;
    color: var(--muted);
    line-height: 1.5;
}

.slideshow-btn {
    position: absolute;
    bottom: 20px;
    right: 20px;
}

.slideshow-btn.playing svg {
    animation: pulse 1s infinite;
}

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

/* ===================================
   ABOUT PAGE
   =================================== */
.hero-section {
    display: grid;
    grid-template-columns: 1fr;
    gap: 40px;
    margin-bottom: 60px;
}

@media (min-width: 900px) {
    .hero-section {
        grid-template-columns: 1fr 1fr;
        gap: 60px;
    }
}

.hero-image {
    width: 100%;
    aspect-ratio: 4/5;
    object-fit: cover;
    filter: grayscale(15%);
}

.hero-content {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.section-title {
    font-size: 0.85rem;
    letter-spacing: 0.25em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 8px;
}

.big-title {
    font-size: clamp(2rem, 5vw, 3.2rem);
    letter-spacing: 0.08em;
    line-height: 1.15;
    margin-bottom: 24px;
}

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

.bio-text p {
    margin-bottom: 16px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
    margin-top: 40px;
    padding-top: 32px;
    border-top: 1px solid var(--line);
}

@media (min-width: 600px) {
    .stats-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

.stat-item {
    text-align: center;
}

.stat-number {
    font-size: 2rem;
    font-weight: 300;
    letter-spacing: 0.05em;
}

.stat-label {
    font-size: 0.75rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--muted);
    margin-top: 4px;
}

.equipment-section {
    background: var(--surface);
    border: 1px solid var(--line);
    padding: 40px;
    margin-bottom: 60px;
}

.equipment-grid {
    display: grid;
    grid-template-columns: repeat(1, 1fr);
    gap: 32px;
    margin-top: 24px;
}

@media (min-width: 600px) {
    .equipment-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

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

.equipment-category h3 {
    font-size: 0.9rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    margin-bottom: 12px;
}

.equipment-list {
    list-style: none;
    color: var(--muted);
    font-size: 0.95rem;
    line-height: 1.9;
    padding-left: 0;
}

.awards-section {
    margin-bottom: 60px;
}

.award-item {
    display: flex;
    align-items: flex-start;
    gap: 20px;
    padding: 24px 0;
    border-bottom: 1px solid var(--line);
}

.award-year {
    font-size: 0.85rem;
    letter-spacing: 0.1em;
    color: var(--muted);
    min-width: 60px;
}

.award-title {
    font-size: 1rem;
    letter-spacing: 0.05em;
}

.award-org {
    font-size: 0.85rem;
    color: var(--muted);
    margin-top: 4px;
}

.cta-section {
    text-align: center;
    padding: 60px 20px;
    background: var(--surface);
    border: 1px solid var(--line);
}

.cta-title {
    font-size: 1.5rem;
    letter-spacing: 0.12em;
    margin-bottom: 16px;
}

.cta-text {
    color: var(--muted);
    margin-bottom: 28px;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

/* Phone link in CTA */
.cta-phone-link {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--text);
    text-decoration: none;
    font-size: 1.25rem;
    font-weight: 500;
    letter-spacing: 0.05em;
    transition: opacity 0.2s ease;
}

.cta-phone-link:hover {
    opacity: 0.75;
}

.cta-phone-link svg {
    flex-shrink: 0;
}

/* Social icons in CTA */
.cta-social-links {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 0;
}

.social-icon-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.05);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.social-icon-link:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
}

.social-icon-link svg {
    width: 24px;
    height: 24px;
}

.cta-btn {
    display: inline-block;
    padding: 14px 36px;
    background: var(--text);
    color: var(--bg);
    font-size: 0.85rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    text-decoration: none;
    transition: opacity 0.2s ease;
}

.cta-btn:hover {
    opacity: 0.85;
}

/* ===================================
   BLOG PAGE
   =================================== */
.post {
    border: 1px solid var(--line);
    min-height: 280px;
    transition: border-color 0.2s ease;
}

.post:hover {
    border-color: var(--muted);
}

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

.read-more {
    color: var(--muted);
    transition: color 0.2s ease;
}

.read-more:hover {
    color: var(--text);
}

/* ===================================
   CLIENT GALLERY
   =================================== */
.login-box {
    max-width: 420px;
    margin: 80px auto;
    padding: 40px;
    background: var(--surface);
    border: 1px solid var(--line);
}

.login-input {
    width: 100%;
    padding: 14px 16px;
    background: var(--bg);
    border: 1px solid var(--line);
    color: var(--text);
    font-size: 1rem;
    letter-spacing: 0.15em;
    text-align: center;
    outline: none;
    transition: border-color 0.2s ease;
}

.login-input:focus {
    border-color: var(--text);
}

.login-input::placeholder {
    color: var(--muted);
}

.login-btn {
    width: 100%;
    padding: 14px;
    background: var(--text);
    color: var(--bg);
    font-size: 0.85rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    cursor: pointer;
    transition: opacity 0.2s ease;
}

.login-btn:hover {
    opacity: 0.85;
}

.client-gallery {
    display: none;
}

.client-gallery.active {
    display: block;
}

/* ===================================
   CLIENT GALLERY GRID
   =================================== */
.photo-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    width: 100%;
}

@media (min-width: 768px) {
    .photo-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 16px;
    }
}

@media (min-width: 1100px) {
    .photo-grid {
        grid-template-columns: repeat(6, 1fr);
        gap: 16px;
    }
}

@media (min-width: 1600px) {
    .photo-grid {
        grid-template-columns: repeat(8, 1fr);
    }
}

.photo-card {
    position: relative;
    cursor: pointer;
    overflow: hidden;
    width: 100%;
    /* Соотношение сторон 3:2 */
    aspect-ratio: 3 / 2;
    /* Светло-серый фон для вертикальных фото */
    background: #f3f3f3;
}

[data-theme="dark"] .photo-card {
    background: #4a4a4a; /* Светлее основного фона для контраста */
}

.photo-card img {
    width: 100%;
    height: 100%;
    object-fit: contain; /* Вертикальные фото отображаются целиком */
    display: block;
    transition: transform 0.3s ease;
}

.photo-card:hover img {
    transform: scale(1.03);
}

.photo-check {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.9;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.photo-check svg {
    width: 18px;
    height: 18px;
    fill: #e5e7eb;
    stroke: #9ca3af;
    stroke-width: 2;
    transition: all 0.2s ease;
}

.photo-card.selected .photo-check {
    background: rgba(255, 255, 255, 0.95);
}

.photo-card.selected .photo-check svg {
    fill: #ef4444;
    stroke: #ef4444;
}

.selection-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--surface);
    border-top: 1px solid var(--line);
    padding: 16px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    z-index: 30;
    transform: translateY(100%);
    transition: transform 0.25s ease;
}

.selection-bar.active {
    transform: translateY(0);
}

.selection-info {
    font-size: 0.95rem;
    letter-spacing: 0.05em;
}

.selection-info span {
    font-weight: 600;
}

.send-btn {
    padding: 12px 28px;
    background: var(--text);
    color: var(--bg);
    font-size: 0.8rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    cursor: pointer;
    transition: opacity 0.2s ease;
    border: none;
}

.send-btn:hover {
    opacity: 0.85;
}

.clear-btn {
    padding: 12px 20px;
    background: transparent;
    border: 1px solid var(--line);
    color: var(--text);
    font-size: 0.8rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    cursor: pointer;
    transition: border-color 0.2s ease;
}

.clear-btn:hover {
    border-color: var(--text);
}

.gallery-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--line);
}

.gallery-title {
    font-size: 1.1rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.gallery-info {
    color: var(--muted);
    font-size: 0.9rem;
}

.lightbox-client {
    position: fixed;
    inset: 0;
    background: var(--bg);
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.lightbox-client.active {
    opacity: 1;
    pointer-events: auto;
}

.lb-control {
    position: absolute;
    width: 46px;
    height: 46px;
    border-radius: 9999px;
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--text);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.45rem;
    cursor: pointer;
    transition: border-color 0.2s ease;
}

.lb-control:hover {
    border-color: var(--text);
}

/* Рамка для выбранного фото в lightbox */
.lightbox-client img.selected {
    border: 4px solid var(--accent, #3b82f6);
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.5);
}

/* Кнопка "Выбрать" в lightbox */
#lbSelectBtn.selected {
    background: var(--text);
    color: var(--bg);
}

.success-modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 60;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.success-modal.active {
    opacity: 1;
    pointer-events: auto;
}

.success-box {
    background: var(--bg);
    border: 1px solid var(--line);
    padding: 40px 50px;
    text-align: center;
    max-width: 90%;
}

.success-icon {
    width: 60px;
    height: 60px;
    margin: 0 auto 20px;
    border: 2px solid var(--text);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.success-icon svg {
    width: 30px;
    height: 30px;
    color: var(--text);
}

/* ===================================
   CONTACT PAGE
   =================================== */
.contact-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 60px;
}

@media (min-width: 900px) {
    .contact-grid {
        grid-template-columns: 1fr 1fr;
    }
}

.contact-text {
    color: var(--muted);
    line-height: 1.8;
    margin-bottom: 32px;
}

.contact-info {
    margin-bottom: 40px;
}

.contact-item {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 20px 0;
    border-bottom: 1px solid var(--line);
}

.contact-item:first-child {
    border-top: 1px solid var(--line);
}

.contact-icon {
    width: 24px;
    height: 24px;
    color: var(--muted);
    flex-shrink: 0;
    margin-top: 2px;
}

.contact-label {
    font-size: 0.75rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 4px;
}

.contact-value {
    font-size: 1.05rem;
    letter-spacing: 0.03em;
}

.contact-value a {
    text-decoration: none;
    color: var(--text);
    transition: opacity 0.2s ease;
}

.contact-value a:hover {
    opacity: 0.7;
}

.social-links {
    display: flex;
    gap: 16px;
    margin-top: 32px;
}

.social-link {
    width: 48px;
    height: 48px;
    border: 1px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text);
    transition: all 0.2s ease;
}

.social-link:hover {
    background: var(--text);
    color: var(--bg);
    border-color: var(--text);
}

.social-link svg {
    width: 20px;
    height: 20px;
}

.form-group {
    margin-bottom: 24px;
}

.form-label {
    display: block;
    font-size: 0.75rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 8px;
}

.form-input,
.form-textarea {
    width: 100%;
    padding: 14px 16px;
    background: var(--surface);
    border: 1px solid var(--line);
    color: var(--text);
    font-size: 1rem;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s ease;
}

.form-input:focus,
.form-textarea:focus {
    border-color: var(--text);
}

.form-input::placeholder,
.form-textarea::placeholder {
    color: var(--muted);
}

.form-textarea {
    min-height: 150px;
    resize: vertical;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

@media (max-width: 600px) {
    .form-row {
        grid-template-columns: 1fr;
    }
}

.submit-btn {
    width: 100%;
    padding: 16px;
    background: var(--text);
    color: var(--bg);
    font-size: 0.85rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    cursor: pointer;
    transition: opacity 0.2s ease;
    border: none;
}

.submit-btn:hover {
    opacity: 0.85;
}

.form-note {
    font-size: 0.8rem;
    color: var(--muted);
    margin-top: 16px;
    text-align: center;
}

.success-message {
    display: none;
    text-align: center;
    padding: 40px;
    background: var(--surface);
    border: 1px solid var(--line);
}

.success-message.active {
    display: block;
}

.map-container {
    margin-top: 60px;
    border: 1px solid var(--line);
    overflow: hidden;
}

.map-placeholder {
    width: 100%;
    height: 300px;
    background: var(--surface);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--muted);
    font-size: 0.9rem;
    letter-spacing: 0.1em;
}

/* ===================================
   FOOTER
   =================================== */
footer {
    border-top: 1px solid var(--line);
}

/* ===================================
   RESPONSIVE
   =================================== */
@media (max-width: 768px) {
    .hero-section {
        gap: 30px;
    }

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

/* ===================================
   BLOG POST CONTENT STYLES
   =================================== */
.post-content {
    color: var(--muted);
    line-height: 1.8;
}

.post-content h1,
.post-content h2,
.post-content h3,
.post-content h4,
.post-content h5,
.post-content h6 {
    color: var(--text);
    font-weight: 600;
    margin-top: 2em;
    margin-bottom: 1em;
    line-height: 1.3;
}

.post-content h1 {
    font-size: 2rem;
}

.post-content h2 {
    font-size: 1.75rem;
}

.post-content h3 {
    font-size: 1.5rem;
}

.post-content h4 {
    font-size: 1.25rem;
}

.post-content h5 {
    font-size: 1.125rem;
}

.post-content h6 {
    font-size: 1rem;
}

.post-content p {
    margin-bottom: 1.5em;
}

.post-content strong {
    color: var(--text);
    font-weight: 600;
}

.post-content em {
    font-style: italic;
}

.post-content u {
    text-decoration: underline;
}

.post-content ul,
.post-content ol {
    margin-bottom: 1.5em;
    padding-left: 1.5em;
}

.post-content ul {
    list-style-type: disc;
}

.post-content ol {
    list-style-type: decimal;
}

.post-content li {
    margin-bottom: 0.5em;
    padding-left: 0.25em;
}

.post-content li > ul,
.post-content li > ol {
    margin-top: 0.5em;
    margin-bottom: 0.5em;
}

.post-content blockquote {
    border-left: 3px solid var(--text);
    padding-left: 1em;
    margin: 1.5em 0;
    font-style: italic;
    color: var(--muted);
}

.post-content img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 2px 0;
    display: block;
}

.post-content a {
    color: var(--text);
    text-decoration: underline;
    transition: opacity 0.2s ease;
}

.post-content a:hover {
    opacity: 0.7;
}

.post-content hr {
    border: none;
    border-top: 1px solid var(--line);
    margin: 2em 0;
}

.post-content pre {
    background: var(--surface);
    padding: 1em;
    border-radius: 6px;
    overflow-x: auto;
    margin: 1.5em 0;
    font-size: 0.875rem;
}

.post-content code {
    background: var(--surface);
    padding: 0.2em 0.4em;
    border-radius: 3px;
    font-size: 0.875em;
}

.post-content pre code {
    background: transparent;
    padding: 0;
}
