/* =========================================================
   Mabel Waisman — site stylesheet
   ========================================================= */

/* ---- design tokens ---- */
:root {
    --paper:           #F7F4EE;   /* page background — warm cream */
    --paper-soft:      #FBF9F4;   /* card background, slightly lighter */
    --paper-edge:      #ECE7DD;   /* hairline borders, subtle dividers */
    --paper-rule:      #E8E2D4;   /* nav divider */
    --ink:             #1F1A14;   /* primary text — warm near-black */
    --ink-soft:        #2D2620;   /* body text, slightly lighter */
    --ink-muted:       #4A4136;   /* secondary text */
    --ink-quiet:       #6B5F4F;   /* tertiary text, captions */
    --ink-whisper:     #B5A892;   /* metadata, label text */
    --sepia:           #5C4A3A;   /* monogram, signature, accent marks */
    --rule:            #DCD4C2;   /* card borders */

    --font-display:    "Jost", "Avant Garde", "Century Gothic", "URW Gothic", system-ui, sans-serif;
    --font-serif:      Georgia, "Times New Roman", "Source Serif Pro", serif;

    --radius-sm:       2px;
    --radius-md:       4px;

    --content-max:     960px;
    --reading-max:     680px;
}

/* ---- reset ---- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
body, h1, h2, h3, h4, p, ul, ol, figure, blockquote { margin: 0; padding: 0; }
ul, ol { list-style: none; }
img, svg { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }

/* ---- base typography ---- */
body {
    font-family: var(--font-display);
    font-weight: 400;
    font-size: 15px;
    line-height: 1.7;
    color: var(--ink);
    background: var(--paper);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    text-rendering: optimizeLegibility;
}

p { color: var(--ink-soft); max-width: var(--reading-max); }

h1, h2, h3 { font-family: var(--font-serif); font-weight: 400; line-height: 1.25; color: var(--ink); }

/* ---- header ---- */
.site-header {
    background: #ffffff;
    border-bottom: 1px solid var(--paper-rule);
}
.site-header-inner {
    max-width: var(--content-max);
    margin: 0 auto;
    padding: 28px 32px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 24px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 14px;
    color: var(--ink);
}
.brand-mark {
    width: 56px;
    height: 30px;
    color: var(--sepia);
    flex-shrink: 0;
}
.brand-mark svg { width: 100%; height: 100%; }
.brand-name {
    font-family: var(--font-display);
    font-size: 23px;
    font-weight: 300;
    letter-spacing: 0.06em;
    color: var(--ink);
    white-space: nowrap;
}

.site-nav {
    display: flex;
    gap: 26px;
    font-size: 13px;
    color: var(--ink-quiet);
    align-items: baseline;
    flex-wrap: wrap;
}
.site-nav a {
    transition: color 0.2s ease;
    padding-bottom: 2px;
    border-bottom: 1px solid transparent;
}
.site-nav a:hover { color: var(--ink); }
.site-nav a.is-active {
    color: var(--ink);
    border-bottom-color: var(--ink);
}
.lang-toggle {
    margin-left: 28px;
    color: var(--ink-whisper);
    letter-spacing: 0.05em;
    font-size: 13px;
}
.lang-toggle a.is-active { color: var(--ink); }
.lang-toggle a:not(.is-active):hover { color: var(--ink-quiet); }

/* ---- main wrapper ---- */
.site-main {
    flex: 1;
    width: 100%;
    max-width: var(--content-max);
    margin: 0 auto;
    padding: 56px 32px 72px;
}

/* ---- welcome / landing ---- */
/* Welcome uses .section-card with a .welcome-card modifier that overrides the
   default section-card layout: text on the left, portrait on the right at 3/4
   aspect, with extra padding suited to a single-card landing. */
.section-card.welcome-card {
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 48px;
    align-items: center;
    max-width: 820px;
    margin: 8px auto 0;
    padding: 32px;
}
.section-card.welcome-card:hover {
    /* No hover effect — welcome-card is not clickable, unlike gallery cards */
    border-color: var(--rule);
    transform: none;
}

.welcome-text { order: 1; }
.welcome-portrait { order: 2; }
.welcome-portrait .portrait-placeholder {
    width: 100%;
    aspect-ratio: 3 / 4;
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: linear-gradient(160deg, #B89968, #6B5F4F);
}
.welcome-portrait .portrait-placeholder img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.welcome-quote {
    font-family: var(--font-serif);
    font-style: italic;
    font-size: 22px;
    line-height: 1.4;
    color: var(--ink);
    margin-bottom: 28px;
}
.welcome-text p {
    margin-bottom: 18px;
    font-size: 15px;
    max-width: none;
    color: var(--ink-soft);
    line-height: 1.7;
}
.welcome-text p:last-of-type { margin-bottom: 36px; }

.signature {
    display: block;
    width: 240px;
    height: auto;
    color: var(--sepia);
    opacity: 0.88;
    margin-top: 8px;
}
.signature img,
.signature svg { width: 100%; height: auto; display: block; }

/* ---- gallery landing — three section cards ---- */
.gallery-intro {
    max-width: var(--reading-max);
    margin: 0 auto 48px;
    text-align: left;
}
.gallery-intro h1 {
    font-size: 30px;
    margin-bottom: 14px;
}
.gallery-intro p {
    font-size: 15px;
    color: var(--ink-soft);
}

.section-cards {
    display: flex;
    flex-direction: column;
    gap: 22px;
}

.section-card {
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
    gap: 32px;
    align-items: stretch;
    padding: 20px;
    border: 0.5px solid var(--rule);
    border-radius: var(--radius-md);
    background: #ffffff;
    color: inherit;
    transition: border-color 0.2s ease, transform 0.2s ease;
}
.section-card:hover {
    border-color: var(--ink-quiet);
    transform: translateY(-1px);
}

.section-card-image {
    aspect-ratio: 4 / 3;
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: linear-gradient(135deg, #C4A782, #8B7355);
}
.section-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.section-card-body {
    display: flex;
    flex-direction: column;
    justify-content: center;
}
.section-card-meta {
    font-size: 11px;
    color: var(--ink-whisper);
    letter-spacing: 0.14em;
    text-transform: uppercase;
    margin-bottom: 10px;
}
.section-card h2 {
    font-size: 28px;
    margin-bottom: 12px;
}
.section-card p {
    font-size: 14px;
    line-height: 1.65;
    color: var(--ink-muted);
    margin-bottom: 16px;
    max-width: 380px;
}
.section-card-list {
    font-size: 12px;
    color: var(--ink-quiet);
}

/* ---- sub-gallery grid (used on Artista, Obras, Exposiciones section pages) ---- */
.sub-gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 24px;
}
.sub-gallery-card {
    display: block;
    color: inherit;
    transition: opacity 0.2s ease;
}
.sub-gallery-card:hover { opacity: 0.78; }
.sub-gallery-card-image {
    aspect-ratio: 1 / 1;
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: var(--paper-edge);
    margin-bottom: 10px;
}
.sub-gallery-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.sub-gallery-card-name {
    font-size: 13px;
    color: var(--ink);
    line-height: 1.3;
}
.sub-gallery-card-year {
    font-size: 11px;
    color: var(--ink-whisper);
    margin-top: 2px;
}

.section-page-header {
    margin-bottom: 40px;
}
.section-page-header .crumb {
    font-size: 12px;
    color: var(--ink-quiet);
    margin-bottom: 8px;
}
.section-page-header .crumb a:hover { color: var(--ink); }
.section-page-header h1 {
    font-size: 32px;
    margin-bottom: 8px;
}
.section-page-header p {
    font-size: 14px;
    color: var(--ink-muted);
}

.subgroup-heading {
    font-family: var(--font-display);
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--ink-quiet);
    margin: 36px 0 18px;
    padding-bottom: 10px;
    border-bottom: 0.5px solid var(--rule);
}
.subgroup-heading:first-child { margin-top: 0; }

/* ---- text pages (currículum, libro) ---- */
.text-page {
    max-width: var(--reading-max);
    margin: 0 auto;
}
.text-page h1 {
    font-size: 32px;
    margin-bottom: 16px;
}
.text-page p {
    font-size: 15px;
    line-height: 1.75;
    color: var(--ink-soft);
    margin-bottom: 18px;
}
.text-page .download-link {
    display: inline-block;
    margin-top: 16px;
    padding: 10px 20px;
    border: 0.5px solid var(--ink-quiet);
    border-radius: var(--radius-sm);
    font-size: 13px;
    color: var(--ink);
    transition: background 0.2s ease, border-color 0.2s ease;
}
.text-page .download-link:hover {
    background: var(--paper-soft);
    border-color: var(--ink);
}
.text-page .pdf-thumbnail {
    display: inline-block;
    margin: 8px 0 24px;
    line-height: 0;
    transition: opacity 0.2s ease;
}
.text-page .pdf-thumbnail:hover { opacity: 0.85; }
.text-page .pdf-thumbnail img {
    max-width: 415px;
    width: 100%;
    height: auto;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

/* ---- gallery page (individual sub-gallery image grid) ---- */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
    min-height: 200px;
}
.gallery-loading,
.gallery-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px 20px;
    font-size: 14px;
    color: var(--ink-quiet);
    font-style: italic;
}
.gallery-item {
    display: block;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    border-radius: var(--radius-sm);
    background: var(--paper-edge);
    cursor: pointer;
    transition: opacity 0.2s ease;
}
.gallery-item:hover { opacity: 0.85; }
.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* ---- lightbox ---- */
.lightbox-overlay {
    position: fixed;
    inset: 0;
    background: rgba(20, 16, 12, 0.94);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 40px;
}
.lightbox-overlay.is-open { display: flex; }
body.lightbox-locked { overflow: hidden; }

.lightbox-figure {
    margin: 0;
    max-width: 100%;
    max-height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}
.lightbox-image {
    max-width: 100%;
    max-height: calc(100vh - 120px);
    object-fit: contain;
    border-radius: var(--radius-sm);
    background: #000;
}
.lightbox-caption {
    color: rgba(255, 255, 255, 0.7);
    font-size: 13px;
    font-family: var(--font-display);
    text-align: center;
    max-width: 600px;
    line-height: 1.4;
}

.lightbox-close,
.lightbox-prev,
.lightbox-next {
    position: absolute;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    width: 44px;
    height: 44px;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease, border-color 0.2s ease;
}
.lightbox-close:hover,
.lightbox-prev:hover,
.lightbox-next:hover {
    background: rgba(255, 255, 255, 0.18);
    border-color: rgba(255, 255, 255, 0.35);
}
.lightbox-close { top: 24px; right: 24px; }
.lightbox-prev { top: 50%; left: 24px; transform: translateY(-50%); }
.lightbox-next { top: 50%; right: 24px; transform: translateY(-50%); }

@media (max-width: 720px) {
    .lightbox-overlay { padding: 16px; }
    .lightbox-close { top: 12px; right: 12px; }
    .lightbox-prev { left: 12px; }
    .lightbox-next { right: 12px; }
    .lightbox-image { max-height: calc(100vh - 80px); }
}

/* ---- footer ---- */
.site-footer {
    background: #ffffff;
    border-top: 1px solid var(--paper-rule);
    padding: 8px 32px;
}
.site-footer-inner {
    max-width: var(--content-max);
    margin: 0 auto;
    text-align: center;
    font-size: 12px;
    color: var(--ink-quiet);
    letter-spacing: 0.02em;
}
.site-footer a {
    color: var(--ink-quiet);
    border-bottom: 1px solid transparent;
    transition: color 0.2s ease, border-color 0.2s ease;
}
.site-footer a:hover {
    color: var(--ink);
    border-bottom-color: var(--ink-quiet);
}
.site-footer .heart {
    color: #C0392B;
    font-style: normal;
    margin: 0 1px;
}

/* ---- responsive ---- */
@media (max-width: 720px) {
    .site-header-inner {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
        padding: 22px 22px 18px;
    }
    .site-nav {
        gap: 18px;
        font-size: 13px;
    }
    .lang-toggle { margin-left: 0; }

    .site-main { padding: 40px 22px 56px; }

    .section-card {
        grid-template-columns: 1fr;
        gap: 18px;
    }
    .section-card-image {
        max-width: 100%;
    }

    .section-card.welcome-card {
        max-width: 480px;
        padding: 22px;
        gap: 28px;
    }
    .welcome-portrait { order: 1; }
    .welcome-text { order: 2; }
    .welcome-portrait .portrait-placeholder {
        max-width: 320px;
        margin: 0 auto;
    }

    .sub-gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 18px;
    }

    .gallery-intro h1,
    .section-page-header h1,
    .text-page h1 { font-size: 26px; }

    .lang-toggle {
        margin-left: 0;
        padding-top: 12px;
        margin-top: 4px;
        border-top: 1px solid var(--paper-rule);
        width: 100%;
    }
}

@media (max-width: 420px) {
    .brand-name { font-size: 20px; }
    .brand-mark { width: 44px; height: 24px; }
}

/* ---- reduced motion ---- */
@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; }
}

/* ---- gallery grid (sub-gallery pages) ---- */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 160px));
    gap: 12px;
    min-height: 100px;
    justify-content: start;
}
.gallery-item {
    display: block;
    aspect-ratio: 1 / 1;
    background: var(--paper-edge);
    border-radius: var(--radius-sm);
    overflow: hidden;
    cursor: zoom-in;
    transition: opacity 0.2s ease;
}
.gallery-item:hover { opacity: 0.85; }
.gallery-item:focus-visible {
    outline: 2px solid var(--ink);
    outline-offset: 3px;
}
.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.gallery-loading,
.gallery-empty {
    grid-column: 1 / -1;
    padding: 36px 24px;
    text-align: center;
    color: var(--ink-quiet);
    font-style: italic;
    background: var(--paper-soft);
    border: 0.5px dashed var(--rule);
    border-radius: var(--radius-md);
}

/* ---- lightbox overlay ---- */
.lightbox-overlay {
    position: fixed;
    inset: 0;
    background: rgba(20, 16, 12, 0.94);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 24px;
}
.lightbox-overlay.is-open { display: flex; }

body.lightbox-locked { overflow: hidden; }

.lightbox-figure {
    margin: 0;
    max-width: min(96vw, 1400px);
    max-height: 92vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
}
.lightbox-image {
    max-width: 100%;
    max-height: 86vh;
    object-fit: contain;
    display: block;
}
.lightbox-video {
    max-width: 100%;
    max-height: 86vh;
    display: block;
    background: #000;
}
.lightbox-caption {
    color: rgba(255, 255, 255, 0.7);
    font-size: 12px;
    letter-spacing: 0.05em;
    font-family: var(--font-display);
    text-align: center;
    min-height: 18px;
}

.lightbox-overlay button {
    position: absolute;
    background: transparent;
    color: rgba(255, 255, 255, 0.8);
    border: 0;
    font-size: 28px;
    line-height: 1;
    padding: 12px;
    cursor: pointer;
    transition: color 0.2s ease, background 0.2s ease;
    border-radius: 50%;
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-display);
}
.lightbox-overlay button:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.08);
}
.lightbox-overlay button:focus-visible {
    outline: 2px solid rgba(255, 255, 255, 0.8);
    outline-offset: 2px;
}

.lightbox-close { top: 16px; right: 16px; font-size: 22px; }
.lightbox-prev { left: 16px; top: 50%; transform: translateY(-50%); font-size: 36px; }
.lightbox-next { right: 16px; top: 50%; transform: translateY(-50%); font-size: 36px; }

@media (max-width: 600px) {
    .lightbox-overlay button { width: 44px; height: 44px; padding: 8px; font-size: 22px; }
    .lightbox-close { top: 8px; right: 8px; font-size: 18px; }
    .lightbox-prev { left: 8px; font-size: 28px; }
    .lightbox-next { right: 8px; font-size: 28px; }
    .gallery-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
}
