:root {
  --ink: #171717;
  --muted: #68635b;
  --paper: #f8f4ec;
  --panel: #fffaf0;
  --line: #ded5c6;
  --ember: #c94f2d;
  --blue: #12304d;
  --green: #28745d;
  --gold: #d8a43b;
  --shadow: 0 24px 70px rgba(24, 20, 16, 0.16);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Avenir Next", "Segoe UI", sans-serif;
  background:
    linear-gradient(135deg, rgba(18, 48, 77, 0.08), transparent 36%),
    radial-gradient(circle at 85% 20%, rgba(216, 164, 59, 0.18), transparent 30%),
    var(--paper);
  color: var(--ink);
}

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

a {
  color: inherit;
}

.shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 54px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 0.88fr) minmax(360px, 1.12fr);
  gap: 30px;
  align-items: stretch;
  min-height: 560px;
}

.hero-copy,
.product-panel,
.order-form,
.admin-header,
.admin-actions,
.admin-grid article,
.modal {
  background: rgba(255, 250, 240, 0.82);
  border: 1px solid rgba(222, 213, 198, 0.9);
  box-shadow: var(--shadow);
}

.hero-copy {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: clamp(28px, 5vw, 58px);
  border-radius: 8px;
}

.kicker {
  margin: 0 0 14px;
  color: var(--ember);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

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

h1 {
  margin: 0;
  max-width: 720px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(3rem, 7vw, 6.8rem);
  font-weight: 700;
  line-height: 0.92;
  letter-spacing: 0;
}

h2 {
  margin: 0 0 18px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.55rem;
  letter-spacing: 0;
}

.lead {
  max-width: 560px;
  margin: 24px 0 0;
  color: var(--muted);
  font-size: 1.08rem;
  line-height: 1.65;
}

.status-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 34px;
}

.status-strip span {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 12px;
  background: #fffdf8;
  color: var(--blue);
  font-size: 0.83rem;
  font-weight: 750;
}

.gallery {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-auto-rows: minmax(220px, 1fr);
  gap: 12px;
}

.gallery img {
  width: 100%;
  height: 100%;
  min-height: 0;
  object-fit: cover;
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.gallery img:first-child {
  grid-row: span 2;
}

.content-grid {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  gap: 24px;
  margin-top: 24px;
  align-items: start;
}

.product-panel,
.order-form,
.admin-header,
.admin-actions,
.admin-grid article {
  border-radius: 8px;
  padding: 24px;
}

.product-panel {
  position: sticky;
  top: 24px;
}

.product-link {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 0;
  text-decoration: none;
  border-top: 1px solid var(--line);
}

.product-link:last-of-type {
  border-bottom: 1px solid var(--line);
}

.product-link strong,
.product-link small {
  display: block;
}

.product-link strong {
  margin-bottom: 6px;
}

.product-link small,
.fine-print {
  color: var(--muted);
  line-height: 1.5;
}

.fine-print {
  margin: 18px 0 0;
}

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

label,
fieldset {
  display: grid;
  gap: 8px;
  min-width: 0;
}

fieldset {
  margin: 22px 0 0;
  padding: 0;
  border: 0;
}

legend,
label > span {
  color: var(--blue);
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 13px 14px;
  background: #fffdf8;
  color: var(--ink);
  outline: none;
}

input:focus,
textarea:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(40, 116, 93, 0.16);
}

textarea {
  resize: vertical;
}

small[data-error-for] {
  min-height: 1.1em;
  color: #a4311b;
  font-size: 0.82rem;
}

.segmented,
.swatches,
.size-grid {
  display: grid;
  gap: 10px;
}

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

.swatches {
  grid-template-columns: repeat(2, minmax(0, 160px));
}

.size-grid {
  grid-template-columns: repeat(8, minmax(58px, 1fr));
}

.segmented label,
.swatches label,
.size-grid label {
  position: relative;
  display: block;
  cursor: pointer;
}

.segmented input,
.swatches input,
.size-grid input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.segmented span,
.swatches span,
.size-grid span {
  display: flex;
  min-height: 58px;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fffdf8;
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.size-grid span {
  align-items: center;
  min-height: 52px;
  padding: 10px;
}

.segmented small {
  color: var(--muted);
  font-weight: 500;
}

.segmented input:checked + span,
.swatches input:checked + span,
.size-grid input:checked + span {
  border-color: var(--green);
  box-shadow: inset 0 0 0 2px var(--green);
}

.segmented label:hover span,
.swatches label:hover span,
.size-grid label:hover span {
  transform: translateY(-1px);
}

.swatch-black span::before,
.swatch-navy span::before {
  content: "";
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.22);
}

.swatch-black span::before {
  background: #111;
}

.swatch-navy span::before {
  background: #102846;
}

.actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 24px;
}

#form-message,
#admin-message {
  min-height: 1.4em;
  margin: 0;
  color: var(--muted);
}

button,
.button-link {
  border: 0;
  border-radius: 8px;
  padding: 13px 18px;
  background: var(--ink);
  color: #fffaf0;
  font-weight: 850;
  text-decoration: none;
  cursor: pointer;
}

button:hover,
.button-link:hover {
  background: var(--blue);
}

button:disabled,
.button-link[aria-disabled="true"] {
  cursor: not-allowed;
  opacity: 0.45;
}

dialog {
  max-width: min(440px, calc(100% - 32px));
  padding: 0;
  border: 0;
  background: transparent;
}

dialog::backdrop {
  background: rgba(23, 23, 23, 0.48);
}

.modal {
  position: relative;
  border-radius: 8px;
  padding: 30px;
}

.modal h2 {
  margin-bottom: 10px;
}

.icon-button {
  position: absolute;
  top: 12px;
  right: 12px;
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  padding: 0;
  border-radius: 50%;
}

.admin-shell {
  padding-top: 40px;
}

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

.admin-header h1 {
  font-size: clamp(2.6rem, 6vw, 5rem);
}

.token-form {
  display: flex;
  align-items: end;
  gap: 12px;
  min-width: min(100%, 420px);
}

.admin-actions {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin: 22px 0;
}

.admin-grid {
  display: grid;
  grid-template-columns: minmax(280px, 0.65fr) minmax(0, 1.35fr);
  gap: 22px;
}

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

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

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

th {
  color: var(--blue);
  font-size: 0.74rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

@media (max-width: 920px) {
  .hero,
  .content-grid,
  .admin-grid {
    grid-template-columns: 1fr;
  }

  .hero {
    min-height: 0;
  }

  .gallery {
    grid-template-columns: repeat(4, minmax(160px, 1fr));
    overflow-x: auto;
    padding-bottom: 4px;
  }

  .gallery img,
  .gallery img:first-child {
    grid-row: auto;
    aspect-ratio: 3 / 4;
  }

  .product-panel {
    position: static;
  }

  .size-grid {
    grid-template-columns: repeat(4, minmax(58px, 1fr));
  }
}

@media (max-width: 640px) {
  .shell {
    width: min(100% - 20px, 1180px);
    padding-top: 10px;
  }

  .hero-copy,
  .product-panel,
  .order-form,
  .admin-header,
  .admin-actions,
  .admin-grid article {
    padding: 18px;
  }

  .form-grid,
  .segmented,
  .swatches,
  .admin-header,
  .token-form,
  .admin-actions {
    grid-template-columns: 1fr;
    flex-direction: column;
    align-items: stretch;
  }

  .gallery {
    grid-template-columns: repeat(4, minmax(132px, 1fr));
  }

  .actions {
    flex-direction: column;
    align-items: stretch;
  }

  .size-grid {
    grid-template-columns: repeat(3, minmax(58px, 1fr));
  }
}
