/* ── Design tokens ─────────────────────────────────────────────────────────── */
:root {
  --yellow:       #FFD60A;
  --yellow-dark:  #E6BC00;
  --yellow-light: #FFF9CC;
  --yellow-pale:  #FFFEF0;
  --coral:        #FF6B6B;
  --coral-dark:   #E05252;
  --teal:         #4ECDC4;
  --teal-dark:    #3ABBB2;
  --text:         #1A1A1A;
  --text-muted:   #666666;
  --bg:           #FFFEF5;
  --card:         #FFFFFF;
  --border:       #FFE566;
  --border-light: #FFF3B0;
  --shadow-sm:    0 2px 6px rgba(0,0,0,.08);
  --shadow-md:    0 4px 16px rgba(0,0,0,.10);
  --radius-sm:    0.5rem;
  --radius-md:    1rem;
  --radius-lg:    1.5rem;
  --font:         'Nunito', system-ui, sans-serif;
  --max-w:        1100px;
}

/* ── Reset ─────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; }

/* ── Base ──────────────────────────────────────────────────────────────────── */
html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Layout ────────────────────────────────────────────────────────────────── */
.container {
  width: 100%;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 1.25rem;
}

.main-content {
  flex: 1;
  padding-top: 2rem;
  padding-bottom: 3rem;
}

/* ── Header ────────────────────────────────────────────────────────────────── */
.site-header {
  background: var(--yellow);
  border-bottom: 3px solid var(--yellow-dark);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-top: 0.9rem;
  padding-bottom: 0.9rem;
}

.site-logo {
  font-size: 1.35rem;
  font-weight: 800;
  text-decoration: none;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.logo-star {
  color: var(--coral);
  font-size: 1.1em;
}

.site-nav {
  display: flex;
  gap: 1.5rem;
  font-weight: 700;
}

.site-nav a {
  text-decoration: none;
  color: var(--text);
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-sm);
  transition: background 0.15s;
}

.site-nav a:hover,
.site-nav a:focus-visible {
  background: rgba(0,0,0,.1);
  outline: none;
}

/* ── Footer ────────────────────────────────────────────────────────────────── */
.site-footer {
  background: var(--yellow-light);
  border-top: 2px solid var(--border);
  text-align: center;
  padding: 1.5rem 1rem;
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* ── Flash messages ─────────────────────────────────────────────────────────── */
.flash-list { margin-bottom: 1.5rem; display: flex; flex-direction: column; gap: 0.5rem; }

.flash {
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  border-left: 4px solid;
}

.flash--success { background: #EDFFF6; border-color: #2ECC71; color: #1a6b3c; }
.flash--error   { background: #FFF0F0; border-color: var(--coral); color: #922; }
.flash--warning { background: #FFF8E6; border-color: #F0A500; color: #7a5100; }

/* ── Buttons ────────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  font-family: var(--font);
  font-weight: 700;
  font-size: 1rem;
  padding: 0.65rem 1.4rem;
  border-radius: var(--radius-md);
  border: 2px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.12s, box-shadow 0.12s, background 0.12s;
  min-height: 44px; /* WCAG touch target */
  white-space: nowrap;
}

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

.btn:active { transform: scale(0.97); }

.btn--primary {
  background: var(--coral);
  color: #fff;
  border-color: var(--coral-dark);
}
.btn--primary:hover { background: var(--coral-dark); }

.btn--secondary {
  background: var(--teal);
  color: #fff;
  border-color: var(--teal-dark);
}
.btn--secondary:hover { background: var(--teal-dark); }

.btn--outline {
  background: transparent;
  color: var(--text);
  border-color: var(--border);
}
.btn--outline:hover { background: var(--yellow-light); }

.btn--warning {
  background: #FFF0CC;
  color: #7a5100;
  border-color: #F0A500;
}
.btn--warning:hover { background: #FFE0A0; }

.btn--danger {
  background: #FFF0F0;
  color: #922;
  border-color: var(--coral);
}
.btn--danger:hover { background: var(--coral); color: #fff; }

.btn--sm  { font-size: 0.85rem; padding: 0.4rem 0.9rem; min-height: 36px; border-radius: var(--radius-sm); }
.btn--xs  { font-size: 0.75rem; padding: 0.3rem 0.6rem; min-height: 30px; border-radius: var(--radius-sm); }
.btn--lg  { font-size: 1.1rem; padding: 0.85rem 2rem; border-radius: var(--radius-md); }
.btn--full { width: 100%; }

/* ── Badges ─────────────────────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.badge--stock {
  background: #E6FFF2;
  color: #1a6b3c;
}

.badge--sold {
  background: #FFF0F0;
  color: #922;
}

.badge--coral {
  background: var(--coral);
  color: #fff;
  text-decoration: none;
}

.badge--lg {
  padding: 0.4rem 1rem;
  font-size: 0.9rem;
}

/* ── Hero ────────────────────────────────────────────────────────────────────── */
.hero {
  background: linear-gradient(135deg, var(--yellow) 0%, var(--yellow-light) 100%);
  border-radius: var(--radius-lg);
  padding: 3rem 2rem;
  margin-bottom: 2.5rem;
  text-align: center;
  border: 2px solid var(--border);
}

.hero h1 {
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 800;
  color: var(--text);
  margin-bottom: 0.75rem;
}

.hero-tagline {
  font-size: 1.15rem;
  color: var(--text-muted);
  max-width: 540px;
  margin: 0 auto;
}

.products-intro {
  text-align: center;
  color: var(--text-muted);
  margin-bottom: 2rem;
  font-size: 1.05rem;
}

/* ── Product grid ───────────────────────────────────────────────────────────── */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.5rem;
}

.product-card {
  background: var(--card);
  border-radius: var(--radius-md);
  border: 2px solid var(--border-light);
  box-shadow: var(--shadow-sm);
  text-decoration: none;
  color: var(--text);
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.product-card:hover,
.product-card:focus-visible {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: var(--yellow);
  outline: none;
}

.product-card__img-wrap {
  position: relative;
  aspect-ratio: 1;
  background: var(--yellow-light);
  overflow: hidden;
}

.product-card__img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.product-card__img-wrap .badge {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
}

.product-card__placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.product-card__body {
  padding: 1rem;
  flex: 1;
}

.product-card__title {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 0.35rem;
  line-height: 1.3;
}

.product-card__price {
  color: var(--coral-dark);
  font-weight: 700;
  font-size: 0.95rem;
}

.empty-state {
  text-align: center;
  color: var(--text-muted);
  padding: 3rem 1rem;
  font-size: 1.05rem;
}

/* ── Product detail ─────────────────────────────────────────────────────────── */
.product-detail {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
}

@media (min-width: 680px) {
  .product-detail {
    grid-template-columns: 1fr 1fr;
    align-items: start;
  }
}

.product-detail__gallery {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.product-detail__photo {
  border-radius: var(--radius-md);
  width: 100%;
  object-fit: cover;
  box-shadow: var(--shadow-sm);
}

.product-detail__no-photo {
  aspect-ratio: 1;
  background: var(--yellow-light);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
}

.product-detail__info {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.product-detail__info h1 {
  font-size: clamp(1.5rem, 4vw, 2.2rem);
  font-weight: 800;
  line-height: 1.2;
}

.product-detail__price {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--coral-dark);
}

.product-detail__description {
  color: var(--text-muted);
  white-space: pre-wrap;
  line-height: 1.7;
}

.sold-out-note {
  color: var(--text-muted);
  font-style: italic;
}

.back-link {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.back-link a {
  color: var(--teal-dark);
  text-decoration: none;
  font-weight: 600;
}

.back-link a:hover { text-decoration: underline; }

/* ── About page ─────────────────────────────────────────────────────────────── */
.page-header { margin-bottom: 1.5rem; }
.page-header h1 { font-size: 2rem; font-weight: 800; }

.prose-block {
  background: var(--card);
  border: 2px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 2rem;
  white-space: pre-wrap;
  line-height: 1.8;
  font-size: 1.05rem;
  max-width: 680px;
  box-shadow: var(--shadow-sm);
}

.about-cta {
  margin-top: 2rem;
}

/* ── Order form ─────────────────────────────────────────────────────────────── */
.form-page {
  max-width: 560px;
}

.form-page__header {
  margin-bottom: 2rem;
}

.form-page__header h1 {
  font-size: 1.8rem;
  font-weight: 800;
  margin-bottom: 0.25rem;
}

.form-subtitle {
  color: var(--text-muted);
}

.order-form { display: flex; flex-direction: column; gap: 1.25rem; }

/* ── Form fields ─────────────────────────────────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: 0.4rem; }

.field label {
  font-weight: 700;
  font-size: 0.95rem;
}

.required { color: var(--coral); }
.optional  { color: var(--text-muted); font-weight: 400; font-size: 0.85rem; }

.field-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

.field input,
.field textarea,
.field select {
  font-family: var(--font);
  font-size: 1rem;
  padding: 0.65rem 0.85rem;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--card);
  color: var(--text);
  width: 100%;
  transition: border-color 0.15s;
}

.field input:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(78, 205, 196, 0.2);
}

.field--narrow { max-width: 140px; }

.field-row {
  display: flex;
  gap: 1rem;
}

.field-row .field { flex: 1; }

.field--checkbox { flex-direction: row; align-items: center; gap: 0.6rem; }
.field--checkbox label { font-weight: 600; margin: 0; display: flex; align-items: center; gap: 0.5rem; }
.field--checkbox input { width: auto; }

.file-input {
  padding: 0.5rem !important;
  cursor: pointer;
}

.form-note {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-top: 0.5rem;
}

/* ── Confirm page ───────────────────────────────────────────────────────────── */
.confirm-page {
  max-width: 480px;
  margin: 4rem auto;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
}

.confirm-icon {
  width: 80px;
  height: 80px;
  background: var(--yellow);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  font-weight: 900;
  color: var(--text);
  border: 3px solid var(--yellow-dark);
}

.error-icon {
  background: #FFF0F0;
  border-color: var(--coral);
  font-size: 1.8rem;
}

.confirm-page h1 { font-size: 2rem; font-weight: 800; }
.confirm-ref strong { font-size: 1.4rem; color: var(--coral-dark); }
.confirmed-message { font-size: 1.25rem; font-weight: 800; color: var(--coral-dark); }

/* ── Login page ─────────────────────────────────────────────────────────────── */
body:has(.login-page) {
  background: var(--yellow-pale);
}

.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
}

.login-card {
  background: var(--card);
  border-radius: var(--radius-lg);
  border: 2px solid var(--border);
  box-shadow: var(--shadow-md);
  padding: 2.5rem;
  width: 100%;
  max-width: 400px;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.login-card h1 { font-size: 1.8rem; font-weight: 800; }
.login-sub { color: var(--text-muted); font-size: 0.9rem; }
.login-back { text-align: center; font-size: 0.85rem; color: var(--text-muted); }
.login-back a { color: var(--teal-dark); text-decoration: none; font-weight: 600; }

/* ── Admin layout ───────────────────────────────────────────────────────────── */
.admin-body { background: #F7F7FA; }

.admin-header {
  background: var(--text);
  color: #fff;
  border-bottom: 3px solid var(--yellow);
  position: sticky;
  top: 0;
  z-index: 100;
}

.admin-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  padding-top: 0.75rem;
  padding-bottom: 0.75rem;
}

.admin-logo {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--yellow);
  text-decoration: none;
}

.admin-nav {
  display: flex;
  gap: 1.25rem;
  flex-wrap: wrap;
}

.admin-nav a {
  text-decoration: none;
  color: #ccc;
  font-weight: 600;
  font-size: 0.9rem;
  transition: color 0.15s;
}

.admin-nav a:hover { color: #fff; }
.admin-logout { color: var(--coral) !important; }

.admin-content {
  padding-top: 2rem;
  padding-bottom: 4rem;
}

.admin-page-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 2rem;
}

.admin-page-header h1 {
  font-size: 1.75rem;
  font-weight: 800;
  flex: 1;
}

/* ── Admin section ──────────────────────────────────────────────────────────── */
.admin-section {
  background: var(--card);
  border-radius: var(--radius-md);
  border: 1px solid #E5E7EB;
  padding: 1.75rem;
  margin-bottom: 2rem;
  box-shadow: var(--shadow-sm);
}

.admin-section h2 {
  font-size: 1.2rem;
  font-weight: 800;
  margin-bottom: 1.25rem;
  color: var(--text);
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}

.section-header h2 { margin-bottom: 0; }

/* ── Content editors ────────────────────────────────────────────────────────── */
.content-editors {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.content-form {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* ── Admin product list ─────────────────────────────────────────────────────── */
.admin-product-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.admin-product-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem;
  background: #FAFAFA;
  border: 1px solid #EBEBEB;
  border-radius: var(--radius-sm);
}

.admin-product-thumb {
  flex-shrink: 0;
}

.admin-product-thumb img {
  width: 60px;
  height: 60px;
  object-fit: cover;
  border-radius: var(--radius-sm);
}

.admin-thumb-placeholder {
  width: 60px;
  height: 60px;
  background: var(--yellow-light);
  border-radius: var(--radius-sm);
  border: 1px dashed var(--border);
}

.admin-product-info {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  min-width: 0;
}

.admin-product-info strong { font-weight: 700; }

.admin-product-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* ── Admin product form ─────────────────────────────────────────────────────── */
.admin-form {
  max-width: 640px;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  background: var(--card);
  border: 1px solid #E5E7EB;
  border-radius: var(--radius-md);
  padding: 2rem;
  box-shadow: var(--shadow-sm);
}

.photo-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

.photo-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
}

.photo-item img {
  width: 100px;
  height: 100px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 2px solid var(--border-light);
}

.form-actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
}

/* ── Orders table ───────────────────────────────────────────────────────────── */
.orders-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.orders-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  min-width: 780px;
}

.orders-table th {
  text-align: left;
  padding: 0.6rem 0.75rem;
  background: var(--yellow-light);
  font-weight: 700;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 2px solid var(--border);
}

.orders-table td {
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid #F0F0F0;
  vertical-align: top;
}

.row--new { background: #FFFFF8; }
.row--done { background: #FAFAFA; color: var(--text-muted); }

.mono { font-family: monospace; font-size: 0.95em; font-weight: 700; }

.email-link {
  color: var(--teal-dark);
  text-decoration: none;
  font-size: 0.85rem;
}

.email-link:hover { text-decoration: underline; }

.notes-cell { max-width: 200px; }
.notes-text { font-size: 0.85rem; color: var(--text-muted); }
.date-cell { font-size: 0.8rem; white-space: nowrap; color: var(--text-muted); }

.status-badge {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.status-badge--pending_confirmation { background: #FFF9CC; color: #7a6200; border: 1px solid var(--yellow-dark); }
.status-badge--pending    { background: #FFF9CC; color: #7a6200; border: 1px solid var(--yellow-dark); }
.status-badge--confirmed  { background: #E6F0FF; color: #1a3a7a; border: 1px solid #4A90D9; }
.status-badge--fulfilled  { background: #E6FFF2; color: #1a6b3c; border: 1px solid #2ECC71; }

/* ── Utility ─────────────────────────────────────────────────────────────────── */
.text-muted { color: var(--text-muted); }

/* ── Focus visible globally ──────────────────────────────────────────────────── */
:focus-visible {
  outline: 3px solid var(--teal);
  outline-offset: 2px;
}

/* ── Responsive adjustments ──────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .product-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 1rem; }
  .field-row { flex-direction: column; }
  .admin-product-actions { width: 100%; }
  .admin-product-row { flex-wrap: wrap; }
  .admin-header-inner { flex-direction: column; align-items: flex-start; }
  .hero { padding: 2rem 1rem; }
}

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