/* ===========================
   Memorial base layer — shared by every theme.
   Structure lives here; themes only set the tokens below.
   Ported from the original Tango site (legacy/styles.css).
   =========================== */

/* Token contract (each theme defines all of these on :root):
   --bg --bg-alt --bg-deep          page, alternate section and deep backgrounds
   --surface                        cards (quotes, reflection message)
   --text --heading --muted         body text, headings, secondary text
   --accent --accent-light          rules, borders, focus rings
   --accent-strong                  emphasis text, dedication
   --on-hero                        text over the hero image
   --hero-overlay                   gradient laid over the hero image
   --hero-fade-from                 top colour of the hero → page fade
   --footer-bg --footer-text --footer-muted --footer-accent
   --shadow --shadow-light
   --font-heading --font-body
*/

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

:root {
    /* Spacing */
    --spacing-xs: 0.5rem;
    --spacing-sm: 1rem;
    --spacing-md: 2rem;
    --spacing-lg: 3rem;
    --spacing-xl: 4rem;
    --spacing-xxl: 6rem;

    /* Transitions */
    --transition-smooth: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-fast: all 0.2s ease;
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    font-family: var(--font-body);
    line-height: 1.7;
    color: var(--text);
    background-color: var(--bg);
    overflow-x: hidden;
}

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

/* ===========================
   Typography
   =========================== */

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    line-height: 1.3;
    font-weight: 600;
    color: var(--heading);
}

p {
    margin-bottom: 1.2rem;
}

/* ===========================
   Utilities
   =========================== */

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--spacing-md);
}

.fade-in {
    animation: fadeIn 1.5s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in-scroll {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.fade-in-scroll.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Without JavaScript, show everything. */
.no-js .fade-in-scroll {
    opacity: 1;
    transform: none;
}

/* ===========================
   Hero Section
   =========================== */

.hero {
    position: relative;
    height: 100vh;
    min-height: 600px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--heading);
    background-image: var(--hero-image, linear-gradient(135deg, var(--accent-strong), var(--heading)));
    background-size: cover;
    background-position: center;
    background-attachment: scroll;
    overflow: hidden;
}

.hero-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--hero-overlay);
}

.hero-content {
    position: relative;
    z-index: 2;
    text-align: center;
    color: var(--on-hero);
    padding: var(--spacing-md);
}

.hero-title {
    font-size: clamp(3rem, 8vw, 6rem);
    font-weight: 600;
    margin-bottom: var(--spacing-sm);
    text-shadow: 2px 4px 8px rgba(0, 0, 0, 0.4);
    letter-spacing: 0.05em;
    color: inherit;
}

.hero-dates {
    font-size: clamp(1.2rem, 3vw, 1.8rem);
    font-family: var(--font-heading);
    margin-bottom: var(--spacing-md);
    opacity: 0.95;
    font-weight: 400;
}

.hero-subtitle {
    font-size: clamp(1rem, 2.5vw, 1.5rem);
    max-width: 800px;
    margin: 0 auto;
    padding: 0 0.5rem;
    font-style: italic;
    opacity: 0.9;
    font-weight: 300;
}

.scroll-indicator {
    position: absolute;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 3;
    transition: opacity 0.4s ease;
}

.scroll-arrow {
    width: 30px;
    height: 50px;
    border: 2px solid var(--on-hero);
    border-radius: 20px;
    position: relative;
    opacity: 0.7;
}

.scroll-arrow::before {
    content: '';
    position: absolute;
    top: 10px;
    left: 50%;
    width: 6px;
    height: 6px;
    background: var(--on-hero);
    border-radius: 50%;
    transform: translateX(-50%);
    animation: scrollDown 2s infinite;
}

@keyframes scrollDown {
    0%, 100% {
        top: 10px;
        opacity: 1;
    }
    50% {
        top: 25px;
        opacity: 0.5;
    }
}

.hero::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 150px;
    background: linear-gradient(
        to bottom,
        var(--hero-fade-from) 0%,
        var(--bg) 100%
    );
    z-index: 1;
    pointer-events: none;
}

/* ===========================
   Story Sections
   =========================== */

.story-section {
    padding: var(--spacing-xxl) 0;
    position: relative;
}

.story-section.alt-bg {
    background-color: var(--bg-alt);
}

.section-title {
    font-size: clamp(2rem, 5vw, 3rem);
    text-align: center;
    margin-bottom: var(--spacing-lg);
    color: var(--heading);
    position: relative;
    padding-bottom: var(--spacing-sm);
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 3px;
    background: linear-gradient(to right, var(--accent), var(--accent-light));
    border-radius: 2px;
}

.content-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--spacing-lg);
    align-items: start;
    max-width: 1100px;
    margin: 0 auto;
}

/* A section without photos uses a single readable column. */
.content-grid.text-only {
    max-width: 760px;
}

@media (min-width: 768px) {
    .content-grid {
        grid-template-columns: 1fr 1fr;
        gap: var(--spacing-xl);
    }

    .content-grid.text-only {
        grid-template-columns: 1fr;
    }

    .content-grid.reverse {
        direction: rtl;
    }

    .content-grid.reverse > * {
        direction: ltr;
    }
}

.story-text {
    font-size: 1.125rem;
    line-height: 1.8;
}

.story-text p {
    margin-bottom: 1.5rem;
}

.story-text em {
    font-style: italic;
    color: var(--accent-strong);
    font-weight: 600;
}

.photo-feature {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}

.featured-photo {
    width: 100%;
    border-radius: 8px;
    box-shadow: 0 4px 12px var(--shadow);
    transition: var(--transition-smooth);
    cursor: pointer;
}

.featured-photo:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px var(--shadow);
}

/* ===========================
   Reflection Section
   =========================== */

.reflection-section {
    background: linear-gradient(to bottom, var(--bg), var(--bg-deep));
    padding: var(--spacing-xxl) 0;
}

.reflection-content {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--spacing-xl);
    max-width: 1100px;
    margin: 0 auto;
}

@media (min-width: 968px) {
    .reflection-content.has-photo {
        grid-template-columns: 1fr 1.2fr;
    }
}

.reflection-content:not(.has-photo) {
    max-width: 760px;
}

.reflection-photo img {
    width: 100%;
    border-radius: 12px;
    box-shadow: 0 8px 24px var(--shadow);
}

.reflection-text {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-lg);
}

.quote {
    background: var(--surface);
    padding: var(--spacing-md) var(--spacing-lg);
    border-left: 4px solid var(--accent);
    border-radius: 4px;
    box-shadow: 0 2px 8px var(--shadow-light);
}

.quote p {
    font-size: 1.125rem;
    font-style: italic;
    line-height: 1.7;
    color: var(--heading);
    margin-bottom: var(--spacing-sm);
}

.quote cite {
    display: block;
    text-align: right;
    font-size: 0.95rem;
    font-style: normal;
    color: var(--muted);
    font-weight: 600;
}

.reflection-message {
    background: var(--surface);
    padding: var(--spacing-lg);
    border-radius: 8px;
    box-shadow: 0 4px 12px var(--shadow-light);
}

.reflection-message p {
    font-size: 1.0625rem;
    line-height: 1.8;
}

.dedication {
    text-align: center;
    font-style: italic;
    font-size: 1.125rem;
    color: var(--accent-strong);
    font-weight: 600;
    margin-top: var(--spacing-md);
    padding-top: var(--spacing-md);
    border-top: 2px solid var(--bg-deep);
}

/* ===========================
   Photo Gallery
   =========================== */

.gallery-section {
    padding: var(--spacing-xxl) 0;
    background-color: var(--bg-alt);
}

.gallery-intro {
    text-align: center;
    font-size: 1.25rem;
    color: var(--muted);
    font-style: italic;
    margin-bottom: var(--spacing-xl);
}

.gallery-category {
    margin-bottom: var(--spacing-xxl);
}

.category-title {
    font-size: 1.75rem;
    color: var(--heading);
    margin-bottom: var(--spacing-lg);
    padding-bottom: var(--spacing-sm);
    border-bottom: 2px solid var(--accent);
}

.photo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-md);
}

@media (min-width: 640px) {
    .photo-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    }
}

@media (min-width: 1024px) {
    .photo-grid {
        grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    }
}

.gallery-photo {
    width: 100%;
    height: 280px;
    object-fit: cover;
    border-radius: 6px;
    box-shadow: 0 3px 10px var(--shadow-light);
    transition: var(--transition-smooth);
    cursor: pointer;
}

.gallery-photo:hover {
    transform: scale(1.03);
    box-shadow: 0 6px 20px var(--shadow);
}

/* ===========================
   Lightbox
   =========================== */

.lightbox {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
}

.lightbox.active {
    display: flex;
}

.lightbox-image {
    max-width: 90%;
    max-height: 85vh;
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.5);
}

.lightbox-close,
.lightbox-prev,
.lightbox-next {
    position: absolute;
    background: rgba(255, 255, 255, 0.2);
    color: #FFFFFF;
    border: none;
    font-size: 2.5rem;
    cursor: pointer;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-fast);
    backdrop-filter: blur(10px);
}

.lightbox-close:hover,
.lightbox-prev:hover,
.lightbox-next:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.lightbox-close {
    top: 20px;
    right: 20px;
    font-size: 2rem;
    line-height: 1;
}

.lightbox-prev {
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
}

.lightbox-prev:hover {
    transform: translateY(-50%) scale(1.1);
}

.lightbox-next {
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
}

.lightbox-next:hover {
    transform: translateY(-50%) scale(1.1);
}

.lightbox-counter {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.2);
    color: #FFFFFF;
    padding: 0.5rem 1.5rem;
    border-radius: 20px;
    font-size: 0.95rem;
    backdrop-filter: blur(10px);
}

.sr-only {
    position: absolute;
    left: -10000px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

/* ===========================
   Footer
   =========================== */

.site-footer {
    background: var(--footer-bg);
    color: var(--footer-text);
    padding: var(--spacing-xl) 0;
    text-align: center;
}

.footer-text {
    font-size: 1.125rem;
    margin-bottom: var(--spacing-sm);
}

.footer-quote {
    font-style: italic;
    font-size: 1rem;
    opacity: 0.9;
    margin-bottom: var(--spacing-md);
    color: var(--footer-muted);
}

.footer-hope {
    font-size: 1.25rem;
    font-family: var(--font-heading);
    color: var(--footer-accent);
    margin-top: var(--spacing-md);
}

/* ===========================
   Responsive Design
   =========================== */

@media (max-width: 767px) {
    :root {
        --spacing-lg: 2rem;
        --spacing-xl: 3rem;
        --spacing-xxl: 4rem;
    }

    .hero {
        background-attachment: scroll;
        min-height: 500px;
    }

    .story-text {
        font-size: 1rem;
    }

    .photo-grid {
        grid-template-columns: 1fr;
        gap: var(--spacing-sm);
    }

    .gallery-photo {
        height: auto;
        aspect-ratio: 4/3;
    }

    .lightbox-prev,
    .lightbox-next {
        width: 40px;
        height: 40px;
        font-size: 2rem;
    }

    .lightbox-prev {
        left: 10px;
    }

    .lightbox-next {
        right: 10px;
    }

    .lightbox-close {
        top: 10px;
        right: 10px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 var(--spacing-sm);
    }

    .hero-content {
        padding: var(--spacing-sm);
    }

    .quote {
        padding: var(--spacing-sm);
    }

    .reflection-message {
        padding: var(--spacing-md);
    }
}

/* ===========================
   Print Styles
   =========================== */

@media print {
    .scroll-indicator,
    .lightbox,
    .site-footer {
        display: none;
    }

    .hero {
        background-attachment: scroll;
        page-break-after: always;
    }

    .story-section {
        page-break-inside: avoid;
    }

    .fade-in-scroll {
        opacity: 1;
        transform: none;
    }
}

/* ===========================
   Accessibility
   =========================== */

a:focus,
button:focus,
.gallery-photo:focus,
.featured-photo:focus {
    outline: 3px solid var(--accent);
    outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }

    .hero {
        background-attachment: scroll;
    }
}

@media (prefers-contrast: high) {
    :root {
        --heading: #000000;
        --text: #000000;
        --muted: #4a4a4a;
    }
}
