/* Nightstand storefront — GYMO design system (§3). All values reference tokens.css. */

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: var(--text-body-size);
  line-height: var(--leading-body);
  color: var(--text-body);
  background: var(--surface-page);
}

a { color: var(--text-link); text-decoration: none; }
a:hover { color: var(--gymo-navy); text-decoration: underline; }

h1, h2, h3 { color: var(--text-heading); line-height: var(--leading-heading); }

.wrap { max-width: var(--content-max); margin: 0 auto; padding: 0 var(--space-5); }

.serif {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: var(--weight-body);
}
.eyebrow {
  font-family: var(--font-body);
  font-weight: var(--weight-bold);
  font-size: var(--text-h5);
  letter-spacing: var(--tracking-eyebrow);
  text-transform: uppercase;
  color: var(--gymo-navy);
  margin: 0 0 var(--space-3);
}
.script {
  font-family: var(--font-script);
  color: var(--gymo-blue);
  font-size: var(--text-body-lg);
  display: inline-block;
  transform: rotate(-3deg);
}

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  font-family: var(--font-body);
  font-weight: var(--weight-bold);
  font-size: var(--text-h5);
  padding: var(--space-3) var(--space-5);
  border-radius: var(--radius-md);
  border: 2px solid var(--gymo-navy);
  background: var(--gymo-navy);
  color: var(--text-on-dark);
  cursor: pointer;
  transition: filter .15s ease;
}
.btn:hover { filter: brightness(.92); text-decoration: none; color: var(--text-on-dark); }
.btn--blue { background: var(--gymo-blue); border-color: var(--gymo-blue); }
.btn--outline { background: transparent; color: var(--gymo-navy); }
.btn--outline:hover { color: var(--gymo-navy); }
.btn--lg { font-size: var(--text-body-size); padding: var(--space-4) var(--space-6); }
.btn[disabled], .btn.is-disabled {
  opacity: .45; cursor: not-allowed; pointer-events: none;
}

:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: 2px; }

/* ── Header ──────────────────────────────────────────────────────────────── */
.site-header {
  background: var(--surface-card);
  border-bottom: 1px solid var(--border-subtle);
  position: sticky;
  top: 0;
  z-index: 40;
}
.site-header__inner {
  display: flex;
  align-items: center;
  gap: var(--space-5);
  padding: var(--space-3) var(--space-5);
  max-width: var(--content-max);
  margin: 0 auto;
}
.site-header__logo img { height: var(--space-7); display: block; }
.site-nav { display: flex; gap: var(--space-5); flex: 1; flex-wrap: wrap; }
.site-nav a {
  font-weight: var(--weight-medium);
  font-size: var(--text-h5);
  color: var(--gymo-navy);
}
.site-header__actions { display: flex; align-items: center; gap: var(--space-4); margin-left: auto; }
.search-form { display: flex; gap: var(--space-2); }
.search-form input {
  font-family: var(--font-body);
  font-size: var(--text-h5);
  padding: var(--space-2) var(--space-3);
  border: 1.5px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background: var(--surface-card);
  color: var(--text-body);
}
.cart-count {
  font-weight: var(--weight-bold);
  color: var(--gymo-navy);
  font-size: var(--text-h5);
}

/* ── Messages ────────────────────────────────────────────────────────────── */
.messages { max-width: var(--content-max); margin: var(--space-4) auto 0; padding: 0 var(--space-5); list-style: none; }
.messages li {
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-2);
  background: var(--surface-tint-blue);
  color: var(--gymo-navy);
  font-weight: var(--weight-medium);
}
.messages li.error { background: var(--gymo-blush); color: var(--gymo-legacy-maroon); }

/* ── Sections + hero ─────────────────────────────────────────────────────── */
.section { padding: var(--space-8) 0; }
.section--tint { background: var(--surface-tint-warm); }
.hero {
  background: linear-gradient(180deg, var(--gymo-blue-pale), var(--surface-page));
  padding: var(--space-9) 0;
  text-align: center;
}
.hero h1 { font-family: var(--font-display); font-style: italic; font-weight: var(--weight-body); font-size: var(--text-h1); margin: 0 0 var(--space-3); }
.hero p { font-size: var(--text-body-lg); color: var(--text-body); margin: 0 auto; max-width: 40rem; }

.section-title { font-family: var(--font-display); font-style: italic; font-weight: var(--weight-body); font-size: var(--text-h2); margin: 0 0 var(--space-5); }

/* ── Grids + cards ───────────────────────────────────────────────────────── */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
  gap: var(--space-5);
}
.card {
  background: var(--surface-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  transition: box-shadow .2s ease;
  display: flex;
  flex-direction: column;
}
.card:hover { box-shadow: var(--shadow-card-hover); }
.card__media { aspect-ratio: 1 / 1; background: var(--gymo-greige); }
.card__media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card__media--empty { display: flex; align-items: center; justify-content: center; color: var(--text-muted); font-size: var(--text-h5); }
.card__body { padding: var(--space-4); display: flex; flex-direction: column; gap: var(--space-2); flex: 1; }
.card__title { font-weight: var(--weight-xbold); font-size: var(--text-h4); color: var(--gymo-navy); margin: 0; }
.card__title a { color: inherit; }
.card__price { font-weight: var(--weight-bold); color: var(--gymo-navy); }
.card__compare { color: var(--text-muted); text-decoration: line-through; font-size: var(--text-h5); margin-left: var(--space-2); }
.card__oos { color: var(--gymo-legacy-maroon); font-weight: var(--weight-bold); font-size: var(--text-h5); }

.category-tile { position: relative; display: block; border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow-card); aspect-ratio: 3 / 2; background: var(--gymo-navy); }
.category-tile img { width: 100%; height: 100%; object-fit: cover; opacity: .8; }
.category-tile__label { position: absolute; inset: auto var(--space-4) var(--space-4); color: var(--text-on-dark); font-family: var(--font-display); font-style: italic; font-size: var(--text-h3); }

/* ── Breadcrumb ──────────────────────────────────────────────────────────── */
.breadcrumb { font-size: var(--text-h5); color: var(--text-muted); margin: 0 0 var(--space-4); }

/* ── Product detail ──────────────────────────────────────────────────────── */
.product { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-7); align-items: start; }
.gallery__main { border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow-card); background: var(--gymo-greige); aspect-ratio: 1 / 1; }
.gallery__main img { width: 100%; height: 100%; object-fit: cover; }
.gallery__thumbs { display: flex; gap: var(--space-2); margin-top: var(--space-3); flex-wrap: wrap; }
.gallery__thumb { padding: 0; border: 2px solid var(--border-subtle); border-radius: var(--radius-sm); background: none; cursor: pointer; line-height: 0; overflow: hidden; transition: border-color .15s ease; }
.gallery__thumb.is-active { border-color: var(--gymo-blue); }
.gallery__thumb:hover { border-color: var(--gymo-blue-light); }
.gallery__thumbs img { width: var(--space-8); height: var(--space-8); object-fit: cover; display: block; }
.product h1 { font-family: var(--font-display); font-style: italic; font-weight: var(--weight-body); font-size: var(--text-h1); margin: 0 0 var(--space-3); }
.product__price { font-size: var(--text-h3); font-weight: var(--weight-bold); color: var(--gymo-navy); }
.product__compare { color: var(--text-muted); text-decoration: line-through; font-size: var(--text-h4); margin-left: var(--space-3); }
.product__desc { margin: var(--space-5) 0; white-space: pre-line; }
.product__desc--rich { white-space: normal; }
.product__desc--rich p { margin: 0 0 var(--space-3); }
.product__desc--rich ul, .product__desc--rich ol { margin: 0 0 var(--space-3); padding-left: var(--space-5); }
.product__desc--rich li { margin-bottom: var(--space-1); }
.product__desc--rich h3, .product__desc--rich h4, .product__desc--rich h5 { color: var(--gymo-navy); margin: var(--space-4) 0 var(--space-2); }
.stock-pill { display: inline-block; padding: var(--space-1) var(--space-3); border-radius: var(--radius-pill); font-size: var(--text-h5); font-weight: var(--weight-bold); }
.stock-pill--in { background: var(--gymo-blue-pale); color: var(--gymo-blue); }
.stock-pill--out { background: var(--gymo-blush); color: var(--gymo-legacy-maroon); }
.add-form { display: flex; gap: var(--space-3); align-items: center; margin-top: var(--space-5); }
.add-form input[type="number"] { width: var(--space-8); padding: var(--space-2) var(--space-3); border: 1.5px solid var(--border-subtle); border-radius: var(--radius-sm); font-family: var(--font-body); }

/* ── Footer ──────────────────────────────────────────────────────────────── */
.site-footer { background: var(--surface-dark); color: var(--text-on-dark); padding: var(--space-8) 0 var(--space-6); margin-top: var(--space-9); }
.site-footer .wrap { display: flex; justify-content: space-between; gap: var(--space-6); flex-wrap: wrap; }
.site-footer img { height: var(--space-7); }
.site-footer p { color: rgba(255, 255, 255, .8); font-size: var(--text-h5); }
.site-footer .script { color: var(--gymo-blue-light); }

/* ── Gate ────────────────────────────────────────────────────────────────── */
.gate { min-height: 80vh; display: flex; align-items: center; justify-content: center; padding: var(--space-6); }
.gate__card { background: var(--surface-card); border-radius: var(--radius-lg); box-shadow: var(--shadow-modal); padding: var(--space-8); max-width: 26rem; width: 100%; text-align: center; }
.gate__card img { height: var(--space-8); margin-bottom: var(--space-5); }
.gate__card h1 { font-family: var(--font-display); font-style: italic; font-weight: var(--weight-body); font-size: var(--text-h2); margin: 0 0 var(--space-2); }
.gate__card input[type="password"] { width: 100%; padding: var(--space-3) var(--space-4); border: 1.5px solid var(--border-subtle); border-radius: var(--radius-sm); font-family: var(--font-body); font-size: var(--text-body-size); margin: var(--space-4) 0; }
.gate__error { color: var(--gymo-legacy-maroon); font-weight: var(--weight-medium); }

.empty-state { text-align: center; padding: var(--space-9) var(--space-5); color: var(--text-muted); }

/* ── Cart + checkout ─────────────────────────────────────────────────────── */
.cart-table { width: 100%; border-collapse: collapse; margin-bottom: var(--space-6); }
.cart-table th, .cart-table td { text-align: left; padding: var(--space-3) var(--space-2); border-bottom: 1px solid var(--border-subtle); vertical-align: middle; }
.cart-table th { font-size: var(--text-h5); color: var(--text-muted); font-weight: var(--weight-bold); }
.qty-form { display: flex; gap: var(--space-2); align-items: center; }
.qty-form input[type="number"] { width: var(--space-8); padding: var(--space-2); border: 1.5px solid var(--border-subtle); border-radius: var(--radius-sm); font-family: var(--font-body); }
.link-button { background: none; border: none; color: var(--text-link); cursor: pointer; font-family: var(--font-body); font-size: var(--text-h5); text-decoration: underline; padding: 0; }

.order-summary { background: var(--surface-card); border-radius: var(--radius-lg); box-shadow: var(--shadow-card); padding: var(--space-5); max-width: 26rem; margin-left: auto; display: flex; flex-direction: column; gap: var(--space-2); }
.order-summary__row { display: flex; justify-content: space-between; gap: var(--space-4); }
.order-summary__savings { color: var(--gymo-blue); font-weight: var(--weight-bold); }
.order-summary__total { font-weight: var(--weight-bold); font-size: var(--text-h4); color: var(--gymo-navy); border-top: 1px solid var(--border-subtle); padding-top: var(--space-3); margin-top: var(--space-2); }
.order-summary .btn { margin-top: var(--space-4); }

.checkout { display: grid; grid-template-columns: 1.4fr 1fr; gap: var(--space-7); align-items: start; }
.checkout__summary .order-summary { margin-left: 0; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-4); margin-bottom: var(--space-5); }
.field { display: flex; flex-direction: column; gap: var(--space-1); }
.field--wide { grid-column: 1 / -1; }
.field label { font-size: var(--text-h5); font-weight: var(--weight-bold); color: var(--gymo-navy); }
.field input, .field select { padding: var(--space-3); border: 1.5px solid var(--border-subtle); border-radius: var(--radius-sm); font-family: var(--font-body); font-size: var(--text-body-size); background: var(--surface-card); }
.field__error { color: var(--gymo-legacy-maroon); font-size: var(--text-h5); }
.checkout__note { color: var(--text-muted); font-size: var(--text-h5); margin-top: var(--space-3); }

.payment-instructions { margin: var(--space-5) 0; }

@media (max-width: 768px) {
  .checkout { grid-template-columns: 1fr; }
  .order-summary { margin-left: 0; max-width: none; }
}

@media (max-width: 768px) {
  .product { grid-template-columns: 1fr; }
  .site-nav { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
