:root {
  color-scheme: light dark;
  --ink: #231f1b;
  --muted: #6f6860;
  --line: #ded8cf;
  --paper: #fbfaf7;
  --panel: #f2eee7;
  --accent: #8f493c;
  --accent-dark: #5f2f29;
  --surface: #ffffff;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink: #f6eee4;
    --muted: #c6b4a0;
    --line: #4c3529;
    --paper: #1f1511;
    --panel: #2b1d17;
    --accent: #c9805f;
    --accent-dark: #e2ad86;
    --surface: #2a1c16;
  }
}

:root[data-theme="light"] {
  color-scheme: light;
  --ink: #231f1b;
  --muted: #6f6860;
  --line: #ded8cf;
  --paper: #fbfaf7;
  --panel: #f2eee7;
  --accent: #8f493c;
  --accent-dark: #5f2f29;
  --surface: #ffffff;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --ink: #f6eee4;
  --muted: #c6b4a0;
  --line: #4c3529;
  --paper: #1f1511;
  --panel: #2b1d17;
  --accent: #c9805f;
  --accent-dark: #e2ad86;
  --surface: #2a1c16;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--paper);
  line-height: 1.5;
}

a {
  color: inherit;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 18px clamp(18px, 4vw, 56px);
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--paper) 92%, var(--surface));
  backdrop-filter: blur(12px);
}

.brand {
  font-family: Georgia, serif;
  font-size: 28px;
  text-decoration: none;
  letter-spacing: 0;
}

.brand-button {
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
}

.brand span,
footer span {
  color: var(--accent);
}

nav {
  flex: 1;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 18px;
  font-size: 14px;
}

.cart-nav {
  margin-left: auto;
}

nav a,
.nav-button {
  appearance: none;
  border: 0;
  padding: 0;
  background: transparent;
  font: inherit;
  line-height: inherit;
  text-decoration: none;
  color: var(--muted);
  cursor: pointer;
}

nav a:hover,
.nav-button:hover {
  color: var(--ink);
}

main {
  overflow: hidden;
}

main[hidden],
.page-view[hidden] {
  display: none;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(320px, 1.1fr);
  gap: clamp(32px, 6vw, 84px);
  align-items: center;
  min-height: 78vh;
  padding: clamp(48px, 8vw, 96px) clamp(18px, 4vw, 56px) 36px;
}

.hero h1,
.section h2 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 500;
  line-height: 1.04;
  letter-spacing: 0;
}

.hero h1 {
  max-width: 760px;
  font-size: clamp(44px, 7vw, 88px);
}

.section h2 {
  font-size: clamp(32px, 4vw, 56px);
}

.lead {
  max-width: 640px;
  margin: 24px 0 0;
  color: var(--muted);
  font-size: clamp(18px, 2vw, 22px);
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.hero-actions,
.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 28px;
}

.auth-switch {
  display: flex;
  gap: 8px;
  margin: 14px 0;
}

.notice {
  display: flex;
  align-items: center;
  gap: 14px;
  justify-content: space-between;
  margin: 18px 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.notice span {
  flex: 1;
  color: var(--muted);
}

.optional-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.section-spacer {
  margin-top: 34px;
}

.button,
.chip,
.save-button {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 16px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  text-decoration: none;
  cursor: pointer;
}

.button.primary,
.chip.active {
  border-color: var(--accent);
  background: var(--accent);
  color: white;
}

.button.secondary {
  background: transparent;
}

.hero-wall {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  grid-auto-rows: minmax(74px, 12vw);
  gap: 12px;
  align-items: stretch;
}

.art-tile,
.art-square,
.mini-wall div {
  background: var(--art);
  border: 1px solid color-mix(in srgb, var(--art) 55%, #111);
}

.art-tile {
  min-height: 120px;
}

.art-tile.large {
  grid-column: span 3;
  grid-row: span 2;
}

.art-tile.wide {
  grid-column: span 3;
}

.art-tile:not(.large):not(.wide) {
  grid-column: span 2;
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.stats div {
  padding: 24px clamp(18px, 4vw, 56px);
  border-right: 1px solid var(--line);
}

.stats div:last-child {
  border-right: 0;
}

.stats strong {
  display: block;
  font-size: 24px;
}

.stats span,
.quiet,
.card-body p,
.timeline span,
.profile-row span,
.feature-grid p,
.admin-section p,
footer p {
  color: var(--muted);
}

.section {
  padding: clamp(58px, 8vw, 108px) clamp(18px, 4vw, 56px);
}

.section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 28px;
}

.section-heading .quiet {
  max-width: 460px;
}

.art-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 300px));
  justify-content: start;
  gap: 18px;
}

.art-card {
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.art-card.is-hidden {
  display: none;
}

.art-square {
  width: 100%;
  aspect-ratio: 1;
}

.card-body {
  padding: 16px;
}

.card-body h3,
.feature-grid h3 {
  margin: 0 0 6px;
  font-size: 18px;
  overflow-wrap: anywhere;
}

.card-body p {
  margin: 0;
  font-size: 14px;
}

.card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 16px;
  font-weight: 700;
}

.text-button {
  appearance: none;
  border: 0;
  padding: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.title-button:hover,
.artist-button:hover {
  color: var(--accent-dark);
  text-decoration: underline;
}

.artist-button {
  color: var(--muted);
}

.save-button {
  min-height: 34px;
  padding: 6px 10px;
  font-size: 13px;
}

.save-button.is-saved {
  border-color: var(--accent);
  color: var(--accent-dark);
}

.two-column {
  display: grid;
  grid-template-columns: minmax(0, 0.85fr) minmax(320px, 1.15fr);
  gap: clamp(28px, 6vw, 80px);
  align-items: center;
}

.two-column p {
  max-width: 620px;
}

.text-link {
  display: inline-block;
  margin-top: 14px;
  color: var(--accent-dark);
  font-weight: 700;
}

.archive-panel,
.collection-card,
.feature-grid > div {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.archive-panel {
  display: grid;
  grid-template-columns: 0.9fr 1.1fr;
  gap: 18px;
  padding: 18px;
}

.archive-art {
  align-self: start;
}

.timeline {
  display: grid;
  gap: 14px;
}

.timeline div {
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.timeline strong,
.timeline span,
.profile-row strong,
.profile-row span {
  display: block;
}

.form-section {
  background: var(--panel);
}

.listing-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

label {
  display: grid;
  gap: 8px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
}

input[aria-invalid="true"],
select[aria-invalid="true"],
textarea[aria-invalid="true"] {
  border-color: #b42318;
  box-shadow: 0 0 0 3px color-mix(in srgb, #b42318 18%, transparent);
}

.field-error {
  margin-top: -2px;
  color: #b42318;
  font-size: 13px;
  font-weight: 700;
}

textarea {
  min-height: 110px;
  resize: vertical;
}

.span-2 {
  grid-column: span 2;
}

.collection-card {
  padding: 20px;
}

.profile-row {
  display: flex;
  gap: 12px;
  align-items: center;
}

.avatar {
  display: grid;
  width: 52px;
  height: 52px;
  place-items: center;
  border-radius: 50%;
  background: var(--panel);
  font-weight: 800;
}

.mini-wall {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin: 20px 0;
}

.mini-wall div {
  aspect-ratio: 1;
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.feature-grid > div {
  padding: 20px;
}

.admin-section {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(320px, 1.2fr);
  gap: 32px;
  background: var(--panel);
}

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.browse-tools {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) minmax(180px, 260px);
  gap: 14px;
  margin-bottom: 18px;
}

.art-card-open,
.mini-chip {
  border: 0;
  padding: 0;
  background: transparent;
  cursor: pointer;
}

.art-card-open {
  display: block;
  width: 100%;
}

.status-row,
.card-actions,
.modal-actions,
.account-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.status-row {
  justify-content: space-between;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.card-actions {
  justify-content: flex-end;
}

.section-cta {
  display: flex;
  justify-content: center;
  margin-top: 26px;
}

.save-button:disabled,
.button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.modal {
  width: min(96vw, 1040px);
  max-height: 94vh;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0;
  color: var(--ink);
  background: var(--surface);
}

.modal.wide,
.modal-panel.wide {
  width: min(94vw, 1120px);
}

.modal::backdrop {
  background: color-mix(in srgb, #000 58%, transparent);
}

.modal-panel {
  position: relative;
  display: grid;
  gap: 16px;
  padding: clamp(22px, 4vw, 34px);
}

.modal-panel h2 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(30px, 4vw, 48px);
  font-weight: 500;
  line-height: 1.06;
}

.close-button {
  position: absolute;
  top: 12px;
  right: 12px;
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
  color: var(--ink);
  font-size: 22px;
  cursor: pointer;
}

.detail-layout {
  display: grid;
  grid-template-columns: minmax(320px, 0.9fr) minmax(320px, 1.1fr);
  gap: 28px;
  align-items: start;
}

.detail-art {
  border-radius: 4px;
}

.lead.compact {
  margin-top: 10px;
  font-size: 18px;
}

.price-line,
.checkout-total {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.compact-timeline {
  margin-top: 10px;
}

.account-tabs {
  margin-bottom: 18px;
}

.account-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.account-stats button,
.list-row {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
}

.account-stats button {
  padding: 16px;
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.account-stats button:hover {
  border-color: var(--accent);
}

.account-stats strong,
.account-stats span,
.list-row strong,
.list-row span {
  display: block;
}

.stack-list {
  display: grid;
  gap: 10px;
}

.list-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
}

.mini-chip {
  width: 44px;
  aspect-ratio: 1;
  border: 1px solid color-mix(in srgb, var(--art) 55%, #111);
  background: var(--art);
}

.empty-state {
  color: var(--muted);
}

.toast {
  position: fixed;
  right: 20px;
  top: 20px;
  z-index: 10000;
  max-width: min(360px, calc(100vw - 40px));
  transform: translateY(-16px);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  background: var(--surface);
  color: var(--ink);
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease;
}

.toast.is-visible {
  transform: translateY(0);
  opacity: 1;
}

.page-view {
  min-height: 78vh;
  padding: clamp(58px, 7vw, 96px) clamp(18px, 4vw, 56px);
  border-top: 1px solid var(--line);
  background: var(--paper);
}

.page-shell {
  display: grid;
  gap: 26px;
  max-width: 1220px;
  margin: 0 auto;
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
}

.page-head h1,
.checkout-summary h2,
.artwork-page h1 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(38px, 6vw, 76px);
  font-weight: 500;
  line-height: 1.04;
}

.page-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.page-browse-tools {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(180px, 260px);
  gap: 14px;
}

.page-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 300px));
  justify-content: start;
  gap: 18px;
}

.collection-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 360px));
  justify-content: start;
  gap: 20px;
}

.collection-grid .art-card .art-square {
  aspect-ratio: 1;
}

.checkout-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 420px);
  gap: 28px;
  align-items: start;
}

.checkout-summary {
  position: sticky;
  top: 92px;
  display: grid;
  gap: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 22px;
  background: var(--surface);
}

.checkout-card {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: var(--surface);
}

.artwork-page {
  display: grid;
  grid-template-columns: minmax(280px, 0.95fr) minmax(320px, 1.05fr);
  gap: clamp(28px, 5vw, 64px);
  align-items: start;
}

.artwork-page .art-square {
  min-height: 420px;
}

.data-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.artist-settings {
  display: grid;
  gap: 14px;
  max-width: 820px;
}

.data-grid div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: var(--surface);
}

.data-grid strong,
.data-grid span {
  display: block;
}

.page-note {
  max-width: 760px;
  color: var(--muted);
  font-size: 18px;
}

th,
td {
  padding: 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

tr:last-child td {
  border-bottom: 0;
}

footer {
  padding: 34px clamp(18px, 4vw, 56px);
  border-top: 1px solid var(--line);
}

footer strong {
  font-family: Georgia, serif;
  font-size: 24px;
  font-weight: 500;
}

footer p {
  margin: 8px 0 0;
}

@media (max-width: 860px) {
  .site-header,
  .section-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  nav {
    justify-content: flex-start;
  }

  .hero,
  .two-column,
  .admin-section {
    grid-template-columns: 1fr;
  }

  .hero {
    min-height: auto;
  }

  .art-grid,
  .page-grid,
  .collection-grid,
  .feature-grid,
  .stats {
    grid-template-columns: 1fr;
    justify-content: stretch;
  }

  .stats div {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .stats div:last-child {
    border-bottom: 0;
  }

  .archive-panel,
  .listing-form,
  .browse-tools,
  .page-browse-tools,
  .page-head,
  .checkout-layout,
  .artwork-page,
  .data-grid,
  .detail-layout,
  .account-stats {
    grid-template-columns: 1fr;
  }

  .checkout-summary {
    position: static;
  }

  .artwork-page .art-square {
    min-height: 280px;
  }

  .span-2 {
    grid-column: span 1;
  }
}

@media (max-width: 520px) {
  .hero-wall {
    grid-auto-rows: 82px;
    gap: 8px;
  }

  .button,
  .chip {
    width: 100%;
    justify-content: center;
    text-align: center;
  }
}
