/* ── Gallery page — design tokens ─────────────────────────────────── */
:root {
    --g-ink:     #0A0A0A;
    --g-muted:   #6B6B6B;
    --g-bg:      #F2F3F5;
    --g-surface: #FFFFFF;
    --g-accent:  #7C3AED;
    --g-border:  rgba(10, 10, 10, 0.10);
    --g-border2: rgba(10, 10, 10, 0.18);
    --g-font:    -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    background: var(--g-bg);
    color: var(--g-ink);
    font-family: var(--g-font);
    -webkit-font-smoothing: antialiased;
}

/* ── Header ──────────────────────────────────────────────────────── */
.gh-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 40px;
    height: 70px;
    background: var(--g-surface);
    border-bottom: 1px solid var(--g-border);
    flex-shrink: 0;
}

.gh-header-left {
    display: flex;
    align-items: center;
    gap: 44px;
}

.gh-logo {
    height: 32px;
    width: 32px;
    border-radius: 8px;
    display: block;
    object-fit: cover;
}

.gh-nav {
    display: flex;
    gap: 28px;
}

.gh-nav-link {
    font-size: 14px;
    font-weight: 500;
    color: var(--g-muted);
    cursor: pointer;
    position: relative;
    padding-bottom: 4px;
    text-decoration: none;
}

.gh-nav-link--active {
    color: var(--g-ink);
    font-weight: 600;
}

.gh-nav-link--active::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: -22px;
    height: 2px;
    background: var(--g-accent);
    border-radius: 2px;
}

.gh-header-right {
    display: flex;
    align-items: center;
    gap: 14px;
}

.gh-signin {
    font-size: 13px;
    color: var(--g-muted);
    font-weight: 500;
    cursor: pointer;
}

.gh-demo-btn {
    background: var(--g-accent);
    color: #fff;
    border: none;
    border-radius: 999px;
    padding: 11px 22px;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    cursor: pointer;
    font-family: var(--g-font);
    box-shadow: 0 4px 14px rgba(124, 58, 237, 0.35);
}

/* ── Two-column layout ───────────────────────────────────────────── */
.gh-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    height: calc(100vh - 70px);
    overflow: hidden;
}

.gh-sidebar {
    display: flex;
    flex-direction: column;
    padding: 28px 36px;
    border-right: 1px solid var(--g-border);
    overflow: hidden;
    gap: 0;
}

.gh-preview {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 28px 44px;
    gap: 18px;
    background: var(--g-surface);
    overflow: hidden;
    min-height: 0;
}

.gh-preview-header { flex-shrink: 0; }
.gh-actions { flex-shrink: 0; }

/* ── Left column ─────────────────────────────────────────────────── */
.gh-heading {
    font-size: 32px;
    font-weight: 600;
    letter-spacing: -0.3px;
    color: var(--g-accent);
    margin: 0 0 12px;
    line-height: 1.1;
}

.gh-search-hint {
    font-size: 13px;
    color: var(--g-muted);
    margin: 0 0 12px;
    line-height: 1.5;
}

.gh-search-examples {
    font-size: 12px;
    color: var(--g-muted);
    opacity: 0.75;
    font-style: italic;
}

.gh-search {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--g-surface);
    border-radius: 999px;
    padding: 12px 18px;
    border: 1px solid var(--g-border);
    flex-shrink: 0;
}

.gh-search input {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    color: var(--g-ink);
    font-size: 14px;
    font-family: var(--g-font);
}

.gh-search input::placeholder { color: var(--g-muted); }

/* Category chips */
.gh-chips {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: 16px;
    flex-shrink: 0;
}

.gh-chip {
    padding: 7px 16px;
    border-radius: 999px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    font-family: var(--g-font);
    border: 1px solid var(--g-border2);
    background: transparent;
    color: var(--g-muted);
    transition: all 0.15s;
}

.gh-chip--active {
    background: var(--g-accent);
    color: #fff;
    border-color: var(--g-accent);
}

/* Count bar */
.gh-meta {
    font-size: 1rem;
    color: var(--g-muted);
    margin-top: 16px;
    margin-bottom: 12px;
    flex-shrink: 0;
}

/* Card grid */
.gh-grid {
    flex: 1;
    overflow-y: auto;
    padding-right: 4px;
    padding-bottom: 8px;
}

.gh-grid-inner {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

/* Empty state */
.gh-empty {
    padding: 40px 16px;
    text-align: center;
}

.gh-empty-icon {
    font-size: 36px;
    margin-bottom: 12px;
}

.gh-empty-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--g-ink);
    margin-bottom: 6px;
}

.gh-empty-sub {
    font-size: 13px;
    color: var(--g-muted);
    line-height: 1.5;
}

/* Show-tab placeholder panel */
.gp-tab-ph {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    gap: 10px;
    padding: 24px;
    text-align: center;
    color: var(--p-muted, #888);
}

.gp-tab-ph-icon { font-size: 64px; }

.gp-tab-ph-name {
    font-size: 28px;
    font-weight: 600;
    color: var(--p-ink, #111);
}

.gp-tab-ph-hint {
    font-size: 18px;
    color: var(--p-muted, #888);
}

.gp-tab-ph-link {
    font-size: 13px;
    color: var(--p-accent, #7C3AED);
    text-decoration: none;
    font-weight: 600;
}

.gh-card {
    cursor: pointer;
    border-radius: 18px;
    overflow: hidden;
    background: var(--g-surface);
    border: 2px solid transparent;
    box-shadow: 0 1px 2px rgba(10, 10, 10, 0.08);
    transition: border-color 0.18s, box-shadow 0.18s, transform 0.18s;
}

.gh-card:hover {
    box-shadow: 0 4px 12px rgba(10, 10, 10, 0.12);
    transform: translateY(-1px);
}

.gh-card--selected {
    border-color: var(--g-accent);
    box-shadow: 0 12px 28px rgba(124, 58, 237, 0.30);
}

.gh-card-cover {
    height: 184px;
    width: 100%;
    position: relative;
    overflow: hidden;
    background-size: cover;
    background-position: center;
}

.gh-card-selected-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: var(--g-accent);
    color: #fff;
    font-size: 10px;
    font-weight: 800;
    padding: 4px 9px;
    border-radius: 99px;
    letter-spacing: 0.8px;
}

.gh-card-body {
    padding: 12px 14px 14px;
    background: var(--card-bg, var(--g-surface));
}

.gh-card-eyebrow {
    font-size: 9px;
    letter-spacing: 1.6px;
    text-transform: uppercase;
    color: var(--card-text-muted, var(--g-muted));
    font-weight: 700;
}

.gh-card-title {
    font-size: 15px;
    font-weight: 500;
    color: var(--card-text, var(--g-ink));
    margin-top: 4px;
    letter-spacing: -0.1px;
    line-height: 1.3;
}


/* ── Right column: preview header ────────────────────────────────── */
.gh-preview-header {
    width: 100%;
    text-align: center;
    flex-shrink: 0;
}

.gh-eyebrow {
    font-size: 11px;
    letter-spacing: 2.2px;
    text-transform: uppercase;
    color: var(--g-muted);
    font-weight: 700;
}

.gh-preview-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--g-ink);
    letter-spacing: -0.3px;
}

/* ── Phone frame ─────────────────────────────────────────────────── */
.gh-phone-wrap {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 0;
    width: 100%;
}

/* Receives transform:scale() from JS — no overflow/border-radius so Firefox clips correctly */
/* 360x720 (was 320x640) — same 1:2 aspect, ~12% wider. The extra 40px gives
   iframe-loaded module pages (draw-names, wishlist, etc.) enough horizontal
   room for their `.user-grid` to fall into two columns instead of one
   (grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)) needs ~310px+
   of content area to fit two 140px columns + gap). */
.gh-phone-scaler {
    width: 360px;
    height: 720px;
    flex-shrink: 0;
    transform-origin: center center;
    will-change: transform;
}

.gh-phone {
    width: 360px;
    height: 720px;
    border-radius: 46px;
    position: relative;
    /* No overflow:hidden — the .phone-side-btn elements protrude 2px past
       the device edge to look like physical buttons. Screen content is
       still clipped by .gh-phone-inner's own overflow + border-radius. */
    box-shadow:
        0 32px 64px rgba(40, 30, 20, 0.18),
        0 0 0 1px rgba(0, 0, 0, 0.08),
        inset 0 0 0 4px rgba(0, 0, 0, 0.85);
    background: #000;
}

.gh-phone-inner {
    position: absolute;
    inset: 4px;
    border-radius: 42px;
    overflow: hidden;
    background: var(--p-bg, #fafafa);
    display: flex;
    flex-direction: column;
}

/* Status bar — floats over content like native iOS */
.gh-phone-status {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 24px 0;
    font-size: 13px;
    font-weight: 600;
    color: var(--phone-chrome-color, #fff);
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 10;
    font-family: -apple-system, system-ui, sans-serif;
}

.gh-phone-status-icons {
    display: flex;
    gap: 4px;
    align-items: center;
}

/* Sliding content area */
.gh-phone-slider {
    flex: 1;
    position: relative;
    overflow: hidden;
    margin-top: 0;
    padding-bottom: 80px;
    min-height: 0;
}

.gh-phone-slide-track {
    display: flex;
    width: 200%;
    height: 100%;
    transition: transform 320ms cubic-bezier(0.32, 0.72, 0.24, 1);
}

.gh-phone-pane {
    width: 50%;
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    background: #fff;
    padding: 44px 20px 20px;
    box-sizing: border-box;
}

.gh-phone-pane--iframe {
    padding: 0;
    overflow: hidden;
}

.gh-phone-pane--event {
    padding: 0;
}

.gh-phone-pane--messages {
    padding: 0;
}

.gh-phone-pane--messages .messages-header-title {
    font-size: 0.9rem;
}

.gh-phone-pane--event .event-header-title {
    font-size: 1.4rem;
}

.gh-phone-pane--event .event-header-info {
    bottom: 100px;
}

.gh-blocks-container {
    margin-top: -119px;
    position: relative;
    z-index: 1;
    padding: 1.5rem;
}

.gh-message-blocks-container {
    padding: 20px;
}

.gh-blocks-container .block,
.gh-message-blocks-container .block {
    margin-top: 12px;
    margin-bottom: 12px;
}

/* Hide timing badges and content-card description fields — not meaningful in gallery preview */
.gh-phone .timing-sticker { display: none; }
.gh-phone .content-card-descriptions { display: none; }

/* Scale down web widget iframes — 1/0.7 ≈ 143% compensates so they still fill their container */
.gh-phone .web-widget-iframe {
    transform: scale(0.7);
    transform-origin: top left;
    width: 143%;
    height: 143%;
}

/* Phone tab bar — reuse main.css .tab-btn but override the bar container */
.gh-phone-tabbar {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--p-surface, #fff);
    border-top: 1px solid rgba(10, 10, 10, 0.08);
    padding-top: 8px;
    padding-bottom: 24px;
    display: flex;
    justify-content: space-around;
    align-items: flex-start;
    z-index: 3;
}

/* Override tab-btn for phone context (no border-top indicator, use bottom bar style) */
.gh-phone-tabbar .tab-btn {
    border-top: none;
    padding: 4px 16px;
    gap: 3px;
    color: var(--p-muted, #999);
}

.gh-phone-tabbar .tab-btn svg,
.gh-phone-tabbar .tab-btn img {
    width: 22px;
    height: 22px;
    color: inherit;
}

/* Show-tab icons are loaded as <img> from /static/img/show_tab/. Dim them
   like the editor does (main.css .tab-btn img) so the active tab visually
   pops. <img> doesn't pick up currentColor, so we use opacity for the
   inactive state and a hue-shift filter for the active state to approximate
   --p-accent. */
.gh-phone-tabbar .tab-btn img {
    opacity: 0.5;
    transition: opacity 0.15s;
}
.gh-phone-tabbar .tab-btn.is-active img {
    opacity: 1;
    filter: invert(16%) sepia(90%) saturate(3000%) hue-rotate(260deg) brightness(80%);
}

.gh-phone-tabbar .tab-btn.is-active {
    color: var(--p-accent, #7C3AED);
    border-top-color: transparent;
}

/* Home indicator — reuse existing styles but tweak color */
.gh-phone .phone-home-bar {
    position: absolute;
    bottom: 8px;
    left: 0;
    right: 0;
    display: flex;
    justify-content: center;
    pointer-events: none;
    z-index: 5;
    height: auto;
}

.gh-phone .phone-home-indicator {
    background: var(--p-ink, #000);
    opacity: 0.35;
    width: 110px;
    height: 4px;
    border-radius: 4px;
}

/* ── Phone content — per-template palette via CSS vars ───────────── */
.gp-event, .gp-messages {
    padding: 12px 16px 90px;
    background: var(--p-bg, #fafafa);
    color: var(--p-ink, #111);
    min-height: 100%;
    font-family: "DM Sans", -apple-system, system-ui, sans-serif;
}

.gp-messages { padding-top: 14px; }

/* Hero cover */
.gp-hero {
    border-radius: 20px;
    overflow: hidden;
    margin-top: 8px;
    height: 160px;
    position: relative;
    display: flex;
    align-items: flex-end;
    padding: 12px 14px;
}

.gp-hero-cat {
    font-size: 10px;
    letter-spacing: 2px;
    text-transform: uppercase;
    opacity: 0.8;
    font-weight: 600;
    color: var(--p-ink, #111);
}

/* Title block */
.gp-title {
    font-family: Georgia, serif;
    font-size: 24px;
    font-weight: 600;
    line-height: 1.15;
    letter-spacing: -0.5px;
    color: var(--p-ink, #111);
    margin-top: 14px;
}

.gp-subtitle {
    font-size: 13px;
    color: var(--p-muted, #666);
    margin-top: 4px;
}

/* Stat strip */
.gp-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-top: 14px;
}

.gp-stat {
    background: var(--p-surface, #fff);
    border-radius: 14px;
    padding: 10px 10px 12px;
}

.gp-stat-label {
    font-size: 9px;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--p-muted, #888);
    font-weight: 600;
}

.gp-stat-value {
    font-family: Georgia, serif;
    font-size: 20px;
    font-weight: 600;
    color: var(--p-ink, #111);
    margin-top: 4px;
    line-height: 1;
}

.gp-stat-sub {
    font-size: 10px;
    color: var(--p-muted, #888);
    margin-top: 2px;
}

/* Sections */
.gp-section { margin-top: 16px; }

.gp-section-title {
    font-size: 11px;
    letter-spacing: 1.4px;
    text-transform: uppercase;
    color: var(--p-muted, #888);
    font-weight: 600;
    margin-bottom: 8px;
    padding: 0 4px;
}

.gp-section-body {
    background: var(--p-surface, #fff);
    border-radius: 16px;
    overflow: hidden;
}

/* Location */
.gp-location {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px;
}

.gp-location-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: var(--p-bg, #f0f0f0);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 16px;
}

.gp-location-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--p-ink, #111);
}

.gp-location-hint {
    font-size: 12px;
    color: var(--p-muted, #888);
    margin-top: 2px;
}

/* Agenda */
.gp-agenda-row {
    display: flex;
    gap: 12px;
    padding: 10px 14px;
    border-bottom: 1px solid var(--p-bg, #f0f0f0);
}

.gp-agenda-row--last { border-bottom: none; }

.gp-agenda-time {
    width: 42px;
    font-family: ui-monospace, monospace;
    font-size: 11px;
    color: var(--p-muted, #888);
    padding-top: 2px;
    flex-shrink: 0;
}

.gp-agenda-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--p-ink, #111);
}

.gp-agenda-sub {
    font-size: 11px;
    color: var(--p-muted, #888);
    margin-top: 1px;
}

/* Messages tab */
.gp-live-banner {
    background: var(--p-accent, #7C3AED);
    color: #fff;
    border-radius: 14px;
    padding: 10px 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 12px;
    font-weight: 600;
}

.gp-live-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #fff;
    flex-shrink: 0;
    box-shadow: 0 0 0 4px var(--p-accent, #7C3AED), 0 0 0 6px rgba(255,255,255,0.3);
}

.gp-messages-stream {
    margin-top: 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.gp-msg-row {
    display: flex;
    gap: 10px;
    padding: 6px 2px;
}

.gp-msg-avatar {
    width: 32px;
    height: 32px;
    border-radius: 16px;
    background: var(--p-surface, #fff);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 14px;
}

.gp-msg-header {
    display: flex;
    align-items: baseline;
    gap: 6px;
}

.gp-msg-from {
    font-size: 12px;
    font-weight: 700;
    color: var(--p-ink, #111);
}

.gp-msg-time {
    font-size: 10px;
    color: var(--p-muted, #888);
}

.gp-msg-text {
    font-size: 13px;
    color: var(--p-ink, #111);
    margin-top: 2px;
    line-height: 1.35;
    opacity: 0.9;
}

/* RSVP card */
.gp-rsvp {
    background: var(--p-surface, #fff);
    border-radius: 14px;
    padding: 12px;
}

.gp-rsvp-label {
    font-size: 10px;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--p-muted, #888);
    font-weight: 600;
}

.gp-rsvp-q {
    font-size: 13px;
    font-weight: 600;
    color: var(--p-ink, #111);
    margin-top: 4px;
}

.gp-rsvp-btns {
    display: flex;
    gap: 6px;
    margin-top: 10px;
}

.gp-rsvp-yes, .gp-rsvp-no {
    flex: 1;
    border: none;
    border-radius: 10px;
    padding: 8px 0;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
}

.gp-rsvp-yes {
    background: var(--p-accent, #7C3AED);
    color: #fff;
}

.gp-rsvp-no {
    background: var(--p-bg, #f0f0f0);
    color: var(--p-ink, #111);
    border: 1px solid rgba(0,0,0,0.10);
}

.gp-rsvp-bar-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
}

.gp-rsvp-bar {
    flex: 1;
    height: 4px;
    background: var(--p-bg, #f0f0f0);
    border-radius: 2px;
    overflow: hidden;
}

.gp-rsvp-fill {
    height: 100%;
    background: var(--p-accent, #7C3AED);
    border-radius: 2px;
}

.gp-rsvp-count {
    font-size: 10px;
    color: var(--p-muted, #888);
    font-family: ui-monospace, monospace;
}

/* Shared album tile */
.gp-album-tile {
    margin-top: 14px;
    background: var(--p-surface, #fff);
    border-radius: 16px;
    padding: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.gp-album-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 3px;
    width: 72px;
    height: 48px;
    border-radius: 8px;
    overflow: hidden;
    flex-shrink: 0;
}

.gp-album-cell {
    background: var(--p-accent, #7C3AED);
}

.gp-album-cell:nth-child(even) {
    background: var(--p-muted, #888);
}

.gp-album-info { flex: 1; min-width: 0; }

.gp-album-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--p-ink, #111);
}

.gp-album-sub {
    font-size: 11px;
    color: var(--p-muted, #888);
    margin-top: 1px;
}

.gp-album-icon {
    font-size: 18px;
    flex-shrink: 0;
}

/* ── Action buttons — exactly phone width (320px) ─────────────────── */
.gh-actions {
    display: flex;
    gap: 8px;
    width: 320px;
    flex-shrink: 0;
}

.gh-btn-primary {
    flex: 1;
    background: var(--g-accent);
    color: #fff;
    border: none;
    border-radius: 999px;
    padding: 10px 14px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    cursor: pointer;
    font-family: var(--g-font);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    box-shadow: 0 4px 12px rgba(124, 58, 237, 0.35);
    transition: opacity 0.15s;
}

.gh-btn-primary:hover { opacity: 0.9; }

/* ── Customize toast ─────────────────────────────────────────────── */
.gh-toast {
    position: fixed;
    left: 50%;
    bottom: 100px;
    transform: translateX(-50%);
    background: var(--g-ink);
    color: var(--g-surface);
    border-radius: 999px;
    padding: 12px 18px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 12px 30px rgba(10,10,10,0.40);
    font-size: 13px;
    font-weight: 500;
    z-index: 90;
    white-space: nowrap;
}

.gh-toast[hidden] { display: none; }

.gh-toast-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #fff;
    flex-shrink: 0;
}

.gh-toast-close {
    background: transparent;
    color: var(--g-surface);
    border: none;
    cursor: pointer;
    font-size: 16px;
    padding: 0;
    line-height: 1;
    opacity: 0.7;
}
