/* BulletinBook Studio. Colours, corners and fonts come from Studio's look (Theme/StudioTheme.cs) as CSS variables
   (--background, --primary, --radius…), so a theme changes everything at once. Phone width first. */

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

html, body {
    margin: 0;
    min-height: 100%;
    background: var(--background);
    color: var(--foreground);
    font: 15px/1.5 var(--font-sans);
    -webkit-text-size-adjust: 100%;
}

h1, h2, .brand, .site-name { font-family: var(--font-heading); }
h1 { font-size: 24px; line-height: 1.25; margin: 0 0 4px; }
h2 { font-size: 17px; margin: 0 0 6px; }
p { margin: 0 0 8px; }
p:last-child { margin-bottom: 0; }
a { color: inherit; }

.quiet { color: var(--muted-foreground); }
.small { font-size: 13px; }
.problem { color: var(--destructive); }
.stack > * + * { margin-top: 14px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spread { justify-content: space-between; }
.grow { flex: 1; }
.narrow { max-width: 440px; margin: 0 auto; }
.readable { max-width: 720px; }

/* Controls. 16px text in fields stops iPhones zooming in when one is tapped. */
label { display: block; }
input {
    display: block; width: 100%; margin-top: 4px; padding: 9px 11px;
    font: inherit; font-size: 16px; color: var(--foreground);
    background: var(--background); border: 1px solid var(--input); border-radius: var(--radius-sm);
}
/* Headings take the focus after moving between pages (for screen readers), without a ring. */
h1:focus { outline: none; }
input:focus-visible, button:focus-visible, a:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }

button {
    font: inherit; color: var(--foreground); cursor: pointer;
    background: var(--muted); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 8px 14px; display: inline-flex; align-items: center; gap: 6px; justify-content: center;
}
button:disabled { cursor: default; opacity: 0.45; }
button.primary { background: var(--primary); color: var(--primary-foreground); border-color: transparent; font-weight: 600; }
button.link { background: none; border: none; padding: 4px 0; text-decoration: underline; color: var(--muted-foreground); }
.icon-button { background: none; border-color: transparent; padding: 6px; }
.icon { flex: none; }

.card {
    display: block; width: 100%; text-align: left;
    background: var(--card); color: var(--card-foreground);
    border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 16px;
}
.chip {
    display: inline-block; font-size: 12px; padding: 1px 9px; white-space: nowrap;
    background: var(--muted); border: 1px solid var(--border); border-radius: 999px; color: var(--foreground);
}

/* The bar along the top of every screen. */
.bar {
    position: sticky; top: 0; z-index: 10;
    display: flex; align-items: center; gap: 10px; padding: 10px 16px;
    background: var(--background); border-bottom: 1px solid var(--border);
}
.brand { font-weight: 600; font-size: 16px; flex: 1; }
.site-name { font-weight: 600; font-size: 17px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }

/* The account menu. */
.account { position: relative; }
.avatar {
    width: 34px; height: 34px; padding: 0; border-radius: 50%;
    background: var(--primary); color: var(--primary-foreground); border: none; font-weight: 600;
}
.shade { position: fixed; inset: 0; z-index: 20; }
.menu {
    position: absolute; right: 0; top: calc(100% + 6px); z-index: 21; width: min(300px, calc(100vw - 24px));
    max-height: calc(100vh - 80px); overflow: auto;
    background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 6px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}
.menu > button, .looks > button {
    display: flex; width: 100%; justify-content: flex-start; background: none; border: none; text-align: left; padding: 9px 10px;
}
.menu > button:hover, .looks > button:hover, .looks > button.chosen { background: var(--accent); color: var(--accent-foreground); }
.menu-who { padding: 6px 10px 8px; margin: 0; overflow: hidden; text-overflow: ellipsis; }
.menu hr { border: none; border-top: 1px solid var(--border); margin: 4px 0; }
.looks { padding: 0 0 6px 10px; }
.swatch { width: 28px; height: 18px; border-radius: 4px; border: 1px solid var(--border); display: inline-flex; align-items: center; justify-content: center; }
.swatch span { width: 10px; height: 10px; border-radius: 50%; }

/* The Launcher. */
.launcher-body { padding: 24px 16px 40px; max-width: 1100px; margin: 0 auto; }
.heading-row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; justify-content: space-between; margin-bottom: 16px; }
.find { max-width: 260px; margin: 0; }
.cards { display: grid; gap: 12px; grid-template-columns: 1fr; }
.site-card { display: flex; gap: 12px; align-items: flex-start; justify-content: flex-start; }
.site-card:hover { border-color: var(--primary); }
.monogram {
    width: 40px; height: 40px; flex: none; border-radius: var(--radius);
    background: var(--background); color: var(--primary);
    display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 18px;
}
.site-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.site-text > * { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.site-text .chip { align-self: flex-start; margin-top: 6px; }
.dialog-shade { position: fixed; inset: 0; z-index: 30; background: rgba(0, 0, 0, 0.6); display: flex; align-items: center; justify-content: center; padding: 16px; }
.dialog { width: 100%; max-width: 460px; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 20px; }

@media (min-width: 600px) {
    .cards { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
}

/* A site's window: sections along the bottom on a phone, down the left on wider screens. */
.site { min-height: 100vh; }
.preview-width { display: none; }
.panel { padding: 20px 16px 96px; }
.sections {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
    display: grid; grid-template-columns: repeat(6, 1fr);
    background: var(--sidebar); border-top: 1px solid var(--sidebar-border);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
}
.sections a {
    display: flex; align-items: center; justify-content: center; gap: 10px; padding: 10px 6px;
    text-decoration: none; color: var(--sidebar-foreground); border-radius: var(--radius);
}
.sections a span { display: none; }
.sections a.chosen { background: var(--sidebar-accent); color: var(--sidebar-accent-foreground); font-weight: 600; }

@media (min-width: 720px) {
    .site { display: grid; grid-template-columns: 180px 1fr; grid-template-rows: auto 1fr; }
    .site > .bar { grid-column: 1 / -1; }
    .preview-width { display: inline-flex; gap: 2px; }
    .sections {
        position: static; display: flex; flex-direction: column; gap: 2px; padding: 8px;
        border-top: none; border-right: 1px solid var(--sidebar-border);
    }
    .sections a { justify-content: flex-start; padding: 8px 10px; }
    .sections a span { display: inline; }
    .panel { padding: 20px 24px 40px; }
}

/* Notes and the draft. */
.note-bar { display: flex; gap: 12px; align-items: center; justify-content: space-between; padding: 10px 14px; margin-bottom: 14px;
            background: var(--accent); color: var(--accent-foreground); border-radius: var(--radius); }
.problem-card { margin-bottom: 14px; border-color: var(--destructive); }
.draft-chip { background: var(--primary); color: var(--primary-foreground); border-color: transparent; font-weight: 600; }

/* Pages: cards in groups. */
.pages { max-width: 860px; }
.pages-head { display: flex; gap: 12px; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; margin-bottom: 16px; }
.page-group { margin: 0 0 22px; padding: 4px; border-radius: var(--radius-lg); border: 1px dashed transparent; }
.group-title { font-size: 14px; text-transform: uppercase; letter-spacing: 0.04em; margin: 4px 4px 8px; display: flex; gap: 10px; align-items: baseline; }
.group-title .quiet { text-transform: none; letter-spacing: 0; font-weight: 400; }
.empty-group { margin: 0 4px 6px; }
.page-card { padding: 6px 8px; margin-bottom: 6px; }
.page-card.dragging { opacity: 0.35; }
/* The copy that follows the finger, and the line where it will land (studio.js). */
.drag-ghost { position: fixed; z-index: 50; pointer-events: none; opacity: 0.92; box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45); margin: 0; }
.drop-marker { position: fixed; z-index: 49; height: 3px; border-radius: 2px; background: var(--primary); pointer-events: none; display: none; }
.page-card.changed { border-left: 3px solid var(--primary); }
.page-row { display: flex; align-items: center; gap: 8px; min-height: 40px; }
/* The handle: big enough for a finger, and it doesn't scroll the page (so a drag can start there). */
.grip { cursor: grab; color: var(--muted-foreground); user-select: none; -webkit-user-select: none; touch-action: none;
        min-width: 36px; min-height: 40px; display: flex; align-items: center; justify-content: center; font-size: 18px; }
.page-name { background: none; border: none; padding: 4px 6px; font-weight: 600; text-align: left; border-radius: var(--radius-sm); }
.page-name:hover { background: var(--accent); }
.rename { max-width: 260px; margin: 0; padding: 5px 8px; }
.page-kind { white-space: nowrap; }
.page-who { color: var(--muted-foreground); white-space: nowrap; }
.page-menu { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 4px 6px 30px; }
.page-menu button { font-size: 13px; padding: 5px 10px; }
.danger { color: var(--destructive); }
.danger-solid { background: var(--destructive); color: #fff; border-color: transparent; }
.confirm { margin: 6px 4px 6px 30px; padding: 10px 12px; border: 1px solid var(--destructive); border-radius: var(--radius); }
.props { display: grid; gap: 12px; padding: 10px 6px 8px 30px; border-top: 1px solid var(--border); margin-top: 6px; }
.prop { display: grid; gap: 6px; }
.prop > span:first-child { font-size: 13px; color: var(--muted-foreground); }
.address { display: flex; align-items: center; gap: 4px; max-width: 360px; }
.address input { margin: 0; }
.segments { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.segments button { font-size: 14px; padding: 6px 12px; border-radius: 999px; background: none; }
.segments button.on { background: var(--primary); color: var(--primary-foreground); border-color: transparent; font-weight: 600; }
.keep { width: 90px; margin: 0; }

@media (min-width: 720px) {
    .prop { grid-template-columns: 120px 1fr; align-items: center; }
}

/* On a phone the who-sees label gives way to the name. */
@media (max-width: 480px) {
    .page-who, .page-kind { display: none; }
}
