:root {
    --ink: #172126;
    --muted: #63727a;
    --paper: #fbfaf7;
    --surface: #ffffff;
    --line: #e3ded6;
    --primary: #9f5f3a;
    --primary-dark: #7c4328;
    --teal: #1f6f78;
    --gold: #c9a14a;
    --rose: #bd5b6d;
    --shadow: 0 14px 34px rgba(23, 33, 38, 0.08);
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    font-family: "Inter", Arial, sans-serif;
    background: var(--paper);
    color: var(--ink);
}

img {
    max-width: 100%;
    display: block;
}

a {
    color: inherit;
}

.container {
    width: min(1180px, calc(100% - 40px));
    margin: 0 auto;
}

.site-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: rgba(251, 250, 247, 0.92);
    border-bottom: 1px solid rgba(227, 222, 214, 0.85);
    backdrop-filter: blur(16px);
}

.navbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    min-height: 76px;
}

.logo {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--ink);
    text-decoration: none;
    font-weight: 800;
    letter-spacing: 0;
    font-size: 1.15rem;
}

.logo-mark {
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: var(--primary);
    color: #fff;
}

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

.nav-links a {
    color: #2d3b41;
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 650;
}

.nav-links a:hover {
    color: var(--primary);
}

.btn-primary,
.btn-secondary,
.btn-outline,
.btn-danger,
.btn-quiet {
    border: 0;
    border-radius: 8px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 42px;
    padding: 10px 16px;
    font: inherit;
    font-weight: 750;
    text-decoration: none;
    transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 10px 22px rgba(159, 95, 58, 0.2);
}

.btn-primary:hover,
.btn-secondary:hover,
.btn-outline:hover,
.btn-danger:hover,
.btn-quiet:hover {
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--teal);
    color: #fff;
}

.btn-outline {
    background: transparent;
    color: var(--primary-dark);
    border: 1px solid #d4c7ba;
}

.btn-danger {
    background: #b33f4b;
    color: #fff;
}

.btn-quiet {
    background: #f0ebe3;
    color: #314047;
}

.section {
    padding: 70px 0;
}

.section-tight {
    padding: 44px 0;
}

.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--primary-dark);
    background: #f3e7dc;
    border: 1px solid #ead8c7;
    border-radius: 999px;
    padding: 7px 12px;
    font-size: 0.82rem;
    font-weight: 800;
}

.page-title {
    font-size: clamp(2.1rem, 6vw, 4.9rem);
    line-height: 1.02;
    margin: 18px 0 18px;
    letter-spacing: 0;
}

.section-title {
    font-size: clamp(1.65rem, 4vw, 2.65rem);
    line-height: 1.08;
    margin: 0 0 14px;
    letter-spacing: 0;
}

.lead {
    color: var(--muted);
    font-size: 1.08rem;
    line-height: 1.75;
    max-width: 760px;
}

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

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

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

.grid-4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.card,
.feature-card,
.form-panel,
.template-option,
.tribute-card,
.quote-card,
.stat-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 8px 20px rgba(23, 33, 38, 0.045);
}

.feature-card,
.quote-card,
.stat-card {
    padding: 24px;
}

.feature-icon {
    width: 44px;
    height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: #edf6f4;
    color: var(--teal);
    margin-bottom: 18px;
}

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

.form-shell {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 330px;
    gap: 24px;
    align-items: start;
}

.form-panel {
    padding: 24px;
    margin-bottom: 20px;
}

.form-panel h2,
.form-panel h3 {
    margin-top: 0;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.field {
    margin-bottom: 18px;
}

.field label,
.field-label {
    display: block;
    font-size: 0.9rem;
    font-weight: 800;
    margin-bottom: 8px;
}

.field input,
.field textarea,
.field select,
.input {
    width: 100%;
    border: 1px solid #d9d1c8;
    border-radius: 8px;
    min-height: 44px;
    padding: 11px 12px;
    background: #fff;
    color: var(--ink);
    font: inherit;
}

.field textarea {
    resize: vertical;
}

.hint {
    color: var(--muted);
    font-size: 0.86rem;
    line-height: 1.5;
    margin-top: 6px;
}

.switch-grid {
    display: grid;
    gap: 12px;
}

.check-line {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}

.check-line input {
    margin-top: 3px;
}

.alert {
    border-radius: 8px;
    padding: 14px 16px;
    margin-bottom: 18px;
}

.alert-error {
    background: #ffe8e9;
    color: #842532;
    border: 1px solid #f2c4c9;
}

.alert-success {
    background: #e8f7ed;
    color: #24583a;
    border: 1px solid #c5e5d0;
}

.template-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 14px;
}

.template-option {
    cursor: pointer;
    overflow: hidden;
    transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.template-option:hover,
.template-option.selected {
    transform: translateY(-2px);
    border-color: var(--primary);
    box-shadow: var(--shadow);
}

.template-preview {
    min-height: 118px;
    padding: 16px;
    color: #fff;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.template-preview i {
    font-size: 1.6rem;
}

.template-body {
    padding: 14px;
}

.template-body h3 {
    font-size: 1rem;
    margin: 0 0 5px;
}

.template-body p {
    margin: 0;
    color: var(--muted);
    font-size: 0.84rem;
    line-height: 1.45;
}

.cover-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 14px;
}

.cover-search {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 160px auto;
    gap: 10px;
}

.pexels-results {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
    margin-top: 16px;
}

.pexels-photo {
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
}

.pexels-photo img {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
}

.pexels-photo button {
    width: 100%;
    border-radius: 0;
}

.cover-preview {
    margin-top: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow: hidden;
    background: #f4f0ea;
}

.cover-preview img {
    width: 100%;
    max-height: 260px;
    object-fit: cover;
}

.image-preview-grid,
.current-image-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 12px;
    margin-top: 14px;
}

.image-thumb {
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
}

.image-thumb img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
}

.image-thumb label {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px;
    font-size: 0.84rem;
}

.timeline-event {
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    margin-bottom: 12px;
    position: relative;
}

.timeline-event .remove-event {
    position: absolute;
    top: 12px;
    right: 12px;
    min-height: 34px;
    width: 34px;
    padding: 0;
}

.sticky-summary {
    position: sticky;
    top: 96px;
}

.summary-preview {
    overflow: hidden;
}

.summary-preview-media {
    min-height: 180px;
    background: linear-gradient(135deg, var(--primary), var(--teal));
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
}

.summary-preview-media img {
    width: 100%;
    height: 220px;
    object-fit: cover;
}

.summary-preview-body {
    padding: 18px;
}

.hero-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(320px, 0.95fr);
    gap: 42px;
    align-items: center;
    padding: 54px 0 40px;
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 26px;
}

.hero-preview {
    min-height: 560px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--line);
    background: #fff;
    box-shadow: var(--shadow);
}

.hero-preview img {
    width: 100%;
    height: 310px;
    object-fit: cover;
}

.hero-preview-body {
    padding: 24px;
}

.mini-gallery {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-top: 18px;
}

.mini-gallery div {
    aspect-ratio: 1;
    border-radius: 8px;
    background: linear-gradient(135deg, #d9b65d, #1f6f78);
}

.template-showcase {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
}

.quote-band {
    background: #16242a;
    color: #fff;
    border-radius: 8px;
    padding: 36px;
}

.quote-band .quote-card {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.14);
    color: #fff;
    box-shadow: none;
}

.tribute-card {
    overflow: hidden;
}

.tribute-card img,
.tribute-card .fallback-media {
    width: 100%;
    height: 205px;
    object-fit: cover;
    background: linear-gradient(135deg, var(--primary), var(--teal));
}

.tribute-card-body {
    padding: 18px;
}

.site-footer {
    margin-top: auto;
    border-top: 1px solid var(--line);
    padding: 34px 0;
    background: #f3f0ea;
}

.footer-grid {
    display: grid;
    grid-template-columns: 1.4fr 1fr 1fr;
    gap: 24px;
}

.footer-grid a {
    color: #415057;
    text-decoration: none;
}

.footer-grid a:hover {
    color: var(--primary);
}

@media (max-width: 980px) {
    .grid-2,
    .grid-3,
    .grid-4,
    .hero-grid,
    .form-shell,
    .footer-grid,
    .template-showcase {
        grid-template-columns: 1fr;
    }

    .sticky-summary {
        position: static;
    }

    .hero-preview {
        min-height: 0;
    }
}

@media (max-width: 720px) {
    .container {
        width: min(100% - 28px, 1180px);
    }

    .navbar {
        align-items: flex-start;
        flex-direction: column;
        padding: 14px 0;
    }

    .nav-links {
        gap: 12px;
    }

    .form-row,
    .cover-search {
        grid-template-columns: 1fr;
    }

    .section {
        padding: 48px 0;
    }

    .quote-band {
        padding: 22px;
    }
}
