:root {
  --paper: #F6F3EC;
  --paper-card: #FFFEFB;
  --ink: #1C1B19;
  --ink-soft: #59564C;
  --ink-faint: #8A8677;
  --brass: #9C7A2E;
  --brass-deep: #7A5F22;
  --brass-wash: #F1E6C9;
  --rule: #E2DCCB;
  --error: #B3432B;
  --success: #3F6B4A;

  --font-display: "Source Serif 4", Georgia, serif;
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, monospace;

  --wrap: 960px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

.wrap {
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 0 24px;
}

a { color: inherit; }

/* ---------- header ---------- */
.site-header {
  border-bottom: 1px solid var(--rule);
  background: var(--paper);
  position: sticky;
  top: 0;
  z-index: 5;
}

.header-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px 20px;
  padding: 22px 24px;
}

.brand {
  display: inline-flex;
  align-items: baseline;
  gap: 10px;
  text-decoration: none;
  color: var(--ink);
}

.brand-mark {
  font-family: var(--font-display);
  font-size: 26px;
  color: var(--brass);
  font-weight: 700;
}

.brand-name {
  font-family: var(--font-display);
  font-size: 21px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.tagline {
  margin: 0;
  color: var(--ink-soft);
  font-size: 14px;
  font-family: var(--font-mono);
}

/* ---------- intro ---------- */
.intro {
  padding: 56px 24px 28px;
}

.intro h1 {
  font-family: var(--font-display);
  font-size: clamp(32px, 5vw, 46px);
  font-weight: 700;
  margin: 0 0 14px;
}

.intro-copy {
  max-width: 56ch;
  color: var(--ink-soft);
  font-size: 17px;
  margin: 0;
}

.how-it-works {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 0;
  padding: 0;
  margin: 34px 0 0;
}

.how-it-works li {
  display: flex;
  align-items: center;
  gap: 10px;
}

.how-it-works li:not(:last-child)::after {
  content: "―";
  color: var(--rule);
  margin: 0 20px;
  font-family: var(--font-mono);
}

.step-num {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  color: var(--brass-deep);
  border: 1px solid var(--brass);
  border-radius: 50%;
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: var(--brass-wash);
}

.step-label {
  font-size: 14px;
  color: var(--ink-soft);
  white-space: nowrap;
}

@media (max-width: 640px) {
  .how-it-works { flex-direction: column; align-items: flex-start; gap: 14px; }
  .how-it-works li:not(:last-child)::after { display: none; }
}

/* ---------- catalog grid ---------- */
.catalog {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 22px;
  padding: 8px 24px 72px;
}

.loading, .empty, .error {
  font-family: var(--font-mono);
  color: var(--ink-faint);
  font-size: 14px;
}

.card {
  background: var(--paper-card);
  border: 1px solid var(--rule);
  border-radius: 2px;
  padding: 26px 22px 22px;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.card:hover {
  border-color: var(--brass);
  transform: translateY(-2px);
}

.card-title {
  font-family: var(--font-display);
  font-size: 21px;
  font-weight: 600;
  margin: 0;
  padding-right: 64px;
}

.card-desc {
  color: var(--ink-soft);
  font-size: 14.5px;
  margin: 0;
  flex-grow: 1;
}

.stamp {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 1.5px solid var(--brass);
  color: var(--brass-deep);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  line-height: 1.2;
  text-align: center;
  transform: rotate(-6deg);
  flex-shrink: 0;
}

.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 6px;
  padding-top: 14px;
  border-top: 1px dashed var(--rule);
}

.price {
  font-family: var(--font-mono);
  font-size: 15px;
  color: var(--ink);
}

.buy-btn {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 14px;
  color: var(--paper);
  background: var(--ink);
  border: none;
  padding: 10px 18px;
  border-radius: 2px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.buy-btn:hover { background: var(--brass-deep); }
.buy-btn:focus-visible, .btn-primary:focus-visible, .modal-close:focus-visible, input:focus-visible {
  outline: 2px solid var(--brass);
  outline-offset: 2px;
}

/* ---------- footer ---------- */
.site-footer {
  border-top: 1px solid var(--rule);
  padding: 26px 24px 40px;
}

.site-footer p {
  margin: 0;
  color: var(--ink-faint);
  font-size: 13px;
  font-family: var(--font-mono);
  max-width: 60ch;
}

/* ---------- modal ---------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(28, 27, 25, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 20;
}

.modal-backdrop[hidden] { display: none; }

.modal {
  background: var(--paper-card);
  border: 1px solid var(--rule);
  border-radius: 3px;
  max-width: 420px;
  width: 100%;
  padding: 32px 28px 28px;
  position: relative;
}

.modal-close {
  position: absolute;
  top: 14px;
  right: 16px;
  background: none;
  border: none;
  font-size: 24px;
  line-height: 1;
  color: var(--ink-faint);
  cursor: pointer;
  padding: 4px;
}

.modal-close:hover { color: var(--ink); }

.eyebrow {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--brass-deep);
  margin: 0 0 6px;
}

.modal h2 {
  font-family: var(--font-display);
  font-size: 24px;
  margin: 0 0 6px;
}

.modal-price {
  font-family: var(--font-mono);
  color: var(--ink-soft);
  margin: 0 0 20px;
}

#checkout-form label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
}

#checkout-form input {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--rule);
  border-radius: 2px;
  font-family: var(--font-body);
  font-size: 15px;
  background: var(--paper);
  color: var(--ink);
}

.hint {
  font-size: 12.5px;
  color: var(--ink-faint);
  margin: 6px 0 18px;
}

.btn-primary {
  width: 100%;
  padding: 13px;
  background: var(--brass);
  color: #fff;
  border: none;
  border-radius: 2px;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.btn-primary:hover { background: var(--brass-deep); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }

.checkout-status {
  margin-top: 18px;
  padding: 14px 16px;
  border-radius: 2px;
  font-size: 14px;
  line-height: 1.5;
}

.checkout-status.pending {
  background: var(--brass-wash);
  color: var(--brass-deep);
  font-family: var(--font-mono);
}

.checkout-status.success {
  background: #E9F0EA;
  color: var(--success);
}

.checkout-status.success a {
  color: var(--success);
  font-weight: 700;
  text-decoration: underline;
}

.checkout-status.error {
  background: #F5E4DF;
  color: var(--error);
}

@media (max-width: 520px) {
  .header-row { padding: 18px 20px; }
  .intro { padding: 40px 20px 20px; }
  .catalog { padding: 8px 20px 56px; grid-template-columns: 1fr; }
}