/* ══════════════════════════════════════════════════════════
   AE Gallery — shared styles for /new, /a/*, and /library.
   Reuses brand tokens from /css/brand.css and hub chrome from
   /css/hub.css. Nothing here should redefine tokens — only
   compose them into gallery-specific components.
   ══════════════════════════════════════════════════════════ */

body.ae-artifact-new,
body.ae-artifact-view,
body.ae-artifact-library {
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  color: var(--ae-text);
  background: var(--ae-grey-light);
  margin: 0;
}

/* Full-bleed viewer background so the artifact frame sits on a
   neutral surface. */
body.ae-artifact-view { background: #F8F7F4; }

#loading {
  padding: 64px 24px;
  color: var(--ae-text-muted);
  font-size: 14px;
  text-align: center;
}

/* ── Buttons (shared) ─────────────────────────────────────── */
.art-btn-primary,
.art-btn-secondary,
.art-btn-icon {
  font-family: inherit;
  font-weight: 600;
  font-size: 13px;
  padding: 10px 18px;
  border-radius: var(--ae-radius-md);
  cursor: pointer;
  display: inline-flex; align-items: center; gap: 7px;
  text-decoration: none;
  transition: all .12s ease;
  line-height: 1;
  border: 1px solid transparent;
}
.art-btn-primary {
  background: var(--ae-purple);
  color: #fff;
  border-color: var(--ae-purple);
}
.art-btn-primary:hover { background: #5045C0; border-color: #5045C0; }
.art-btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.art-btn-secondary {
  background: #fff;
  color: var(--ae-text);
  border-color: var(--ae-grey-border);
}
.art-btn-secondary:hover { border-color: var(--ae-purple); color: var(--ae-purple); }

.art-btn-icon {
  background: #fff;
  color: var(--ae-text-secondary);
  border-color: var(--ae-grey-border);
  padding: 8px 12px;
  font-size: 12px;
}
.art-btn-icon:hover { border-color: var(--ae-purple); color: var(--ae-purple); }
.art-btn-icon svg { flex-shrink: 0; }

/* ══════════════════════════════════════════════════════════
   /new — publish page
   ══════════════════════════════════════════════════════════ */
.art-new {
  max-width: 1100px;
  margin: 0 auto;
  padding: 40px 40px 80px;
}

.art-new-intro {
  margin-bottom: 32px;
}
.art-new-intro h1 {
  font-size: 28px;
  font-weight: 700;
  margin: 0 0 8px;
  letter-spacing: -0.02em;
}
.art-new-intro p {
  font-size: 15px;
  color: var(--ae-text-secondary);
  margin: 0;
  max-width: 720px;
  line-height: 1.55;
}

/* ── Drop zone ────────────────────────────────────────────── */
.art-dropzone {
  background: #fff;
  border: 2px dashed var(--ae-grey-border);
  border-radius: var(--ae-radius-lg);
  padding: 72px 32px;
  cursor: pointer;
  transition: all .15s ease;
  text-align: center;
}
.art-dropzone:hover,
.art-dropzone-hot {
  border-color: var(--ae-purple);
  background: var(--ae-purple-20);
}
.art-drop-icon {
  width: 48px; height: 48px;
  color: var(--ae-purple);
  margin-bottom: 16px;
}
.art-drop-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 6px;
}
.art-drop-sub {
  font-size: 14px;
  color: var(--ae-text-secondary);
  margin-bottom: 16px;
}
.art-drop-browse {
  background: none;
  border: none;
  color: var(--ae-purple);
  font-family: inherit;
  font-size: inherit;
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
  padding: 0;
}
.art-drop-hint {
  font-size: 12px;
  color: var(--ae-text-muted);
}
.art-drop-hint span {
  font-family: 'DM Mono', 'Courier New', monospace;
  font-size: 11px;
  background: var(--ae-grey-light);
  padding: 2px 6px;
  border-radius: 4px;
}
/* Packaging guide link below the dropzone — understated, link-only,
   not the primary affordance. Only relevant to users shipping richer
   content. */
.art-drop-footnote {
  margin-top: 14px;
  font-size: 12.5px;
  color: var(--ae-text-muted);
  text-align: center;
  line-height: 1.55;
}
.art-drop-footnote a {
  color: var(--ae-purple);
  font-weight: 600;
  text-decoration: none;
  margin-left: 3px;
}
.art-drop-footnote a:hover { text-decoration: underline; }

/* ── Review form ──────────────────────────────────────────── */
.art-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
  background: #fff;
  border: 1px solid var(--ae-grey-border);
  border-radius: var(--ae-radius-lg);
  padding: 32px;
}

.art-field { margin-bottom: 20px; }
.art-field:last-child { margin-bottom: 0; }
.art-field label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ae-text-secondary);
  margin-bottom: 6px;
}
.art-optional {
  text-transform: none;
  font-weight: 500;
  color: var(--ae-text-muted);
  font-size: 10px;
  letter-spacing: 0;
}
.art-field input,
.art-field textarea {
  width: 100%;
  box-sizing: border-box;
  font-family: inherit;
  font-size: 14px;
  padding: 10px 12px;
  border: 1px solid var(--ae-grey-border);
  border-radius: var(--ae-radius-md);
  background: var(--ae-grey-light);
  color: var(--ae-text);
  line-height: 1.5;
}
.art-field input:focus,
.art-field textarea:focus {
  outline: none;
  border-color: var(--ae-purple);
  background: #fff;
}
.art-field textarea {
  resize: vertical;
  min-height: 72px;
}
.art-field-hint {
  font-size: 11px;
  color: var(--ae-text-muted);
  margin-top: 6px;
  line-height: 1.4;
}

/* Slug field has a prefix so users see the final URL they'll get. */
.art-slug-wrap {
  display: flex;
  align-items: stretch;
  border: 1px solid var(--ae-grey-border);
  border-radius: var(--ae-radius-md);
  background: var(--ae-grey-light);
  overflow: hidden;
}
.art-slug-wrap:focus-within {
  border-color: var(--ae-purple);
  background: #fff;
}
.art-slug-prefix {
  padding: 10px 12px;
  font-family: 'DM Mono', 'Courier New', monospace;
  font-size: 12px;
  color: var(--ae-text-muted);
  background: var(--ae-grey-light);
  border-right: 1px solid var(--ae-grey-border);
  white-space: nowrap;
}
.art-slug-wrap input {
  border: none !important;
  border-radius: 0 !important;
  background: transparent !important;
  font-family: 'DM Mono', 'Courier New', monospace;
  font-size: 13px;
  flex: 1;
}
.art-slug-status {
  font-size: 12px;
  margin-top: 6px;
  line-height: 1.4;
}
.art-slug-status.art-slug-ok { color: var(--ae-success); }
.art-slug-status.art-slug-bad { color: var(--ae-error); }
.art-slug-status.art-slug-warn { color: var(--ae-warning); }
.art-slug-status.art-slug-pending { color: var(--ae-text-muted); }

/* Stat row (size / words / visibility). */
.art-field-row {
  display: flex;
  gap: 16px;
  padding: 14px 16px;
  background: var(--ae-grey-light);
  border: 1px solid var(--ae-grey-border);
  border-radius: var(--ae-radius-md);
  margin-bottom: 20px;
}
.art-field-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.art-field-stat span {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ae-text-muted);
}
.art-field-stat strong {
  font-size: 13px;
  font-weight: 600;
  color: var(--ae-text);
}

.art-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 16px;
  border-top: 1px solid var(--ae-grey-border);
}

.art-error {
  display: none;
  margin-top: 12px;
  padding: 10px 14px;
  background: #FEE2E2;
  border: 1px solid var(--ae-error);
  color: #991B1B;
  border-radius: var(--ae-radius-md);
  font-size: 13px;
  line-height: 1.45;
}
.art-error-show { display: block; }

/* Soft-warn banner — file is big enough to be slow but still under
   the hard cap. Amber, not red, because publish still works. */
.art-size-warn {
  display: none;
  margin-bottom: 16px;
  padding: 10px 14px;
  background: #FEF3C7;
  border: 1px solid var(--ae-warning);
  color: #92400E;
  border-radius: var(--ae-radius-md);
  font-size: 12px;
  line-height: 1.5;
}
.art-size-warn-show { display: block; }

/* File-size stat turns amber when we're into soft-warn territory
   so users see at-a-glance that the file is heavy. */
.art-field-stat strong.art-stat-warn { color: #92400E; }

/* ── Live preview frame ──────────────────────────────────── */
.art-preview-wrap {
  border: 1px solid var(--ae-grey-border);
  border-radius: var(--ae-radius-md);
  overflow: hidden;
  background: var(--ae-white);
  height: 520px;
}
.art-preview-frame {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

/* ── Success state ───────────────────────────────────────── */
.art-success {
  max-width: 560px;
  margin: 0 auto;
  text-align: center;
  background: #fff;
  border: 1px solid var(--ae-grey-border);
  border-radius: var(--ae-radius-lg);
  padding: 48px 40px;
}
.art-success-check {
  width: 56px; height: 56px;
  border-radius: 50%;
  background: var(--ae-success);
  color: #fff;
  font-size: 28px;
  line-height: 56px;
  margin: 0 auto 16px;
}
.art-success h2 {
  font-size: 22px;
  font-weight: 700;
  margin: 0 0 4px;
}
.art-success p {
  font-size: 14px;
  color: var(--ae-text-secondary);
  margin: 0 0 18px;
}
.art-success-link-row {
  display: flex;
  gap: 10px;
  align-items: stretch;
  justify-content: center;
  margin-bottom: 20px;
}
.art-success-link {
  flex: 1;
  max-width: 380px;
  padding: 10px 12px;
  background: var(--ae-grey-light);
  border: 1px solid var(--ae-grey-border);
  border-radius: var(--ae-radius-md);
  font-family: 'DM Mono', 'Courier New', monospace;
  font-size: 12px;
  color: var(--ae-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: flex;
  align-items: center;
}
.art-success-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
}

/* ══════════════════════════════════════════════════════════
   /a/{slug} — viewer page
   ══════════════════════════════════════════════════════════ */

/* Viewer meta bar — thin strip between hub chrome and the artifact. */
.art-meta-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 40px;
  background: #fff;
  border-bottom: 1px solid var(--ae-grey-border);
  gap: 20px;
}
.art-meta-left { min-width: 0; flex: 1; }
.art-meta-right { display: flex; gap: 8px; flex-shrink: 0; }

.art-meta-title {
  font-size: 16px;
  font-weight: 700;
  margin: 0 0 3px;
  color: var(--ae-text);
  letter-spacing: -0.01em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.art-meta-sub {
  font-size: 12px;
  color: var(--ae-text-muted);
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}
.art-meta-owner { font-weight: 600; color: var(--ae-text-secondary); }
.art-meta-dot { opacity: 0.5; }

/* Stage that holds the artifact iframe. The height fills the viewport
   minus the hub chrome (64px) and meta bar (~54px). */
.art-stage {
  position: relative;
  padding: 16px 24px 24px;
  height: calc(100vh - 64px - 58px);
  box-sizing: border-box;
}
.art-frame {
  width: 100%;
  height: 100%;
  border: 1px solid var(--ae-grey-border);
  border-radius: var(--ae-radius-md);
  background: #fff;
  display: block;
  box-shadow: var(--ae-shadow-md);
}

/* Not-found state. */
.art-notfound {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
}
.art-notfound-inner {
  max-width: 420px;
  text-align: center;
  background: #fff;
  border: 1px solid var(--ae-grey-border);
  border-radius: var(--ae-radius-lg);
  padding: 40px 32px;
}
.art-notfound h1 {
  font-size: 20px;
  font-weight: 700;
  margin: 0 0 8px;
}
.art-notfound p {
  font-size: 13px;
  color: var(--ae-text-secondary);
  margin: 0 0 24px;
  line-height: 1.5;
}
.art-notfound-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
}

/* ══════════════════════════════════════════════════════════
   /library — list page
   ══════════════════════════════════════════════════════════ */
.art-library {
  max-width: 1100px;
  margin: 0 auto;
  padding: 40px 40px 80px;
}

.art-lib-head {
  margin-bottom: 32px;
}
.art-lib-head h1 {
  font-size: 28px;
  font-weight: 700;
  margin: 0 0 6px;
  letter-spacing: -0.02em;
}
.art-lib-head p {
  font-size: 14px;
  color: var(--ae-text-secondary);
  margin: 0 0 20px;
}
.art-lib-head code {
  font-family: 'DM Mono', 'Courier New', monospace;
  font-size: 12px;
  background: var(--ae-grey-light);
  padding: 2px 6px;
  border-radius: 4px;
}

.art-lib-search {
  position: relative;
  max-width: 420px;
}
.art-lib-search svg {
  position: absolute;
  left: 12px; top: 50%;
  transform: translateY(-50%);
  color: var(--ae-text-muted);
}
.art-lib-search input {
  width: 100%;
  box-sizing: border-box;
  padding: 10px 12px 10px 36px;
  border: 1px solid var(--ae-grey-border);
  border-radius: var(--ae-radius-md);
  background: #fff;
  font-family: inherit;
  font-size: 13px;
}
.art-lib-search input:focus {
  outline: none;
  border-color: var(--ae-purple);
}

.art-lib-section { margin-bottom: 36px; }
.art-lib-section h2 {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ae-text-muted);
  margin: 0 0 12px;
}

.art-lib-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}
.art-lib-empty {
  padding: 24px;
  background: #fff;
  border: 1px dashed var(--ae-grey-border);
  border-radius: var(--ae-radius-md);
  font-size: 13px;
  color: var(--ae-text-secondary);
  text-align: center;
}
.art-lib-empty a { color: var(--ae-purple); font-weight: 600; }

/* Library card — thumbnail on top, body below. Click anywhere in the
   card to open the viewer. */
.art-card {
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid var(--ae-grey-border);
  border-radius: var(--ae-radius-md);
  overflow: hidden;
  text-decoration: none;
  color: var(--ae-text);
  transition: all .12s ease;
}
.art-card:hover {
  border-color: var(--ae-purple);
  box-shadow: var(--ae-shadow-md);
  transform: translateY(-1px);
}

/* Thumbnail slot — fixed 3:2 aspect ratio so the grid is visually
   uniform even with mixed-aspect artifacts. */
.art-card-thumb {
  position: relative;
  aspect-ratio: 3 / 2;
  background: var(--ae-grey-light);
  overflow: hidden;
}
.art-card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.art-card-thumb-loading {
  background: linear-gradient(90deg, var(--ae-grey-light) 0%, #ECEAE4 50%, var(--ae-grey-light) 100%);
  background-size: 200% 100%;
  animation: art-thumb-shimmer 1.2s ease-in-out infinite;
}
@keyframes art-thumb-shimmer {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}
.art-card-thumb-fallback {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.85);
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -0.02em;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
}

.art-card-body {
  padding: 14px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.art-card-title {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.01em;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  line-height: 1.3;
}
.art-card-desc {
  font-size: 12px;
  color: var(--ae-text-secondary);
  line-height: 1.45;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.art-card-meta {
  font-size: 11px;
  color: var(--ae-text-muted);
  display: flex;
  gap: 5px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: auto;
}
.art-card-owner { font-weight: 600; color: var(--ae-text-secondary); }
.art-card-dot { opacity: 0.5; }

/* Retention chip — small pill at the bottom of each card. Color
   conveys urgency: amber for ≤3 days, neutral otherwise, permanent
   gets a distinct slate. */
.art-card-retention {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 999px;
  margin-top: 4px;
}
.art-card-retention-normal {
  background: var(--ae-grey-light);
  color: var(--ae-text-secondary);
}
.art-card-retention-soon {
  background: #FEF3C7;
  color: #92400E;
}
.art-card-retention-expired {
  background: #FEE2E2;
  color: #991B1B;
}
.art-card-retention-permanent {
  background: var(--ae-purple-20);
  color: var(--ae-purple);
}
.art-card-retention-unlisted {
  background: #1F2937;
  color: #E5E7EB;
  display: inline-flex;
  align-items: center;
}
/* Featured chip — visually tied to the purple brand so it reads as
   "this is on the homepage" at a glance, including on non-owner
   library views. */
.art-card-retention-featured {
  background: var(--ae-purple);
  color: #fff;
  display: inline-flex;
  align-items: center;
}
/* AE-branded chip — tied to the coral brand accent to distinguish
   it at a glance from the purple Featured chip. */
.art-card-retention-branded {
  background: #FF5233;
  color: #fff;
  display: inline-flex;
  align-items: center;
}

/* ══════════════════════════════════════════════════════════
   /new — extra styles for retention + advanced expander
   ══════════════════════════════════════════════════════════ */

/* Select element styled to match the text inputs. Native control
   so there's no risk of accessibility regressions — we style the
   outside but let the native dropdown do its thing. */
.art-select {
  width: 100%;
  box-sizing: border-box;
  padding: 10px 32px 10px 12px;
  border: 1px solid var(--ae-grey-border);
  border-radius: var(--ae-radius-md);
  background: var(--ae-grey-light);
  color: var(--ae-text);
  font-family: inherit;
  font-size: 14px;
  line-height: 1.4;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg viewBox='0 0 12 8' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236B6B6B' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 10px auto;
}
.art-select:focus {
  outline: none;
  border-color: var(--ae-purple);
  background-color: #fff;
}

/* "Keep it permanent" note — shown only when Forever is selected.
   Quiet, neutral tone — storage cost isn't a user's problem. */
.art-retention-note {
  margin-top: 8px;
  padding: 10px 12px;
  background: var(--ae-purple-20);
  border-left: 3px solid var(--ae-purple);
  border-radius: var(--ae-radius-sm);
  font-size: 12px;
  color: var(--ae-text-secondary);
  line-height: 1.5;
}

/* Visibility radio group — Public / Unlisted on the /upload form.
   Vertically stacked so labels can be full sentences + subtext. */
.art-visibility-options {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.art-radio {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  background: #fff;
  border: 1px solid var(--ae-grey-border);
  border-radius: var(--ae-radius-md);
  cursor: pointer;
  transition: border-color .12s, background .12s;
}
.art-radio:hover { border-color: var(--ae-purple); }
.art-radio input[type="radio"] {
  margin-top: 3px;
  flex-shrink: 0;
  accent-color: var(--ae-purple);
  cursor: pointer;
}
.art-radio input[type="radio"]:checked ~ .art-radio-body strong { color: var(--ae-purple); }
.art-radio:has(input[type="radio"]:checked) {
  border-color: var(--ae-purple);
  background: var(--ae-purple-20);
}
.art-radio-body {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 13px;
  line-height: 1.45;
}
.art-radio-body strong {
  color: var(--ae-text);
  font-weight: 600;
}
.art-radio-sub {
  color: var(--ae-text-secondary);
  font-size: 12px;
}

/* Honest-language note shown beneath the radios when Unlisted is
   selected. Amber-ish to signal 'read this, but you're fine'. Not
   scary red because Unlisted is legitimate; we just want users to
   understand what it actually guarantees. */
.art-visibility-note {
  margin-top: 8px;
  padding: 10px 12px;
  background: #FEF3C7;
  border-left: 3px solid var(--ae-warning);
  border-radius: var(--ae-radius-sm);
  font-size: 12px;
  color: #92400E;
  line-height: 1.5;
}
.art-visibility-note strong { font-weight: 700; }
.art-visibility-note code {
  font-family: 'DM Mono', 'Courier New', monospace;
  font-size: 11px;
  background: #fff;
  padding: 1px 5px;
  border-radius: 3px;
  border: 1px solid rgba(0,0,0,0.08);
}

/* "Change the URL" expander — collapsed by default. When collapsed,
   show the auto-generated slug in the summary so users see what
   they're getting without needing to open it. */
.art-advanced {
  margin-bottom: 20px;
  background: var(--ae-grey-light);
  border: 1px solid var(--ae-grey-border);
  border-radius: var(--ae-radius-md);
  overflow: hidden;
}
.art-advanced > summary {
  padding: 10px 14px;
  font-size: 12px;
  font-weight: 600;
  color: var(--ae-text-secondary);
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
  user-select: none;
}
.art-advanced > summary::-webkit-details-marker { display: none; }
.art-advanced > summary::before {
  content: '';
  width: 0; height: 0;
  border-left: 4px solid var(--ae-text-muted);
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  transition: transform .15s;
}
.art-advanced[open] > summary::before { transform: rotate(90deg); }
.art-advanced > summary:hover { color: var(--ae-text); }
.art-advanced-default {
  margin-left: auto;
  font-family: 'DM Mono', 'Courier New', monospace;
  font-size: 11px;
  font-weight: 500;
  color: var(--ae-text-muted);
  text-transform: none;
  letter-spacing: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 60%;
}
.art-field-nested {
  padding: 14px;
  background: #fff;
  border-top: 1px solid var(--ae-grey-border);
  margin: 0;
}

/* Success state polish — bigger primary copy button, richer reminder. */
.art-success-note {
  margin: -6px auto 22px;
  padding: 10px 14px;
  background: var(--ae-grey-light);
  border-radius: var(--ae-radius-md);
  font-size: 12px;
  color: var(--ae-text-secondary);
  line-height: 1.5;
  max-width: 440px;
}
.art-success-note code {
  font-family: 'DM Mono', 'Courier New', monospace;
  font-size: 11px;
  background: #fff;
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid var(--ae-grey-border);
}

/* Library CTA in the nav */
.art-lib-new-cta {
  color: var(--ae-purple) !important;
  font-weight: 600;
}

/* "Internal only" pill next to the page headline on /new. Signals
   the visibility constraint immediately without the user having to
   read the subtitle. */
.art-badge-internal {
  display: inline-flex;
  align-items: center;
  margin-left: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--ae-orange-20);
  color: var(--ae-orange);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  vertical-align: middle;
  line-height: 1;
}

/* Shortening suggestion banner — non-blocking, appears when auto-
   generated URL exceeds the length threshold. One click accepts
   the shorter candidate; "Keep as is" dismisses without changing
   anything. Banner fits between the retention dropdown and the
   "Change the URL" expander. */
.art-slug-suggest {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
  padding: 12px 14px;
  background: linear-gradient(135deg, var(--ae-purple-20) 0%, #EEEAFB 100%);
  border: 1px solid var(--ae-purple-40);
  border-radius: var(--ae-radius-md);
  font-size: 12px;
  color: var(--ae-text);
  flex-wrap: wrap;
}
.art-slug-suggest-show { display: flex; }
.art-slug-suggest-body {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 200px;
  line-height: 1.4;
}
.art-slug-suggest-icon {
  font-size: 14px;
  flex-shrink: 0;
}
.art-slug-suggest-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}
.art-slug-suggest-btn {
  padding: 6px 12px;
  background: var(--ae-purple);
  color: #fff;
  border: 1px solid var(--ae-purple);
  border-radius: var(--ae-radius-sm);
  cursor: pointer;
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: background .12s;
}
.art-slug-suggest-btn:hover { background: #5045C0; border-color: #5045C0; }
.art-slug-suggest-btn code {
  font-family: 'DM Mono', 'Courier New', monospace;
  font-size: 11px;
  background: rgba(255,255,255,0.18);
  padding: 1px 6px;
  border-radius: 3px;
}
.art-slug-suggest-dismiss {
  padding: 6px 12px;
  background: transparent;
  color: var(--ae-text-secondary);
  border: 1px solid transparent;
  border-radius: var(--ae-radius-sm);
  cursor: pointer;
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
}
.art-slug-suggest-dismiss:hover { color: var(--ae-text); }

/* ══════════════════════════════════════════════════════════
   Library filter tabs + admin pill
   ══════════════════════════════════════════════════════════ */

/* Admin view pill next to the library heading — purple to match
   the admin brand, visible only when role == admin. Signals to
   admins that the action menus on other people's cards aren't
   a bug. */
.art-admin-pill {
  display: inline-flex;
  align-items: center;
  margin-left: 10px;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--ae-purple);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  vertical-align: middle;
  line-height: 1;
}

.art-lib-toolbar {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.art-lib-tabs {
  display: inline-flex;
  background: var(--ae-grey-light);
  border: 1px solid var(--ae-grey-border);
  border-radius: var(--ae-radius-md);
  padding: 3px;
  gap: 2px;
}
.art-lib-tab {
  border: 0;
  background: transparent;
  color: var(--ae-text-secondary);
  padding: 7px 14px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  border-radius: var(--ae-radius-sm);
  cursor: pointer;
  white-space: nowrap;
  transition: all .12s;
}
.art-lib-tab:hover { color: var(--ae-text); }
.art-lib-tab-active {
  background: #fff;
  color: var(--ae-text);
  box-shadow: var(--ae-shadow-sm);
}

/* Library search adjusts to sit inline with the tabs. */
.art-lib-toolbar .art-lib-search {
  flex: 1;
  min-width: 240px;
  max-width: 420px;
  margin: 0;
}

/* ══════════════════════════════════════════════════════════
   Card action menu (three-dot)
   ══════════════════════════════════════════════════════════ */

/* Wrap sits top-right inside the thumbnail slot. Not-interactive
   surface of the card is still clickable around it. */
.art-card-menu {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 5;
}
.art-card-menu-btn {
  width: 30px;
  height: 30px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  color: var(--ae-text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
  box-shadow: var(--ae-shadow-sm);
  opacity: 0;
  transition: opacity .12s, transform .12s;
}
.art-card:hover .art-card-menu-btn,
.art-card:focus-within .art-card-menu-btn,
.art-card-menu-open .art-card-menu-btn {
  opacity: 1;
}
.art-card-menu-btn:hover {
  background: #fff;
  color: var(--ae-text);
  transform: scale(1.08);
}

.art-card-menu-popup {
  position: absolute;
  top: 36px;
  right: 0;
  min-width: 180px;
  background: #fff;
  border: 1px solid var(--ae-grey-border);
  border-radius: var(--ae-radius-md);
  box-shadow: var(--ae-shadow-lg);
  padding: 4px;
  display: none;
  z-index: 10;
}
.art-card-menu-open .art-card-menu-popup { display: block; }

.art-card-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  background: transparent;
  border: 0;
  border-radius: var(--ae-radius-sm);
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  color: var(--ae-text);
  text-align: left;
  transition: background .1s;
}
.art-card-menu-item:hover { background: var(--ae-grey-light); }
.art-card-menu-item svg { flex-shrink: 0; color: var(--ae-text-muted); }
.art-card-menu-item:hover svg { color: var(--ae-text); }
.art-card-menu-item-danger { color: var(--ae-error); }
.art-card-menu-item-danger svg { color: var(--ae-error); }
.art-card-menu-item-danger:hover { background: #FEE2E2; }

.art-card-menu-sep {
  height: 1px;
  background: var(--ae-grey-border);
  margin: 4px 2px;
}

/* Archived cards get a slight desaturation so you can eyeball the
   status at a glance when the Archived tab is active. */
.art-card-archived { opacity: 0.75; }
.art-card-archived .art-card-thumb { filter: grayscale(0.4); }
.art-card-retention-archived {
  background: var(--ae-grey-light);
  color: var(--ae-text-secondary);
}

/* ══════════════════════════════════════════════════════════
   Modals (edit + confirm)
   ══════════════════════════════════════════════════════════ */
.art-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.art-modal-open { display: flex; }
.art-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(30, 30, 40, 0.48);
  backdrop-filter: blur(3px);
}
.art-modal-dialog {
  position: relative;
  width: 100%;
  max-width: 520px;
  background: #fff;
  border-radius: var(--ae-radius-lg);
  box-shadow: var(--ae-shadow-lg);
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 48px);
  overflow: hidden;
}
.art-modal-dialog-small { max-width: 440px; }

.art-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 10px;
}
.art-modal-header h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.art-modal-close {
  background: transparent;
  border: 0;
  font-size: 22px;
  color: var(--ae-text-muted);
  cursor: pointer;
  line-height: 1;
  padding: 4px 8px;
  border-radius: var(--ae-radius-sm);
}
.art-modal-close:hover { color: var(--ae-text); background: var(--ae-grey-light); }

.art-modal-body {
  padding: 10px 24px 12px;
  overflow-y: auto;
}
.art-modal-body p {
  font-size: 13px;
  line-height: 1.55;
  color: var(--ae-text-secondary);
  margin: 0;
}

.art-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 24px 20px;
  border-top: 1px solid var(--ae-grey-border);
  background: var(--ae-grey-light);
}

/* Destructive variant of the primary button — used for Delete and
   Archive confirms. */
.art-btn-primary.art-btn-danger {
  background: var(--ae-error);
  border-color: var(--ae-error);
}
.art-btn-primary.art-btn-danger:hover {
  background: #B91C1C;
  border-color: #B91C1C;
}

/* ══════════════════════════════════════════════════════════
   Publishing-as row (admin upload-on-behalf on /upload)
   ══════════════════════════════════════════════════════════ */
.art-publish-as {
  margin-bottom: 16px;
  padding: 10px 14px;
  background: var(--ae-purple-20);
  border: 1px solid var(--ae-purple-40);
  border-radius: var(--ae-radius-md);
}
.art-publish-as-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.art-publish-as-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ae-text-secondary);
}
.art-publish-as-value {
  font-size: 13px;
  font-weight: 600;
  color: var(--ae-text);
}
.art-publish-as-value.art-publish-as-value-delegate {
  color: var(--ae-purple);
}
.art-publish-as-change,
.art-publish-as-reset {
  margin-left: auto;
  background: #fff;
  border: 1px solid var(--ae-grey-border);
  color: var(--ae-text-secondary);
  padding: 4px 10px;
  border-radius: var(--ae-radius-sm);
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color .12s, color .12s;
}
.art-publish-as-change:hover,
.art-publish-as-reset:hover {
  border-color: var(--ae-purple);
  color: var(--ae-purple);
}
.art-publish-as-hint {
  margin-top: 8px;
  font-size: 12px;
  color: var(--ae-text-secondary);
  line-height: 1.5;
}

/* Picker modal list items */
.art-picker-intro {
  margin: 0 0 12px !important;
  font-size: 12px !important;
  color: var(--ae-text-secondary);
  line-height: 1.5;
}
.art-picker-list {
  max-height: 340px;
  overflow-y: auto;
  border: 1px solid var(--ae-grey-border);
  border-radius: var(--ae-radius-md);
  background: #fff;
}
.art-picker-loading,
.art-picker-empty {
  padding: 20px 16px;
  font-size: 13px;
  color: var(--ae-text-secondary);
  text-align: center;
  line-height: 1.5;
}
.art-picker-row {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--ae-grey-border);
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  transition: background .1s;
}
.art-picker-row:last-child { border-bottom: 0; }
.art-picker-row:hover { background: var(--ae-purple-20); }
.art-picker-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--ae-grey-light);
  color: var(--ae-text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
  overflow: hidden;
}
.art-picker-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.art-picker-meta {
  min-width: 0;
  flex: 1;
}
.art-picker-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--ae-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.art-picker-email {
  font-size: 11px;
  color: var(--ae-text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: 'DM Mono', 'Courier New', monospace;
}

/* ══════════════════════════════════════════════════════════
   Feature-on-homepage button state (admin meta-bar toggle)
   ══════════════════════════════════════════════════════════ */
/* The default .art-btn-icon look is outline-white. When an artifact
   is already featured we swap to the filled purple look so the admin
   can tell at a glance this button will REMOVE rather than ADD. */
.art-btn-icon.art-btn-icon-featured {
  background: var(--ae-purple);
  color: #fff;
  border-color: var(--ae-purple);
}
.art-btn-icon.art-btn-icon-featured:hover {
  background: #5045C0;
  border-color: #5045C0;
  color: #fff;
}

/* Bullet list inside the Feature-on-homepage confirm modal — each
   item describes one side effect of the flip (retention change,
   visibility auto-flip, archive restore). Readable plain English
   per the lowest-common-denominator rule — no jargon. */
.art-feature-effects {
  list-style: disc;
  margin: 12px 0 0;
  padding-left: 22px;
  color: var(--ae-text-secondary);
  font-size: 13px;
  line-height: 1.55;
}
.art-feature-effects li + li { margin-top: 6px; }

/* ══════════════════════════════════════════════════════════
   Per-artifact analytics card (owner + admin, below viewer)
   ══════════════════════════════════════════════════════════ */
.art-analytics {
  max-width: 1100px;
  margin: 0 auto 24px;
  padding: 0 24px;
}
.art-analytics-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--ae-white);
  border: 1px solid var(--ae-grey-border);
  border-radius: var(--ae-radius-md);
  padding: 10px 14px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--ae-text);
  cursor: pointer;
  transition: all .14s ease;
}
.art-analytics-toggle:hover {
  border-color: var(--ae-purple);
  color: var(--ae-purple);
}
.art-analytics-toggle-left {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.art-analytics-toggle-hint {
  font-weight: 500;
  color: var(--ae-text-muted);
  font-size: 12px;
}
.art-analytics-chevron {
  transition: transform .14s ease;
}
.art-analytics-toggle-open .art-analytics-chevron {
  transform: rotate(180deg);
}
.art-analytics-toggle-open {
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
  border-bottom-color: transparent;
}

.art-analytics-body {
  background: var(--ae-white);
  border: 1px solid var(--ae-grey-border);
  border-top: none;
  border-bottom-left-radius: var(--ae-radius-md);
  border-bottom-right-radius: var(--ae-radius-md);
  padding: 16px 18px 18px;
}

.art-analytics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}
.art-analytics-stat {
  background: var(--ae-grey-light);
  border-radius: var(--ae-radius-md);
  padding: 12px 14px;
}
.art-analytics-stat-value {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--ae-text);
  line-height: 1.1;
}
.art-analytics-stat-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ae-text-muted);
  margin-top: 4px;
  font-weight: 600;
}
.art-analytics-loading {
  padding: 18px 4px;
  color: var(--ae-text-muted);
  font-size: 13px;
}

.art-analytics-viewers-head {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ae-text-muted);
  margin: 6px 0 8px;
  font-weight: 600;
}
.art-analytics-viewers-list {
  list-style: none;
  padding: 0;
  margin: 0 0 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.art-analytics-viewers-list li {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  font-size: 13px;
  padding: 6px 0;
  border-bottom: 1px solid var(--ae-grey-border);
}
.art-analytics-viewers-list li:last-child { border-bottom: none; }
.art-analytics-viewer-name { font-weight: 600; color: var(--ae-text); }
.art-analytics-viewer-when { font-size: 12px; color: var(--ae-text-muted); white-space: nowrap; }
.art-analytics-self {
  font-size: 11px;
  color: var(--ae-purple);
  margin-left: 6px;
  font-weight: 600;
}

.art-analytics-empty,
.art-analytics-error {
  padding: 14px 4px;
  font-size: 13px;
  color: var(--ae-text-muted);
  line-height: 1.5;
}
.art-analytics-error { color: #991B1B; }
.art-analytics-note {
  margin: 12px 0 0;
  font-size: 12px;
  color: var(--ae-text-muted);
  line-height: 1.5;
}

/* ══════════════════════════════════════════════════════════
   A/B view-mode segmented control (admin-only, meta-bar right)
   ══════════════════════════════════════════════════════════ */
/* Flips between Branded / Original / Compare without committing.
   Visual style: rounded pill container with inline buttons; active
   button carries the AE purple background. Sits inline with the
   existing .art-btn-icon controls in the meta bar. */
.art-view-segmented {
  display: inline-flex;
  align-items: stretch;
  background: var(--ae-grey-light);
  border: 1px solid var(--ae-grey-border);
  border-radius: var(--ae-radius-md);
  padding: 2px;
  gap: 2px;
  font-family: inherit;
}
.art-view-seg-btn {
  background: transparent;
  border: 0;
  padding: 6px 12px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  color: var(--ae-text-secondary);
  cursor: pointer;
  border-radius: calc(var(--ae-radius-md) - 2px);
  transition: background 140ms ease, color 140ms ease;
  white-space: nowrap;
}
.art-view-seg-btn:hover {
  background: rgba(95, 81, 213, 0.08);
  color: var(--ae-purple);
}
.art-view-seg-btn-active {
  background: var(--ae-purple);
  color: #fff;
}
.art-view-seg-btn-active:hover {
  background: #5045C0;
  color: #fff;
}

/* ══════════════════════════════════════════════════════════
   Compare mode — side-by-side iframes (admin-only)
   ══════════════════════════════════════════════════════════ */
/* Replaces the single .art-frame with a two-column grid. Each pane
   has a small label on top. The same height math as .art-stage
   would leave awkward gaps — using flex on the pane itself handles
   variable label heights cleanly. */
.art-stage-compare {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  width: 100%;
  height: 100%;
}
.art-compare-pane {
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow: hidden;
  min-width: 0;
}
.art-compare-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ae-text-muted);
  padding: 0 4px;
  flex-shrink: 0;
}
.art-compare-frame {
  flex: 1;
  width: 100%;
  border: 1px solid var(--ae-grey-border);
  border-radius: var(--ae-radius-md);
  background: #fff;
  display: block;
}

/* ══════════════════════════════════════════════════════════
   Branding modal — preview-side-by-side link
   ══════════════════════════════════════════════════════════ */
.art-brand-preview-row {
  margin: 14px 0 0;
  padding: 12px 14px;
  background: var(--ae-grey-light);
  border-radius: var(--ae-radius-md);
  border: 1px dashed var(--ae-grey-border);
}
.art-brand-preview-link {
  font-size: 13px;
  font-weight: 600;
  color: var(--ae-purple);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.art-brand-preview-link:hover { text-decoration: underline; }

/* ══════════════════════════════════════════════════════════
   Upload: 'Apply AE branding' checkbox row (admin delegation)
   ══════════════════════════════════════════════════════════ */
.art-brand-apply-field {
  padding: 14px 16px;
  background: linear-gradient(135deg,
    color-mix(in srgb, #FF5233 6%, transparent),
    color-mix(in srgb, #5F51D5 6%, transparent));
  border: 1px solid color-mix(in srgb, #FF5233 24%, transparent);
  border-radius: var(--ae-radius-md);
}
.art-brand-apply-toggle {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  cursor: pointer;
  margin: 0;
}
.art-brand-apply-toggle input[type="checkbox"] {
  margin-top: 3px;
  width: 16px;
  height: 16px;
  accent-color: var(--ae-purple);
  cursor: pointer;
  flex-shrink: 0;
}
.art-brand-apply-body {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 14px;
  line-height: 1.4;
}
.art-brand-apply-body strong {
  font-weight: 700;
  color: var(--ae-text);
}
.art-brand-apply-sub {
  font-size: 12px;
  color: var(--ae-text-secondary);
  line-height: 1.5;
}

/* ══════════════════════════════════════════════════════════
   Responsive
   ══════════════════════════════════════════════════════════ */
@media (max-width: 900px) {
  .art-form-grid { grid-template-columns: 1fr; }
  .art-new { padding: 24px 20px 60px; }
  .art-library { padding: 24px 20px 60px; }
  .art-meta-bar { padding: 12px 20px; flex-wrap: wrap; }
  .art-stage { padding: 12px 16px 16px; height: calc(100vh - 64px - 100px); }
  .art-advanced-default { display: none; }
  .art-lib-toolbar { flex-direction: column; align-items: stretch; }
  .art-lib-toolbar .art-lib-search { max-width: none; }
  .art-card-menu-btn { opacity: 1; }  /* always visible on touch */
  .art-publish-as-change,
  .art-publish-as-reset { margin-left: 0; }
  .art-analytics { padding: 0 20px; }
  /* On tight screens, the segmented control can get squeezed — let
     it wrap to the next line under the icon buttons. */
  .art-view-segmented {
    margin-top: 8px;
    flex: 1;
    justify-content: flex-start;
  }
  /* Compare view collapses to stacked iframes on narrow screens. */
  .art-stage-compare {
    grid-template-columns: 1fr;
    grid-auto-rows: minmax(320px, 1fr);
  }
}

/* ── Phone (≤640px) — Gallery flow tighter pass ─────────────────────────
   The 900px block above handles tablet/small-laptop layout. This block
   layers on phone-specific adjustments so the upload + share + view
   flow is genuinely usable on a mobile screen — Matt's primary mobile
   use case is recipients clicking shared links and viewing artifacts. */
@media (max-width: 640px) {
  /* ─── Viewer (/a/{slug}) ─────────────────────────────────────────
     Meta bar wraps to two rows: title row + action row. Action buttons
     drop their text labels on phones (icon-only); the title is what
     matters most. Stage height accounts for the wrapped meta bar. */
  .art-meta-bar {
    padding: 10px max(16px, env(safe-area-inset-right))
             10px max(16px, env(safe-area-inset-left));
    gap: 8px;
    flex-wrap: wrap;
  }
  .art-meta-left { flex-basis: 100%; min-width: 0; }
  .art-meta-title { font-size: 15px; }
  .art-meta-sub { font-size: 11px; gap: 4px; }
  .art-meta-right {
    flex-basis: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    /* Allow horizontal scroll for the action row when there are many
       admin buttons — easier than picking which to hide. */
  }
  .art-btn-icon {
    min-height: 40px;
    padding: 8px 10px;
  }
  .art-btn-icon span {
    /* Hide button text labels on phones — icons only, save space. */
    position: absolute;
    width: 1px; height: 1px;
    padding: 0; margin: -1px; overflow: hidden;
    clip: rect(0,0,0,0); white-space: nowrap; border: 0;
  }
  .art-stage {
    /* 56px hub header (mobile) + ~88px wrapped meta bar = 144px */
    padding: 12px max(12px, env(safe-area-inset-right))
             max(12px, env(safe-area-inset-bottom))
             max(12px, env(safe-area-inset-left));
    height: calc(100dvh - 56px - 88px);
  }
  .art-frame { border-radius: var(--ae-radius-sm); }

  /* ─── Upload (/upload) ───────────────────────────────────────────
     Drop zone is tap-friendly (the hidden file input + button trigger
     work on phones). Form stacks single-column. Submit button is
     full-width and meets the 48px tap-target bar. */
  .art-new {
    padding: 20px max(16px, env(safe-area-inset-right))
             max(60px, env(safe-area-inset-bottom))
             max(16px, env(safe-area-inset-left));
  }
  .art-new-intro h1 { font-size: 1.375rem; }
  .art-new-intro p { font-size: 0.9375rem; }
  .art-dropzone {
    padding: 32px 20px;
    min-height: 180px;
  }
  .art-drop-title { font-size: 1rem; }
  .art-drop-sub { font-size: 0.875rem; }
  .art-drop-browse {
    /* Tap target — explicit padding so finger has room. */
    padding: 8px 12px;
    min-height: 44px;
  }
  .art-form-grid { gap: 16px; }
  .art-field input,
  .art-field textarea,
  .art-field .art-select,
  .art-select {
    font-size: 16px;  /* prevents iOS zoom on focus */
    padding: 12px 14px;
    min-height: 48px;
    box-sizing: border-box;
  }
  .art-btn-primary,
  .art-btn-secondary {
    width: 100%;
    justify-content: center;
    min-height: 48px;
    font-size: 0.9375rem;
  }
  /* The publish-action row may have multiple buttons — let them stack
     and be full-width rather than fight for inline space. */
  .art-publish-row,
  .art-form-actions {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  /* ─── Library (/library) ─────────────────────────────────────────
     Single-column card grid. Full-width search input. Tap targets on
     card menu and quick actions. */
  .art-library {
    padding: 20px max(16px, env(safe-area-inset-right))
             max(60px, env(safe-area-inset-bottom))
             max(16px, env(safe-area-inset-left));
  }
  .art-lib-grid { grid-template-columns: 1fr; gap: 12px; }
  .art-lib-search input {
    font-size: 16px;  /* prevents iOS zoom */
    padding: 12px 14px 12px 40px;
    min-height: 48px;
  }
  .art-card-thumb { aspect-ratio: 16 / 9; }
  .art-card-menu-btn {
    /* Already opacity:1 on touch in 900px block; ensure it has tap room. */
    min-width: 36px;
    min-height: 36px;
  }

  /* ─── Modals (replace, feature, edit, etc.) ──────────────────────
     The shared .art-modal-dialog is a centered card with fixed width.
     On phones, take the full width with edge gutters and full-height
     scroll. Action buttons stack. */
  .art-modal-dialog {
    width: calc(100% - 24px);
    max-height: calc(100dvh - 24px);
    max-width: none;
  }
  .art-modal-actions {
    flex-direction: column-reverse;  /* primary CTA on top */
    gap: 8px;
  }
  .art-modal-actions .art-btn-primary,
  .art-modal-actions .art-btn-secondary { width: 100%; }
}
