/* Artis Collections — editorial charcoal, cream, and sage catalog UI. */

*, *::before, *::after { box-sizing: border-box; }
html { background: var(--bg); -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  padding: 0 var(--gutter) calc(40px + env(safe-area-inset-bottom));
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent-bright); outline-offset: 4px; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip {
  position: fixed;
  left: 16px;
  top: -80px;
  z-index: 100;
  min-height: 52px;
  padding: 14px 18px;
  border-radius: var(--r-xs);
  background: var(--text);
  color: var(--bg);
  text-decoration: none;
}
.skip:focus { top: calc(14px + env(safe-area-inset-top)); }

/* Topbar */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: min(1080px, 100%);
  min-height: calc(88px + env(safe-area-inset-top));
  margin: 0 auto;
  padding-top: env(safe-area-inset-top);
  border-bottom: 1px solid var(--line);
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  text-decoration: none;
  flex-shrink: 0;
}
.brand-symbol {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--accent);
  border-radius: 50%;
  color: var(--accent);
  font-family: var(--display);
  font-size: 28px;
  font-style: italic;
  line-height: 1;
  padding: 0 3px 4px 0;
}
.wordmark {
  font-family: var(--display);
  font-size: 28px;
  font-weight: 400;
  letter-spacing: -0.05em;
}
.topnav {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.nav-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 50px;
  min-width: 50px;
  padding: 0 12px;
  border-radius: var(--r-pill);
  font-size: 14px;
  color: var(--dim);
  text-decoration: none;
  transition: color var(--speed) var(--ease), background var(--speed) var(--ease);
}
.nav-link:hover { color: var(--text); background: var(--surface); }
.nav-link.is-current { color: var(--bg); background: var(--accent); font-weight: 600; }

/* Main layout */
.shell { width: min(1080px, 100%); margin: 0 auto; }

.hero {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  padding: clamp(28px, 5vw, 56px) 0 24px;
}
.eyebrow {
  margin: 0 0 10px;
  color: var(--accent);
  font-size: 13px;
  letter-spacing: 0.04em;
}
h1 {
  margin: 0;
  font-family: var(--display);
  font-size: clamp(36px, 5vw, 58px);
  font-weight: 400;
  line-height: 1.05;
  letter-spacing: -0.045em;
}
.lead {
  margin: 12px 0 0;
  color: var(--dim);
  font-size: 15px;
  line-height: 1.5;
  max-width: 52ch;
}
.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 50px;
  min-width: 50px;
  padding: 0 16px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-pill);
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: background var(--speed) var(--ease), border-color var(--speed) var(--ease);
}
.btn:hover { border-color: var(--accent); background: var(--surface-2); }
.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #151714;
  font-weight: 600;
}
.btn-primary:hover { background: var(--accent-bright); border-color: var(--accent-bright); }
.btn-ghost { background: transparent; color: var(--dim); }
.btn-ghost:hover { color: var(--text); background: var(--surface); }
.btn-danger { border-color: var(--danger); color: var(--red); background: var(--danger-wash); }
.btn-danger:hover { background: rgba(244, 33, 46, 0.22); }
.btn-icon { width: 50px; height: 50px; padding: 0; font-size: 22px; line-height: 1; }
.file-btn { cursor: pointer; }

/* Controls */
.controls {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 18px 0 12px;
  border-top: 1px solid var(--line);
}
.medium-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 50px;
  min-width: 50px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  background: var(--surface);
  color: var(--dim);
  font-size: 14px;
  cursor: pointer;
  transition: background var(--speed) var(--ease), border-color var(--speed) var(--ease), color var(--speed) var(--ease);
}
.tab:hover { color: var(--text); border-color: var(--line-strong); }
.tab.is-active {
  background: var(--accent-wash);
  border-color: var(--accent);
  color: var(--accent-bright);
  font-weight: 600;
}
.tab .count {
  font-size: 12px;
  font-family: var(--mono);
  opacity: 0.8;
}

.filter-row {
  display: grid;
  grid-template-columns: minmax(0, 1.8fr) repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field label { font-size: 13px; color: var(--dim); }
.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 50px;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--text);
  font-size: 16px;
  line-height: 1.4;
}
.field textarea { resize: vertical; min-height: 96px; }
.field input:focus,
.field select:focus,
.field textarea:focus { border-color: var(--accent); outline: none; }

.status-bar {
  min-height: 22px;
  margin: 6px 0 14px;
  font-size: 13px;
  color: var(--muted);
}

/* Catalog cards */
.catalog-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
  transition: border-color var(--speed) var(--ease);
}
.card:hover { border-color: var(--line-strong); }
.card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
.badges { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: var(--r-pill);
  font-size: 12px;
  letter-spacing: 0.02em;
  border: 1px solid var(--line-strong);
  color: var(--dim);
}
.badge-medium {
  border-color: var(--accent);
  color: var(--accent-bright);
  background: var(--accent-wash);
}
.card-rating {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--accent);
}
.card-title {
  margin: 0;
  font-family: var(--display);
  font-size: 24px;
  font-weight: 400;
  line-height: 1.15;
  letter-spacing: -0.02em;
}
.card-meta {
  margin: 0;
  font-size: 14px;
  color: var(--dim);
}
.card-provenance {
  margin: 0;
  padding: 8px 10px;
  border-left: 2px solid var(--accent);
  background: var(--surface-2);
  border-radius: 0 var(--r-xs) var(--r-xs) 0;
  font-size: 13px;
  color: var(--text-2);
}
.card-notes {
  margin: 0;
  font-size: 14px;
  line-height: 1.55;
  color: var(--dim);
  white-space: pre-wrap;
  word-break: break-word;
}
.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.tag {
  padding: 2px 8px;
  border-radius: var(--r-xs);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12px;
}
.card-footer {
  margin-top: auto;
  padding-top: 8px;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.card-date { font-size: 12px; color: var(--muted); }
.card-edit {
  min-height: 50px;
  min-width: 64px;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-pill);
  background: transparent;
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
}
.card-edit:hover { border-color: var(--accent); color: var(--accent-bright); }

/* Empty state */
.empty-state {
  margin: 24px 0;
  padding: 36px 24px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--r-md);
  background: var(--surface);
  text-align: center;
}
.empty-state h2 {
  margin: 0 0 10px;
  font-family: var(--display);
  font-size: 28px;
  font-weight: 400;
}
.empty-state p {
  margin: 0 auto 20px;
  max-width: 48ch;
  color: var(--dim);
  font-size: 15px;
  line-height: 1.5;
}

/* Dialog sheet */
.sheet {
  width: min(620px, calc(100% - 24px));
  max-height: calc(100dvh - 32px);
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-lg);
  background: var(--bg);
  color: var(--text);
  box-shadow: var(--shadow-sheet);
}
.sheet::backdrop { background: rgba(0, 0, 0, 0.72); }
.sheet-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 22px;
  overflow-y: auto;
  max-height: calc(100dvh - 34px);
}
.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.sheet-head h2 {
  margin: 0;
  font-family: var(--display);
  font-size: 28px;
  font-weight: 400;
}
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.field-span { grid-column: 1 / -1; }
.sheet-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}
.sheet-actions-right { display: flex; gap: 10px; margin-left: auto; }

@media (max-width: 720px) {
  .filter-row { grid-template-columns: minmax(0, 1fr); }
  .catalog-grid { grid-template-columns: minmax(0, 1fr); }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 420px) {
  .topbar { min-height: calc(76px + env(safe-area-inset-top)); }
  .wordmark { font-size: 24px; }
  .nav-link { padding: 0 9px; font-size: 13px; }
}
@media (prefers-reduced-motion: reduce) {
  .nav-link, .btn, .tab, .card { transition: none; }
}
