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

:root {
    --bg-primary: #ffffff;
    --text-primary: #1a1a1a;
    --text-secondary: #666;
    --accent: #d4a574;
    --shadow: rgba(0, 0, 0, 0.1);
}

body {
    font-family: 'sofia-pro', sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    overflow-x: hidden;
}

/* Header */
header {
    background-color: #fff;
    padding: 1.8rem 3rem;
    box-shadow: 0 1px 3px var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #eee;
}

.logo {
    font-family: 'sofia-pro', sans-serif;
    font-size: 1.8rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    color: var(--text-primary);
}

.logo-img {
    height: 48px;
    display: block;
    object-fit: contain;
}

.main-nav {
    display: flex;
    gap: 2rem;
    align-items: center;
}

.nav-link {
    background: none;
    border: none;
    font-family: 'sofia-pro', sans-serif;
    font-size: 0.95rem;
    font-weight: 400;
    color: var(--text-primary);
    cursor: pointer;
    padding: 0.5rem 0;
    position: relative;
    transition: color 0.2s ease;
}

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

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

.nav-link:hover::after {
    width: 100%;
}

/* Main Gallery */
main {
    max-width: 1600px;
    margin: 0 auto;
    padding: 4rem 3rem;
}

/* Portfolio Page */
.portfolio-page {
    width: 100%;
    padding-top: 1rem;
}

.editorial-scroll {
    display: flex;
    flex-direction: column;
    gap: 5rem;
    max-width: 1400px;
    margin: 0 auto;
}

.ed-row {
    display: flex;
    align-items: flex-start;
    gap: 1.5rem;
}

.ed-row--left   { justify-content: flex-start; }
.ed-row--right  { justify-content: flex-end; }
.ed-row--center { justify-content: center; }
.ed-row--spread { justify-content: space-between; }

.ed-img {
    width: var(--ed-w, 100%);
    flex-shrink: 0;
}

.ed-img img {
    width: 100%;
    height: auto;
    display: block;
}

/* Magazines Page */
.magazines-page {
    width: 100%;
}

h1 {
    font-family: 'sofia-pro', sans-serif;
    text-align: center;
    margin-bottom: 2.5rem;
    font-size: 1.8rem;
    font-weight: 300;
    letter-spacing: -0.6px;
    color: var(--text-primary);
}

/* Magazine Grid - 3 per row */
.magazine-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 3rem;
    margin-bottom: 3rem;
}

.magazine-card {
    transition: transform 0.4s ease;
    animation: fadeIn 0.6s ease forwards;
    opacity: 0;
}

@keyframes fadeIn {
    to {
        opacity: 1;
    }
}

.magazine-card:nth-child(1) { animation-delay: 0.1s; }
.magazine-card:nth-child(2) { animation-delay: 0.2s; }
.magazine-card:nth-child(3) { animation-delay: 0.3s; }
.magazine-card:nth-child(4) { animation-delay: 0.4s; }
.magazine-card:nth-child(5) { animation-delay: 0.5s; }
.magazine-card:nth-child(6) { animation-delay: 0.6s; }
.magazine-card:nth-child(7) { animation-delay: 0.7s; }
.magazine-card:nth-child(8) { animation-delay: 0.8s; }

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

/* 8.5x11 aspect ratio (vertical) */
.magazine-cover {
    width: 100%;
    aspect-ratio: 8.5 / 11;
    background: #fff;
    box-shadow: 0 4px 20px var(--shadow), 0 0 0 1px rgba(0,0,0,0.05);
    position: relative;
    overflow: hidden;
    transition: box-shadow 0.4s ease;
    cursor: pointer;
}

.magazine-card:hover .magazine-cover {
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0,0,0,0.05);
}

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

.magazine-info {
    margin-top: 1.2rem;
}

.magazine-title {
    font-family: 'sofia-pro', sans-serif;
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.4rem;
}

.magazine-issue {
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 400;
}

/* Book Reader Modal */
.reader-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.95);
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.reader-overlay.active {
    display: flex;
    opacity: 1;
}

.reader-container {
    width: 90%;
    max-width: 1400px;
    height: 85vh;
    position: relative;
}

.close-reader {
    position: absolute;
    top: 0;
    right: -80px;
    background: none;
    border: none;
    color: white;
    font-size: 2rem;
    cursor: pointer;
    padding: 10px;
    transition: transform 0.2s;
    z-index: 10;
    font-family: 'sofia-pro', sans-serif;
}

.close-reader:hover {
    transform: scale(1.1);
}

/* Flipbook container */
#flipbook-container {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: transform 0.3s ease;
}

#bookSpread {
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

/* StPageFlip page styles */
.page {
    background: white;
    overflow: hidden;
}

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

/* StPageFlip library overrides */
.stf__parent {
    overflow: visible !important;
}

.stf__wrapper {
    perspective: 2000px;
}

.stf__block {
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.3);
}


.navigation {
    position: absolute;
    bottom: -60px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 1rem;
    align-items: center;
}

.nav-btn {
    background: white;
    border: none;
    padding: 0.8rem 1.5rem;
    font-family: 'sofia-pro', sans-serif;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    border-radius: 2px;
}

.nav-btn:hover:not(:disabled) {
    background: var(--accent);
    color: white;
}

.nav-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.page-indicator {
    color: white;
    font-family: 'sofia-pro', sans-serif;
    font-size: 0.9rem;
    font-weight: 400;
}

/* Zoom controls */
.zoom-controls {
    position: absolute;
    top: -50px;
    left: 0;
    display: flex;
    gap: 0.5rem;
}

.zoom-btn {
    background: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 2px;
    cursor: pointer;
    font-size: 1.2rem;
    font-family: 'sofia-pro', sans-serif;
    transition: all 0.2s;
}

.zoom-btn:hover {
    background: var(--accent);
    color: white;
}

/* Fullscreen button */
.fullscreen-btn {
    position: absolute;
    top: -50px;
    left: 100px;
    background: white;
    border: none;
    padding: 0.6rem 1rem;
    font-family: 'sofia-pro', sans-serif;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    border-radius: 2px;
    transition: all 0.2s;
}

.fullscreen-btn:hover {
    background: var(--accent);
    color: white;
}

/* Placeholder gradient backgrounds for covers without images */
.cover-placeholder-1 { background: linear-gradient(135deg, #2d3436 0%, #000000 100%); }
.cover-placeholder-2 { background: linear-gradient(135deg, #b8860b 0%, #8b6914 100%); }
.cover-placeholder-3 { background: linear-gradient(135deg, #1e3a5f 0%, #0f1f38 100%); }
.cover-placeholder-4 { background: linear-gradient(135deg, #6a4c3a 0%, #3d2817 100%); }
.cover-placeholder-5 { background: linear-gradient(135deg, #2c5f2d 0%, #1a3a1b 100%); }
.cover-placeholder-6 { background: linear-gradient(135deg, #7f3f3f 0%, #5a2828 100%); }
.cover-placeholder-7 { background: linear-gradient(135deg, #483d8b 0%, #2e2563 100%); }
.cover-placeholder-8 { background: linear-gradient(135deg, #556b2f 0%, #3a4a1f 100%); }

/* Contact Page */
.contact-page {
    width: 100%;
    min-height: calc(100vh - 120px);
    display: flex;
    align-items: flex-start;
    justify-content: flex-start;
}

.contact-form-wrapper {
    width: 100%;
    max-width: 600px;
    padding: 2rem 0;
}

.contact-form {
    display: flex;
    flex-direction: column;
    gap: 2.5rem;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-name-row {
    flex-direction: row;
    gap: 3rem;
}

.form-name-row .form-field {
    flex: 1;
}

.form-field {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.form-label {
    font-family: 'sofia-pro', sans-serif;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.3;
}

.form-label-right {
    font-size: 0rem;
}

.form-required {
    font-weight: 400;
    font-size: 1rem;
    color: var(--text-secondary);
}

.form-sublabel {
    font-weight: 400;
    font-size: 0.9rem;
    color: var(--text-primary);
}

.contact-form input[type="text"],
.contact-form input[type="email"],
.contact-form input[type="tel"] {
    border: none;
    border-bottom: 1.5px solid var(--text-primary);
    outline: none;
    padding: 0.5rem 0;
    font-family: 'sofia-pro', sans-serif;
    font-size: 1rem;
    color: var(--text-primary);
    background: transparent;
    width: 100%;
    transition: border-color 0.2s ease;
}

.contact-form input:focus {
    border-bottom-color: var(--accent);
}

.contact-form textarea {
    border: none;
    border-bottom: 1.5px solid var(--text-primary);
    outline: none;
    padding: 0.5rem 0;
    font-family: 'sofia-pro', sans-serif;
    font-size: 1rem;
    color: var(--text-primary);
    background: transparent;
    width: 100%;
    resize: vertical;
    min-height: 120px;
    transition: border-color 0.2s ease;
}

.contact-form textarea:focus {
    border-bottom-color: var(--accent);
}

.form-submit-row {
    padding-top: 0.5rem;
}

.form-submit {
    background: none;
    border: none;
    border-bottom: 2px solid var(--text-primary);
    font-family: 'sofia-pro', sans-serif;
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    cursor: pointer;
    padding: 0.2rem 0;
    transition: color 0.2s ease, border-color 0.2s ease;
    letter-spacing: 0.01em;
}

.form-submit:hover {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

.form-submit:disabled {
    color: var(--text-secondary);
    border-bottom-color: var(--text-secondary);
    cursor: default;
}

.form-social {
    padding-top: 0.5rem;
}

.social-link {
    color: var(--text-primary);
    text-decoration: none;
    display: inline-flex;
    transition: color 0.2s ease;
}

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

/* Loading indicator */
.loading {
    text-align: center;
    padding: 2rem;
    color: var(--text-secondary);
    font-family: 'sofia-pro', sans-serif;
}

/* Responsive */
@media (max-width: 1200px) {
    .magazine-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    /* Header */
    header {
        padding: 0.9rem 1.2rem;
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .logo-img {
        height: 28px;
    }

    .main-nav {
        gap: 0.8rem;
    }

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

    /* Main */
    main {
        padding: 1.5rem 1rem;
    }

    /* Portfolio - stack single column on mobile */
    .editorial-scroll {
        gap: 2.5rem;
    }

    .ed-row {
        flex-direction: column;
        gap: 2.5rem;
    }

    .ed-img {
        width: 100% !important;
    }

    /* Magazines */
    .magazine-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    h1 {
        font-size: 1.2rem;
        margin-bottom: 1.5rem;
    }

    /* Contact form - stack name fields */
    .form-name-row {
        flex-direction: column;
        gap: 2rem;
    }

    /* Reader - close button back on screen */
    .reader-container {
        width: 100%;
        height: 72vh;
        margin-top: 55px;
    }

    .close-reader {
        top: -45px;
        right: 0;
    }

    .zoom-controls {
        top: -42px;
        left: 0;
    }

    .zoom-btn {
        width: 34px;
        height: 34px;
        font-size: 1rem;
    }

    .fullscreen-btn {
        top: -42px;
        left: 80px;
        padding: 0.4rem 0.7rem;
        font-size: 0.8rem;
    }

    .navigation {
        bottom: -55px;
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.5rem;
    }

    .nav-btn {
        padding: 0.5rem 1rem;
        font-size: 0.8rem;
    }

    .page-indicator {
        font-size: 0.8rem;
    }
}

/* Very small phones - stack header vertically */
@media (max-width: 400px) {
    header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.6rem;
    }

    .main-nav {
        gap: 1rem;
    }

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