/* CJ Sales — hand-written storefront CSS. No framework, no CDN, no build step. */

:root {
  --cream: #fdf8f1;
  --paper: #ffffff;
  --ink: #23201c;
  --ink-soft: #5d564d;
  --line: #e8dfd2;
  --brand: #d94f3d;
  --brand-dark: #b23c2d;
  --brand-tint: #fdece8;
  --accent: #2f7d6b;
  --accent-tint: #e6f3ef;
  --gold: #e0a52b;
  --danger: #b3261e;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(35, 32, 28, .06), 0 8px 24px rgba(35, 32, 28, .06);
  --shadow-lift: 0 2px 4px rgba(35, 32, 28, .08), 0 16px 40px rgba(35, 32, 28, .12);
  --font: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--cream);
  background-image:
    radial-gradient(circle at 12% -10%, rgba(224, 165, 43, .10), transparent 45%),
    radial-gradient(circle at 92% 4%, rgba(217, 79, 61, .08), transparent 42%);
  background-attachment: fixed;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main { flex: 1 0 auto; padding-bottom: 4rem; }

.wrap { width: min(1120px, 100% - 2.5rem); margin-inline: auto; }

h1, h2, h3 { line-height: 1.2; margin: 0 0 .5rem; letter-spacing: -.015em; }
h1 { font-size: clamp(1.75rem, 4.5vw, 2.5rem); }
h2 { font-size: 1.3rem; }
p { margin: 0 0 .75rem; }
a { color: var(--brand-dark); }
code {
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  background: #f1e9dc; padding: .1em .35em; border-radius: 5px; font-size: .9em;
}

/* ---------- accessibility helpers ---------- */

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: -999px; top: 0; z-index: 100;
  background: var(--ink); color: #fff; padding: .75rem 1.25rem; border-radius: 0 0 8px 0;
}
.skip-link:focus { left: 0; }

:focus-visible {
  outline: 3px solid var(--brand);
  outline-offset: 2px;
  border-radius: 4px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ---------- header ---------- */

.site-header {
  background: rgba(255, 255, 255, .88);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
}
.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; min-height: 68px; flex-wrap: wrap;
}
.brand {
  display: inline-flex; align-items: center; gap: .55rem;
  font-weight: 800; font-size: 1.2rem; color: var(--ink); text-decoration: none;
  letter-spacing: -.02em;
}
.brand-mark { font-size: 1.5rem; }
.brand-tag {
  font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em;
  background: var(--brand-tint); color: var(--brand-dark);
  padding: .15rem .45rem; border-radius: 999px; vertical-align: middle;
}
.nav { display: flex; align-items: center; gap: .35rem; flex-wrap: wrap; }
.nav a {
  text-decoration: none; color: var(--ink-soft); font-weight: 600; font-size: .95rem;
  padding: .5rem .7rem; border-radius: 9px;
}
.nav a:hover { background: var(--brand-tint); color: var(--brand-dark); }
.nav a[aria-current="page"] { color: var(--brand-dark); background: var(--brand-tint); }
/* Owner sign-in sits in the upper right on every page. */
.nav .signin {
  margin-left: .5rem; border: 1.5px solid var(--line);
  background: var(--paper); color: var(--ink);
}
.nav .signin:hover { border-color: var(--brand); }
.pill {
  display: inline-block; min-width: 1.35rem; padding: 0 .35rem; margin-left: .15rem;
  background: var(--brand); color: #fff; border-radius: 999px;
  font-size: .78rem; font-weight: 700; text-align: center; line-height: 1.5;
}

/* ---------- hero ---------- */

.hero { padding: clamp(2rem, 6vw, 3.5rem) 0 2.5rem; max-width: 44rem; }
.lede { color: var(--ink-soft); font-size: 1.08rem; margin-bottom: 1.25rem; }

/* ---------- buttons ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  padding: .68rem 1.15rem; border-radius: 11px; border: 1.5px solid var(--line);
  background: var(--paper); color: var(--ink);
  font: inherit; font-weight: 650; font-size: .95rem; text-decoration: none;
  cursor: pointer; transition: transform .12s ease, box-shadow .12s ease, background .12s ease;
}
.btn:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); }
.btn-ghost { background: transparent; }
.btn-danger { color: var(--danger); border-color: #f0cdc9; background: #fff6f5; }
.btn-danger:hover { background: #fdecea; }
.btn-block { display: flex; width: 100%; margin-top: .6rem; }
.btn-small { padding: .35rem .7rem; font-size: .85rem; }

/* ---------- product grid ---------- */

.grid {
  display: grid; gap: 1.25rem;
  grid-template-columns: repeat(auto-fill, minmax(255px, 1fr));
}
.grid-tight { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }

.card {
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; display: flex; flex-direction: column;
  box-shadow: var(--shadow); transition: box-shadow .15s ease, transform .15s ease;
}
.card:hover { box-shadow: var(--shadow-lift); transform: translateY(-2px); }
.card-media {
  display: flex; align-items: center; justify-content: center;
  height: 168px; text-decoration: none;
  background: linear-gradient(150deg, #fff7ec, #fdeadf);
  border-bottom: 1px solid var(--line);
}
.card-body { padding: 1.1rem 1.15rem 1.2rem; display: flex; flex-direction: column; flex: 1; }
.card-body h2, .card-body h3 { font-size: 1.12rem; }
.card-body h2 a, .card-body h3 a { color: var(--ink); text-decoration: none; }
.card-body h2 a:hover, .card-body h3 a:hover { color: var(--brand-dark); }
.card-body form { margin-top: auto; display: flex; gap: .5rem; }
.desc { color: var(--ink-soft); font-size: .93rem; }
.price { font-weight: 800; font-size: 1.2rem; color: var(--ink); margin: .2rem 0 .5rem; }
.price-lg { font-size: 1.7rem; }

.emoji { font-size: 3.6rem; line-height: 1; }
.emoji-lg { font-size: clamp(5rem, 18vw, 8rem); }
.emoji-sm { font-size: 1.1rem; }

/* ---------- product detail ---------- */

.crumbs { font-size: .88rem; color: var(--ink-soft); padding: 1.5rem 0 1rem; }
.crumbs a { text-decoration: none; }
.detail {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: 2.5rem;
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius);
  padding: clamp(1.25rem, 4vw, 2.25rem); box-shadow: var(--shadow);
}
.detail-media {
  display: flex; align-items: center; justify-content: center; min-height: 240px;
  background: linear-gradient(150deg, #fff7ec, #fdeadf); border-radius: 10px;
}
.specs { display: flex; flex-wrap: wrap; gap: 1.5rem; margin: 1.25rem 0; }
.specs dt { font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-soft); }
.specs dd { margin: 0; font-weight: 600; }
.more { margin-top: 2.75rem; }
.qty-form { display: flex; align-items: end; gap: .65rem; flex-wrap: wrap; }
.qty-form label { font-size: .9rem; font-weight: 600; }

/* ---------- forms ---------- */

.form { display: flex; flex-direction: column; gap: 1.1rem; }
.card-form {
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.5rem; box-shadow: var(--shadow); max-width: 26rem;
}
.field { display: flex; flex-direction: column; gap: .35rem; }
.field label { font-weight: 650; font-size: .93rem; }
.field input, .field textarea, .table input {
  font: inherit; padding: .6rem .75rem; border: 1.5px solid var(--line);
  border-radius: 9px; background: var(--paper); color: var(--ink); width: 100%;
}
.field input:focus, .field textarea:focus, .table input:focus { border-color: var(--brand); outline: none; box-shadow: 0 0 0 3px var(--brand-tint); }
.field textarea { resize: vertical; min-height: 5.5rem; }
.help { font-size: .82rem; color: var(--ink-soft); margin: 0; }
.inline-form { display: inline-flex; align-items: center; gap: .4rem; margin: 0; }
.qty-form input[type=number], .table input[type=number] { width: 5rem; }

/* ---------- states ---------- */

.state {
  background: var(--paper); border: 1px dashed var(--line); border-radius: var(--radius);
  padding: 2.5rem 1.5rem; text-align: center; max-width: 34rem; margin: 1.5rem auto;
}
.state h1, .state h2 { margin-top: .4rem; }
.state p { color: var(--ink-soft); }
.state-error { border-style: solid; border-color: #f0cdc9; background: #fff8f7; }
.state-error h1, .state-error h2 { color: var(--danger); }
.state-good { border-style: solid; border-color: #bfe0d5; background: var(--accent-tint); }
.form-errors { text-align: left; max-width: none; margin: 0 0 1rem; padding: 1rem 1.25rem; }
.form-errors h2 { font-size: 1rem; }
.form-errors ul { margin: .4rem 0 0; padding-left: 1.1rem; }
.form-errors li { color: var(--ink-soft); font-size: .92rem; }

.flash {
  margin: 1.25rem 0 0; padding: .8rem 1.1rem; border-radius: 10px;
  font-weight: 600; font-size: .95rem; border: 1px solid;
}
.flash-success { background: var(--accent-tint); border-color: #bfe0d5; color: #1d574a; }
.flash-error { background: #fff6f5; border-color: #f0cdc9; color: var(--danger); }

.spinner {
  display: inline-block; width: 1.1rem; height: 1.1rem; margin-right: .5rem;
  border: 2px solid var(--line); border-top-color: var(--brand);
  border-radius: 50%; animation: spin .7s linear infinite; vertical-align: -.2rem;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- cart / tables ---------- */

.cart-layout { display: grid; grid-template-columns: minmax(0, 2.1fr) minmax(0, 1fr); gap: 1.75rem; align-items: start; margin-top: 1.25rem; }
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table {
  width: 100%; border-collapse: collapse; background: var(--paper);
  border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow);
}
.table th, .table td { padding: .8rem 1rem; text-align: left; border-bottom: 1px solid var(--line); font-size: .93rem; }
.table thead th { background: #faf5ec; font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-soft); }
.table tbody tr:last-child td, .table tbody tr:last-child th { border-bottom: 0; }
.table tbody tr:hover { background: #fdfaf5; }
.table tfoot th, .table tfoot td { background: #faf5ec; font-weight: 800; font-size: 1.05rem; }
.table-compact th, .table-compact td { padding: .5rem .75rem; font-size: .88rem; }
.cell-product { display: flex; align-items: center; gap: .7rem; }
.total { font-weight: 800; }
.cell-address { white-space: pre-line; color: var(--ink-soft); max-width: 22rem; }

.summary {
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.25rem; box-shadow: var(--shadow); position: sticky; top: 88px;
}
.summary h2 { font-size: 1.05rem; }
.summary dl { margin: 0; }
.summary dl > div { display: flex; justify-content: space-between; padding: .4rem 0; font-size: .95rem; }
.summary dt { color: var(--ink-soft); }
.summary dd { margin: 0; font-weight: 600; }
.summary .grand { border-top: 1px solid var(--line); margin-top: .5rem; padding-top: .65rem; font-size: 1.15rem; font-weight: 800; }
.summary .grand dd { color: var(--brand-dark); }
.summary-items { list-style: none; margin: 0 0 1rem; padding: 0; font-size: .9rem; }
.summary-items li { display: flex; align-items: center; gap: .45rem; padding: .3rem 0; border-bottom: 1px dashed var(--line); }
.summary-items strong { margin-left: auto; }

/* ---------- confirmation ---------- */

.receipt { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.5rem; box-shadow: var(--shadow); margin-top: 1.5rem; }

/* ---------- admin ---------- */

.admin { background-image: radial-gradient(circle at 8% -6%, rgba(47, 125, 107, .10), transparent 45%); }
.admin-header .brand-tag { background: var(--accent-tint); color: var(--accent); }
.admin .signin-page { max-width: 30rem; margin: 2rem auto; }
.panel {
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.4rem 1.5rem 1.6rem; box-shadow: var(--shadow); margin: 1.5rem 0 2rem;
  max-width: 34rem;
}
.panel h2 { margin-top: 0; }
.panel > .muted { margin-top: -.4rem; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 1rem; margin: 1.5rem 0 2.5rem; }
.stat {
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.1rem 1.25rem; box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: .25rem;
}
.stat-label { font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-soft); }
.stat-value { font-size: 1.6rem; font-weight: 800; }
.orders { display: flex; flex-direction: column; gap: 1.25rem; margin-top: 1.25rem; }
.order {
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.25rem; box-shadow: var(--shadow);
}
.order header { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; margin-bottom: .35rem; }
.order header h2 { margin: 0; font-size: 1.1rem; }
.order-total { margin-left: auto; font-weight: 800; font-size: 1.1rem; }
.badge { background: var(--accent-tint); color: var(--accent); font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; padding: .15rem .5rem; border-radius: 999px; }
.muted { color: var(--ink-soft); font-size: .9rem; }

/* ---------- footer ---------- */

.site-footer { border-top: 1px solid var(--line); background: rgba(255, 255, 255, .6); margin-top: auto; }
.footer-inner { padding: 1.5rem 0; display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; font-size: .9rem; color: var(--ink-soft); }
.footer-inner p { margin: 0; }

/* ---------- responsive (verified at 390px) ---------- */

@media (max-width: 860px) {
  .cart-layout, .detail { grid-template-columns: 1fr; }
  .summary { position: static; }
  .detail-media { min-height: 180px; }
}

@media (max-width: 560px) {
  .wrap { width: min(1120px, 100% - 1.75rem); }
  .header-inner { min-height: 0; padding: .7rem 0; gap: .5rem; }
  .brand { font-size: 1.05rem; }
  .nav { width: 100%; justify-content: space-between; gap: .15rem; }
  .nav a { padding: .4rem .45rem; font-size: .85rem; }
  .nav .signin { margin-left: 0; }
  .grid { grid-template-columns: 1fr; }
  .card-body form { flex-direction: column; }
  .card-body form .btn { width: 100%; }
  .table th, .table td { padding: .6rem .65rem; font-size: .85rem; }
  .cell-address { max-width: 10rem; }
  .hero { padding-top: 1.5rem; }
  .footer-inner { flex-direction: column; gap: .25rem; }
}
