/* ─── The Weekly Perasha ─── */

/* Reset */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ─── Palette ─── */
:root {
    --bg: #FAFAF8;
    --surface: #F0EDE6;
    --text: #1C1C28;
    --text-secondary: #55556A;
    --accent: #8B6914;
    --accent-hover: #A37D1A;
    --accent-light: #F7F1E3;
    --border: #D8D3C8;
    --sage: #5B6E5D;
    --white: #FFFFFF;
}

/* ─── Base ─── */
html {
    font-size: 18px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Lora', Georgia, 'Times New Roman', serif;
    color: var(--text);
    background: var(--bg);
    line-height: 1.7;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
}

main { flex: 1; }

a {
    color: var(--accent);
    text-decoration: none;
    transition: color 0.15s;
}
a:hover { color: var(--accent-hover); }

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

/* ─── Navigation ─── */
nav {
    border-bottom: 1px solid var(--border);
    background: var(--white);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-inner {
    max-width: 1080px;
    margin: 0 auto;
    padding: 0.8rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.site-name {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--text);
    letter-spacing: -0.01em;
}
.site-name:hover { color: var(--accent); }

.nav-links {
    display: flex;
    gap: 1.2rem;
}

.nav-links a {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    font-size: 0.8rem;
    color: var(--text-secondary);
    letter-spacing: 0.03em;
    text-transform: uppercase;
    font-weight: 500;
}
.nav-links a:hover,
.nav-links a.active { color: var(--text); }

.nav-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.4rem;
    cursor: pointer;
    color: var(--text);
    padding: 0.25rem;
}

/* ─── Hebrew Date Info (inline in nav) ─── */
.nav-left {
    display: flex;
    align-items: baseline;
    gap: 0;
    min-width: 0;
}

.heb-banner {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    padding: 0.45rem 1rem;
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    color: var(--accent);
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 56px;
    z-index: 99;
}

.heb-sep {
    color: var(--border);
    font-weight: 400;
    margin: 0 0.5rem;
}

/* ─── Home Header ─── */
.home-header {
    text-align: center;
    padding: 2.5rem 1.5rem 1.5rem;
}

.home-header h1 {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 2.4rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.02em;
    line-height: 1.1;
    margin-bottom: 0.3rem;
}

.home-header p {
    font-size: 0.95rem;
    color: var(--text-secondary);
    font-style: italic;
}

/* ─── This Week's Article (on homepage) ─── */
.this-week {
    max-width: 680px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

.this-week-label {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--accent);
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--accent);
    margin-bottom: 1.5rem;
}

.home-article-header {
    margin-bottom: 1.75rem;
}

.home-parsha-name {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--sage);
}

.home-article-header h2 {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 2rem;
    font-weight: 700;
    color: var(--text);
    margin: 0.25rem 0 0.4rem;
    line-height: 1.2;
}

.home-article-header h2 a {
    color: inherit;
}
.home-article-header h2 a:hover {
    color: var(--accent);
}

.home-article-header time {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.home-article-body {
    font-size: 1rem;
    line-height: 1.8;
}

.home-article-body p { margin-bottom: 1.3rem; }

.home-article-body h2 {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 1.45rem;
    font-weight: 700;
    margin: 2rem 0 0.8rem;
}

.home-article-body h3 {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 1.2rem;
    font-weight: 600;
    margin: 1.5rem 0 0.6rem;
}

.home-article-body blockquote {
    border-left: 3px solid var(--accent);
    padding: 0.5rem 0 0.5rem 1.25rem;
    margin: 1.5rem 0;
    color: var(--text-secondary);
    font-style: italic;
}

.home-article-body ul, .home-article-body ol {
    margin: 1rem 0 1.3rem 1.5rem;
}

.home-article-body li { margin-bottom: 0.4rem; }

.home-article-body strong { font-weight: 600; }

.home-article-share {
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.home-article-share a {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
}
.home-article-share a:hover { color: var(--accent); }

.home-prev-years {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    font-size: 0.8rem;
    color: var(--text-secondary);
}
.home-prev-years a {
    color: var(--accent);
    font-weight: 600;
}

/* ─── Previous Divrei Torah ─── */
.previous {
    max-width: 680px;
    margin: 0 auto;
    padding: 2.5rem 1.5rem 3rem;
}

.previous h3 {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
}

.previous ul {
    list-style: none;
    padding: 0;
}

.previous li {
    border-bottom: 1px solid rgba(0,0,0,0.05);
}

.previous li a {
    display: flex;
    align-items: baseline;
    gap: 0.75rem;
    padding: 0.65rem 0;
    color: var(--text);
    transition: color 0.15s;
}
.previous li a:hover { color: var(--accent); }

.prev-parsha {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--sage);
    white-space: nowrap;
    min-width: 120px;
}

.prev-title {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 1.05rem;
    font-weight: 600;
    flex: 1;
}

.previous li time {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    font-size: 0.7rem;
    color: var(--text-secondary);
    white-space: nowrap;
}

.browse-link {
    display: inline-block;
    margin-top: 1rem;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    font-size: 0.82rem;
    font-weight: 500;
}

/* ─── Article Page ─── */
.article-page {
    max-width: 680px;
    margin: 0 auto;
    padding: 2.5rem 1.5rem 3rem;
}

.article-header {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border);
}

.article-parsha {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--sage);
}

.article-header h1 {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 2.2rem;
    font-weight: 700;
    color: var(--text);
    margin: 0.3rem 0 0.5rem;
    line-height: 1.2;
    letter-spacing: -0.01em;
}

.article-header time {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    font-size: 0.82rem;
    color: var(--text-secondary);
}

.print-btn {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    color: var(--text-secondary);
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    margin-top: 0.5rem;
    transition: color 0.15s;
}
.print-btn:hover {
    color: var(--accent);
}
.print-label {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    font-size: 0.78rem;
}

.dedication-row {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
    margin: 1.25rem auto 1.75rem;
    max-width: 680px;
    padding: 0 1rem;
}

.dedication-card {
    flex: 1;
    padding: 1.1rem 1.5rem;
    text-align: center;
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 1.1rem;
    font-weight: 700;
    font-style: italic;
    line-height: 1.6;
    color: #2c2206;
    background: linear-gradient(135deg, #faf6eb 0%, #f5eed8 100%);
    border: 2px solid #b8a455;
    border-radius: 5px;
    box-shadow: inset 0 0 0 3px #faf6eb, inset 0 0 0 4px #b8a455;
}

.dedication-card p {
    margin: 0 0 0.3rem;
}

.dedication-card p:first-child {
    font-weight: 800;
    font-size: 1.2rem;
    font-style: normal;
}

.dedication-card p:last-child {
    margin-bottom: 0;
}

@media (max-width: 600px) {
    .dedication-row {
        flex-direction: column;
        gap: 0.5rem;
    }
}

.article-body {
    font-size: 1rem;
    line-height: 1.8;
}

.article-body p { margin-bottom: 1.3rem; }

.article-body h2 {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 1.5rem;
    font-weight: 700;
    margin: 2rem 0 0.8rem;
}

.article-body h3 {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 1.2rem;
    font-weight: 600;
    margin: 1.5rem 0 0.6rem;
}

.article-body blockquote {
    border-left: 3px solid var(--accent);
    padding: 0.5rem 0 0.5rem 1.25rem;
    margin: 1.5rem 0;
    color: var(--text-secondary);
    font-style: italic;
}

.article-body ul, .article-body ol {
    margin: 1rem 0 1.3rem 1.5rem;
}

.article-body li { margin-bottom: 0.4rem; }

.article-body strong { font-weight: 600; }

.article-body em { font-style: italic; }

/* ─── Previous Years ─── */
.prev-years {
    margin-top: 2.5rem;
    padding: 1.25rem 1.5rem;
    background: var(--surface);
    border-radius: 6px;
}

.prev-years h3 {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text);
    margin: 0 0 0.75rem;
}

.prev-years ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.prev-years li {
    padding: 0.3rem 0;
}

.prev-years li a {
    color: var(--accent);
    font-size: 0.92rem;
}

.prev-year-date {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    font-size: 0.78rem;
    color: var(--text-secondary);
}

.article-footer {
    margin-top: 3rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}

.article-footer a {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    font-size: 0.85rem;
    font-weight: 500;
}

/* ─── Page Content (Archive, About, Feedback) ─── */
.page-content {
    max-width: 720px;
    margin: 0 auto;
    padding: 2.5rem 1.5rem 3rem;
}

.page-content h1 {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.page-subtitle {
    color: var(--text-secondary);
    margin-bottom: 2rem;
    font-size: 0.95rem;
}

/* ─── Archive ─── */
.archive-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 2rem;
    border-bottom: 1px solid var(--border);
}

.tab {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    background: none;
    border: none;
    padding: 0.6rem 1.2rem;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: color 0.15s;
}
.tab:hover { color: var(--text); }
.tab.active {
    color: var(--text);
    border-bottom-color: var(--accent);
}

.tab-content { display: none; }
.tab-content.active { display: block; }

.archive-book {
    margin-bottom: 2rem;
}

.archive-book h3 {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 0.6rem;
    padding-bottom: 0.3rem;
    border-bottom: 1px solid var(--border);
}

.archive-book ul, .archive-year ul {
    list-style: none;
    padding: 0;
}

.archive-book li, .archive-year li {
    padding: 0.4rem 0;
    font-size: 0.92rem;
    border-bottom: 1px solid rgba(0,0,0,0.04);
}

.parsha-name {
    font-weight: 600;
    margin-right: 0.5rem;
}

.archive-year {
    margin-bottom: 2rem;
}

.archive-year h3 {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 0.6rem;
    padding-bottom: 0.3rem;
    border-bottom: 1px solid var(--border);
}

.archive-year li a {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 1rem;
}

.archive-year li time {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    font-size: 0.75rem;
    color: var(--text-secondary);
    white-space: nowrap;
}

/* ─── About ─── */
.about-photo-wrapper {
    text-align: center;
    margin-bottom: 2rem;
}
.about-photo {
    width: 140px;
    height: 140px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--border);
}
.about-body p {
    margin-bottom: 1.2rem;
    line-height: 1.8;
}
.about-body a {
    color: var(--accent);
    font-weight: 600;
}

/* ─── Feedback ─── */
.feedback-body p {
    margin-bottom: 1.2rem;
    line-height: 1.8;
}

.feedback-body a {
    color: var(--accent);
    font-weight: 600;
}

/* ─── Subscribe ─── */
.subscribe-form {
    max-width: 420px;
    margin-top: 1.5rem;
}
.subscribe-form label {
    display: block;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.4rem;
}
.subscribe-row {
    display: flex;
    gap: 0.5rem;
}
.subscribe-row input[type="email"] {
    flex: 1;
    padding: 0.6rem 0.8rem;
    font-size: 0.95rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
}
.subscribe-row input[type="email"]:focus {
    outline: none;
    border-color: var(--accent);
}
.subscribe-row button {
    padding: 0.6rem 1.2rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: #fff;
    background: var(--accent);
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
}
.subscribe-row button:hover {
    opacity: 0.9;
}
.subscribe-error {
    background: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fecaca;
    border-radius: 4px;
    padding: 0.6rem 0.8rem;
    font-size: 0.9rem;
    margin-bottom: 1rem;
    max-width: 420px;
}

.home-subscribe-cta {
    max-width: 680px;
    margin: 1.5rem auto;
    text-align: center;
}
.home-subscribe-cta p {
    font-size: 0.9rem;
    color: var(--text-secondary);
}
.home-subscribe-cta a {
    color: var(--accent);
    font-weight: 600;
}

/* ─── Ads ─── */
.ad-container {
    max-width: 680px;
    margin: 2rem auto;
    text-align: center;
}

/* ─── Footer ─── */
footer {
    border-top: 1px solid var(--border);
    background: var(--white);
    margin-top: auto;
}

.footer-inner {
    max-width: 960px;
    margin: 0 auto;
    padding: 1.5rem;
    text-align: center;
}

footer p {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    font-size: 0.78rem;
    color: var(--text-secondary);
}

.footer-tagline {
    font-family: 'Lora', Georgia, serif;
    font-style: italic;
    margin-top: 0.3rem;
}

/* ─── Mobile ─── */
@media (max-width: 640px) {
    html { font-size: 16px; }

    .nav-links { display: none; flex-direction: column; position: absolute; top: 100%; left: 0; right: 0; background: var(--white); border-bottom: 1px solid var(--border); padding: 1rem 1.5rem; gap: 1rem; }
    .nav-links.open { display: flex; }
    .nav-toggle { display: block; }
    .heb-banner { font-size: 0.9rem; padding: 0.4rem 0.75rem; }

    .home-header { padding: 2rem 1.25rem 1rem; }
    .home-header h1 { font-size: 1.8rem; }

    .this-week { padding: 0 1.25rem; }
    .home-article-header h2 { font-size: 1.6rem; }

    .previous { padding: 2rem 1.25rem; }
    .previous li a {
        flex-direction: column;
        gap: 0.15rem;
    }
    .prev-parsha { min-width: unset; }

    .article-page { padding: 1.5rem 1.25rem 2rem; }
    .article-header h1 { font-size: 1.7rem; }

    .page-content { padding: 1.5rem 1.25rem 2rem; }
    .page-content h1 { font-size: 1.6rem; }

    .archive-year li a {
        flex-direction: column;
        gap: 0.15rem;
    }
}

/* ─── Halachot Page ─── */
h1.halachot-title {
    text-align: center !important;
    width: 100%;
}
.halachot-intro {
    font-size: 1rem;
    line-height: 1.8;
}
.halachot-intro p {
    margin-bottom: 1.6rem;
}
.halachot-week {
    margin: 2rem 0;
    padding: 1.5rem 1.75rem;
    background: linear-gradient(135deg, #faf6eb 0%, #f5eed8 100%);
    border: 1.5px solid #d4c5a9;
    border-radius: 6px;
}
.halachot-week-title {
    font-family: Georgia, 'Times New Roman', serif;
    font-size: 1.1rem;
    color: #8B6914;
    margin: 0 0 0.75rem;
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 0.5rem;
}
.halachot-week-title a {
    color: #8B6914;
    text-decoration: none;
}
.halachot-week-title a:hover {
    text-decoration: underline;
}
.halachot-date {
    font-size: 0.85rem;
    font-weight: normal;
    color: #8b7355;
}
.halachot-list {
    list-style: none;
    padding: 0;
    margin: 0;
}
.halachot-list li {
    position: relative;
    padding-left: 1.5em;
    margin-bottom: 0.75em;
    line-height: 1.7;
    color: #3d2e1f;
}
.halachot-list li::before {
    content: "\2727";
    position: absolute;
    left: 0;
    color: #8B6914;
}

/* ─── Did You Know ─── */
.did-you-know {
    margin: 2.5rem 0 1.5rem;
    padding: 1.5rem 1.75rem;
    background: linear-gradient(135deg, #faf6eb 0%, #f5eed8 100%);
    border: 1.5px solid #d4c5a9;
    border-radius: 6px;
}
.dyk-heading {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--accent);
    margin: 0 0 0.75rem;
}
.dyk-list {
    list-style: none;
    margin: 0;
    padding: 0;
}
.dyk-list li {
    position: relative;
    padding-left: 1.25rem;
    margin-bottom: 0.6rem;
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--text);
}
.dyk-list li:last-child {
    margin-bottom: 0;
}
.dyk-list li::before {
    content: "\2727";
    position: absolute;
    left: 0;
    color: var(--accent);
    font-size: 0.85rem;
}

/* ─── Rating Widget ─── */
.rating-widget {
    text-align: center;
    margin: 2.5rem 0 1.5rem;
    padding: 1.5rem;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}
.rating-prompt {
    font-family: 'EB Garamond', Georgia, serif;
    font-size: 1.1rem;
    color: var(--text);
    margin: 0 0 0.75rem;
}
.rating-stars {
    display: inline-flex;
    gap: 0.35rem;
}
.rating-stars .star {
    background: none;
    border: none;
    font-size: 2rem;
    color: var(--border);
    cursor: pointer;
    padding: 0 0.1rem;
    transition: color 0.15s, transform 0.15s;
    line-height: 1;
}
.rating-stars .star.selected {
    color: var(--accent);
}
.rating-stars .star:hover,
.rating-stars .star.hover {
    color: var(--accent);
    transform: scale(1.15);
}
.rating-feedback-link {
    color: var(--accent);
    font-size: 0.9rem;
}
.rating-thanks {
    font-family: 'EB Garamond', Georgia, serif;
    font-size: 1.05rem;
    color: var(--sage);
    margin: 0;
}

/* ─── Print ─── */
@media print {
    nav, footer, .ad-container, .article-footer,
    .rating-widget, .prev-years, .print-btn,
    .home-subscribe-cta, .home-article-share,
    .previous { display: none !important; }
    .article-page { max-width: 100%; padding: 0; }
    .article-header { border-bottom: 1px solid #ccc; }
    body { font-size: 12pt; background: #fff; }
    a { color: inherit; text-decoration: none; }
    .article-body blockquote { border-left-color: #999; }
}
