:root {
  /* Codemify brand palette — matches codemify.com (near-black + signature yellow). */
  --ink: #191919;          /* near-black: text + dark surfaces */
  --muted: #6b7280;
  --line: #e1e1e1;
  --bg: #ffffff;
  --bg-soft: #fafafa;
  --brand: #fee600;        /* signature yellow — primary CTAs/highlights (as a background) */
  --brand-hi: #f2de18;     /* yellow, hover */
  --accent: #191919;       /* links/text stay ink (yellow text fails contrast) */
  --accent-soft: #fff9c2;  /* pale yellow tint for badges/soft fills */
  --danger: #d11a1a;
  --radius: 10px;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.55;
}
.wrap { max-width: 880px; margin: 0 auto; padding: 0 20px; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.9rem; margin: 0 0 .4rem; }
h2 { font-size: 1.35rem; }
.muted { color: var(--muted); }

/* Environment banner - the visible dev/prod signal for Week 1 */
.env-banner {
  text-align: center;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .14em;
  padding: 5px;
  color: #fff;
}
.env-dev { background: #1b7a5e; }
.env-prod { background: #9a3412; }

.site-header { border-bottom: 1px solid var(--line); background: var(--bg-soft); }
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 60px; }
.brand { font-weight: 800; font-size: 1.25rem; color: var(--ink); }
.brand span { color: var(--ink); background: var(--brand); padding: 0 5px; border-radius: 4px; margin-left: 1px; }
.main-nav { display: flex; align-items: center; gap: 18px; font-size: .92rem; }
.inline-form { display: inline; margin: 0; }
.link-btn { background: none; border: none; color: var(--accent); cursor: pointer; font: inherit; padding: 0; }
.link-btn:hover { text-decoration: underline; }
.danger { color: var(--danger); }

.main-content { padding: 28px 20px 60px; min-height: 60vh; }

.hero { padding: 8px 0 22px; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 24px; }
.filters input[type="search"] { flex: 1; min-width: 200px; }
input, select, textarea {
  padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px; font: inherit; background: #fff;
}
button {
  padding: 9px 16px; border: none; border-radius: 8px; background: var(--ink); color: #fff;
  font: inherit; cursor: pointer;
}
button:hover { background: #000; }
.btn { display: inline-block; padding: 9px 16px; border-radius: 8px; background: var(--ink); color: #fff; }
.btn:hover { background: #000; text-decoration: none; }
.btn-secondary { display: inline-block; padding: 9px 16px; border: 1px solid var(--line); border-radius: 8px; color: var(--ink); background: #fff; }
.btn-secondary:hover { background: var(--bg-soft); text-decoration: none; }
/* Signature yellow CTA (add-to-cart, place order, checkout) */
.btn-primary, button.btn-primary { background: var(--brand); color: var(--ink); font-weight: 700; }
.btn-primary:hover, button.btn-primary:hover { background: var(--brand-hi); }

.article-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 16px; }
.article-card { border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; }
.article-card-title { font-size: 1.2rem; font-weight: 700; }
.article-card-meta { font-size: .85rem; color: var(--muted); margin: 4px 0 8px; }
.article-card-excerpt { margin: 0; }
.badge { display: inline-block; background: var(--accent-soft); color: var(--accent); border-radius: 999px; padding: 2px 10px; font-size: .78rem; }
.status-draft { background: #fef3c7; color: #92400e; }
.status-published { background: var(--accent-soft); color: var(--accent); }

.pagination { display: flex; align-items: center; gap: 16px; margin-top: 26px; font-size: .92rem; }
.empty-state { padding: 30px; text-align: center; color: var(--muted); border: 1px dashed var(--line); border-radius: var(--radius); }

.article-detail { max-width: 720px; }
.back-link { font-size: .9rem; }
.article-body { margin-top: 18px; white-space: pre-wrap; }
.cover { width: 100%; border-radius: var(--radius); margin-top: 14px; }

.comments { max-width: 720px; margin-top: 40px; border-top: 1px solid var(--line); padding-top: 24px; }
.comment-items { list-style: none; padding: 0; display: grid; gap: 12px; }
.comment { border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; }
.comment-author { font-weight: 600; margin: 0 0 4px; }
.comment-text { margin: 0; }
.comment-form { margin-top: 22px; display: grid; gap: 10px; max-width: 480px; }
.comment-form label { display: grid; gap: 4px; font-size: .9rem; }

.auth-card, .form-card { max-width: 460px; margin: 0 auto; }
.auth-card form, .form-card form { display: grid; gap: 12px; }
.auth-card label, .form-card label { display: grid; gap: 4px; font-size: .9rem; }
fieldset { border: 1px solid var(--line); border-radius: 8px; display: grid; gap: 10px; padding: 14px; }
legend { padding: 0 6px; color: var(--muted); font-size: .85rem; }

.form-errors { background: #fef2f2; border: 1px solid #fecaca; color: var(--danger); padding: 10px 14px; border-radius: 8px; font-size: .9rem; }
.form-errors ul { margin: 0; padding-left: 18px; }
.form-success { background: var(--accent-soft); border: 1px solid #a7f3d0; color: var(--accent); padding: 10px 14px; border-radius: 8px; }
.hint { margin-top: 16px; font-size: .85rem; color: var(--muted); }

.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th, .data-table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); font-size: .92rem; }
.row-actions { display: flex; gap: 12px; align-items: center; }
.form-actions { display: flex; gap: 12px; align-items: center; }

.inline-create { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 20px; }
.chip-list { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 10px; }
.chip { display: flex; align-items: center; gap: 8px; background: var(--bg-soft); border: 1px solid var(--line); border-radius: 999px; padding: 6px 8px 6px 14px; }
.chip-x { background: none; color: var(--muted); padding: 0 6px; font-size: 1.1rem; line-height: 1; }
.chip-x:hover { background: none; color: var(--danger); }

.error-page { text-align: center; padding: 60px 0; }
.error-page h1 { font-size: 3rem; }

.site-footer { border-top: 1px solid var(--line); background: var(--bg-soft); padding: 22px 0; font-size: .85rem; color: var(--muted); }

/* ============================ STORE (merch) ============================ */
.wrap-wide { max-width: 1100px; margin: 0 auto; padding: 0 20px; }
.nav-cart { position: relative; font-weight: 600; }
.cart-count { display: inline-block; min-width: 18px; text-align: center; background: var(--brand); color: var(--ink); border-radius: 999px; padding: 0 6px; font-size: .74rem; font-weight: 700; margin-left: 2px; }

.store-toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 22px; }
.store-toolbar select, .store-toolbar input { min-width: 130px; }

.product-grid { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 20px; }
.product-card { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; background: #fff; }
.product-card:hover { border-color: var(--ink); }
.product-thumb { aspect-ratio: 1/1; background: var(--bg-soft); display: flex; align-items: center; justify-content: center; overflow: hidden; }
.product-thumb img { width: 100%; height: 100%; object-fit: cover; }
.product-body { padding: 14px 16px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.product-name { font-weight: 700; color: var(--ink); }
.product-cat { font-size: .78rem; color: var(--muted); text-transform: capitalize; }
.product-price { font-weight: 800; font-size: 1.05rem; margin-top: auto; }

.stock-badge { display: inline-block; border-radius: 999px; padding: 2px 10px; font-size: .74rem; font-weight: 700; }
.stock-in { background: var(--accent-soft); color: #7a5c00; }
.stock-out { background: #f3f4f6; color: var(--muted); }

/* Product detail */
.product-detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 34px; align-items: start; }
.product-gallery { aspect-ratio: 1/1; background: var(--bg-soft); border-radius: var(--radius); overflow: hidden; display: flex; align-items: center; justify-content: center; }
.product-gallery img { width: 100%; height: 100%; object-fit: cover; }
.product-info h1 { margin-bottom: 6px; }
.product-info .product-price { font-size: 1.5rem; margin: 10px 0 16px; }
.buy-form { display: grid; gap: 14px; max-width: 340px; }
.buy-form label { display: grid; gap: 4px; font-size: .9rem; }

/* Cart */
.cart-layout { display: grid; grid-template-columns: 1fr 320px; gap: 30px; align-items: start; }
.cart-thumb { width: 52px; height: 52px; border-radius: 6px; object-fit: cover; background: var(--bg-soft); }
.qty-cell { display: flex; align-items: center; gap: 6px; }
.qty-cell input { width: 64px; }
.cart-aside { border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; background: var(--bg-soft); }
.totals-row { display: flex; justify-content: space-between; margin: 6px 0; font-size: .95rem; }
.totals-total { font-weight: 800; font-size: 1.15rem; border-top: 1px solid var(--line); padding-top: 10px; margin-top: 10px; }
.coupon-form { display: flex; gap: 8px; margin: 14px 0; }
.coupon-form input { flex: 1; }

/* Checkout */
.checkout-layout { display: grid; grid-template-columns: 1fr 320px; gap: 30px; align-items: start; }
.checkout-form { display: grid; gap: 14px; }
.checkout-form label { display: grid; gap: 4px; font-size: .9rem; }
.checkout-step { border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; }
.checkout-step h2 { margin-top: 0; font-size: 1.1rem; }
/* inputs must be shrinkable/full-width or the grid columns below blow out of alignment */
.checkout-form input { width: 100%; min-width: 0; }
.card-row { display: grid; grid-template-columns: 1fr 120px 100px; gap: 12px; align-items: end; }
.card-row label { min-width: 0; }
.card-row + button { margin-top: 18px; }
.test-cards { font-size: .84rem; color: var(--muted); background: var(--bg-soft); border-radius: 8px; padding: 12px 14px; line-height: 1.5; }
.test-cards ul { margin: 8px 0 6px; padding-left: 18px; }
.test-cards li { margin: 3px 0; }
.test-cards code { background: #fff; border: 1px solid var(--line); border-radius: 4px; padding: 1px 6px; font-size: .92em; color: var(--ink); }
@media (max-width: 560px) { .card-row { grid-template-columns: 1fr; } }

/* Order confirmation + history */
.order-confirm { text-align: center; max-width: 560px; margin: 0 auto; padding: 20px 0; }
.order-number { display: inline-block; background: var(--accent-soft); border-radius: 8px; padding: 6px 14px; font-weight: 800; letter-spacing: .04em; }
.order-status { text-transform: capitalize; font-weight: 700; }

@media (max-width: 780px) {
  .product-detail-grid, .cart-layout, .checkout-layout { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .header-inner { height: auto; flex-direction: column; gap: 8px; padding: 10px 0; }
  .main-nav { flex-wrap: wrap; justify-content: center; }
}
