@import "../../_shared/v1.0.0/variables.css";

:root {
    --bg-color: #FDFBF8;
    /* Very subtle warm white */
    --text-primary: #121212;
    --text-secondary: #757575;
    --accent: #D4D4D4;
    /* Light grey for lines */

    --font-main: 'Manrope', sans-serif;
    --font-display: 'Playfair Display', serif;
}

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

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    font-family: var(--font-main);
    font-weight: 300;
    font-size: 1rem;
    line-height: 1.6;
    overflow-x: hidden;
}

/* Utilities */
.container {
    max-width: var(--spacing-350);
    margin: 0 auto;
    padding: 0 var(--spacing-10);
}

.line {
    width: 100%;
    height: 1px;
    background-color: var(--accent);
    margin: var(--spacing-8) 0;
}

.flex {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: var(--spacing-5);
}

/* Navigation */
.site-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--spacing-5) var(--spacing-10);
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--bg-color);
    border-bottom: 1px solid var(--accent);
    gap: var(--spacing-sm);
}

/* Mobile hamburger — hidden on desktop */
.mobile-nav-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: var(--spacing-1);
    background: none;
    border: none;
    padding: var(--spacing-2);
    cursor: pointer;
    flex-shrink: 0;
}

.mobile-nav-toggle span {
    display: block;
    width: var(--spacing-5);
    height: 2px;
    background: var(--text-primary);
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.mobile-nav-toggle.is-open span:nth-child(2) {
    opacity: 0;
}

.mobile-nav-toggle.is-open span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.mobile-nav-toggle.is-open span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* Nav menu — desktop row, mobile dropdown */
.nav-menu {
    display: flex;
    align-items: center;
    gap: var(--spacing-lg);
    flex: 1;
    justify-content: flex-end;
}

/* Language Toggle */
.lang-switch,
.language-switcher {
    font-size: 0.75rem;
    letter-spacing: 1px;
    display: flex;
    gap: var(--spacing-2);
    flex-shrink: 0;
}

.lang-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    text-transform: uppercase;
    transition: color 0.3s;
}

.lang-btn.active,
.lang-btn:hover {
    color: var(--text-primary);
    text-decoration: underline;
    text-underline-offset: 4px;
}

.lang-en {
    display: none;
}

body[data-lang="en"] .lang-en {
    display: block;
}

body[data-lang="en"] .lang-pl {
    display: none;
}

/* Typography */
h1 {
    font-family: var(--font-display);
    font-weight: 400;
    line-height: 0.95;
    letter-spacing: -0.03em;
    margin-bottom: var(--spacing-5);
    margin-left: calc(var(--spacing-1) * -1);
    word-break: break-word;
    hyphens: auto;
}

/* Hero h1 — higher specificity beats _shared/variables.css */
.hero h1 {
    font-size: clamp(2rem, 12vw, 10rem);
}

h2 {
    font-size: clamp(1rem, 4vw, 0.875rem);
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: var(--spacing-10);
    font-weight: 500;
    word-break: break-word;
    hyphens: auto;
}

.label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-secondary);
    margin-bottom: var(--spacing-2);
    display: block;
}

/* Hero */
.hero {
    min-height: 100vh;
    padding-top: 20vh;
    position: relative;
    /* Correct hero overflow on mobile */
    overflow-x: hidden;
}

.hero-details {
    margin-top: var(--spacing-24);
    display: flex;
    gap: var(--spacing-16);
}

.hero-detail-item {
    flex: 0 0 auto;
}

.hero-image {
    position: absolute;
    right: 10%;
    top: 15%;
    width: var(--spacing-76);
    height: var(--spacing-100);
    z-index: 0;
    opacity: 0.8;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

/* Stack couple names — name2 on its own line, same font size */
.hero-name-title {
    display: block;
}

/* Keep all hero content above the decorative image */
.hero>.line,
.hero>.flex,
.hero>h1,
.hero>.hero-details {
    position: relative;
    z-index: 1;
}


.hero-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    /* Removes bottom space */
}

/* Sections General */
section {
    padding: var(--spacing-xxl) 0;
}

/* Story - Asymmetric Grid */
.story-section .grid {
    align-items: center;
}

.story-left {
    grid-column: 2 / span 4;
    min-width: 0;
}

.story-right {
    grid-column: 7 / span 5;
    min-width: 0;
}

.big-text {
    font-size: 2rem;
    line-height: 1.4;
    font-family: var(--font-display);
    font-style: italic;
    overflow-wrap: break-word;
    word-break: break-word;
}

.minimal-img {
    width: 100%;
    min-height: 200px; /* fallback for browsers without aspect-ratio (iOS < 15) */
    aspect-ratio: 3/4;
    object-fit: cover;
    filter: grayscale(100%);
    transition: filter 0.5s ease;
}

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

/* Info Grid - Clean Lines */
.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(var(--spacing-76), 1fr));
    border-top: 1px solid var(--accent);
}

.info-cell {
    padding: var(--spacing-10);
    border-right: 1px solid var(--accent);
    min-height: var(--spacing-76);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-width: 0;
    overflow-wrap: break-word;
    word-break: break-word;
}

.info-cell:last-child {
    border-right: none;
}

/* When the last cell is hidden (section disabled), remove the dangling right border.
   JS fallback: core.js toggles .has-no-last-cell for browsers without :has() (Firefox) */
.info-grid.has-no-last-cell .info-cell:nth-last-child(2) {
    border-right: none;
}
@supports selector(:has(*)) {
    .info-grid:has(.info-cell:last-child[style*="display: none"]) .info-cell:nth-last-child(2) {
        border-right: none;
    }
}

.info-content {
    font-size: 1.5rem;
    font-weight: 200;
    overflow-wrap: break-word;
    word-break: break-word;
}

/* Ensure empty data-keys in info cells don't collapse but don't show margins */
.info-cell [data-key]:empty {
    visibility: hidden;
}

/* Gallery - Horizontal Scroll */
.gallery-track {
    display: flex;
    gap: var(--spacing-5);
    overflow-x: auto;
    padding-bottom: var(--spacing-5);
    padding-left: var(--spacing-10);
    /* Indented start */
    padding-right: var(--spacing-10);
    /* Space at the end */
    scrollbar-width: thin;
    scrollbar-color: var(--accent) transparent;
    -webkit-overflow-scrolling: touch;
}

.gallery-track::-webkit-scrollbar {
    height: 3px;
}

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

.gallery-track::-webkit-scrollbar-thumb {
    background: var(--accent);
    border-radius: var(--radius-md);
}

.gallery-img {
    height: var(--spacing-128);
    flex: 0 0 auto;
    filter: grayscale(100%);
    /* Ensure images don't stretch and are visible */
    max-width: 80vw;
    min-width: var(--spacing-76);
    object-fit: cover;
}

/* RSVP - Minimal Form */
#rsvp {
    padding-top: var(--spacing-xxl);
}

.rsvp-container {
    max-width: var(--spacing-150);
}

.form-row {
    display: flex;
    gap: var(--spacing-5);
    margin-bottom: var(--spacing-10);
}

.input-group {
    flex: 1;
    position: relative;
    margin-bottom: var(--spacing-4);
    /* Better spacing on mobile if wrapped */
}

input,
select,
textarea {
    width: 100%;
    background: transparent;
    border: none;
    border-bottom: 1px solid var(--text-primary);
    padding: var(--spacing-4) 0;
    font-family: var(--font-main);
    font-size: 1rem;
    color: var(--text-primary);
    outline: none;
    border-radius: 0;
}

label {
    position: absolute;
    left: 0;
    top: var(--spacing-4);
    pointer-events: none;
    transition: 0.3s;
    color: var(--text-secondary);
}

input:focus+label,
textarea:focus+label,
input:not(:placeholder-shown)+label,
textarea:not(:placeholder-shown)+label {
    top: calc(-1 * var(--spacing-3)) !important;
    font-size: 0.75rem;
    color: var(--text-primary);
}

/* Hide select arrow roughly */
select {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    cursor: pointer;
}


button.submit {
    background: var(--text-primary);
    color: var(--bg-color);
    border: none;
    padding: var(--spacing-5) var(--spacing-16);
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    cursor: pointer;
    margin-top: var(--spacing-5);
    margin-bottom: var(--spacing-10);
    /* Added space before footer */
    transition: all 0.3s;
}

button.submit:hover {
    opacity: 0.8;
    transform: translateY(-2px);
}

/* Hide duplicate labels for select fields */
#attending+label,
#plusOne+label {
    display: none !important;
}

/* Ensure placeholder/value in select aligns nicely without label animation */
#attending,
#plusOne {
    padding-top: var(--spacing-4);
    font-family: var(--font-main);
    font-weight: 300;
    color: var(--text-primary);
    /* Default to primary (user selected) */
}

/* Target the "placeholder" state (value is empty).
   .is-empty-value is toggled by JS for browsers without :has() (Firefox) */
#attending:required:invalid,
#plusOne:required:invalid,
select.is-empty-value {
    color: var(--text-secondary) !important;
    font-family: var(--font-main);
    opacity: 1;
}
@supports selector(:has(*)) {
    select:has(option[value=""]:checked) {
        color: var(--text-secondary) !important;
        font-family: var(--font-main);
        opacity: 1;
    }
}

/* Tablet */
@media (min-width: 769px) and (max-width: 1024px) {
    .hero-image {
        width: var(--spacing-64);
        height: var(--spacing-80);
        right: 10%;
    }
}

/* Mobile Optimizations */
@media (max-width: 768px) {
    :root {
        --spacing-xxl: var(--spacing-12);
        --spacing-xl: var(--spacing-10);
    }

    :root {
        --spacing-xxl: var(--spacing-12);
        --spacing-xl: var(--spacing-10);
    }

    .container {
        padding: 0 var(--spacing-5);
    }

    .site-nav {
        padding: var(--spacing-3) var(--spacing-5);
    }

    .hero {
        min-height: auto;
        padding-top: 7.5rem;
        padding-bottom: var(--spacing-10);
    }

    /* Mobile nav */
    .mobile-nav-toggle {
        display: flex;
        margin-left: auto;
    }

    .nav-menu {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        width: 100%;
        flex-direction: column;
        align-items: center;
        gap: var(--spacing-md);
        padding: var(--spacing-8) var(--spacing-lg);
        background: var(--bg-color);
        border-bottom: 1px solid var(--accent);
        z-index: 99;
    }

    .nav-menu.is-open {
        display: flex;
    }

    /* Make links stack vertically inside the drawer */
    .nav-menu.is-open .nav-links {
        flex-direction: column !important;
        flex: 0 !important;
        width: 100%;
        align-items: center;
        justify-content: center !important;
        gap: var(--spacing-4) !important;
        margin: 0 !important;
    }

    .nav-menu .lang-switch {
        justify-content: center;
    }

    /* Compact lang switcher — proportional to rest of page on mobile */
    .lang-switch {
        gap: 4px;
    }

    .lang-btn {
        padding: var(--spacing-1) var(--spacing-2);
        font-size: 0.72rem;
    }

    .hero h1 {
        line-height: 1.1;
    }

    .grid {
        display: block;
    }

    .story-left,
    .story-right {
        margin-bottom: var(--spacing-15);
        grid-column: span 12;
    }

    .hero-details {
        flex-direction: column;
        gap: var(--spacing-8);
        margin-top: var(--spacing-16);
    }

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

    .info-cell {
        border-right: none;
        border-bottom: 1px solid var(--accent);
        min-height: auto;
        padding: var(--spacing-8) 0;
    }

    .info-cell:last-child {
        border-bottom: none;
    }

    .info-grid.has-no-last-cell .info-cell:nth-last-child(2) {
        border-bottom: none;
    }
    @supports selector(:has(*)) {
        .info-grid:has(.info-cell:last-child[style*="display: none"]) .info-cell:nth-last-child(2) {
            border-bottom: none;
        }
    }

    .hero-image {
        display: block;
        width: var(--spacing-50);
        height: var(--spacing-64);
        right: 5%;
        top: 10%;
        opacity: 0.5;
    }

    /* Make gallery swipeable with visible hint */
    .gallery-track {
        padding-right: var(--spacing-5);
        /* Peek effect */
    }

    .gallery-img {
        height: var(--spacing-75);
    }

    .form-row {
        flex-direction: column;
        gap: 0;
    }

    .big-text {
        font-size: 1.5rem;
    }
}

/* Fix for Select Floating Label */
.input-group select+label {
    top: -15px !important;
    font-size: 0.8rem;
    color: var(--text-primary);
}

/* Skeleton Loading Styles */
.skeleton {
    background: linear-gradient(90deg, var(--skeleton-base) 25%, var(--skeleton-shine) 50%, var(--skeleton-base) 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: var(--radius-md);
}

.skeleton-text {
    height: 1em;
    width: 80%;
    margin-bottom: 0.5em;
}

.skeleton-title {
    height: 2.5em;
    width: 60%;
}

.skeleton-image {
    width: 100%;
    height: var(--spacing-75);
}

.content-loaded {
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes skeleton-loading {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}