:root {
  --bg: #fff6e6;
  --surface: #fffdf8;
  --surface-soft: #eef6ff;
  --ink: #141a23;
  --muted: #5f6874;
  --line: #141a23;
  --mint: #53f0bd;
  --coral: #ff6b8a;
  --blue: #6ea7ff;
  --yellow: #ffdc3d;
  --lilac: #c9a7ff;
  --danger: #b42318;
  --shadow: 6px 6px 0 rgba(20, 26, 35, 0.95);
  --soft-shadow: 0 16px 34px rgba(20, 26, 35, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  color-scheme: light;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background:
    linear-gradient(90deg, rgba(20, 26, 35, 0.035) 1px, transparent 1px) 0 0 / 34px 34px,
    linear-gradient(0deg, rgba(20, 26, 35, 0.035) 1px, transparent 1px) 0 0 / 34px 34px,
    var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
}

img {
  display: block;
  max-width: 100%;
  height: auto;
}

a {
  color: inherit;
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
a,
input,
select,
textarea {
  outline-color: var(--blue);
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -4rem;
  z-index: 20;
  background: var(--ink);
  color: #fff;
  padding: 0.7rem 1rem;
  border-radius: 8px;
}

.skip-link:focus {
  top: 1rem;
}

.site-header,
.admin-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 1rem;
  min-height: 64px;
  padding: 0.7rem clamp(1rem, 3vw, 2.5rem);
  background: rgba(255, 246, 230, 0.9);
  border-bottom: 2px solid var(--ink);
  backdrop-filter: blur(14px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  font-weight: 950;
  text-decoration: none;
  white-space: nowrap;
}

.brand img {
  width: 42px;
  height: 42px;
  border: 2px solid var(--ink);
  border-radius: 8px;
  box-shadow: 3px 3px 0 var(--yellow);
}

.top-nav,
.admin-nav {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  overflow-x: auto;
  scrollbar-width: none;
}

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

.top-nav a,
.admin-nav a {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  padding: 0.55rem 0.8rem;
  border-radius: 8px;
  color: var(--muted);
  font-weight: 900;
  text-decoration: none;
}

.top-nav a:hover,
.admin-nav a:hover,
.admin-nav a.active {
  background: var(--yellow);
  color: var(--ink);
  box-shadow: 3px 3px 0 var(--ink);
}

main {
  min-height: 62vh;
}

.intro-band {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: center;
  gap: 1rem;
  width: min(1120px, calc(100% - 2rem));
  margin: 0.9rem auto 0;
  padding: clamp(0.8rem, 2vw, 1.45rem) 0 0;
}

.intro-copy h1 {
  margin: 0;
  font-size: clamp(2.25rem, 5.2vw, 4.15rem);
  line-height: 0.9;
  letter-spacing: 0;
  max-width: 640px;
  text-wrap: balance;
  text-shadow: 4px 4px 0 rgba(255, 220, 61, 0.65);
}

.intro-copy p {
  max-width: 44rem;
  margin: 0.45rem 0 0;
  color: var(--muted);
  font-size: clamp(0.98rem, 1.35vw, 1.08rem);
  font-weight: 650;
}

.handle {
  display: inline-flex;
  width: fit-content;
  min-height: 30px;
  align-items: center;
  padding: 0.18rem 0.5rem;
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink) !important;
  font-weight: 950;
  box-shadow: 4px 4px 0 var(--mint);
  transform: rotate(-1deg);
}

.intro-mark {
  display: none;
}

.search-band,
.notice {
  width: min(1120px, calc(100% - 2rem));
  margin: 1rem auto;
  padding: 0.85rem 1rem;
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
}

.search-band {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.85rem;
  box-shadow: var(--shadow);
  background: #fffef9;
}

.search-input {
  min-height: 52px;
  border-color: transparent;
  background: transparent;
  padding: 0.1rem 0;
  font-size: 1.05rem;
  font-weight: 900;
}

.search-input:focus {
  outline: none;
}

.search-band:focus-within {
  border-color: var(--blue);
  box-shadow: 7px 7px 0 var(--yellow);
}

.search-icon {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: var(--mint);
  color: var(--ink);
  position: relative;
  border: 2px solid var(--ink);
}

.search-icon::before {
  content: "";
  width: 12px;
  height: 12px;
  border: 3px solid currentColor;
  border-radius: 50%;
  transform: translate(-2px, -2px);
}

.search-icon::after {
  content: "";
  position: absolute;
  width: 10px;
  height: 3px;
  border-radius: 999px;
  background: currentColor;
  transform: translate(7px, 8px) rotate(45deg);
}

.search-input::placeholder {
  color: var(--muted);
  font-weight: 700;
}

.search-count {
  color: var(--muted);
  font-weight: 800;
  white-space: nowrap;
  background: var(--surface-soft);
  border: 2px solid var(--ink);
  border-radius: 8px;
  padding: 0.25rem 0.55rem;
}

.notice.success {
  border-color: rgba(103, 213, 181, 0.6);
  background: #eefaf6;
  color: #174f41;
}

.notice.error {
  border-color: rgba(180, 35, 24, 0.28);
  background: #fff1ef;
  color: var(--danger);
}

.filters {
  display: flex;
  gap: 0.55rem;
  width: min(1120px, calc(100% - 2rem));
  margin: 0.85rem auto 1.15rem;
  overflow-x: auto;
  padding-bottom: 0.3rem;
}

.filters a {
  flex: 0 0 auto;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  padding: 0.55rem 0.9rem;
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  font-weight: 950;
  text-decoration: none;
}

.filters a.active,
.filters a:hover {
  border-color: var(--ink);
  color: var(--ink);
  background: var(--yellow);
  box-shadow: 4px 4px 0 var(--ink);
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(0.9rem, 2.5vw, 1.4rem);
  width: min(1120px, calc(100% - 2rem));
  margin: 0 auto 3rem;
}

.product-grid.compact {
  margin-top: 1rem;
}

.product-card {
  overflow: hidden;
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.product-card:hover,
.product-card:focus-within {
  transform: translate(-3px, -3px) rotate(-0.35deg);
  box-shadow: 10px 10px 0 rgba(20, 26, 35, 0.95);
}

.product-image-link {
  display: block;
  background:
    linear-gradient(135deg, rgba(83, 240, 189, 0.45), rgba(110, 167, 255, 0.22)),
    var(--surface-soft);
  aspect-ratio: 1 / 1;
  overflow: hidden;
  border-bottom: 2px solid var(--ink);
}

.product-image-link img,
.detail-media img,
.current-image img,
.image-choices img,
.table-product img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.product-card-body {
  padding: 0.9rem;
}

.product-kicker {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0 0 0.45rem;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 950;
}

.product-kicker span {
  border-radius: 8px;
  background: var(--lilac);
  color: var(--ink);
  border: 2px solid var(--ink);
  padding: 0.12rem 0.48rem;
  box-shadow: 2px 2px 0 var(--ink);
}

.product-card h2 {
  min-height: 3.15rem;
  margin: 0;
  font-size: 1rem;
  line-height: 1.25;
  letter-spacing: 0;
  font-weight: 950;
}

.product-card h2 a {
  text-decoration: none;
}

.card-actions {
  display: grid;
  gap: 0.45rem;
  margin-top: 0.85rem;
}

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

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

.is-hidden {
  display: none !important;
}

.button {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.65rem 0.9rem;
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font-weight: 950;
  text-decoration: none;
  cursor: pointer;
}

.button.primary {
  background: var(--ink);
  color: #fff;
  box-shadow: 4px 4px 0 var(--yellow);
}

.button:hover {
  transform: translate(-1px, -1px);
  box-shadow: 5px 5px 0 var(--yellow);
}

.button.large {
  min-height: 52px;
  padding-inline: 1.15rem;
}

.button.compact {
  min-height: 36px;
  padding: 0.35rem 0.65rem;
}

.button.danger {
  border-color: var(--danger);
  color: var(--danger);
}

.empty-state,
.text-page {
  width: min(760px, calc(100% - 2rem));
  margin: 3rem auto;
  padding: 2rem 0;
  text-align: center;
}

.empty-state img {
  margin: 0 auto 1rem;
}

.product-detail {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(300px, 0.95fr);
  gap: clamp(1rem, 4vw, 3rem);
  width: min(1120px, calc(100% - 2rem));
  margin: 2rem auto;
  align-items: start;
}

.detail-media {
  overflow: hidden;
  aspect-ratio: 1 / 1;
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.detail-copy {
  padding-top: 0.4rem;
}

.detail-copy h1,
.text-page h1,
.admin-title h1 {
  margin: 0;
  font-size: clamp(2rem, 5vw, 3.8rem);
  line-height: 1;
  letter-spacing: 0;
  text-wrap: balance;
}

.creator-note {
  font-size: 1.1rem;
}

.retailer {
  font-weight: 800;
}

.related {
  width: min(1120px, calc(100% - 2rem));
  margin: 1rem auto 3rem;
}

.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 2rem clamp(1rem, 3vw, 2.5rem);
  border-top: 1px solid var(--line);
  color: var(--muted);
}

.site-footer nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem;
}

.site-footer a {
  color: var(--muted);
  font-weight: 700;
  text-decoration: none;
}

.footer-link {
  width: auto;
  min-height: auto;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  padding: 0;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

.site-footer a:hover,
.footer-link:hover {
  color: var(--ink);
}

.cookie-banner {
  position: fixed;
  right: clamp(1rem, 3vw, 2rem);
  bottom: clamp(1rem, 3vw, 2rem);
  z-index: 30;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1rem;
  align-items: center;
  width: min(680px, calc(100% - 2rem));
  padding: 1rem;
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.cookie-copy strong {
  display: block;
  font-size: 1rem;
}

.cookie-copy p {
  margin: 0.2rem 0 0;
  color: var(--muted);
  font-size: 0.94rem;
  font-weight: 650;
}

.cookie-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  justify-content: flex-end;
}

.admin-body {
  background: #f7f8f5;
}

.admin-header {
  background: rgba(247, 248, 245, 0.94);
}

.admin-nav {
  flex: 1;
}

.admin-main,
.auth-shell {
  width: min(1180px, calc(100% - 2rem));
  margin: 1.2rem auto 3rem;
}

.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
}

.login-panel {
  width: min(420px, 100%);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 1.4rem;
  box-shadow: var(--shadow);
}

.login-panel img {
  margin-bottom: 0.75rem;
}

.login-panel h1 {
  margin: 0;
}

.admin-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.admin-title p {
  margin: 0.4rem 0 0;
  color: var(--muted);
}

.admin-section,
.quick-import,
.editor-form,
.settings-form,
.advanced-fields {
  margin: 1rem 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 1rem;
  box-shadow: var(--shadow);
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 0.75rem;
  margin: 1rem 0;
}

.metric {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 1rem;
}

.metric-link {
  color: inherit;
  text-decoration: none;
}

.metric-link:hover {
  transform: translateY(-1px);
}

.metric span {
  display: block;
  font-size: 2rem;
  font-weight: 900;
}

.metric p {
  margin: 0.2rem 0 0;
  color: var(--muted);
  font-weight: 700;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

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

th {
  color: var(--muted);
  font-size: 0.84rem;
  text-transform: uppercase;
}

.table-product {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 220px;
}

.table-product img {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  background: var(--surface-soft);
}

.status {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  padding: 0.2rem 0.5rem;
  border-radius: 8px;
  background: #eef2f7;
  color: var(--muted);
  font-weight: 800;
}

.status.published {
  background: #e9faf4;
  color: #17614d;
}

.status.archived {
  background: #f5eeee;
  color: #854036;
}

.stack-form,
.settings-form {
  display: grid;
  gap: 0.8rem;
}

.inline-form,
.form-grid,
.action-row,
.category-edit-row {
  display: grid;
  gap: 0.8rem;
}

.inline-form {
  grid-template-columns: minmax(240px, 1fr) auto;
  align-items: end;
}

.category-edit-row {
  grid-template-columns: repeat(6, minmax(120px, 1fr));
  align-items: end;
}

.form-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

label {
  display: grid;
  gap: 0.35rem;
  color: var(--muted);
  font-weight: 800;
}

input,
select,
textarea {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 0.62rem 0.75rem;
}

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

.checkbox-label {
  grid-auto-flow: column;
  justify-content: start;
  align-items: center;
}

.checkbox-label input {
  width: auto;
}

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

.current-image {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.current-image img {
  width: 120px;
  height: 120px;
  border-radius: 8px;
  background: var(--surface-soft);
}

.advanced-fields summary {
  cursor: pointer;
  font-weight: 900;
}

.advanced-fields .form-grid {
  margin-top: 1rem;
}

.form-actions,
.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  margin-top: 1rem;
}

.preview-list {
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 0.55rem 1rem;
}

.preview-list dt {
  color: var(--muted);
  font-weight: 900;
}

.preview-list dd {
  margin: 0;
}

.image-choices {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 0.8rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 1rem;
}

.image-choices legend {
  font-weight: 900;
}

.image-choices label {
  display: grid;
  gap: 0.4rem;
}

.image-choices input {
  width: auto;
  min-height: auto;
}

.image-choices img {
  aspect-ratio: 1 / 1;
  border-radius: 8px;
  border: 2px solid var(--line);
}

@media (min-width: 720px) {
  .product-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (min-width: 1020px) {
  .product-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (min-width: 1280px) {
  .product-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}

@media (max-width: 780px) {
  .site-header,
  .admin-header {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .top-nav,
  .admin-nav {
    order: 3;
    width: 100%;
  }

  .intro-band {
    grid-template-columns: 1fr;
    margin-top: 0.55rem;
    padding-top: 0.65rem;
  }

  .intro-mark {
    display: none;
  }

  .intro-copy h1 {
    font-size: clamp(2rem, 14vw, 3rem);
  }

  .intro-copy p {
    margin-top: 0.35rem;
  }

  .search-band {
    margin-top: 0.75rem;
    padding: 0.65rem 0.75rem;
  }

  .product-detail,
  .form-grid,
  .inline-form,
  .search-band,
  .category-edit-row,
  .metric-grid {
    grid-template-columns: 1fr;
  }

  .search-count {
    grid-column: 1 / -1;
    justify-self: start;
    min-height: 20px;
  }

  .search-band {
    grid-template-columns: auto minmax(0, 1fr);
  }

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

  .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .site-footer {
    display: grid;
  }

  .cookie-banner {
    left: 1rem;
    right: 1rem;
    grid-template-columns: 1fr;
  }

  .cookie-actions {
    justify-content: stretch;
  }

  .cookie-actions .button {
    flex: 1 1 auto;
  }
}

@media (max-width: 380px) {
  .product-grid {
    grid-template-columns: 1fr;
  }

  .intro-copy h1 {
    font-size: 2.2rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}
