/* BlogSpace main site: landing, Studio and the info pages.
   A space's own page is styled by space.css, driven by its owner's theme. */

:root {
    --ink: #1d2130;
    --muted: #646b80;
    --line: #e3e6ef;
    --paper: #ffffff;
    --page: #f5f6fb;
    --brand: #6c4cf1;
    --brand-dark: #5638d8;
    --brand2: #19b8d6;
    --danger: #d43c4f;
    --ok: #1c9a5e;
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
    font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
    color: var(--ink);
    background: var(--page);
    line-height: 1.55;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

main { flex: 1 0 auto; }

a { color: var(--brand); }

h1, h2, h3 { font-family: 'Poppins', 'Inter', sans-serif; line-height: 1.2; margin: 0 0 .5em; }

/* ── Logo ── */
.bs-logo { display: inline-flex; align-items: center; gap: 7px; color: inherit; }
.bs-logo-word { font-family: 'Poppins', 'Inter', sans-serif; font-weight: 600; font-size: 1.2rem; letter-spacing: -.01em; }
.bs-logo-word b { font-weight: 800; background: linear-gradient(90deg, #8b6cff, #19b8d6); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* ── Top bar and footer ── */
.site-bar { background: var(--paper); border-bottom: 1px solid var(--line); }
.site-bar-in { max-width: 1180px; margin: 0 auto; padding: 10px 20px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.site-brand { color: var(--ink); text-decoration: none; }
.site-nav { display: flex; align-items: center; gap: 18px; font-weight: 600; font-size: .95rem; }
.site-nav a { text-decoration: none; color: var(--ink); }
.site-nav a.btn { color: #fff; }

.site-foot { text-align: center; color: var(--muted); font-size: .85rem; padding: 22px 16px; border-top: 1px solid var(--line); background: var(--paper); }
.site-foot a { color: var(--muted); }
.site-foot .dot { margin: 0 4px; }

/* ── Buttons and fields ── */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    background: var(--brand); color: #fff; border: 0; border-radius: 10px;
    padding: 11px 20px; font: inherit; font-weight: 700; cursor: pointer; text-decoration: none;
    transition: background .15s ease, transform .05s ease;
}
.btn:hover { background: var(--brand-dark); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: default; }
.btn-small { padding: 7px 14px; font-size: .9rem; border-radius: 8px; }
.btn-ghost { background: transparent; color: var(--brand); box-shadow: inset 0 0 0 1.5px var(--brand); }
.btn-ghost:hover { background: rgba(108, 76, 241, .08); }
.btn-danger { background: transparent; color: var(--danger); box-shadow: inset 0 0 0 1.5px var(--danger); }
.btn-danger:hover { background: rgba(212, 60, 79, .08); }

label { display: block; font-weight: 600; font-size: .88rem; margin: 0 0 5px; }
.hint { color: var(--muted); font-size: .82rem; font-weight: 400; }

input[type=text], input[type=email], input[type=url], textarea, select {
    width: 100%; font: inherit; color: var(--ink); background: #fff;
    border: 1.5px solid var(--line); border-radius: 9px; padding: 9px 11px;
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(108, 76, 241, .15); }
textarea { resize: vertical; min-height: 90px; }
.field { margin-bottom: 14px; }

.msg { font-size: .88rem; font-weight: 600; min-height: 1.3em; margin-top: 6px; }
.msg.ok { color: var(--ok); }
.msg.bad { color: var(--danger); }

/* ── Landing ── */
.hero {
    background: radial-gradient(1200px 500px at 15% -10%, rgba(139, 108, 255, .55), transparent 60%),
                radial-gradient(900px 500px at 95% 10%, rgba(25, 184, 214, .45), transparent 60%),
                #15172b;
    color: #fff;
    padding: 68px 20px 76px;
    text-align: center;
}
.hero h1 { font-size: clamp(2rem, 5.2vw, 3.4rem); font-weight: 800; max-width: 820px; margin: 0 auto 14px; letter-spacing: -.02em; }
.hero p.lead { font-size: clamp(1rem, 2.2vw, 1.2rem); max-width: 620px; margin: 0 auto 30px; color: rgba(255, 255, 255, .82); }

.claim { max-width: 560px; margin: 0 auto; }
.claim-row { display: flex; background: #fff; border-radius: 14px; padding: 6px; box-shadow: 0 14px 40px rgba(0, 0, 0, .35); }
.claim-prefix { align-self: center; padding: 0 2px 0 12px; color: var(--muted); font-weight: 600; white-space: nowrap; font-size: .95rem; }
.claim-row input[type=text] { border: 0; box-shadow: none; padding: 10px 6px; font-weight: 700; min-width: 0; flex: 1; }
.claim-row input[type=text]:focus { box-shadow: none; }
.claim .msg { color: rgba(255, 255, 255, .9); text-align: left; padding-left: 14px; }
.claim .msg.ok { color: #7df0b4; }
.claim .msg.bad { color: #ffb1ba; }
.hero-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.hero .btn-ghost { color: #fff; box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, .7); }
.hero .btn-ghost:hover { background: rgba(255, 255, 255, .12); }

.section { max-width: 1180px; margin: 0 auto; padding: 46px 20px; }
.section > h2 { font-size: 1.5rem; margin-bottom: 20px; }

.features { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.feature { background: var(--paper); border: 1px solid var(--line); border-radius: 16px; padding: 22px; }
.feature .ico { font-size: 1.7rem; }
.feature h3 { font-size: 1.08rem; margin: 10px 0 6px; }
.feature p { margin: 0; color: var(--muted); font-size: .95rem; }

.space-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 18px; }
.space-tile { display: block; text-decoration: none; color: inherit; border-radius: 16px; overflow: hidden; background: var(--paper); border: 1px solid var(--line); transition: transform .15s ease, box-shadow .15s ease; }
.space-tile:hover { transform: translateY(-3px); box-shadow: 0 12px 28px rgba(20, 24, 50, .14); }
.space-tile-banner { height: 70px; background-size: cover; background-position: center; }
.space-tile-body { padding: 0 16px 16px; }
.space-tile-avatar { width: 56px; height: 56px; border-radius: 50%; border: 3px solid #fff; margin-top: -28px; background: var(--brand); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 1.4rem; object-fit: cover; }
.space-tile h3 { font-size: 1.02rem; margin: 8px 0 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.space-tile p { margin: 0; color: var(--muted); font-size: .86rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.space-tile .addr { font-size: .78rem; color: var(--brand); font-weight: 600; margin-top: 6px; }

.empty { color: var(--muted); background: var(--paper); border: 1px dashed var(--line); border-radius: 14px; padding: 26px; text-align: center; }

/* ── Plain content pages ── */
.page { max-width: 760px; margin: 0 auto; padding: 40px 20px 60px; }
.page h1 { font-size: 2rem; }
.page h2 { font-size: 1.2rem; margin-top: 1.6em; }
.panel { background: var(--paper); border: 1px solid var(--line); border-radius: 16px; padding: 24px; }

/* ── Studio ── */
.studio { max-width: 1280px; margin: 0 auto; padding: 22px 20px 50px; display: grid; grid-template-columns: 400px 1fr; gap: 22px; align-items: start; }
.studio-side { min-width: 0; }
.studio-head { margin-bottom: 14px; }
.studio-head h1 { font-size: 1.45rem; margin: 0 0 2px; }
.studio-addr { font-weight: 700; text-decoration: none; word-break: break-all; }

.tabs { display: flex; gap: 4px; background: #e9ebf4; border-radius: 12px; padding: 4px; margin-bottom: 14px; }
.tab { flex: 1; border: 0; background: transparent; font: inherit; font-weight: 700; font-size: .9rem; color: var(--muted); padding: 8px 4px; border-radius: 9px; cursor: pointer; }
.tab.on { background: var(--paper); color: var(--ink); box-shadow: 0 1px 4px rgba(0, 0, 0, .1); }
.tabpane { display: none; }
.tabpane.on { display: block; }

.preset-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.preset { border: 0; cursor: pointer; border-radius: 999px; padding: 7px 14px; font: inherit; font-weight: 700; font-size: .85rem; box-shadow: 0 0 0 1.5px rgba(0, 0, 0, .12); }
.preset:hover { box-shadow: 0 0 0 2.5px var(--brand); }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.color-field { display: flex; align-items: center; gap: 9px; border: 1.5px solid var(--line); border-radius: 9px; padding: 5px 9px; background: #fff; }
.color-field input[type=color] { width: 30px; height: 30px; padding: 0; border: 0; background: none; cursor: pointer; flex: none; }
.color-field span { font-size: .85rem; font-weight: 600; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: .88rem; margin: 0; }
.check input { width: 17px; height: 17px; }
input[type=range] { width: 100%; accent-color: var(--brand); }

.pic-row { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.pic-thumb { flex: none; background: #e9ebf4 center/cover no-repeat; border: 1px solid var(--line); }
.pic-thumb.avatar { width: 72px; height: 72px; border-radius: 50%; }
.pic-thumb.banner { width: 132px; height: 48px; border-radius: 9px; }
.pic-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.pic-thumb.avatar { background-color: #fff; }
.pick-row { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 6px; }
.pick { width: 58px; height: 58px; padding: 0; border: 0; border-radius: 50%; background: #fff; cursor: pointer; box-shadow: 0 0 0 1.5px var(--line); overflow: hidden; transition: transform .12s ease, box-shadow .12s ease; }
.pick:hover { transform: scale(1.08); box-shadow: 0 0 0 2.5px var(--brand); }
.pick.on { box-shadow: 0 0 0 3px var(--brand); }
.pick img { width: 100%; height: 100%; display: block; }
.save-row { display: flex; align-items: center; gap: 12px; margin-top: 6px; }

.studio-preview { position: sticky; top: 14px; }
.preview-frame { width: 100%; height: calc(100vh - 110px); min-height: 520px; border: 1px solid var(--line); border-radius: 16px; background: #fff; box-shadow: 0 10px 34px rgba(20, 24, 50, .12); }
.preview-label { display: flex; justify-content: space-between; align-items: center; font-size: .82rem; color: var(--muted); font-weight: 600; margin-bottom: 6px; }

.btn.is-saved, .btn.is-saved:hover { background: var(--ok); }
.studio-toast {
    position: fixed; left: 50%; bottom: 28px; z-index: 50;
    transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
    background: var(--ok); color: #fff; font-weight: 800; font-size: 1.05rem;
    padding: 12px 26px; border-radius: 999px; box-shadow: 0 10px 30px rgba(0, 0, 0, .28);
    transition: transform .22s ease, opacity .22s ease;
}
.studio-toast.show { transform: translate(-50%, 0); opacity: 1; }

.danger-zone { border-top: 1px solid var(--line); margin-top: 22px; padding-top: 18px; }

/* ── Create (claim a name) ── */
.create { max-width: 560px; margin: 0 auto; padding: 50px 20px 70px; }
.create .claim-row { box-shadow: none; border: 1.5px solid var(--line); }
.create .claim .msg { color: var(--muted); }
.create .claim .msg.ok { color: var(--ok); }
.create .claim .msg.bad { color: var(--danger); }

@media (max-width: 900px) {
    .features { grid-template-columns: 1fr; }
    .studio { grid-template-columns: 1fr; }
    .studio-preview { position: static; }
    .preview-frame { height: 560px; }
}

@media (max-width: 520px) {
    .site-nav { gap: 12px; font-size: .88rem; }
    .hero { padding: 44px 16px 52px; }
    .claim-prefix { font-size: .78rem; padding-left: 8px; }
    .claim-row .btn { padding: 10px 12px; font-size: .9rem; }
    .grid2 { grid-template-columns: 1fr; }
}
