:root {
    --bg: #f8f5f1;
    --text: #2a2a2a;
    --accent: #9f7b5a;
    --muted: #7a7a7a;
    --card: #ffffff;
    --maxw: 900px;
    --ring: rgba(159, 123, 90, 0.35);
    --line: rgba(42, 42, 42, 0.12);
    --placeholder: rgba(42, 42, 42, 0.48);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Georgia", serif;
    color: var(--text);
    background: var(--bg);
    line-height: 1.6;
}

.container {
    width: min(100% - 32px, var(--maxw));
    margin: 0 auto;
}

.site-header,
.site-footer {
    padding: 20px 0;
    text-align: center;
}

.site-logo {
    letter-spacing: 0.1em;
}

/* HERO */

.hero-main {
    min-height: 70vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.card {
    background: var(--card);
    padding: 40px 30px;
    border-radius: 24px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.08);
}

.hero-details {
    margin-top: 6px;
}

/* TEXT */

.eyebrow {
    text-transform: uppercase;
    letter-spacing: 0.25em;
    font-size: 12px;
    color: var(--muted);
}

.names {
    font-size: clamp(42px, 7vw, 84px);
    margin: 20px 0;
    font-weight: 500;
}

.names span {
    color: var(--accent);
}

.hero-date {
    font-size: 22px;
    margin-bottom: 30px;
}

.hero-details p {
    margin: 10px 0;
    font-size: 18px;
}

.hero-sub {
    font-size: 16px;
    color: var(--muted);
}

/* MAP LINK */

.map-link {
    display: inline-block;
    margin-top: 10px;
    padding: 10px 18px;
    border-radius: 999px;
    background: var(--accent);
    color: #fff;
    text-decoration: none;
    font-size: 14px;
    transition: 0.2s ease;
    border: none;
}

.map-link:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.map-link:active {
    transform: translateY(0);
}

.map-link:focus-visible {
    outline: none;
    box-shadow: 0 0 0 4px var(--ring);
}

/* MAP */

.map-section {
    padding: 40px 0 80px;
}

.map-wrapper {
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 20px 50px rgba(0,0,0,0.08);
}

/* COUNTDOWN */

.countdown {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin: 30px 0 40px;
    flex-wrap: wrap;
}

@media (max-width: 480px) {
    .countdown {
        gap: 12px;
        margin: 22px 0 28px;
    }
}

.cd-item {
    text-align: center;
    min-width: 70px;
}

.cd-item span {
    display: block;
    font-size: 28px;
    font-weight: 600;
}

.cd-item small {
    font-size: 12px;
    letter-spacing: 0.1em;
    color: var(--muted);
}

/* FLIP COUNTDOWN */

.cd-flip {
    font-size: 32px;
    font-weight: 600;
    perspective: 1000px;
    display: inline-block;
    min-width: 40px;
}

.cd-flip.flip {
    animation: flipAnim 0.4s ease;
}

@keyframes flipAnim {
    0% {
        transform: rotateX(0deg);
    }
    50% {
        transform: rotateX(90deg);
    }
    100% {
        transform: rotateX(0deg);
    }
}

.flip {
    display: inline-block;
    font-size: 32px;
    font-weight: 600;
    perspective: 600px;
}

.flip span {
    display: inline-block;
    transition: transform 0.3s ease;
    transform-origin: center;
}

.flip.anim span {
    transform: rotateX(90deg);
}

/* FIX JUMPING NUMBERS */

.cd-item span,
.flip span {
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum";
}

.cd-item {
    width: 80px;
}

/* FIX COUNTDOWN LAYOUT */

.cd-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.cd-item small {
    display: block;
    margin-top: 6px;
}

/* FORM */

.invite-form {
    margin-top: 30px;
    text-align: left;
}

.invite-form-fields {
    border: 0;
    padding: 0;
    margin: 0;
    min-inline-size: 0;
}

.invite-form--locked .invite-form-fields {
    opacity: 0.92;
}

.invite-rsvp-locked-note {
    margin-top: 14px;
    text-align: center;
}

/* Extra fields smooth reveal */

#extra-fields {
    overflow: visible;
    max-height: 1200px;
    opacity: 1;
    transform: translateY(0);
    transition: max-height 0.35s ease, opacity 0.25s ease, transform 0.25s ease;
    will-change: max-height, opacity, transform;
}

#extra-fields.is-hidden {
    overflow: hidden;
    max-height: 0;
    opacity: 0;
    transform: translateY(-6px);
    pointer-events: none;
}

.invite-form h3 {
    text-align: center;
    margin-bottom: 20px;
}

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

/* Inputs baseline */

.invite-form input[type="text"],
.invite-form textarea,
.invite-form select {
    width: 100%;
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.9);
    color: var(--text);
    font-family: inherit;
    font-size: 15px;
    transition: box-shadow 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.invite-form input[type="text"]::placeholder,
.invite-form textarea::placeholder {
    color: var(--placeholder);
}

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

.invite-form input[type="text"]:focus-visible,
.invite-form textarea:focus-visible,
.invite-form select:focus-visible {
    outline: none;
    box-shadow: 0 0 0 4px var(--ring);
    border-color: rgba(159, 123, 90, 0.55);
}

.invite-form select {
    appearance: none;
    background-image:
        linear-gradient(45deg, transparent 50%, rgba(42,42,42,0.65) 50%),
        linear-gradient(135deg, rgba(42,42,42,0.65) 50%, transparent 50%);
    background-position:
        calc(100% - 18px) 50%,
        calc(100% - 12px) 50%;
    background-size: 6px 6px, 6px 6px;
    background-repeat: no-repeat;
    padding-right: 34px;
}

/* Choice pills */

.invite-form .form-group label {
    display: inline-block;
    margin: 0 0 8px;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: default;
    user-select: text;
    line-height: 1.2;
}

/* Modern browsers */
@supports selector(:has(*)) {
    .invite-form .form-group label:has(input) {
        display: inline-flex;
        align-items: center;
        gap: 10px;
        margin: 6px 10px 0 0;
        padding: 9px 12px;
        border-radius: 999px;
        border: 1px solid var(--line);
        background: rgba(255, 255, 255, 0.75);
        cursor: pointer;
        user-select: none;
        line-height: 1.1;
        transition: transform 0.15s ease, box-shadow 0.2s ease, border-color 0.2s ease, background 0.2s ease;
    }

    .invite-form .form-group label:has(input):hover {
        transform: translateY(-1px);
    }

    .invite-form .form-group label:has(input):focus-within {
        box-shadow: 0 0 0 4px var(--ring);
        border-color: rgba(159, 123, 90, 0.55);
    }

    .invite-form .form-group label:has(input:checked) {
        border-color: rgba(159, 123, 90, 0.55);
        background: rgba(159, 123, 90, 0.12);
    }
}

.invite-form .form-group > label > input[type="checkbox"],
.invite-form .form-group > label > input[type="radio"] {
    width: 18px;
    height: 18px;
    margin: 0;
    accent-color: var(--accent);
}

/* In older browsers we can't test :has, so we rely on the fact that option labels come after the question label,
   and question label is typically the first child. */
.invite-form .form-group > label:not(:first-child) {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin: 6px 10px 0 0;
    padding: 9px 12px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.75);
    cursor: pointer;
    user-select: none;
    line-height: 1.1;
    transition: transform 0.15s ease, box-shadow 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.invite-form .form-group > label:not(:first-child):hover {
    transform: translateY(-1px);
}

.invite-form .form-group > label:not(:first-child):focus-within {
    box-shadow: 0 0 0 4px var(--ring);
    border-color: rgba(159, 123, 90, 0.55);
}

.invite-form .form-group > label:not(:first-child) input[type="checkbox"],
.invite-form .form-group > label:not(:first-child) input[type="radio"] {
    width: 18px;
    height: 18px;
    margin: 0;
    accent-color: var(--accent);
}

button {
    margin-top: 10px;
    cursor: pointer;
}

.invite-form button.map-link {
    margin-top: 14px;
}

.hero-details hr {
    margin: 30px auto;
    width: 60px;
    border: none;
    border-top: 1px solid #ddd;
}

.invite-info {
    margin: 25px auto;
    text-align: center;
    font-size: 16px;
    line-height: 1.6;
}

.invite-info p {
    margin-bottom: 12px;
}

.invite-info p {
    margin: 6px 0;
}

.muted {
    color: #777;
    font-size: 14px;
}

.divider {
    margin: 20px auto;
    width: 40px;
    height: 1px;
    background: #ddd;
}

.map-wrapper {
    margin: 15px 0 25px;
    border-radius: 12px;
    overflow: hidden;
}

.map-wrapper iframe {
    display: block;
}

/* FIX NAME */

.names {
    line-height: 1.1;
    word-break: break-word;
    overflow-wrap: anywhere;
}

@media (max-width: 768px) {

    .names {
        font-size: 36px;
        line-height: 1.2;
    }

    .card {
        padding: 20px;
    }

}

.names {
    font-size: 64px;
}

.names {
    line-height: 1.1;

    /* ВАЖНО */
    word-break: normal;
    overflow-wrap: normal;
}

/* FIX NAME TYPOGRAPHY */

.names {
    line-height: 1.1;
    word-break: normal;
    overflow-wrap: normal;
}

.names span {
    display: block;
}

/* MOBILE */

@media (max-width: 768px) {
    .names {
        font-size: 36px;
        line-height: 1.2;
    }
}

/* =========================
   DARK MODE (SYSTEM)
   ========================= */

@media (prefers-color-scheme: dark) {

    body {
        background: #111;
        color: #eee;
    }

    .card {
        background: #1c1c1c;
        color: #eee;
    }

    .map-link {
        background: #b08968;
        color: #fff;
    }

    .divider {
        background: #333;
    }

    input, textarea, select {
        background: #222;
        color: #eee;
        border: 1px solid #444;
    }

    .muted {
        color: #aaa;
    }

    :root {
        --line: rgba(255, 255, 255, 0.16);
        --ring: rgba(176, 137, 104, 0.35);
        --placeholder: rgba(238, 238, 238, 0.50);
    }

    .invite-form input[type="text"],
    .invite-form textarea,
    .invite-form select {
        background: rgba(34, 34, 34, 0.9);
        border-color: var(--line);
        color: #eee;
        color-scheme: dark;
    }

    .invite-form input[type="text"]::placeholder,
    .invite-form textarea::placeholder {
        color: var(--placeholder);
    }

    .invite-form select option {
        background: #222;
        color: #eee;
    }

    .invite-form .form-group label {
        background: rgba(34, 34, 34, 0.7);
        border-color: var(--line);
    }

    @supports selector(:has(*)) {
        .invite-form .form-group label:has(input:checked) {
            border-color: rgba(176, 137, 104, 0.75);
            background: rgba(176, 137, 104, 0.14);
        }
    }
}

/* COUNTDOWN FLIP */

.cd-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.cd-item span {
    display: inline-block;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.cd-item.anim span {
    transform: scaleY(0);
    opacity: 0.3;
}
