/*
 * Vishnive Memorial Site – Modern Stylesheet
 * "The Shtetl and I" by Dvora Rogovin Helberg
 * Translated from Hebrew by Zvi Rogovin
 */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* ── Reset & Box Model ── */
*, *::before, *::after {
    box-sizing: border-box;
}

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

/* ── Body & Background ── */
body {
    margin: 0;
    padding: 40px 16px 60px;
    background-color: #f5f4f0;
    font-family: 'Inter', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    line-height: 1.75;
    color: #1a1a1a;
    min-height: 100vh;
}

/* ── Page Container ── */
.page-wrapper {
    max-width: 1200px;
    margin: 0 auto;
}

/* ── Navigation Bar ── */
.site-nav {
    display: flex;
    flex-wrap: nowrap;
    align-items: stretch;
    background: transparent;
    border-radius: 14px;
    margin-bottom: 8px;
    overflow: hidden;
}

.site-nav a {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #1a1a1a;
    text-decoration: none;
    padding: 9px 8px;
    font-size: 0.9em;
    font-family: 'Inter', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    font-weight: 500;
    letter-spacing: 0.01em;
    transition: background 0.2s;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.site-nav a:hover {
    background: rgba(0, 0, 0, 0.08);
    text-decoration: none;
    color: #1a1a1a;
}

.site-nav .lang-switch {
    border-inline-start: 1px solid rgba(255, 255, 255, 0.4);
    font-style: italic;
}

.content-box {
    padding: 44px 0;
}

/* ── Headings ── */
h1 a, h2 a, h3 a {
    color: inherit;
    text-decoration: none;
}
h1 a:hover, h2 a:hover, h3 a:hover {
    text-decoration: underline;
}

h1 {
    font-size: 2em;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -0.01em;
    margin: 0 0 0.5em;
    color: #1a1a2e;
}

h2 {
    font-size: 1.35em;
    font-weight: 600;
    letter-spacing: -0.005em;
    margin: 1.8em 0 0.5em;
    color: #1a1a2e;
    border-bottom: 1px solid #d5cabb;
    padding-bottom: 0.25em;
}

h3 {
    font-size: 1.1em;
    font-weight: 600;
    margin: 1.4em 0 0.4em;
    color: #2c3e50;
}

h4, h5, h6 {
    font-weight: 600;
    margin: 1.2em 0 0.3em;
    color: #2c3e50;
}

/* ── Paragraphs ── */
p {
    margin: 0.9em 0;
}

strong, b {
    color: #111;
}

em, i {
    font-style: italic;
}

/* ── Quotations ── */
cite {
    display: block;
    font-style: italic;
    color: #3a3a3a;
    background: #f8f5ef;
    border-left: 4px solid #9b8a6a;
    padding: 0.75em 1.2em;
    margin: 1.2em 0;
    border-radius: 0 2px 2px 0;
}

[dir="rtl"] cite {
    border-left: none;
    border-right: 4px solid #9b8a6a;
    border-radius: 2px 0 0 2px;
}

blockquote {
    font-style: italic;
    color: #3a3a3a;
    background: #f8f5ef;
    border-left: 4px solid #9b8a6a;
    padding: 0.75em 1.2em;
    margin: 1.2em 0;
    border-radius: 0 2px 2px 0;
}

[dir="rtl"] blockquote {
    border-left: none;
    border-right: 4px solid #9b8a6a;
    border-radius: 2px 0 0 2px;
}

/* ── Links ── */
a {
    color: #2563eb;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
    color: #1d4ed8;
}

/* ── Images ── */
img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 1.2em auto;
}

/* ── Lists ── */
ul, ol {
    padding-left: 2em;
    margin: 0.8em 0;
}

[dir="rtl"] ul,
[dir="rtl"] ol {
    padding-left: 0;
    padding-right: 2em;
}

li {
    margin: 0.3em 0;
}

/* List item headings (used in table of contents) */
ol > li:has(> h2),
ol > li:has(> h3),
ol[type="I"] > li {
    list-style: none;
}

li > h2,
li > h3 {
    display: block;
    border-bottom: none;
    margin: 0.3em 0 0.1em;
    padding: 0;
}

li > ol,
li > ul {
    margin-top: 0.4em;
}

/* ── Horizontal Rule ── */
hr {
    border: none;
    border-top: 1px solid #d5cabb;
    margin: 2em 0;
}

/* ── Guestbook ── */
.guestbook-entries {
    margin-top: 1.5em;
}

.guestbook-entry {
    padding: 1.2em 0;
    border-bottom: 1px solid #e8e4dc;
}

.guestbook-entry:last-child {
    border-bottom: none;
}

.entry-name {
    font-weight: bold;
    color: #1a1a2e;
    margin-bottom: 0.3em;
}

.entry-comment {
    color: #333;
    margin: 0;
}

/* ── Title Header with Image ── */
.title-header {
    display: flex;
    align-items: flex-start;
    gap: 2em;
    margin-bottom: 1em;
}

.title-text {
    flex: 1;
}

.title-image {
    flex-shrink: 0;
    text-align: center;
    font-size: 0.9em;
    color: #3a3a3a;
}

.title-image img {
    margin: 0 auto 0.4em;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* ── Hamburger Toggle Button ── */
.nav-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 10px 14px;
    flex-shrink: 0;
    margin-left: auto;
}

.nav-toggle span {
    display: block;
    width: 22px;
    height: 2px;
    background: #1a1a1a;
    border-radius: 2px;
    transition: transform 0.25s, opacity 0.25s;
    transform-origin: center;
}

/* Animate to X when open */
.site-nav.nav-open .nav-toggle span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}
.site-nav.nav-open .nav-toggle span:nth-child(2) {
    opacity: 0;
    transform: scaleX(0);
}
.site-nav.nav-open .nav-toggle span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* ── Responsive ── */
@media (max-width: 640px) {
    .title-header {
        flex-direction: column;
    }

    body {
        padding: 12px 8px 40px;
    }

    .content-box {
        padding: 24px 20px;
    }

    h1 {
        font-size: 1.6em;
    }

    h2 {
        font-size: 1.2em;
    }
}

/* ── Home Page Layout ── */
body.home-page {
    padding: 0;
    background-color: #fff;
}

body.home-page .page-wrapper {
    padding: 0 24px;
}

/* ── Site Header ── */
.site-header {
    background: #fff;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 0 #e0e0e0;
}

.header-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.header-top {
    border-bottom: 1px solid #e8e8e8;
    padding: 14px 0;
}

.site-logo {
    font-size: 2.2em;
    font-weight: 700;
    color: #1a1a1a;
    text-decoration: none;
    letter-spacing: -0.02em;
    font-family: 'Inter', 'Helvetica Neue', Helvetica, Arial, sans-serif;
}

.site-logo:hover {
    text-decoration: none;
    color: #1a1a1a;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.btn-header-outline {
    display: inline-block;
    padding: 7px 18px;
    border: 1px solid #1a1a1a;
    color: #1a1a1a;
    font-size: 0.875em;
    font-weight: 500;
    text-decoration: none;
    background: #fff;
    letter-spacing: 0.01em;
    font-family: 'Inter', 'Helvetica Neue', Helvetica, Arial, sans-serif;
}

.btn-header-outline:hover {
    background: #f0f0f0;
    text-decoration: none;
    color: #1a1a1a;
}

.btn-header-filled {
    display: inline-block;
    padding: 7px 18px;
    background: #0067c5;
    color: #fff;
    font-size: 0.875em;
    font-weight: 500;
    text-decoration: none;
    border: 1px solid #0067c5;
    letter-spacing: 0.01em;
    font-family: 'Inter', 'Helvetica Neue', Helvetica, Arial, sans-serif;
}

.btn-header-filled:hover {
    background: #005099;
    border-color: #005099;
    text-decoration: none;
    color: #fff;
}

/* ── Header Nav Bar ── */
.header-nav-bar {
    padding: 0;
}

.header-inner--nav {
    justify-content: flex-start;
}

.site-header .site-nav {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    background: transparent;
    border-radius: 0;
    margin-bottom: 0;
    overflow: visible;
    flex: 1;
}

.site-header .site-nav a {
    flex: none;
    display: flex;
    align-items: center;
    color: #1a1a1a;
    text-decoration: none;
    padding: 14px 16px;
    font-size: 0.95em;
    font-weight: 600;
    letter-spacing: 0.01em;
    white-space: nowrap;
    border-bottom: 3px solid transparent;
    transition: border-color 0.15s;
    overflow: visible;
}

.site-header .site-nav a:hover {
    border-bottom-color: #1a1a1a;
    background: none;
    color: #1a1a1a;
    text-decoration: none;
}

/* ── Hero Image ── */
.hero-image {
    width: 100%;
    max-height: 440px;
    overflow: hidden;
    line-height: 0;
}

.hero-image img {
    width: 100%;
    height: 440px;
    object-fit: cover;
    object-position: center;
    display: block;
    margin: 0;
    cursor: zoom-in;
}

/* ── Image Modal ── */
.img-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(0, 0, 0, 0.85);
    align-items: center;
    justify-content: center;
    cursor: zoom-out;
}

.img-modal.open {
    display: flex;
}

.img-modal img {
    max-width: 92vw;
    max-height: 90vh;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
    margin: 0;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.6);
}

.img-modal-close {
    position: fixed;
    top: 16px;
    right: 20px;
    background: none;
    border: none;
    color: #fff;
    font-size: 2.2em;
    line-height: 1;
    cursor: pointer;
    padding: 4px 8px;
    opacity: 0.8;
}

.img-modal-close:hover {
    opacity: 1;
}

/* ── Welcome Section ── */
.welcome-section {
    border-bottom: 1px solid #d5cabb;
    padding: 32px 0;
    background: #fff;
}

.welcome-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 2em;
}

.welcome-text h1 {
    font-size: 2.5em;
    font-weight: 700;
    margin: 0 0 0.2em;
    border-bottom: none;
    padding-bottom: 0;
    color: #1a1a1a;
}

.welcome-text p {
    margin: 0;
    font-size: 1em;
    font-weight: 600;
    color: #1a1a1a;
}

.welcome-info {
    flex-shrink: 0;
    min-width: 220px;
}

.welcome-info p {
    color: #5a4a2a;
    margin: 0 0 1em;
    font-size: 0.95em;
}

.btn-plan-visit {
    display: inline-block;
    padding: 10px 22px;
    background: #1a1a1a;
    color: #fff;
    font-size: 0.9em;
    font-weight: 600;
    text-decoration: none;
    letter-spacing: 0.02em;
    font-family: 'Inter', 'Helvetica Neue', Helvetica, Arial, sans-serif;
}

.btn-plan-visit:hover {
    background: #333;
    text-decoration: none;
    color: #fff;
}

/* ── Mobile: home header & welcome ── */
@media (max-width: 640px) {
    .welcome-inner {
        flex-direction: column;
    }

    .hero-image img {
        height: 220px;
    }

    .welcome-text h1 {
        font-size: 1.8em;
    }

    .header-inner {
        padding: 0 12px;
        gap: 8px;
        flex-wrap: wrap;
        align-items: center;
    }

    .site-logo {
        font-size: clamp(1.1em, 5vw, 2.2em);
        flex-shrink: 1;
        min-width: 0;
    }

    .header-actions {
        flex-shrink: 0;
        gap: 6px;
    }

    .btn-header-outline,
    .btn-header-filled {
        padding: 5px 10px;
        font-size: 0.78em;
    }
}

@media (max-width: 540px) {
    .site-header .site-nav {
        flex-direction: column;
        align-items: stretch;
        border-radius: 0;
    }

    .site-header .site-nav a {
        display: none;
        border-bottom: none;
        border-top: 1px solid #e0e0e0;
        padding: 12px 20px;
        justify-content: flex-start;
    }

    .site-header .site-nav.nav-open a {
        display: flex;
    }
}

/* ── Fix legacy fixed-width tables ── */
.content-box table {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box;
}

.content-box td {
    width: auto !important;
    max-width: 100% !important;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* ── Mobile Nav (hamburger) ── */
@media (max-width: 540px) {
    .site-nav {
        flex-direction: column;
        align-items: stretch;
        border-radius: 14px;
        padding: 0;
    }

    /* Show the toggle button */
    .nav-toggle {
        display: flex;
        width: 100%;
        flex-direction: row;
        justify-content: flex-start;
        align-items: center;
        padding: 10px 16px;
        border-radius: 14px;
    }

    .nav-toggle span {
        display: none;
    }

    [dir="rtl"] .nav-toggle::before {
        content: 'תפריט  ☰';
    }

    .nav-toggle::before {
        content: '☰  Menu';
        color: #1a1a1a;
        font-family: 'Inter', 'Helvetica Neue', Helvetica, Arial, sans-serif;
        font-weight: 500;
        font-size: 0.95em;
        letter-spacing: 0.05em;
    }

    [dir="rtl"] .site-nav.nav-open .nav-toggle::before {
        content: 'תפריט  ✕';
    }

    .site-nav.nav-open .nav-toggle::before {
        content: '✕  Menu';
    }

    /* Hide all nav links by default on mobile */
    .site-nav a {
        display: none;
        border-top: 1px solid rgba(255, 255, 255, 0.15);
        padding: 12px 20px;
        font-size: 0.95em;
        justify-content: flex-start;
    }

    /* Show links when open */
    .site-nav.nav-open a {
        display: flex;
    }

    /* Last link gets rounded bottom corners */
    .site-nav.nav-open a:last-child {
        border-radius: 0 0 14px 14px;
    }

    .site-nav .lang-switch {
        border-inline-start: none;
        border-top: 1px solid rgba(255, 255, 255, 0.15);
        font-style: italic;
    }
}
