/*
 * admin.css — the panel's own layout, on the site's design system.
 *
 * organic.css beside this file is the same export the public site uses, so the panel looks
 * like the thing it edits. Only the arrangement is here: a fixed sidebar, a scrolling pane,
 * and forms dense enough to see a whole section at once.
 *
 * The panel is a desktop tool. It works on a narrow screen — the sidebar goes horizontal —
 * but it is not pretending a phone is a good place to rewrite a pricing table.
 */

/* ══════════════════════════════════════════════════════ display scaling */

/*
 * THE ONE LINE THAT SIZES THE WHOLE PAGE.
 *
 * Every length here and in organic.css is a rem — a multiple of the root font size — so this
 * single number scales type, spacing, radii and the 75rem content column together, exactly
 * the way the browser's own zoom does. Nothing is left in pixels except hairline borders,
 * focus rings and the 999px pill idiom, none of which should grow.
 *
 * The ramp is 16px up to a 1920-wide viewport, then straight up to 24px — 1.5x — at 2560,
 * and flat after that. Both ends are measured rather than picked: 1080p was already right,
 * and a 2560-wide screen needed the browser set to 150% before the page filled it.
 *
 *      1.25vw - 0.5rem   →   at 1920px: 24 - 8 = 16px      at 2560px: 32 - 8 = 24px
 *
 * The bounds are rem, not px, so that somebody who has raised their browser's default font
 * size keeps the increase instead of having it silently overwritten.
 *
 * WHY VIEWPORT WIDTH, NOT PIXEL DENSITY: the question is how much room the page has, not how
 * sharp the screen is. A 4K monitor at 200% OS scaling reports a 1920 viewport and wants
 * 1080p sizing; so does a half-width window on a 2560 monitor. Both get it.
 *
 * Media-query breakpoints stay in px deliberately. They describe the device, not the design —
 * and a breakpoint in rem would move as this line changed it, which is a feedback loop.
 */
:root { font-size: clamp(1rem, 1.25vw - 0.5rem, 1.5rem); }

* { box-sizing: border-box; }

html, body { height: 100%; margin: 0; }
body {
    background: var(--color-neutral-200);
    color: var(--color-text);
    font-family: var(--font-body);
    font-size: 0.875rem;
}
:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 2px; }

/* The heading face is a weight range now, not a single cut — see the same note in the
   site's site.css. Everything that asks for the face has to ask for the weight. */
.brand-chip,
.brand-name,
.title,
.group-name { font-weight: var(--font-heading-weight); }

/* ══════════════════════════════════════════════════════════════ sign in */

.login-page { display: grid; place-items: center; padding: 1.5rem; background: var(--color-bg); }
.login-card {
    width: min(25rem, 100%);
    background: var(--color-neutral-100);
    border: 1px solid var(--color-divider);
    border-radius: 2rem;
    padding: 2rem 1.875rem 1.875rem;
    box-shadow: var(--shadow-md);
}
.login-card h1 { font-family: var(--font-heading); font-size: 1.625rem; margin: 0 0 0.375rem; }
.login-note { font-size: 0.8125rem; color: var(--color-neutral-700); margin: 0 0 1.375rem; line-height: 1.5; }
.login-card form { display: flex; flex-direction: column; gap: 0.875rem; }
.login-card .input { background: var(--color-bg); }
.login-error {
    margin: 0;
    padding: 0.625rem 0.875rem;
    border-radius: 1rem;
    background: var(--color-accent-100);
    color: var(--color-accent-800);
    font-size: 0.8125rem;
    line-height: 1.45;
}
.login-brand { display: flex; align-items: center; gap: 0.6875rem; margin-bottom: 1.625rem; }

.brand-chip {
    width: 1.875rem;
    height: 1.875rem;
    flex: none;
    border-radius: 999px;
    background: var(--color-accent);
    color: var(--color-bg);
    display: grid;
    place-items: center;
    font-family: var(--font-heading);
    font-size: 0.9375rem;
}
.brand-name { font-family: var(--font-heading); font-size: 1.0625rem; line-height: 1.1; }
.brand-sub { font-size: 0.6562rem; letter-spacing: .09em; text-transform: uppercase; color: var(--color-neutral-600); }

/* ══════════════════════════════════════════════════════════════ shell */

.shell { display: flex; height: 100%; }

.sidebar {
    width: 16.75rem;
    flex: none;
    display: flex;
    flex-direction: column;
    background: var(--color-surface);
    border-right: 1px solid var(--color-divider);
    overflow: hidden;
}
.sidebar-brand { display: flex; align-items: center; gap: 0.625rem; padding: 1rem 1.125rem 0.875rem; }

.sidebar-nav { display: flex; flex-direction: column; gap: 2px; padding: 0 0.625rem 0.75rem; }
.side-btn {
    display: flex;
    align-items: center;
    gap: 0.5625rem;
    padding: 0.5rem 0.75rem;
    border: 0;
    border-radius: 999px;
    cursor: pointer;
    font: inherit;
    font-size: 0.8438rem;
    text-align: left;
    background: transparent;
    color: var(--color-text);
    width: 100%;
}
.side-btn:hover { background: color-mix(in srgb, var(--color-text) 8%, transparent); }
.side-btn.is-on { background: var(--color-accent); color: var(--color-bg); }
.side-btn .count { margin-left: auto; font-size: 0.6875rem; opacity: .7; }

.sidebar-section { display: flex; align-items: center; gap: 0.5rem; padding: 0.625rem 1.125rem 0.375rem; border-top: 1px solid var(--color-divider); }
.sidebar-label { font-size: 0.6562rem; letter-spacing: .09em; text-transform: uppercase; color: var(--color-neutral-600); }

.lang-seg { margin: 0 0.875rem 0.25rem; display: grid; grid-template-columns: repeat(3, 1fr); background: var(--color-neutral-100); }

.page-list { flex: 1; overflow-y: auto; padding: 0.25rem 0.625rem 0.875rem; display: flex; flex-direction: column; gap: 2px; }
.page-row {
    display: flex;
    align-items: center;
    gap: 0.5625rem;
    padding: 0.5rem 0.75rem;
    border: 0;
    border-radius: 0.875rem;
    cursor: pointer;
    font: inherit;
    text-align: left;
    background: transparent;
    width: 100%;
}
.page-row:hover { background: color-mix(in srgb, var(--color-text) 6%, transparent); }
.page-row.is-on { background: color-mix(in srgb, var(--color-text) 10%, transparent); }
.page-row .marker { width: 0.375rem; height: 0.375rem; flex: none; border-radius: 999px; background: var(--color-neutral-400); }
.page-row.is-on .marker { background: var(--color-accent); }
.page-row .name { display: block; font-size: 0.8438rem; line-height: 1.25; }
.page-row .path { display: block; font-size: 0.6875rem; color: var(--color-neutral-600); }
.page-row.is-dirty .marker { background: var(--color-accent-2-600); }

.sidebar-foot {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 0.75rem 0.75rem 1.125rem;
    border-top: 1px solid var(--color-divider);
    font-size: 0.7188rem;
    color: var(--color-neutral-700);
}
.who { display: flex; align-items: center; gap: 0.5rem; margin-right: auto; }
.who-dot { width: 1.25rem; height: 1.25rem; border-radius: 999px; background: var(--color-accent-2-300); flex: none; }
.sidebar-foot .btn { font-size: 0.75rem; }

/* ══════════════════════════════════════════════════════════════ main */

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }

.topbar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.5rem;
    border-bottom: 1px solid var(--color-divider);
    background: var(--color-neutral-100);
}
.topbar-title { min-width: 0; }
.crumb { font-size: 0.6875rem; color: var(--color-neutral-600); letter-spacing: .04em; }
.title-row { display: flex; align-items: center; gap: 0.5625rem; }
.title { font-family: var(--font-heading); font-size: 1.3125rem; line-height: 1.15; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 0.625rem; }
.topbar-actions .btn { font-size: 0.8125rem; }
.saved-label { font-size: 0.7188rem; color: var(--color-neutral-600); }

.pane { flex: 1; min-height: 0; overflow-y: auto; padding: 1.375rem 1.5rem 6rem; }
.sheet { max-width: 47.5rem; margin: 0 auto; display: flex; flex-direction: column; gap: 0.875rem; }

/* ══════════════════════════════════════════════════════════════ the generated form */

/*
 * One <section> per top-level key of the page — hero, pricing, faq. The nesting below that
 * is drawn with an indented rule rather than another box: three levels of rounded card
 * inside rounded card is how a settings screen becomes unreadable.
 */
.group {
    background: var(--color-neutral-100);
    border: 1px solid var(--color-divider);
    border-radius: 1.375rem;
    padding: 0.875rem 1rem 1rem;
}
.group > .group-head { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.625rem; }
.group-name { font-family: var(--font-heading); font-size: 1rem; }
.group-kind { font-size: 0.6562rem; letter-spacing: .09em; text-transform: uppercase; color: var(--color-neutral-600); }
.group-body { display: flex; flex-direction: column; gap: 0.75rem; }

.subgroup { border-left: 2px solid var(--color-divider); padding-left: 0.875rem; display: flex; flex-direction: column; gap: 0.75rem; }
.subgroup-name { font-size: 0.6875rem; letter-spacing: .08em; text-transform: uppercase; color: var(--color-neutral-600); }

.row { display: flex; flex-direction: column; gap: 0.3125rem; }
.row > label { font-size: 0.75rem; color: var(--color-neutral-700); }
.row .input { background: var(--color-bg); width: 100%; }
.row textarea.input { border-radius: 1.125rem; padding: 0.625rem 0.875rem; min-height: 5.25rem; font: inherit; line-height: 1.55; resize: vertical; }
.row .hint { font-size: 0.6875rem; color: var(--color-neutral-600); }

/* Array entries. The tools appear on hover so a long list is not a wall of buttons, but they
   are always in the tab order — a keyboard user cannot hover. */
.item {
    background: var(--color-bg);
    border: 1px solid var(--color-divider);
    border-radius: 1.125rem;
    padding: 0.625rem 0.75rem 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.5625rem;
}
.item-head { display: flex; align-items: center; gap: 0.5rem; }
.item-num { font-size: 0.6562rem; letter-spacing: .09em; text-transform: uppercase; color: var(--color-neutral-600); }
.item-tools { margin-left: auto; display: flex; gap: 2px; opacity: 0; transition: opacity .12s; }
.item:hover .item-tools, .item:focus-within .item-tools { opacity: 1; }
.icon-btn {
    width: 1.875rem;
    height: 1.875rem;
    display: inline-grid;
    place-items: center;
    border: 0;
    background: transparent;
    border-radius: 999px;
    cursor: pointer;
    color: var(--color-neutral-700);
    font-size: 0.875rem;
    line-height: 1;
}
.icon-btn:hover { background: color-mix(in srgb, var(--color-text) 10%, transparent); color: var(--color-text); }
.icon-btn.danger:hover { background: var(--color-accent-200); color: var(--color-accent-800); }
.icon-btn:disabled { opacity: .3; cursor: default; background: transparent; }

.add-row { display: flex; align-items: center; gap: 0.5rem; }
.add-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.4375rem 0.875rem;
    border: 1px dashed var(--color-neutral-500);
    border-radius: 999px;
    background: transparent;
    cursor: pointer;
    font: inherit;
    font-size: 0.8125rem;
    color: var(--color-neutral-700);
}
.add-btn:hover { border-color: var(--color-accent); color: var(--color-accent-800); }

/* The picker on an `image` field. */
.picker { display: flex; gap: 0.75rem; align-items: flex-start; }
.picker-preview {
    width: 8.25rem;
    height: 5.5rem;
    flex: none;
    border-radius: 1rem;
    background: var(--color-neutral-300);
    border: 1px dashed var(--color-neutral-500);
    display: grid;
    place-items: center;
    overflow: hidden;
    font-size: 0.6562rem;
    color: var(--color-neutral-700);
    text-align: center;
    padding: 0.375rem;
}
.picker-preview img { width: 100%; height: 100%; object-fit: cover; display: block; }
.picker-fields { flex: 1; display: flex; flex-direction: column; gap: 0.375rem; min-width: 0; }
select.input { background: var(--color-bg); width: 100%; height: 2.5rem; font: inherit; }

/* ══════════════════════════════════════════════════════════════ media */

.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(11.875rem, 1fr)); gap: 1.125rem; }
.media-card { display: flex; flex-direction: column; gap: 0.4375rem; }
.media-thumb {
    height: 8.25rem;
    border-radius: 1.125rem;
    background: var(--color-neutral-300);
    display: grid;
    place-items: center;
    overflow: hidden;
    color: var(--color-neutral-700);
    font-size: 0.6875rem;
}
.media-thumb img, .media-thumb video { width: 100%; height: 100%; object-fit: cover; display: block; }
.media-name { font-size: 0.7812rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.media-meta { font-size: 0.6875rem; color: var(--color-neutral-600); display: flex; align-items: center; gap: 0.5rem; }
.media-meta button { margin-left: auto; }

.dropzone {
    grid-column: 1 / -1;
    min-height: 8.25rem;
    border-radius: 1.125rem;
    border: 1px dashed var(--color-neutral-500);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    color: var(--color-neutral-700);
    font-size: 0.8125rem;
    padding: 1.25rem;
    text-align: center;
}
.dropzone.is-over { border-color: var(--color-accent); background: var(--color-accent-100); color: var(--color-accent-800); }
.dropzone .hint { font-size: 0.7188rem; color: var(--color-neutral-600); }

/* ══════════════════════════════════════════════════════════════ messages */

.notice {
    border-radius: 1.25rem;
    padding: 0.875rem 1.125rem;
    font-size: 0.8125rem;
    line-height: 1.55;
    background: var(--color-accent-100);
    color: var(--color-accent-900);
    border: 1px solid var(--color-accent-300);
}
.notice ul { margin: 0.5rem 0 0; padding-left: 1.25rem; }
.notice li { margin-bottom: 0.1875rem; font-family: ui-monospace, Menlo, monospace; font-size: 0.75rem; }
.notice-quiet { background: var(--color-neutral-100); border-color: var(--color-divider); color: var(--color-neutral-800); }

.toast {
    position: fixed;
    bottom: 1.375rem;
    left: 50%;
    transform: translateX(-50%);
    background: var(--color-neutral-900);
    color: var(--color-neutral-100);
    padding: 0.625rem 1.25rem;
    border-radius: 999px;
    font-size: 0.8125rem;
    box-shadow: var(--shadow-lg);
    z-index: 40;
    max-width: min(35rem, calc(100vw - 2.5rem));
}
.toast.is-bad { background: var(--color-accent-800); }

.empty { padding: 2.5rem 0; text-align: center; color: var(--color-neutral-600); font-size: 0.8125rem; }

/* ══════════════════════════════════════════════════════════════ narrow screens */

@media (max-width: 820px) {
    .shell { flex-direction: column; height: auto; }
    body { height: auto; }
    .sidebar { width: 100%; border-right: 0; border-bottom: 1px solid var(--color-divider); }
    .page-list { flex-direction: row; overflow-x: auto; }
    .page-row { width: auto; white-space: nowrap; }
    .topbar { flex-wrap: wrap; }
    .pane { overflow: visible; }
}
