/*
Theme Name: Petaluma Social
Theme URI: https://petaluma.ngrok.app
Author: Petaluma Social
Description: Editorial event listings for Petaluma, CA
Version: 1.1.0
*/

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

:root {
    --pj-red:       #C62828;
    --pj-red-light: #FFEBEE;
    --pj-blue:      #1565C0;
    --pj-blue-light:#E3F2FD;
    --pj-green:     #2E7D32;
    --pj-green-light:#E8F5E9;
    --pj-orange:    #E65100;
    --pj-orange-light:#FFF3E0;
    --pj-purple:    #7B1FA2;
    --pj-purple-light:#F3E5F5;
    --pj-black:     #1a1a1a;
    --pj-gray-900:  #333;
    --pj-gray-700:  #555;
    --pj-gray-500:  #888;
    --pj-gray-300:  #ddd;
    --pj-gray-100:  #f5f5f5;
    --pj-white:     #fff;
    --font-serif:   'Playfair Display', Georgia, serif;
    --font-sans:    'Inter', -apple-system, sans-serif;
}

body {
    font-family: var(--font-sans);
    background: var(--pj-gray-100);
    color: var(--pj-black);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    padding-bottom: 80px;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

/* ── Sticky Header Wrapper (header + category tabs) ────────── */
.pj-sticky-header {
    position: sticky;
    top: 0;
    z-index: 100;
}

/* ── Header ────────────────────────────────────────────────── */
.pj-site-header {
    background: var(--pj-white);
    border-bottom: 1px solid var(--pj-gray-300);
    padding: 16px 20px;
    text-align: center;
}
.pj-site-title {
    font-family: var(--font-serif);
    font-size: 24px;
    font-weight: 700;
    color: var(--pj-black);
    letter-spacing: -0.5px;
}
.pj-site-subtitle {
    font-size: 11px;
    font-weight: 500;
    color: var(--pj-gray-500);
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-top: 2px;
}

/* ── Archive / Section Headers ─────────────────────────────── */
.pj-archive-header {
    padding: 24px 20px 12px;
    text-align: center;
}
.pj-archive-title {
    font-family: var(--font-serif);
    font-size: 28px;
    font-weight: 700;
}

/* ── Date Section Labels ───────────────────────────────────── */
.pj-section-label {
    font-family: var(--font-sans);
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--pj-gray-500);
    padding: 20px 20px 8px;
    margin: 0;
}

/* ── Event Cards (Compact Horizontal Row) ──────────────────── */
.pj-event-card {
    background: var(--pj-white);
    border-radius: 14px;
    margin: 0 16px 16px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    display: flex;
    align-items: stretch;
    padding: 12px;
    gap: 12px;
}
.pj-event-card:active {
    transform: scale(0.995);
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}

.pj-card-link {
    display: flex;
    text-decoration: none;
    color: inherit;
    flex: 1;
    gap: 12px;
    align-items: stretch;
}

.pj-event-image-wrap {
    flex-shrink: 0;
    width: 80px;
    height: 80px;
    border-radius: 10px;
    overflow: hidden;
    position: relative;
}
.pj-event-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}
/* Hide broken/empty images and their wrappers */
.pj-event-image[src=""],
.pj-event-image:not([src]) {
    display: none;
}
.pj-event-image-wrap:has(.pj-event-image[src=""]),
.pj-event-image-wrap:has(.pj-event-image:not([src])) {
    display: none;
}

.pj-event-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
}

/* ── Card Header (Category + Time) ─────────────────────────── */
.pj-event-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}
.pj-event-category {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 3px 8px;
    border-radius: 6px;
}
.pj-event-time {
    font-size: 11px;
    font-weight: 500;
    color: var(--pj-gray-500);
}

/* ── Title ─────────────────────────────────────────────────── */
.pj-event-title {
    font-family: var(--font-serif);
    font-size: 16px;
    font-weight: 700;
    line-height: 1.3;
    margin-bottom: 4px;
    color: var(--pj-black);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.pj-event-title a {
    color: inherit;
}
.pj-event-title a:hover,
.pj-event-title a:active {
    color: var(--pj-red);
}

/* ── Description ───────────────────────────────────────────── */
.pj-event-desc {
    font-size: 13px;
    color: var(--pj-gray-700);
    line-height: 1.4;
    margin-bottom: 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── Footer Row (Venue + Price) ────────────────────────────── */
.pj-event-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.pj-event-venue {
    font-size: 12px;
    color: var(--pj-gray-500);
    display: flex;
    align-items: center;
    gap: 4px;
}
.pj-venue-icon {
    font-size: 12px;
}
.pj-event-price {
    font-size: 12px;
    font-weight: 600;
    color: var(--pj-gray-900);
}
.pj-event-price.pj-free {
    color: var(--pj-red);
    font-weight: 700;
}

/* ── Source Link (inline, small) ───────────────────────────── */
.pj-event-source {
    display: none; /* hide on card rows, show on detail page */
}

/* ── Archive Layout: time + price aligned right ────────────── */
.pj-event-meta-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: center;
    gap: 4px;
    flex-shrink: 0;
    text-align: right;
    padding-left: 8px;
}
.pj-event-meta-right .pj-event-time {
    font-size: 11px;
    color: var(--pj-gray-500);
}
.pj-event-meta-right .pj-event-price {
    font-size: 12px;
    font-weight: 600;
    color: var(--pj-gray-900);
}
.pj-event-meta-right .pj-event-price.pj-free {
    color: var(--pj-red);
}

/* ── No Events ─────────────────────────────────────────────── */
.pj-no-events {
    text-align: center;
    padding: 60px 20px;
    color: var(--pj-gray-500);
    font-size: 16px;
}

/* ── Bottom Tab Nav ────────────────────────────────────────── */
.pj-bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(255,255,255,0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid var(--pj-gray-300);
    display: flex;
    justify-content: space-around;
    padding: 8px 0;
    z-index: 150;
}
.pj-bottom-nav a {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    font-size: 10px;
    font-weight: 500;
    color: var(--pj-gray-500);
    padding: 4px 16px;
    border-radius: 8px;
}
.pj-bottom-nav a.active {
    color: var(--pj-red);
}
.pj-nav-icon {
    font-size: 20px;
    line-height: 1;
}

/* ── Category Tabs ────────────────────────────────────────────────── */
.pj-category-tabs {
    display: flex;
    gap: 8px;
    padding: 12px 16px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    background: var(--pj-white);
    border-bottom: 1px solid var(--pj-gray-300);
}

/* ── Date Picker Bar ───────────────────────────────────────── */
.pj-date-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    background: var(--pj-white);
    border-bottom: 1px solid var(--pj-gray-300);
}
.pj-date-bar::-webkit-scrollbar { display: none; }

.pj-date-chip {
    flex-shrink: 0;
    font-size: 13px;
    font-weight: 600;
    padding: 7px 16px;
    border-radius: 20px;
    border: 1px solid var(--pj-gray-300);
    background: var(--pj-white);
    color: var(--pj-gray-700);
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
    -webkit-tap-highlight-color: transparent;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
}
.pj-date-chip:hover,
.pj-date-chip.active {
    background: var(--pj-black);
    color: var(--pj-white);
    border-color: var(--pj-black);
}
.pj-date-chip--past { border-color: var(--pj-gray-500); }
.pj-date-chip--past.active {
    background: var(--pj-gray-700);
    border-color: var(--pj-gray-700);
}

.pj-date-form {
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
}
.pj-date-form input[type="date"] {
    font-family: var(--font-sans);
    font-size: 13px;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 20px;
    border: 1px solid var(--pj-gray-300);
    color: var(--pj-gray-700);
    background: var(--pj-white);
    cursor: pointer;
    height: 36px;
}
.pj-date-form input[type="date"]:focus {
    outline: none;
    border-color: var(--pj-black);
}

/* ── Single Event Page ─────────────────────────────────────── */
.pj-category-tabs::-webkit-scrollbar { display: none; }
.pj-category-tab {
    flex-shrink: 0;
    font-size: 13px;
    font-weight: 600;
    padding: 8px 16px;
    border-radius: 20px;
    border: 1px solid var(--pj-gray-300);
    background: var(--pj-white);
    color: var(--pj-gray-700);
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
    -webkit-tap-highlight-color: transparent;
}
.pj-category-tab:hover,
.pj-category-tab.active {
    background: var(--pj-black);
    color: var(--pj-white);
    border-color: var(--pj-black);
}

/* ── Single Event Page ─────────────────────────────────────── */
/* Full-bleed blurred backplate fills width behind image */
.pj-single-hero {
    position: relative;
    width: 100%;
    min-height: 280px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: var(--pj-gray-100);
}
.pj-single-hero-bg {
    position: absolute;
    inset: -20px;
    background-size: cover;
    background-position: center;
    filter: blur(40px) brightness(0.75);
    z-index: 0;
}
.pj-single-hero img {
    position: relative;
    z-index: 1;
    max-height: 70vh;
    width: auto;
    max-width: 100%;
    object-fit: contain;
    box-shadow: 0 8px 40px rgba(0,0,0,0.25);
}
.pj-single-content {
    padding: 24px 20px;
    max-width: 640px;
    margin: 0 auto;
}
.pj-single-title {
    font-family: var(--font-serif);
    font-size: 28px;
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 12px;
}
.pj-single-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 20px;
}
.pj-single-meta-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    color: var(--pj-gray-700);
    padding: 6px 12px;
    background: var(--pj-gray-100);
    border-radius: 8px;
}
.pj-single-description {
    font-size: 16px;
    line-height: 1.7;
    color: var(--pj-gray-900);
    margin-bottom: 24px;
}
.pj-single-source {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--pj-red);
    color: var(--pj-white);
    font-size: 15px;
    font-weight: 600;
    padding: 14px 28px;
    border-radius: 12px;
    margin-bottom: 24px;
    transition: background 0.15s ease;
}
.pj-single-source:hover {
    background: #a02020;
}

/* ── Front Page / Weekend Guide ────────────────────────────── */
.pj-weekend-hero {
    padding: 24px 20px;
    text-align: center;
}
.pj-weekend-hero h2 {
    font-family: var(--font-serif);
    font-size: 26px;
    font-weight: 700;
    margin-bottom: 4px;
}
.pj-weekend-hero p {
    font-size: 15px;
    color: var(--pj-gray-500);
}
.pj-featured-grid {
    padding: 0 16px;
    display: grid;
    gap: 12px;
}

/* ── Mobile Text Wrapping ─────────────────────────────────────── */
@media (max-width: 640px) {
    .pj-event-title {
        white-space: normal;
        overflow: visible;
        text-overflow: clip;
    }
    .pj-event-desc {
        white-space: normal;
        overflow: visible;
        text-overflow: clip;
    }
}
