:root {
  --navy: #315166;
  --navy-dark: #183344;
  --cream: #fff8ed;
  --cream-deep: #f3dfbf;
  --sage: #527767;
  --rose: #b85e6a;
  --gold: #d89d37;
  --ink: #1e3039;
  --muted: #627278;
  --line: #dfcfb8;
  --white: #ffffff;
  --special: #e7a443;
  --foods: #c75e47;
  --garden: #5e8f67;
  --books: #5579a6;
  --clothes: #c1769a;
  --music: #8b67b0;
  --feeding: #4f9c9d;
  --home: #b88750;
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at 15% 0%, rgba(216, 157, 55, 0.18), transparent 28rem),
    linear-gradient(180deg, #fff8ed 0%, #fffaf3 48%, #f7ead7 100%);
  color: var(--ink);
}

button,
input,
textarea {
  font: inherit;
}

a {
  color: var(--navy-dark);
}

.site-header {
  background:
    linear-gradient(135deg, rgba(49, 81, 102, 0.95), rgba(44, 90, 88, 0.94)),
    var(--navy);
  color: var(--cream);
  padding: 48px max(20px, calc((100vw - 1080px) / 2)) 40px;
  border-bottom: 5px solid var(--gold);
}

.site-header > div {
  max-width: 680px;
}

.site-header--admin {
  display: flex;
  gap: 24px;
  align-items: end;
  justify-content: space-between;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--cream-deep);
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

h1 {
  margin: 0;
  font-size: clamp(2.2rem, 7vw, 5rem);
  line-height: 0.95;
  letter-spacing: 0;
}

h2 {
  margin: 0;
  font-size: 1.6rem;
  letter-spacing: 0;
}

h3 {
  margin: 10px 0 8px;
  font-size: 1.15rem;
  line-height: 1.2;
  letter-spacing: 0;
}

.site-header__copy {
  margin: 16px 0 0;
  max-width: 54ch;
  color: #f8efe1;
  font-size: 1.05rem;
  line-height: 1.5;
}

main {
  width: min(1080px, calc(100% - 32px));
  margin: 0 auto;
  padding: 30px 0 56px;
}

.registry-controls {
  display: flex;
  gap: 18px;
  align-items: center;
  justify-content: space-between;
  margin: 0 0 12px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 10px 30px rgba(49, 81, 102, 0.08);
}

.registry-controls__label {
  margin: 0 0 3px;
  color: var(--navy-dark);
  font-size: 0.8rem;
  font-weight: 900;
  text-transform: uppercase;
}

.registry-controls__copy {
  margin: 0;
  color: var(--muted);
  line-height: 1.35;
}

.switch {
  display: inline-flex;
  grid-template-columns: none;
  gap: 10px;
  align-items: center;
  min-width: max-content;
  cursor: pointer;
}

.switch input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.switch__track {
  display: inline-flex;
  align-items: center;
  width: 54px;
  height: 32px;
  padding: 3px;
  border: 2px solid var(--navy);
  border-radius: 999px;
  background: #e8efe9;
  transition: background 160ms ease, border-color 160ms ease;
}

.switch__thumb {
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: var(--navy);
  box-shadow: 0 2px 5px rgba(30, 48, 57, 0.28);
  transition: transform 160ms ease, background 160ms ease;
}

.switch input:checked + .switch__track {
  border-color: var(--gold);
  background: #faefd6;
}

.switch input:checked + .switch__track .switch__thumb {
  transform: translateX(22px);
  background: var(--gold);
}

.switch__text {
  color: var(--navy-dark);
  font-weight: 900;
}

.category-section {
  padding: 28px 0 8px;
  --category-color: var(--navy);
}

.category-section__header {
  display: flex;
  gap: 12px;
  align-items: baseline;
  justify-content: space-between;
  padding-bottom: 14px;
  border-bottom: 3px solid color-mix(in srgb, var(--category-color) 44%, var(--line));
}

.category-section__header h2 {
  color: var(--category-color);
}

.category-section__header span {
  color: var(--muted);
  font-weight: 700;
}

.category-section--special,
.gift-card--special {
  --category-color: var(--special);
}

.category-section--favorite-foods,
.gift-card--favorite-foods {
  --category-color: var(--foods);
}

.category-section--garden-outdoor,
.gift-card--garden-outdoor {
  --category-color: var(--garden);
}

.category-section--books-learning,
.gift-card--books-learning {
  --category-color: var(--books);
}

.category-section--clothes,
.gift-card--clothes {
  --category-color: var(--clothes);
}

.category-section--music-play,
.gift-card--music-play {
  --category-color: var(--music);
}

.category-section--feeding-bath,
.gift-card--feeding-bath {
  --category-color: var(--feeding);
}

.category-section--home-play,
.gift-card--home-play {
  --category-color: var(--home);
}

.gift-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 250px), 1fr));
  gap: 18px;
  padding-top: 16px;
}

.gift-card {
  --category-color: var(--navy);
  display: grid;
  grid-template-rows: 190px 1fr;
  min-width: 0;
  overflow: hidden;
  background: var(--white);
  border: 1px solid color-mix(in srgb, var(--category-color) 38%, var(--line));
  border-radius: 8px;
  box-shadow: 0 14px 34px rgba(49, 81, 102, 0.1);
}

.gift-card--covered {
  opacity: 0.72;
}

.gift-card[data-covered="true"] {
  display: none;
}

.show-claimed .gift-card[data-covered="true"] {
  display: grid;
}

.gift-card__image {
  width: 100%;
  height: 190px;
  object-fit: cover;
  background: color-mix(in srgb, var(--category-color) 24%, var(--cream));
  border-bottom: 5px solid var(--category-color);
}

.gift-card__body {
  display: flex;
  flex-direction: column;
  min-height: 230px;
  padding: 16px;
}

.gift-card__topline {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
  min-height: 26px;
}

.gift-card__count,
.gift-card__remaining {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 800;
}

.gift-card__count {
  background: color-mix(in srgb, var(--category-color) 12%, #ffffff);
  color: color-mix(in srgb, var(--category-color) 78%, #1e3039);
}

.gift-card__remaining {
  background: #f8ebe5;
  color: var(--rose);
}

.gift-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.gift-card__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: auto;
  padding-top: 16px;
}

button,
.link-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  min-width: 0;
  padding: 9px 13px;
  border: 1px solid var(--navy);
  border-radius: 6px;
  background: var(--white);
  color: var(--navy-dark);
  font-weight: 800;
  line-height: 1.1;
  text-decoration: none;
  cursor: pointer;
}

button.primary,
.primary {
  background: var(--navy);
  color: var(--cream);
}

.claim-button {
  flex: 1 1 auto;
  border-color: color-mix(in srgb, var(--category-color) 70%, var(--navy));
  color: var(--navy-dark);
}

.claim-button:not(:disabled) {
  background: color-mix(in srgb, var(--category-color) 12%, var(--white));
}

button:disabled {
  cursor: not-allowed;
  border-color: var(--line);
  color: var(--muted);
}

.claim-dialog {
  width: min(440px, calc(100% - 24px));
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0;
}

.claim-dialog::backdrop {
  background: rgba(20, 30, 35, 0.5);
}

.claim-dialog form {
  display: grid;
  gap: 16px;
  padding: 22px;
}

.claim-dialog .eyebrow {
  color: var(--sage);
}

label {
  display: grid;
  gap: 6px;
  font-weight: 800;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px;
  color: var(--ink);
}

.claim-dialog__actions {
  display: flex;
  gap: 10px;
  justify-content: end;
}

.claim-dialog__status {
  min-height: 22px;
  margin: 0;
  color: var(--rose);
  font-weight: 700;
}

.admin-main {
  width: min(1280px, calc(100% - 32px));
}

.admin-section {
  margin: 24px 0;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

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

th {
  background: #f7ead8;
}

td form {
  display: inline-block;
  margin: 0 4px 4px 0;
}

@media (max-width: 520px) {
  .site-header {
    padding-top: 34px;
  }

  .registry-controls {
    align-items: flex-start;
    flex-direction: column;
  }

  .category-section__header,
  .site-header--admin {
    display: block;
  }

  .gift-card {
    grid-template-rows: 168px 1fr;
  }

  .gift-card__image {
    height: 168px;
  }

  .gift-card__actions,
  .claim-dialog__actions {
    flex-direction: column;
  }

  button,
  .link-button {
    width: 100%;
  }
}
