/*
Theme Name: MJM Theme
Theme URI:
Description: Custom theme for the Museum of Jewish Montreal
Version: 1.0
Author: MJM
Text Domain: mjm-theme
*/

@font-face {
    font-family: "KF Zuka Book";
    src: url("assets/fonts/KFZuka-Book.otf") format("opentype");
    font-style: normal;
    font-weight: 400;
    font-display: swap;
}

@font-face {
    font-family: "KF Zuka Regular";
    src: url("assets/fonts/KFZuka-Regular.otf") format("opentype");
    font-style: normal;
    font-weight: 400;
    font-display: swap;
}

@font-face {
    font-family: "KF Zuka Medium";
    src: url("assets/fonts/KFZuka-Medium.otf") format("opentype");
    font-style: normal;
    font-weight: 500;
    font-display: swap;
}

/* =============================================
   Typography Design Tokens
   Spec: MJM Brand Guidelines, Typography Hierarchy (pages 15-22)
   ============================================= */
:root {
    /* Font families (semantic aliases) */
    --font-headline: "KF Zuka Medium", "Helvetica Neue", Helvetica, Arial, sans-serif;
    --font-subtitle: "KF Zuka Medium", "Helvetica Neue", Helvetica, Arial, sans-serif;
    --font-body:     "KF Zuka Book", "Helvetica Neue", Helvetica, Arial, sans-serif;

    /* Tracking: -1% across all levels */
    --tracking-tight: -0.01em;

    /* Type scale — responsive, proportional to brand ratios (1/1, 1/2, 1/4, 1/6) */
    --text-level-1: clamp(2.5rem, 6vw, 5rem);     /* Level 1 — 100pt hero headline  */
    --text-level-2: clamp(1.75rem, 3.5vw, 3rem);  /* Level 2 — 50pt subtitle        */
    --text-level-3: clamp(1.1rem, 1.8vw, 1.5rem); /* Level 3 — 25pt event/date info */
    --text-level-4: clamp(0.875rem, 1vw, 1rem);   /* Level 4 — 15pt body copy       */

    /* Line heights per level */
    --leading-level-1: 0.85;
    --leading-level-2: 0.90;
    --leading-level-3: 1.0;
    --leading-level-4: 1.1;

    /* =============================================
       Brand colour tokens
       ============================================= */

    /* Base palette */
    --color-black:      #000000;
    --color-near-black: #1a1a1a;
    --color-dark:       #333333;
    --color-mid:        #666666;
    --color-border:     #e0e0e0;
    --color-white:      #ffffff;

    /* Accents */
    --color-green:      #1D8D02;  /* nav active, donate button */
    --color-orange:     #FF5500;  /* newsletter checkbox */

    /* Semantic aliases */
    --color-text:       var(--color-near-black);
    --color-link:       var(--color-near-black);
    --color-link-hover: var(--color-near-black);
    --color-success:    #23613c;
    --color-error:      #b42318;
}

/* =============================================
   Heading Scale
   h1 → Level 1 (KF Zuka Medium, hero)
   h2 → Level 2 (KF Zuka Book, subtitle)
   h3 → Level 3 (KF Zuka Book, info)
   h4–h6 → Level 4 (KF Zuka Regular, fine)
   ============================================= */
h1 {
    font-family: var(--font-headline);
    font-size: var(--text-level-1);
    line-height: var(--leading-level-1);
    letter-spacing: var(--tracking-tight);
    font-weight: normal;
}

h2 {
    font-family: var(--font-subtitle);
    font-size: var(--text-level-2);
    line-height: var(--leading-level-2);
    letter-spacing: var(--tracking-tight);
    font-weight: normal;
}

h3 {
    font-family: var(--font-subtitle);
    font-size: var(--text-level-3);
    line-height: var(--leading-level-3);
    letter-spacing: var(--tracking-tight);
    font-weight: normal;
}

h4, h5, h6 {
    font-family: var(--font-body);
    font-size: var(--text-level-4);
    line-height: var(--leading-level-4);
    letter-spacing: var(--tracking-tight);
    font-weight: normal;
}

/* =============================================
   Utility Classes
   Apply brand hierarchy levels to any element
   ============================================= */
.mjm-visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.text-level-1 {
    font-family: var(--font-headline);
    font-size: var(--text-level-1);
    line-height: var(--leading-level-1);
    letter-spacing: var(--tracking-tight);
}

.text-level-2 {
    font-family: var(--font-subtitle);
    font-size: var(--text-level-2);
    line-height: var(--leading-level-2);
    letter-spacing: var(--tracking-tight);
}

.text-level-3 {
    font-family: var(--font-subtitle);
    font-size: var(--text-level-3);
    line-height: var(--leading-level-3);
    letter-spacing: var(--tracking-tight);
}

.text-level-4 {
    font-family: var(--font-body);
    font-size: var(--text-level-4);
    line-height: var(--leading-level-4);
    letter-spacing: var(--tracking-tight);
}

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

body {
    font-family: var(--font-body);
    font-size: var(--text-level-4);
    line-height: var(--leading-level-4);
    letter-spacing: var(--tracking-tight);
    color: #1a1a1a;
}

a {
    color: var(--color-link);
    text-decoration: none;
}

a:hover {
    color: var(--color-link-hover);
    text-decoration: none;
}

/* =============================================
   Responsive Media
   ============================================= */
img,
video {
    max-width: 100%;
    height: auto;
    display: block;
}

/* =============================================
   Focus Styles
   ============================================= */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 2px solid var(--color-near-black);
    outline-offset: 2px;
}

/* =============================================
   Entry Content — HTML element defaults
   Scoped to .entry-content so these only apply
   to page/post body copy, not header/footer/blocks.
   ============================================= */

/* Paragraphs */
:where(.entry-content) p {
    margin-bottom: 1.25em;
    line-height: var(--leading-level-4);
}
:where(.entry-content) p:last-child {
    margin-bottom: 0;
}

/* Headings — spacing (size/weight set by global h1–h6 rules) */
:where(.entry-content) h1,
:where(.entry-content) h2,
:where(.entry-content) h3,
:where(.entry-content) h4,
:where(.entry-content) h5,
:where(.entry-content) h6 {
    margin-top: 1.5em;
    margin-bottom: 0.5em;
}
:where(.entry-content) h1:first-child,
:where(.entry-content) h2:first-child {
    margin-top: 0;
}

/* Links in content */
:where(.entry-content) a {
    text-decoration: none;
}
:where(.entry-content) a:hover {
    text-decoration: none;
}

/* Lists */
:where(.entry-content) ul,
:where(.entry-content) ol {
    padding-left: 1.5rem;
    margin-bottom: 1.25em;
}
:where(.entry-content) ul {
    list-style: disc;
}
:where(.entry-content) ol {
    list-style: decimal;
}
:where(.entry-content) li {
    margin-bottom: 0.35em;
}
:where(.entry-content) ul ul,
:where(.entry-content) ol ol,
:where(.entry-content) ul ol,
:where(.entry-content) ol ul {
    margin-bottom: 0;
    margin-top: 0.25em;
}

/* Blockquote */
:where(.entry-content) blockquote {
    border-left: 3px solid var(--color-near-black);
    padding-left: 1.25rem;
    margin: 1.5em 0;
    font-style: italic;
    color: var(--color-dark);
}
:where(.entry-content) blockquote cite {
    display: block;
    margin-top: 0.5em;
    font-size: 0.875em;
    color: var(--color-mid);
    font-style: normal;
}

/* Inline code */
:where(.entry-content) code {
    font-family: "Courier New", Courier, monospace;
    font-size: 0.875em;
    background: #f4f4f4;
    padding: 0.15em 0.35em;
    border-radius: 3px;
}

/* Code blocks */
:where(.entry-content) pre {
    font-family: "Courier New", Courier, monospace;
    font-size: 0.875em;
    background: #f4f4f4;
    padding: 1rem 1.25rem;
    border-radius: 4px;
    overflow-x: auto;
    margin-bottom: 1.25em;
    line-height: 1.55;
}
:where(.entry-content) pre code {
    background: none;
    padding: 0;
    font-size: inherit;
    border-radius: 0;
}

/* Tables */
:where(.entry-content) table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1.25em;
    font-size: var(--text-level-4);
}
:where(.entry-content) th,
:where(.entry-content) td {
    padding: 0.5rem 0.75rem;
    text-align: left;
    border: 1px solid var(--color-border);
}
:where(.entry-content) th {
    font-family: var(--font-headline);
    font-weight: normal;
    background: #f7f7f7;
}
:where(.entry-content) tr:nth-child(even) td {
    background: #fafafa;
}

/* Figures & captions */
:where(.entry-content) figure {
    margin: 1.5em 0;
}
:where(.entry-content) figcaption {
    font-size: 0.8rem;
    color: var(--color-mid);
    margin-top: 0.4rem;
    line-height: 1.35;
}

/* Horizontal rule */
:where(.entry-content) hr {
    border: none;
    border-top: 1px solid var(--color-border);
    margin: 2em 0;
}

/* Bold — KF Zuka Medium is the "bold" weight in this type system */
:where(.entry-content) strong,
:where(.entry-content) b {
    font-family: var(--font-headline);
    font-weight: normal;
}

/* =============================================
   Core WordPress Block Defaults
   wp-block-library-theme is dequeued, so
   provide minimal replacements for common blocks.
   ============================================= */

/* Block: Image */
.entry-content .wp-block-image {
    margin: 1.5em 0;
}
.entry-content .wp-block-image img {
    max-width: 100%;
    height: auto;
}
.entry-content .wp-block-image figcaption {
    font-size: 0.8rem;
    color: var(--color-mid);
    margin-top: 0.4rem;
    line-height: 1.35;
}

/* Block: Quote */
.entry-content .wp-block-quote {
    border-left: 3px solid var(--color-near-black);
    padding-left: 1.25rem;
    margin: 1.5em 0;
    font-style: italic;
    color: var(--color-dark);
}
.entry-content .wp-block-quote cite,
.entry-content .wp-block-quote footer {
    display: block;
    margin-top: 0.5em;
    font-size: 0.875em;
    color: var(--color-mid);
    font-style: normal;
}

/* Block: Separator */
.entry-content .wp-block-separator {
    border: none;
    border-top: 1px solid var(--color-border);
    margin: 2em 0;
}

/* Block: Code */
.entry-content .wp-block-code {
    background: #f4f4f4;
    padding: 1rem 1.25rem;
    border-radius: 4px;
    overflow-x: auto;
    margin-bottom: 1.25em;
}
.entry-content .wp-block-code code {
    background: none;
    padding: 0;
    font-size: inherit;
}

/* Block: Table */
.entry-content .wp-block-table {
    margin-bottom: 1.25em;
    overflow-x: auto;
}
.entry-content .wp-block-table table {
    margin-bottom: 0;
}

/* Block: List */
.entry-content .wp-block-list {
    padding-left: 1.5rem;
    margin-bottom: 1.25em;
}

/* Block: Paragraph — ensure spacing when adjacent blocks stack */
.entry-content .wp-block-paragraph {
    margin-bottom: 1.25em;
}
.entry-content .wp-block-paragraph:last-child {
    margin-bottom: 0;
}

/* Header */
.site-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 65px;
    max-height: 65px;
    padding: 0 clamp(1.5rem, 3vw, 2rem);
    background: #fff;
}

.site-branding .site-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
}

.site-branding .site-title a {
    color: #333;
    text-decoration: none;
}

.site-branding .site-description {
    font-size: 0.85rem;
    color: #666;
    margin: 0;
}

/* Site Logo */
.site-branding {
    height: 100%;
}

.site-logo {
    display: flex;
    align-items: center;
    height: 100%;
}

.site-logo a {
    display: flex;
    align-items: center;
    height: 100%;
    line-height: 0;
}

.site-logo img {
    display: block;
    height: 25px;
    max-height: 100%;
    width: auto;
}

/* Header Right (nav + language switcher) */
.header-right {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

/* Main Navigation - Top Right */
.main-navigation {
    display: flex;
    align-items: center;
}

/* WPML Language Switcher */
.language-switcher {
    list-style: none;
    display: flex;
    gap: 0.5rem;
    margin: 0;
    padding: 0;
    border-left: 1px solid #e0e0e0;
    padding-left: 1.5rem;
}

.language-switcher a {
    color: #666;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    transition: color 0.2s;
}

.language-switcher .active a {
    color: #0073aa;
}

.language-switcher a:hover {
    color: #0073aa;
    text-decoration: none;
}

.main-navigation ul {
    list-style: none;
    display: flex;
    align-items: center;
    gap: 3.25rem;
    margin: 0;
    padding: 0;
}

.main-navigation li {
    position: relative;
}

.main-navigation a {
    color: #000;
    font-family: "KF Zuka Regular", "Helvetica Neue", Helvetica, Arial, sans-serif;
    font-size: 1.1rem;
    font-weight: normal;
    letter-spacing: var(--tracking-tight);
    padding: 0rem 0;
    transition: color 0.2s;
}

.main-navigation a:hover {
    color: #0073aa;
    text-decoration: none;
}

.main-navigation .current-menu-item > a,
.main-navigation .current_page_item > a,
.main-navigation .nav-donate > a {
    display: inline-flex;
    align-items: center;
    padding: 0.5rem 1.25rem;
    border-radius: 49.87px;
    background: #1D8D02;
    color: #000;
    text-decoration: none;
    gap: 9.97px;
}

/* Dropdown submenus */
.main-navigation ul ul {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    flex-direction: column;
    background: #fff;
    border: 1px solid #e0e0e0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    min-width: 180px;
    padding: 0.5rem 0;
    gap: 0;
    z-index: 1000;
}

.main-navigation li:hover > ul {
    display: flex;
}

.main-navigation ul ul a {
    padding: 0.4rem 1rem;
    display: block;
    white-space: nowrap;
}

/* Content */
.site-content {
    max-width: 1200px;
    margin: 0rem auto;
    padding: 0;
}

.entry-title {
    margin-top: 2rem;
    margin-left: 2rem;
}

/* Footer */
.site-footer {
    padding: clamp(1.5rem, 3vw, 2.5rem) clamp(1.5rem, 3vw, 2rem) 2rem;
    font-family: var(--font-body);
    font-size: 0.85rem;
    line-height: 1.45;
    color: #000;
    margin-top: clamp(2rem, 4vw, 3.5rem);
}

.footer-inner {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(12rem, 0.8fr) minmax(16rem, 1fr);
    gap: clamp(1.5rem, 3vw, 3rem);
    align-items: start;
    border-top: 1px solid #000;
    padding-top: clamp(1rem, 2vw, 1.4rem);
}

.footer-col {
    min-width: 0;
}

/* Footer About Column */
.footer-about {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.footer-about p {
    margin: 0;
    line-height: 1.45;
}

.footer-logo {
    margin-top: auto;
    padding-top: 1rem;
}

.footer-logo a {
    display: block;
    line-height: 0;
}

.footer-logo img {
    width: min(100%, 16rem);
    max-width: 100%;
    height: auto;
}

.footer-nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 0.55rem;
}

.footer-nav li {
    margin: 0;
}

.footer-nav a {
    color: #000;
    font-family: var(--font-headline);
    font-size: 0.78rem;
    font-weight: normal;
    letter-spacing: var(--tracking-tight);
    text-transform: uppercase;
}

.footer-nav a:hover {
    text-decoration: none;
}

/* Footer Contact Column */
.footer-contact {
    display: grid;
    gap: 1rem;
    align-content: start;
}

.footer-heading {
    font-family: var(--font-headline);
    font-size: 0.78rem;
    font-weight: normal;
    letter-spacing: var(--tracking-tight);
    text-transform: uppercase;
    margin: 0 0 0.5rem;
}

.newsletter-form {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0;
    padding: 0.65rem 0;
    border-top: 1px solid #000;
    border-bottom: 1px solid #000;
}

.newsletter-form input[type="email"] {
    flex: 1;
    border: none;
    padding: 0;
    font-size: 0.85rem;
    line-height: 1.3;
    background: transparent;
    outline: none;
    min-width: 0;
    color: #000;
}

.newsletter-form input[type="email"]::placeholder {
    color: #000;
    opacity: 1;
}

.newsletter-checkbox {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    cursor: pointer;
    margin: 0;
}

.newsletter-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin: 0;
    appearance: none;
    -webkit-appearance: none;
    border: 1px solid #FF5500;
    background: #FF5500;
    border-radius: 50%;
    cursor: pointer;
    position: relative;
}

.newsletter-checkbox input[type="checkbox"]:checked::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 4px;
    height: 9px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: translate(-50%, -58%) rotate(45deg);
}

.newsletter-checkbox input[type="checkbox"]:focus {
    outline: 2px solid rgba(255, 85, 0, 0.25);
    outline-offset: 2px;
}

.newsletter-form.is-loading {
    opacity: 0.75;
}

.newsletter-form.is-loading .newsletter-checkbox input[type="checkbox"] {
    cursor: progress;
}

.newsletter-status {
    margin: 0;
    min-height: 1.4rem;
    font-size: 0.8rem;
    line-height: 1.4;
}

.newsletter-status.is-success {
    color: #23613c;
}

.newsletter-status.is-error {
    color: #b42318;
}

.footer-address p,
.footer-contact-info p {
    margin: 0;
    line-height: 1.5;
}

.footer-contact-info a {
    color: #000;
}

.footer-social {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.footer-social a {
    color: #000;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    line-height: 0;
    border: 1px solid currentColor;
    border-radius: 999px;
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.footer-social a:hover {
    opacity: 1;
    background: #000;
    color: #fff;
    text-decoration: none;
}

.footer-bottom {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--color-border);
    font-size: 0.8rem;
    color: #666;
}

.footer-bottom p {
    margin: 0;
}

/* Contact Lightbox */
.contact-lightbox {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9999;
    align-items: center;
    justify-content: center;
}

.contact-lightbox.is-open {
    display: flex;
}

.contact-lightbox-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
}

.contact-lightbox-content {
    position: relative;
    background: #fff;
    padding: 2.5rem;
    border-radius: 8px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    z-index: 1;
}

.contact-lightbox-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.2rem;
}

.contact-lightbox-content h2 {
    margin: 0 0 1.5rem;
    font-size: 1.25rem;
}

.contact-lightbox-logo {
    display: flex;
    align-items: center;
}

.contact-lightbox-logo a {
    display: block;
    line-height: 0;
}

.contact-lightbox-logo img {
    max-height: 30px;
    width: auto;
}

.contact-lightbox-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    line-height: 1;
    color: #333;
}

.contact-form .form-field {
    margin-bottom: 1rem;
}

.contact-form label {
    display: block;
    margin-bottom: 0.25rem;
    font-weight: 500;
    font-size: 0.85rem;
}

.contact-form input[type="text"],
.contact-form input[type="email"],
.contact-form textarea {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 0.85rem;
    font-family: inherit;
}

.contact-form textarea {
    resize: vertical;
}

.contact-submit {
    display: inline-block;
    padding: 0.6rem 1.5rem;
    background: #000;
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 0.85rem;
    cursor: pointer;
}

.contact-submit:hover {
    background: #333;
}

/* Hamburger Toggle (hidden on desktop) */
.menu-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.25rem;
    flex-direction: column;
    gap: 4px;
    z-index: 1001;
}

.hamburger-line {
    display: block;
    width: 22px;
    height: 2px;
    background: #333;
    transition: transform 0.3s, opacity 0.3s;
}

.menu-toggle.is-active .hamburger-line:nth-child(1) {
    transform: translateY(6px) rotate(45deg);
}

.menu-toggle.is-active .hamburger-line:nth-child(2) {
    opacity: 0;
}

.menu-toggle.is-active .hamburger-line:nth-child(3) {
    transform: translateY(-6px) rotate(-45deg);
}

/* Responsive - Tablet and below */
@media (max-width: 768px) {

    .entry-title {
        margin-left: 1rem;
        margin-right: 1rem;
    }

    /* Header */
    .site-header {
        position: relative;
    }

    .menu-toggle {
        display: flex;
    }

    .header-right {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: #fff;
        flex-direction: column;
        align-items: flex-start;
        padding: 1rem 1.5rem;
        box-shadow: 0 4px 12px rgba(0,0,0,0.1);
        gap: 1rem;
        z-index: 1000;
    }

    .header-right.is-open {
        display: flex;
    }

    .main-navigation ul {
        flex-direction: column;
        gap: 0.75rem;
    }

    .main-navigation ul ul {
        position: static;
        box-shadow: none;
        border: none;
        padding-left: 1rem;
    }

    .main-navigation li:hover > ul {
        display: flex;
    }

    .language-switcher {
        border-left: none;
        padding-left: 0;
        border-top: 1px solid #e0e0e0;
        padding-top: 1rem;
    }

    /* Footer */
    .footer-inner {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .footer-nav ul {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.5rem 1rem;
    }

    .footer-logo img {
        width: min(100%, 13rem);
    }

    .newsletter-form {
        max-width: 24rem;
    }

    .site-content {
        padding: 0;
    }
}

/* Responsive - Small phones */
@media (max-width: 480px) {

    .site-header {
        padding: 0.2rem clamp(1.5rem, 3vw, 2rem);
    }

    .site-content {
        padding: 0;
        margin: 1rem auto;
    }

    .site-footer {
        padding: 1.5rem clamp(1.5rem, 3vw, 2rem);
    }

    .footer-nav ul {
        grid-template-columns: 1fr;
    }

    .contact-lightbox-content {
        padding: 1.5rem;
        width: 95%;
    }
}
