/* ==========================================================================
   Atelier — gallery stylesheet. No build step, no external dependencies.
   ========================================================================== */

:root {
  --bg: #f5f2ec;
  --bg-elev: #fbfaf7;
  --surface: #ffffff;
  --ink: #1c1a17;
  --ink-2: #4d4842;
  --muted: #857d73;
  --line: #e4ded4;
  --line-strong: #cfc7ba;
  --accent: #a4462a;
  --accent-ink: #ffffff;
  --accent-soft: #f3e3dc;
  --ok: #3f7a4f;
  --ok-soft: #e1efe4;
  --warn: #9a6a12;
  --warn-soft: #f6ecd4;
  --danger: #b3261e;
  --danger-soft: #f9e0de;
  --shadow-sm: 0 1px 2px rgb(28 26 23 / .06), 0 1px 1px rgb(28 26 23 / .04);
  --shadow: 0 10px 30px -12px rgb(28 26 23 / .25), 0 2px 6px rgb(28 26 23 / .06);
  --shadow-lg: 0 30px 60px -20px rgb(28 26 23 / .35);
  --radius: 14px;
  --radius-sm: 8px;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", "Source Serif Pro", Georgia, serif;
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --wrap: 1320px;
  --header-h: 68px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121110; --bg-elev: #181716; --surface: #1e1c1a;
    --ink: #f1ede6; --ink-2: #cbc4b9; --muted: #948b80;
    --line: #2d2a27; --line-strong: #403b36;
    --accent: #e0835f; --accent-ink: #1a0f0a; --accent-soft: #3a2219;
    --ok: #7cc28e; --ok-soft: #1d2e22; --warn: #e2b252; --warn-soft: #33290f;
    --danger: #f08a82; --danger-soft: #3a1b19;
    --shadow-sm: 0 1px 2px rgb(0 0 0 / .4);
    --shadow: 0 10px 30px -12px rgb(0 0 0 / .7), 0 2px 6px rgb(0 0 0 / .3);
    --shadow-lg: 0 30px 60px -20px rgb(0 0 0 / .8);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #121110; --bg-elev: #181716; --surface: #1e1c1a;
  --ink: #f1ede6; --ink-2: #cbc4b9; --muted: #948b80;
  --line: #2d2a27; --line-strong: #403b36;
  --accent: #e0835f; --accent-ink: #1a0f0a; --accent-soft: #3a2219;
  --ok: #7cc28e; --ok-soft: #1d2e22; --warn: #e2b252; --warn-soft: #33290f;
  --danger: #f08a82; --danger-soft: #3a1b19;
  --shadow-sm: 0 1px 2px rgb(0 0 0 / .4);
  --shadow: 0 10px 30px -12px rgb(0 0 0 / .7), 0 2px 6px rgb(0 0 0 / .3);
  --shadow-lg: 0 30px 60px -20px rgb(0 0 0 / .8);
  color-scheme: dark;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 16px); }
body {
  margin: 0; min-height: 100vh; display: flex; flex-direction: column;
  background: var(--bg); color: var(--ink);
  font: 16px/1.6 var(--sans); -webkit-font-smoothing: antialiased;
}
main { flex: 1; }
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
svg { width: 1.1em; height: 1.1em; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
h1, h2, h3 { margin: 0; line-height: 1.15; font-weight: 500; }
p { margin: 0 0 .75em; }
button, input, select, textarea { font: inherit; color: inherit; }
::selection { background: var(--accent); color: var(--accent-ink); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 clamp(16px, 4vw, 40px); }
.narrow { max-width: 760px; }
.center { text-align: center; justify-content: center; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.accent { color: var(--accent); }
.sr-only, .skip:not(:focus) { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip:focus { position: fixed; top: 8px; left: 8px; z-index: 100; background: var(--surface); padding: 8px 14px; border-radius: 8px; }
.link { color: var(--accent); font-weight: 500; }
.link:hover { text-decoration: underline; text-underline-offset: 3px; }

.eyebrow { font-size: .75rem; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); font-weight: 600; margin-bottom: .6rem; }
.display { font-family: var(--serif); font-size: clamp(2.6rem, 6vw, 4.8rem); letter-spacing: -.02em; line-height: 1.02; }
.display em, .page-title em { font-style: italic; color: var(--accent); }
.page-title { font-family: var(--serif); font-size: clamp(2rem, 4vw, 3rem); letter-spacing: -.015em; }
.section-title { font-family: var(--serif); font-size: clamp(1.5rem, 2.6vw, 2rem); }
.lede { font-size: 1.15rem; color: var(--ink-2); max-width: 36ch; margin-top: 1.2rem; }
.center .lede { margin-inline: auto; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45em;
  padding: .7em 1.25em; border-radius: 999px; border: 1px solid transparent;
  font-weight: 600; font-size: .95rem; line-height: 1.2; cursor: pointer; white-space: nowrap;
  transition: background .2s, color .2s, border-color .2s, transform .15s, box-shadow .2s;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--ink); color: var(--bg); }
.btn-primary:hover:not(:disabled) { background: var(--accent); color: var(--accent-ink); box-shadow: var(--shadow); }
.btn-ghost { background: transparent; border-color: var(--line-strong); color: var(--ink); }
.btn-ghost:hover:not(:disabled) { border-color: var(--ink); background: var(--surface); }
.btn-danger { background: transparent; color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, transparent); }
.btn-danger:hover:not(:disabled) { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-sm { padding: .45em .95em; font-size: .85rem; }
.btn-block { width: 100%; }
.icon-btn {
  display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 50%;
  border: 1px solid transparent; background: transparent; cursor: pointer; color: var(--ink-2);
}
.icon-btn:hover { background: var(--surface); border-color: var(--line); color: var(--ink); }
.icon-btn svg { width: 20px; height: 20px; }
.i-moon { display: none; }
[data-theme="dark"] .i-sun { display: none; }
[data-theme="dark"] .i-moon { display: block; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 40; height: var(--header-h);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
}
.header-inner { display: flex; align-items: center; gap: 28px; height: 100%; }
.brand { display: inline-flex; align-items: center; gap: .6rem; font-family: var(--serif); font-size: 1.45rem; letter-spacing: -.01em; }
.brand.small { font-size: 1.2rem; }
.brand-mark {
  width: 22px; height: 22px; border-radius: 4px; position: relative;
  background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 50%, #e8b04b));
  box-shadow: inset 0 0 0 3px var(--bg), 0 0 0 1px var(--ink);
}
.main-nav { display: flex; gap: 4px; }
.main-nav a { padding: .45rem .85rem; border-radius: 999px; color: var(--ink-2); font-weight: 500; font-size: .95rem; transition: .2s; }
.main-nav a:hover { color: var(--ink); background: var(--surface); }
.main-nav a[aria-current="page"] { color: var(--ink); background: var(--surface); box-shadow: var(--shadow-sm); }
.header-search { flex: 1; max-width: 380px; margin-left: auto; position: relative; }
.header-search svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.header-search input {
  width: 100%; padding: .6rem 1rem .6rem 2.5rem; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); font-size: .92rem; transition: .2s;
}
.header-search input:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 15%, transparent); }
.header-actions { display: flex; align-items: center; gap: 8px; }

.avatar {
  display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 45%, #3a2a6b));
  color: #fff; font-family: var(--serif); font-size: 1.05rem; font-weight: 600; flex-shrink: 0; list-style: none; cursor: pointer;
}
.avatar::-webkit-details-marker { display: none; }
.avatar-lg { width: 56px; height: 56px; font-size: 1.5rem; }
.avatar-xl { width: 96px; height: 96px; font-size: 2.6rem; margin: 0 auto 1rem; box-shadow: var(--shadow); }
.menu { position: relative; }
.menu[open] > summary { box-shadow: 0 0 0 3px var(--bg), 0 0 0 5px var(--accent); }
.menu-panel {
  position: absolute; right: 0; top: calc(100% + 10px); min-width: 220px; padding: 6px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-lg);
  animation: pop .16s ease-out;
}
.menu-head { padding: 10px 12px; border-bottom: 1px solid var(--line); margin-bottom: 4px; display: grid; }
.menu-head span { color: var(--muted); font-size: .85rem; }
.menu-panel a, .menu-panel button {
  display: block; width: 100%; text-align: left; padding: 9px 12px; border-radius: 8px;
  background: none; border: 0; cursor: pointer; font-size: .93rem;
}
.menu-panel a:hover, .menu-panel button:hover { background: var(--bg); }
.menu-panel form { border-top: 1px solid var(--line); margin-top: 4px; padding-top: 4px; }
@keyframes pop { from { opacity: 0; transform: translateY(-6px) scale(.98); } }

/* ---------- Toasts ---------- */
.toasts { position: fixed; top: calc(var(--header-h) + 12px); right: 16px; z-index: 60; display: grid; gap: 8px; max-width: min(420px, calc(100vw - 32px)); }
.toast {
  display: flex; align-items: flex-start; gap: 12px; padding: 12px 14px 12px 16px;
  background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--ink);
  border-radius: 10px; box-shadow: var(--shadow); font-size: .93rem; animation: slidein .3s ease-out;
}
.toast-success { border-left-color: var(--ok); }
.toast-error { border-left-color: var(--danger); }
.toast-info { border-left-color: var(--accent); }
.toast.is-leaving { opacity: 0; transform: translateX(20px); transition: .3s; }
.toast-x { margin-left: auto; background: none; border: 0; font-size: 1.3rem; line-height: 1; cursor: pointer; color: var(--muted); }
@keyframes slidein { from { opacity: 0; transform: translateX(24px); } }

/* ---------- Hero ---------- */
.hero { padding: clamp(40px, 7vw, 96px) 0 clamp(32px, 5vw, 64px); }
.hero-inner { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: clamp(32px, 5vw, 72px); align-items: center; }
.hero-cta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 2rem; }
.hero-empty { padding: clamp(80px, 12vw, 160px) 0; }
.hero-mosaic {
  display: grid; gap: 14px; height: clamp(360px, 48vw, 600px);
  grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(2, 1fr);
}
.mosaic-item {
  position: relative; overflow: hidden; border-radius: var(--radius);
  background: var(--c, var(--line)); box-shadow: var(--shadow);
}
.mosaic-item img { width: 100%; height: 100%; object-fit: cover; transition: transform .8s cubic-bezier(.2, .7, .2, 1); }
.mosaic-item:hover img { transform: scale(1.05); }
.mosaic-caption {
  position: absolute; inset: auto 0 0 0; padding: 32px 14px 12px; color: #fff; font-size: .82rem;
  background: linear-gradient(transparent, rgb(0 0 0 / .65)); opacity: 0; transform: translateY(8px); transition: .3s;
}
.mosaic-caption strong { display: block; font-family: var(--serif); font-size: 1.05rem; font-weight: 500; }
.mosaic-item:hover .mosaic-caption, .mosaic-item:focus-visible .mosaic-caption { opacity: 1; transform: none; }
.mosaic-1 { grid-template-columns: 1fr; grid-template-rows: 1fr; }
.mosaic-2 { grid-template-rows: 1fr; grid-template-columns: 3fr 2fr; }
.mosaic-3 .mosaic-item:first-child { grid-column: span 2; grid-row: span 2; }
.mosaic-4 .mosaic-item:first-child { grid-column: span 2; grid-row: span 2; }
.mosaic-4 { grid-template-rows: repeat(3, 1fr); }
.mosaic-4 .mosaic-item:first-child { grid-row: span 3; }
.mosaic-5 { grid-template-columns: repeat(4, 1fr); }
.mosaic-5 .mosaic-item:first-child { grid-column: span 2; grid-row: span 2; }

/* ---------- Sections ---------- */
.section { padding-top: clamp(24px, 4vw, 48px); padding-bottom: clamp(48px, 7vw, 96px); }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.section-head .muted { margin: 0; }
.page-head { margin-bottom: 28px; }
.page-head.row { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.sort-form select {
  appearance: none; padding: .5rem 2.2rem .5rem 1rem; border-radius: 999px; border: 1px solid var(--line-strong);
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23857d73' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right .8rem center / 14px;
  font-size: .9rem; cursor: pointer;
}

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 24px; }
.chips.center { justify-content: center; }
.chip {
  padding: .3rem .8rem; border-radius: 999px; font-size: .85rem; color: var(--ink-2);
  background: var(--surface); border: 1px solid var(--line); transition: .2s;
}
.chip:hover { border-color: var(--accent); color: var(--accent); }
.chip-active { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.active-filters { margin-top: 1rem; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; color: var(--muted); font-size: .9rem; }

/* ---------- Masonry grid ---------- */
.grid { columns: 4 280px; column-gap: 20px; }
.grid > .card { break-inside: avoid; margin-bottom: 20px; }
.grid > .load-more { column-span: all; display: flex; width: max-content; margin: 24px auto 0; }
.card { position: relative; animation: fadeup .5s ease-out both; }
.card-link { display: block; position: relative; border-radius: var(--radius); overflow: hidden; background: var(--line); box-shadow: var(--shadow-sm); transition: box-shadow .3s, transform .3s; }
.card-media { background: var(--c, var(--line)); }
.card-link:hover { box-shadow: var(--shadow-lg); transform: translateY(-3px); }
.card-media img { width: 100%; height: auto; transition: opacity .5s, transform .8s cubic-bezier(.2, .7, .2, 1); }
.js .card-media img:not(.is-loaded) { opacity: 0; }
.card-link:hover .card-media img { transform: scale(1.04); }
.card-overlay {
  position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: flex-end;
  padding: 18px; color: #fff; background: linear-gradient(to top, rgb(0 0 0 / .72), rgb(0 0 0 / 0) 55%);
  opacity: 0; transition: opacity .3s;
}
.card-link:hover .card-overlay, .card-link:focus-visible .card-overlay { opacity: 1; }
.card-title { font-family: var(--serif); font-size: 1.2rem; transform: translateY(8px); transition: transform .35s; }
.card-artist { font-size: .85rem; opacity: .85; margin: 2px 0 0; transform: translateY(8px); transition: transform .35s .03s; }
.card-link:hover .card-title, .card-link:hover .card-artist { transform: none; }
.card-stats { display: flex; gap: 12px; margin: 8px 0 0; font-size: .8rem; opacity: .85; }
.card-stats span { display: inline-flex; align-items: center; gap: 4px; }
.card-stats svg { width: 14px; height: 14px; }
.card.is-draft .card-link { outline: 2px dashed var(--line-strong); outline-offset: 3px; }
.badge { position: absolute; top: 12px; left: 12px; padding: .2rem .6rem; border-radius: 999px; font-size: .72rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.badge-draft { background: var(--warn-soft); color: var(--warn); }
.badge-featured { left: auto; right: 12px; background: rgb(0 0 0 / .45); color: #ffd98a; backdrop-filter: blur(6px); }
@keyframes fadeup { from { opacity: 0; transform: translateY(14px); } }

.strip { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(220px, 1fr); gap: 18px; overflow-x: auto; padding-bottom: 8px; scroll-snap-type: x mandatory; }
.strip .card { scroll-snap-align: start; }
.strip .card-media img { aspect-ratio: 1; object-fit: cover; }

.empty { text-align: center; padding: 72px 20px; border: 1px dashed var(--line-strong); border-radius: var(--radius); color: var(--ink-2); }
.empty > p:first-child { font-family: var(--serif); font-size: 1.5rem; }

/* ---------- Artwork page ---------- */
.artwork-layout { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: clamp(24px, 4vw, 56px); padding-top: 32px; padding-bottom: 32px; align-items: start; }
.artwork-stage {
  position: relative; margin: 0; border-radius: var(--radius); min-height: 320px;
  background: radial-gradient(ellipse at center, color-mix(in srgb, var(--c, #888) 22%, var(--bg-elev)), var(--bg-elev) 70%);
  border: 1px solid var(--line); display: grid; place-items: center; padding: clamp(16px, 4vw, 56px);
}
.stage-btn { padding: 0; border: 0; background: none; cursor: zoom-in; display: block; }
.stage-btn img { max-height: calc(100vh - var(--header-h) - 140px); width: auto; height: auto; margin: auto; box-shadow: var(--shadow-lg); border-radius: 2px; }
.stage-nav {
  position: absolute; top: 50%; transform: translateY(-50%); width: 44px; height: 44px; display: grid; place-items: center;
  border-radius: 50%; background: var(--surface); box-shadow: var(--shadow); font-size: 1.6rem; line-height: 1; opacity: .0; transition: .25s;
}
.artwork-stage:hover .stage-nav, .stage-nav:focus-visible { opacity: 1; }
.stage-nav.prev { left: 14px; } .stage-nav.next { right: 14px; }
.artwork-info { position: sticky; top: calc(var(--header-h) + 24px); }
.artwork-title { font-family: var(--serif); font-size: clamp(2rem, 3.4vw, 2.8rem); letter-spacing: -.015em; margin-bottom: 18px; }
.artist-line { display: inline-flex; align-items: center; gap: 12px; margin-bottom: 24px; }
.artist-line span:last-child { display: grid; line-height: 1.3; }
.artist-line small { color: var(--muted); }
.artist-line:hover strong { color: var(--accent); }
.specs { margin: 0 0 24px; border-top: 1px solid var(--line); }
.specs div { display: flex; justify-content: space-between; gap: 16px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: .93rem; }
.specs dt { color: var(--muted); }
.specs dd { margin: 0; text-align: right; }
.specs a:hover { color: var(--accent); }
.artwork-desc { white-space: pre-line; color: var(--ink-2); margin-bottom: 24px; font-size: 1.02rem; }
.artwork-actions { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.like-btn {
  display: inline-flex; align-items: center; gap: 8px; padding: .55rem 1.1rem; border-radius: 999px;
  border: 1px solid var(--line-strong); background: var(--surface); cursor: pointer; font-weight: 600; transition: .2s;
}
.like-btn svg { width: 20px; height: 20px; transition: transform .3s cubic-bezier(.3, 1.8, .5, 1); }
.like-btn:hover { border-color: var(--accent); color: var(--accent); }
.like-btn.is-liked { background: var(--accent-soft); border-color: transparent; color: var(--accent); }
.like-btn.is-liked svg { fill: currentColor; transform: scale(1.12); }
.like-btn.pulse svg { animation: pulse .45s; }
@keyframes pulse { 50% { transform: scale(1.4); } }
.views { display: inline-flex; align-items: center; gap: 6px; font-size: .9rem; }
.owner-panel { margin-top: 28px; padding: 16px; border-radius: var(--radius); background: var(--bg-elev); border: 1px solid var(--line); }
.owner-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.lightbox { border: 0; padding: 0; max-width: 100vw; max-height: 100vh; width: 100vw; height: 100vh; background: rgb(8 8 8 / .96); color: #fff; }
.lightbox[open] { display: grid; place-items: center; animation: fadein .25s; }
.lightbox::backdrop { background: transparent; }
.lightbox img { max-width: 94vw; max-height: 86vh; object-fit: contain; }
.lightbox-caption { position: absolute; bottom: 16px; left: 0; right: 0; text-align: center; opacity: .75; font-size: .9rem; }
.lightbox-close { position: absolute; top: 16px; right: 20px; background: none; border: 0; color: #fff; font-size: 2.4rem; cursor: pointer; line-height: 1; opacity: .7; }
.lightbox-close:hover { opacity: 1; }
@keyframes fadein { from { opacity: 0; } }

/* ---------- Artists ---------- */
.artist-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 22px; }
.artist-card { border-radius: var(--radius); overflow: hidden; background: var(--surface); border: 1px solid var(--line); transition: .3s; }
.artist-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-3px); }
.artist-cover { height: 160px; background: var(--c, var(--line)); overflow: hidden; }
.artist-cover img { width: 100%; height: 100%; object-fit: cover; transition: transform .8s; }
.artist-card:hover .artist-cover img { transform: scale(1.06); }
.artist-body { padding: 0 20px 20px; margin-top: -28px; position: relative; }
.artist-body .avatar { box-shadow: 0 0 0 4px var(--surface); margin-bottom: 10px; }
.artist-body h2 { font-family: var(--serif); font-size: 1.35rem; }
.artist-body .muted { font-size: .88rem; margin: 2px 0 8px; }
.artist-bio { font-size: .9rem; color: var(--ink-2); margin: 0; }
.profile-head { padding: clamp(40px, 6vw, 80px) 0 16px; border-bottom: 1px solid var(--line); margin-bottom: 8px; }
.profile-bio { font-size: 1.1rem; color: var(--ink-2); max-width: 60ch; margin: 1rem auto; white-space: pre-line; }

/* ---------- Forms ---------- */
.form { display: grid; gap: 18px; }
.field { display: grid; gap: 6px; }
.field > span { font-weight: 600; font-size: .9rem; }
.field small { color: var(--muted); font-size: .82rem; }
.field input, .field textarea, .field select, .search-big input, .inline-search input {
  width: 100%; padding: .75rem .9rem; border-radius: var(--radius-sm); border: 1px solid var(--line-strong);
  background: var(--bg-elev); transition: border-color .2s, box-shadow .2s;
}
.field textarea { resize: vertical; min-height: 96px; }
.field input:focus, .field textarea:focus, .search-big input:focus, .inline-search input:focus {
  outline: none; border-color: var(--ink); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 15%, transparent); background: var(--surface);
}
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-actions { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.search-big { display: flex; gap: 10px; margin-top: 1.4rem; max-width: 640px; }
.search-big input { border-radius: 999px; padding-inline: 1.2rem; }
.inline-search input { padding: .45rem .9rem; border-radius: 999px; width: 220px; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }
.switch { display: flex; align-items: center; gap: 12px; cursor: pointer; font-weight: 500; }
.switch input { position: absolute; opacity: 0; }
.switch-ui { width: 44px; height: 26px; border-radius: 999px; background: var(--line-strong); position: relative; transition: .25s; flex-shrink: 0; }
.switch-ui::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-sm); transition: .25s; }
.switch input:checked + .switch-ui { background: var(--ok); }
.switch input:checked + .switch-ui::after { transform: translateX(18px); }
.switch input:focus-visible + .switch-ui { outline: 2px solid var(--accent); outline-offset: 2px; }

.alert { padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 18px; font-size: .93rem; }
.alert ul { margin: 0; padding-left: 1.1rem; }
.alert-error { background: var(--danger-soft); color: var(--danger); }
.alert-info { background: var(--warn-soft); color: var(--warn); }

.auth-page main { display: grid; place-items: center; padding: 48px 16px; background:
  radial-gradient(1200px 500px at 10% -10%, var(--accent-soft), transparent 60%),
  radial-gradient(900px 500px at 110% 110%, color-mix(in srgb, var(--accent-soft) 60%, transparent), transparent 60%); }
.auth-card { width: 100%; max-width: 440px; background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: clamp(24px, 5vw, 44px); box-shadow: var(--shadow-lg); }
.auth-card .page-title { margin-bottom: 24px; font-size: 2.2rem; }
.setup-card { max-width: 600px; }
.setup-card > .muted { margin: -12px 0 24px; }
.divider { border: 0; border-top: 1px solid var(--line); margin: 4px 0; width: 100%; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .88em; background: var(--bg); padding: .1em .35em; border-radius: 4px; }
.auth-alt { text-align: center; margin: 20px 0 0; font-size: .93rem; }
.auth-alt + .auth-alt { margin-top: 6px; }

/* ---------- Panels / Studio ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: clamp(18px, 3vw, 28px); margin-bottom: 20px; }
.panel-title { font-family: var(--serif); font-size: 1.35rem; margin-bottom: 16px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 14px; margin-bottom: 32px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; display: grid; }
.stat-n { font-family: var(--serif); font-size: 2.1rem; line-height: 1.1; }
.stat-l { color: var(--muted); font-size: .85rem; }
.tabs { display: inline-flex; gap: 4px; padding: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; }
.tabs a { padding: .4rem 1rem; border-radius: 999px; font-size: .9rem; color: var(--ink-2); font-weight: 500; }
.tabs a[aria-current="page"] { background: var(--ink); color: var(--bg); }
.bulk-bar {
  position: sticky; top: calc(var(--header-h) + 8px); z-index: 5; display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 10px 16px; margin-bottom: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; box-shadow: var(--shadow-sm);
}
.bulk-bar .muted { font-size: .88rem; }
.bulk-actions { display: flex; gap: 8px; margin-left: auto; }
.studio-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.studio-item {
  display: grid; grid-template-columns: auto 72px minmax(0, 1fr) auto auto; align-items: center; gap: 16px;
  padding: 12px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); transition: .2s;
}
.studio-item:hover { border-color: var(--line-strong); box-shadow: var(--shadow-sm); }
.studio-item:has(input:checked) { border-color: var(--accent); background: color-mix(in srgb, var(--accent-soft) 40%, var(--surface)); }
.studio-thumb { width: 72px; height: 72px; border-radius: 10px; overflow: hidden; background: var(--c, var(--line)); }
.studio-thumb img { width: 100%; height: 100%; object-fit: cover; }
.studio-title { font-family: var(--serif); font-size: 1.15rem; }
.studio-title:hover { color: var(--accent); }
.studio-meta p { margin: 2px 0 0; }
.tag-line { font-size: .8rem; color: var(--accent); }
.studio-actions { display: flex; gap: 8px; }
.status { display: inline-flex; align-items: center; gap: 6px; padding: .2rem .7rem; border-radius: 999px; font-size: .78rem; font-weight: 600; white-space: nowrap; }
.status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.status.big { font-size: .9rem; padding: .35rem .9rem; }
.status-live { background: var(--ok-soft); color: var(--ok); }
.status-draft { background: var(--warn-soft); color: var(--warn); }

.upload-layout { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 24px; align-items: start; }
.dropzone {
  position: relative; min-height: 440px; border: 2px dashed var(--line-strong); border-radius: 20px; background: var(--bg-elev);
  display: grid; place-items: center; padding: 24px; transition: .2s; text-align: center;
}
.dropzone.is-over { border-color: var(--accent); background: var(--accent-soft); }
.dropzone input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.dropzone-prompt svg { width: 56px; height: 56px; color: var(--muted); stroke-width: 1.2; margin: 0 auto 12px; }
.dropzone-prompt p { margin: 0 0 4px; }
.dropzone.has-files { place-items: start stretch; }
.dropzone.has-files .dropzone-prompt { display: none; }
.previews { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 12px; width: 100%; }
.previews:empty { display: none; }
.preview { position: relative; border-radius: 10px; overflow: hidden; aspect-ratio: 1; background: var(--line); animation: fadeup .3s both; }
.preview img { width: 100%; height: 100%; object-fit: cover; }
.preview span { position: absolute; inset: auto 0 0 0; padding: 4px 8px; font-size: .72rem; color: #fff; background: rgb(0 0 0 / .55); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.upload-meta { position: sticky; top: calc(var(--header-h) + 16px); display: grid; gap: 16px; margin: 0; }

.edit-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 24px; align-items: start; }
.edit-image { display: grid; place-items: center; border-radius: var(--radius); background: var(--bg-elev); border: 1px solid var(--line); padding: 24px; margin-bottom: 10px; }
.edit-image img { max-height: 520px; width: auto; height: auto; box-shadow: var(--shadow); }
.publish-panel { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 16px; }
.publish-panel .panel-title { margin-bottom: 4px; font-size: 1.15rem; }
.publish-panel p { margin: 0; }
.danger-zone { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 28px; padding-top: 20px; border-top: 1px solid var(--line); }
.danger-zone p { margin: 0; }

/* ---------- Tables (admin) ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th { text-align: left; font-size: .75rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.table td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr.is-muted td { opacity: .55; }
.table .actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
.table .actions form { display: flex; gap: 6px; }
.mini-thumb { display: block; width: 44px; height: 44px; border-radius: 6px; overflow: hidden; background: var(--c, var(--line)); }
.mini-thumb img { width: 100%; height: 100%; object-fit: cover; }
.pager { display: flex; gap: 8px; justify-content: center; margin-top: 16px; }

.credentials dd code { font-size: 1.05rem; padding: .2em .5em; user-select: all; }
.add-user-form .form-actions { gap: 20px; }
.error-page { padding: 120px 0; }
.error-code { font-family: var(--serif); font-size: clamp(5rem, 16vw, 10rem); line-height: 1; margin: 0 0 1rem; color: var(--accent); font-style: italic; }
.error-page .page-title { margin-bottom: 2rem; }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--line); padding: 40px 0; margin-top: 40px; }
.footer-inner { display: flex; justify-content: space-between; gap: 24px; flex-wrap: wrap; align-items: flex-start; }
.footer-inner p { margin: 6px 0 0; font-size: .9rem; }
.footer-inner nav { display: flex; gap: 22px; flex-wrap: wrap; font-size: .93rem; color: var(--ink-2); }
.footer-inner nav a:hover { color: var(--accent); }

/* ---------- Responsive ---------- */
@media (max-width: 1080px) {
  .hero-inner { grid-template-columns: 1fr; }
  .artwork-layout { grid-template-columns: 1fr; }
  .artwork-info { position: static; }
  .upload-layout, .edit-layout { grid-template-columns: 1fr; }
  .upload-meta { position: static; }
}
@media (max-width: 820px) {
  .main-nav { display: none; }
  .header-inner { gap: 12px; }
  .header-search { max-width: none; }
  .hide-sm { display: none; }
  .studio-item { grid-template-columns: auto 56px minmax(0, 1fr); }
  .studio-thumb { width: 56px; height: 56px; }
  .studio-item .status, .studio-actions { grid-column: 3; justify-self: start; }
  .bulk-bar { border-radius: var(--radius); }
  .bulk-actions { margin-left: 0; }
}
@media (max-width: 560px) {
  :root { --header-h: 60px; }
  .brand { font-size: 1.2rem; }
  .header-search input { font-size: 16px; }
  .grid { columns: 2 140px; column-gap: 12px; }
  .grid > .card { margin-bottom: 12px; }
  .hero-mosaic { height: 340px; gap: 8px; }
  .field-row { grid-template-columns: 1fr; }
  .search-big { flex-direction: column; }
  .publish-panel, .danger-zone { flex-direction: column; align-items: stretch; }
  .card-overlay { opacity: 1; background: linear-gradient(to top, rgb(0 0 0 / .6), transparent 45%); padding: 12px; }
  .card-title { font-size: 1rem; transform: none; }
  .card-artist { transform: none; }
  .card-stats { display: none; }
  .stage-nav { opacity: 1; }
}
@media (hover: none) {
  .card-overlay { opacity: 1; background: linear-gradient(to top, rgb(0 0 0 / .6), transparent 45%); }
  .card-title, .card-artist { transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
