/* MotorMe: pages rendered by Cloud Functions (/profile/, /post/) – builds on site.css tokens (Forest & Oak) */

.page-hero {
    padding: clamp(1.5rem, 4vw, 3rem) 0 clamp(1.5rem, 4vw, 2.5rem);
    background:
        radial-gradient(60% 70% at 90% 0%, rgba(230, 199, 154, .45), transparent 70%),
        linear-gradient(180deg, var(--ivory), var(--champagne));
}
.breadcrumb { display: flex; flex-wrap: wrap; gap: .4rem; font-size: .85rem; color: var(--muted); margin-bottom: 1.25rem; }
.breadcrumb a { color: var(--gold-text); text-decoration: none; }
.page-hero .display { margin-bottom: 1rem; }
.page-hero .lead { margin-bottom: 1.5rem; }
.hero-actions { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; }
.btn-light { background: var(--glass-strong); border: 1px solid var(--line); color: var(--ink); }

.section-sm { padding-block: clamp(2.5rem, 6vw, 4rem); }
.section-title { font-family: var(--display); font-weight: 500; font-size: clamp(1.6rem, 3vw, 2.2rem); margin-bottom: .5rem; }
.section-sub { color: var(--muted); margin-bottom: 1.5rem; max-width: 40em; }

/* Style cards (hub) */
.style-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 1rem; }
.style-card {
    position: relative; display: block; aspect-ratio: 4 / 5; border-radius: var(--radius); overflow: hidden;
    text-decoration: none; color: var(--ivory); box-shadow: var(--shadow-sm); background: var(--sand);
}
.style-card img { width: 100%; height: 100%; object-fit: cover; transition: transform 1s; }
.style-card:hover img { transform: scale(1.05); }
.style-card::after { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 45%, rgba(31, 43, 26, .78)); }
.style-card-text { position: absolute; z-index: 1; inset-inline: 1.1rem; bottom: 1rem; }
.style-card-text strong { display: block; font-family: var(--display); font-weight: 500; font-size: 1.45rem; line-height: 1.15; }
.style-card-text small { color: var(--gold-1); font-size: .82rem; letter-spacing: .04em; }

/* Design gallery */
.design-grid { columns: 4 220px; column-gap: 1rem; }
.design-card {
    display: block; break-inside: avoid; margin-bottom: 1rem; border-radius: 20px; overflow: hidden;
    background: #fff; text-decoration: none; color: var(--ink); box-shadow: var(--shadow-sm); transition: transform .3s;
}
.design-card:hover { transform: translateY(-3px); }
.design-card img { width: 100%; height: auto; display: block; background: var(--sand); }
.design-meta { display: flex; align-items: center; gap: .55rem; padding: .7rem .8rem; }
.design-meta img { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; flex: none; }
.design-meta span { font-size: .85rem; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.design-meta .ai-badge {
    margin-inline-start: auto; flex: none; font-size: .7rem; font-weight: 600; padding: .15rem .5rem; border-radius: 999px;
    background: linear-gradient(135deg, var(--gold-1), var(--gold-2)); color: var(--espresso);
}

/* Chips */
.chips { display: flex; flex-wrap: wrap; gap: .5rem; }
.chip {
    padding: .5rem 1rem; border-radius: 999px; background: #fff; border: 1px solid var(--line);
    text-decoration: none; color: var(--ink); font-size: .92rem; font-weight: 500; transition: border-color .2s;
}
.chip:hover { border-color: var(--gold-2); }

/* Text blocks */
.prose { max-width: 46em; color: var(--muted); font-size: 1.05rem; }
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 1rem; }
.info-card { padding: 1.4rem; border-radius: var(--radius); background: var(--glass-strong); border: 1px solid rgba(255, 255, 255, .9); box-shadow: var(--shadow-sm); }
.info-card h3 { font-family: var(--display); font-weight: 500; font-size: 1.2rem; margin-bottom: .4rem; }
.info-card p { color: var(--muted); font-size: .95rem; }

/* Dark CTA band */
.cta-band {
    display: grid; grid-template-columns: 1.2fr .8fr; gap: 2rem; align-items: center;
    padding: clamp(1.75rem, 4vw, 3rem); border-radius: 32px; color: var(--ivory);
    background: radial-gradient(60% 80% at 90% 0%, rgba(183, 131, 74, .3), transparent 70%), var(--espresso);
}
.cta-band .kicker { color: var(--gold-1); }
.cta-band h2 { font-family: var(--display); font-weight: 500; font-size: clamp(1.7rem, 3.4vw, 2.4rem); line-height: 1.15; margin-bottom: .75rem; }
.cta-band p { color: rgba(247, 246, 238, .75); }
.cta-band .store-badges { margin: 1.25rem 0 0; }
.cta-band img { border-radius: 24px; aspect-ratio: 1; object-fit: cover; width: 100%; }

/* Studios: list panel + large map (studios.js) */
.page-hero.compact { padding-top: 1.1rem; padding-bottom: 1rem; }
.page-hero.compact .display { font-size: clamp(2rem, 4.2vw, 3.2rem); margin-bottom: .5rem; }
.page-hero.compact .lead { margin-bottom: 0; font-size: 1rem; max-width: 46rem; }
.wrap-wide { width: min(1600px, 100% - 2.5rem); margin-inline: auto; }
.studio-app {
    display: grid; grid-template-columns: minmax(340px, 420px) 1fr; gap: 1rem; margin-top: 1rem; margin-bottom: 2rem;
    height: clamp(600px, calc(100vh - 92px), 1500px);
}
.studio-panel {
    position: relative; overflow-y: auto; overscroll-behavior: contain; border-radius: var(--radius); background: #fff;
    border: 1px solid var(--line); box-shadow: var(--shadow-sm); scrollbar-width: thin;
}
.studio-tools { position: sticky; top: 0; z-index: 3; padding: 1rem 1rem .5rem; background: rgba(255, 255, 255, .96); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.studio-toolbar { display: flex; gap: .5rem; align-items: center; margin-bottom: .7rem; }
.studio-toolbar input {
    flex: 1; min-width: 0; height: 44px; padding: 0 1rem; border-radius: 999px; border: 1px solid var(--line);
    background: #fff; font: 1rem var(--text); color: var(--ink); outline: none;
}
.studio-toolbar input:focus { border-color: var(--gold-2); }
.studio-toolbar .btn { white-space: nowrap; }
.studio-filters { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .55rem; }
.chip-toggle { position: relative; cursor: pointer; user-select: none; }
.chip-toggle input { position: absolute; opacity: 0; pointer-events: none; }
.chip-toggle span { display: inline-flex; align-items: center; gap: .35rem; padding: .32rem .8rem; border-radius: 999px; border: 1px solid var(--line); font-size: .84rem; color: var(--ink); background: #fff; transition: background .15s, border-color .15s; }
.chip-toggle.demo span { border-style: dashed; border-color: var(--gold-2); }
.chip-toggle input:checked + span { background: var(--espresso); border-color: var(--espresso); color: var(--ivory); }
.chip-toggle input:checked + span::before { content: '✓'; font-size: .75rem; }
.chip-toggle input:focus-visible + span { outline: 2px solid var(--gold-2); outline-offset: 2px; }
.studio-count { color: var(--muted); font-size: .85rem; margin: 0; }
.studio-list { display: grid; gap: .6rem; padding: .75rem; }
.studio-item {
    display: grid; grid-template-columns: 64px 1fr; gap: .85rem; align-items: center; padding: .7rem; border-radius: 18px;
    background: #fff; border: 1px solid var(--line); transition: border-color .2s, box-shadow .2s, background .2s; cursor: pointer;
}
.studio-item:hover { border-color: var(--gold-2); }
.studio-item.active { border-color: var(--espresso); box-shadow: 0 0 0 2px var(--gold-2); background: var(--ivory); }
.studio-item > img { width: 64px; height: 64px; border-radius: 16px; object-fit: cover; background: var(--sand); }
.studio-item h3 { font-family: var(--display); font-weight: 500; font-size: 1.08rem; line-height: 1.2; }
.studio-item p { color: var(--muted); font-size: .82rem; }
.studio-actions { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .45rem; }
.studio-actions a, .studio-actions button { font: 500 .82rem var(--text); text-decoration: none; padding: .32rem .8rem; border-radius: 999px; cursor: pointer; background: none; }
.studio-actions .book { background: linear-gradient(135deg, var(--gold-1), var(--gold-2)); color: var(--espresso); }
.studio-actions .profile, .studio-actions .route, .studio-actions .share { border: 1px solid var(--line); color: var(--ink); }
.distance { display: inline-block; margin-inline-start: .35rem; padding: .05rem .5rem; border-radius: 999px; background: var(--espresso); color: var(--ivory); font-size: .72rem; }
.studio-empty { padding: 1.5rem 1rem; text-align: center; color: var(--muted); }
.demo-note { padding: 0 1rem 1rem; color: var(--muted); font-size: .78rem; }
.studio-mapwrap { position: relative; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); background: var(--champagne); }
.studio-map { width: 100%; height: 100%; }

/* Profile preview over the start side of the map (studios.js): header + profile page in an iframe */
.studio-preview {
    position: absolute; z-index: 5; inset-block: 0; inset-inline-start: 0; width: clamp(340px, 36%, 480px); max-width: 100%;
    display: flex; flex-direction: column; background: #fff; box-shadow: 0 0 40px -10px rgba(0, 0, 0, .45); animation: studio-preview-in .25s ease-out;
}
.studio-preview[hidden] { display: none; }
.preview-head { display: flex; align-items: center; gap: .5rem; padding: .6rem .7rem; padding-inline-start: 1rem; border-bottom: 1px solid var(--line); flex: none; }
.preview-head strong { flex: 1; min-width: 0; font-family: var(--display); font-weight: 500; font-size: 1rem; line-height: 1.2; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.preview-btn { flex: none; font: 500 .8rem var(--text); text-decoration: none; padding: .32rem .75rem; border-radius: 999px; border: 1px solid var(--line); color: var(--ink); background: none; cursor: pointer; white-space: nowrap; }
.preview-btn.dark { background: var(--espresso); border-color: var(--espresso); color: var(--ivory); }
.preview-close { flex: none; width: 34px; height: 34px; border-radius: 50%; border: 0; background: var(--ivory); color: var(--ink); font-size: 1.25rem; line-height: 1; cursor: pointer; }
.studio-preview iframe { flex: 1; width: 100%; min-height: 0; border: 0; background: var(--ivory); transition: opacity .2s; }
.studio-preview.loading iframe { opacity: 0; }
.preview-fallback { padding: 1.2rem 1rem; overflow-y: auto; }
.preview-fallback h3 { font-family: var(--display); font-weight: 500; font-size: 1.3rem; }
.preview-fallback p { color: var(--muted); font-size: .9rem; }
.studio-preview.loading::after { content: ''; position: absolute; top: 50%; left: 50%; width: 34px; height: 34px; margin: -17px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--gold-2); animation: studio-preview-spin .8s linear infinite; }
@keyframes studio-preview-in { from { opacity: 0; transform: translateX(-24px); } to { opacity: 1; transform: none; } }
@keyframes studio-preview-spin { to { transform: rotate(360deg); } }
[dir="rtl"] .studio-preview { animation-name: studio-preview-in-rtl; }
@keyframes studio-preview-in-rtl { from { opacity: 0; transform: translateX(24px); } to { opacity: 1; transform: none; } }
@keyframes studio-preview-up { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }

/* Pin groups (studios.js clusters pins closer than ~50 px) */
.nm-cluster { min-width: 46px; height: 46px; padding: 0 .6rem; border-radius: 999px; border: 3px solid #fff; background: var(--espresso); color: var(--ivory); font: 600 1rem var(--text); box-shadow: 0 6px 16px -6px rgba(0, 0, 0, .55); cursor: pointer; transition: transform .15s; }
.nm-cluster:hover { transform: scale(1.08); }
.nm-pin:hover { transform: scale(1.1); }

/* Example studios (static showcase data) */
.demo-switch { display: flex; gap: .7rem; align-items: flex-start; margin: 0 0 1rem; padding: .85rem 1rem; border-radius: 16px; background: #fff; border: 1.5px dashed var(--gold-2); cursor: pointer; }
.demo-switch input { margin-top: .25rem; width: 18px; height: 18px; accent-color: var(--espresso); flex: none; }
.demo-switch strong { display: block; font-weight: 500; }
.demo-switch small { color: var(--muted); font-size: .82rem; }
.studio-item.demo { border-style: dashed; border-color: var(--gold-2); }
.example-badge { display: inline-block; margin-inline-start: .4rem; padding: .05rem .5rem; border-radius: 999px; border: 1px solid var(--gold-2); color: var(--gold-text); font-family: var(--text); font-size: .68rem; letter-spacing: .08em; text-transform: uppercase; vertical-align: middle; }
.nm-pin.demo { border-style: dashed; }

/* Map pins in the MotorMe style (MapLibre markers) */
.nm-pin { width: 46px; height: 46px; padding: 0; border-radius: 50%; border: 3px solid #B7834A; background: #1F2B1A center/cover no-repeat; box-shadow: 0 6px 16px -6px rgba(31, 43, 26, .6); cursor: pointer; transition: transform .2s, border-color .2s; }
.nm-pin.active { transform: scale(1.32); z-index: 3; box-shadow: 0 0 0 4px #fff, 0 0 0 7px var(--espresso), 0 10px 22px -6px rgba(0, 0, 0, .55); }
.nm-me { width: 18px; height: 18px; border-radius: 50%; background: #B7834A; border: 3px solid #fff; box-shadow: 0 0 0 6px rgba(183, 131, 74, .3); }
.maplibregl-popup-content { border-radius: 16px; padding: .8rem 1rem; font-family: var(--text); box-shadow: var(--shadow); }
.maplibregl-popup-content strong { font-family: var(--display); font-weight: 500; font-size: 1.05rem; }
.maplibregl-popup-content a { color: var(--gold-text); }
.distance[hidden] { display: none; }

.city-links { columns: 7 130px; column-gap: 1.25rem; font-size: .9rem; }
section:has(> .city-links) { padding-bottom: 1.75rem; }
section:has(> .city-links) .section-title { font-size: 1.25rem; margin-bottom: .6rem; }
.city-links a { display: block; padding: .14rem 0; color: var(--ink); text-decoration: none; }
.city-links a:hover { color: var(--gold-text); }

/* Profile */
.profile-hero { position: relative; padding-bottom: 1rem; background: linear-gradient(180deg, var(--champagne), var(--ivory)); }
.profile-cover { position: absolute; inset: 0 0 auto 0; height: 300px; overflow: hidden; }
.profile-cover img { width: 100%; height: 100%; object-fit: cover; filter: saturate(.9); }
.profile-cover::after { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(247, 246, 238, .2), var(--champagne) 96%); }
.profile-hero .wrap { position: relative; padding-top: 1.5rem; }
.profile-hero .breadcrumb { display: inline-flex; padding: .35rem .9rem; border-radius: 999px; background: var(--glass-strong); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); color: var(--ink); }
.profile-card {
    display: grid; grid-template-columns: auto 1fr; gap: 1.5rem; align-items: start; margin-top: 140px;
    padding: 1.75rem; border-radius: 28px; background: var(--glass-strong); border: 1px solid rgba(255, 255, 255, .9);
    backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); box-shadow: var(--shadow);
}
.profile-avatar { width: 112px; height: 112px; border-radius: 50%; object-fit: cover; box-shadow: 0 0 0 4px var(--gold-1); }
.profile-info .kicker { margin-bottom: .3rem; }
.profile-sub { color: var(--muted); font-size: .95rem; margin-top: .2rem; }
.profile-stats { display: flex; gap: 1.5rem; margin: 1rem 0; }
.profile-stats span { color: var(--muted); font-size: .85rem; }
.profile-stats strong { display: block; color: var(--ink); font-family: var(--display); font-size: 1.4rem; font-weight: 500; }
.profile-bio { margin: .75rem 0 1rem; max-width: 42em; }

/* Service price list */
.service-columns { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1rem 2rem; }
.service-group { padding: 1.25rem 1.4rem; border-radius: var(--radius); background: #fff; border: 1px solid var(--line); }
.service-group h3 { font-size: .78rem; letter-spacing: .18em; text-transform: uppercase; color: var(--gold-text); font-weight: 500; margin-bottom: .5rem; }
.service-row { display: flex; justify-content: space-between; gap: 1rem; padding: .7rem 0; border-bottom: 1px solid var(--line); }
.service-row:last-child { border-bottom: 0; }
.service-row strong { display: block; font-weight: 500; }
.service-row small { color: var(--muted); font-size: .82rem; }
.service-row > span { font-family: var(--display); font-size: 1.15rem; white-space: nowrap; }

/* Post detail */
.post-layout { display: grid; grid-template-columns: 1.15fr .85fr; gap: clamp(1.5rem, 4vw, 3rem); align-items: start; }
.post-media { display: grid; gap: .75rem; }
.post-media img { width: 100%; border-radius: var(--radius); box-shadow: var(--shadow); background: var(--sand); }
.post-thumbs { display: grid; grid-template-columns: repeat(4, 1fr); gap: .5rem; }
.post-thumbs img { aspect-ratio: 1; object-fit: cover; border-radius: 14px; box-shadow: none; }
.post-info { position: sticky; top: 100px; }
.author-card { display: flex; align-items: center; gap: .9rem; padding: 1rem; border-radius: 22px; background: var(--glass-strong); border: 1px solid rgba(255, 255, 255, .9); box-shadow: var(--shadow-sm); text-decoration: none; color: var(--ink); }
.author-card img { width: 54px; height: 54px; border-radius: 50%; object-fit: cover; box-shadow: 0 0 0 3px var(--gold-1); }
.author-card strong { display: block; font-family: var(--display); font-weight: 500; font-size: 1.2rem; }
.author-card small { color: var(--muted); }
.post-text { margin: 1.5rem 0; white-space: pre-line; font-size: 1.05rem; }
.post-info .chips { margin-bottom: 1.5rem; }
.ai-note { display: inline-block; margin-bottom: 1rem; padding: .2rem .7rem; border-radius: 999px; font-size: .78rem; font-weight: 600; background: linear-gradient(135deg, var(--gold-1), var(--gold-2)); color: var(--espresso); }

@media (max-width: 900px) {
    .studio-app { grid-template-columns: 1fr; height: auto; margin-top: .75rem; }
    .studio-mapwrap { order: -1; height: 60vh; min-height: 360px; }
    .studio-panel { display: contents; }
    .studio-tools { position: static; order: -2; padding: 0 0 .25rem; background: none; backdrop-filter: none; border: 0; }
    .studio-list { padding: 0; }
    .studio-empty, .demo-note { padding-inline: 0; }
    .studio-preview { position: fixed; z-index: 1000; inset: auto 0 0 0; width: auto; height: 88vh; height: 88dvh; border-radius: 22px 22px 0 0; overflow: hidden; box-shadow: 0 0 0 100vmax rgba(0, 0, 0, .4); animation-name: studio-preview-up; }
    [dir="rtl"] .studio-preview { animation-name: studio-preview-up; }
    html.studio-preview-open { overflow: hidden; }
    .cta-band { grid-template-columns: 1fr; }
    .cta-band img { display: none; }
    .post-layout { grid-template-columns: 1fr; }
    .post-info { position: static; }
}
@media (max-width: 560px) {
    .design-grid { columns: 2 140px; column-gap: .6rem; }
    .design-card { margin-bottom: .6rem; border-radius: 16px; }
    .design-meta { padding: .5rem .55rem; }
    .design-meta img { width: 22px; height: 22px; }
    .style-grid { grid-template-columns: 1fr 1fr; gap: .6rem; }
    .style-card-text strong { font-size: 1.15rem; }
    .profile-cover { height: 220px; }
    .profile-card { grid-template-columns: 1fr; margin-top: 90px; padding: 1.25rem; gap: 1rem; }
    .profile-avatar { width: 88px; height: 88px; margin-top: -60px; }
    .service-columns { grid-template-columns: 1fr; }
}

/* the hidden attribute always wins over component display rules */
[hidden] { display: none !important; }
