/* ============================================================
   Kiln & Co. — sublimation mug shop
   Dark (default) and light themes share one token set.
   ============================================================ */

:root {
  --orange:      #ff6b00;
  --orange-lift: #ff8a33;
  --orange-deep: #c74f00;

  --bg:        #000000;
  --panel:     #17120e;
  --panel-2:   #221a13;
  --line:      #3a2c20;
  --ink:       #f7f2ec;
  --ink-dim:   #b3a595;
  --ink-faint: #7d7062;
  --shadow:    0 18px 40px rgba(0, 0, 0, .55);

  --ok:   #4ea86a;
  --warn: #d9483b;

  --radius:  14px;
  --radius-s: 8px;
  --wrap: 1180px;
  --step: clamp(1.25rem, 3vw, 2.5rem);

  --font-display: 'Bricolage Grotesque', 'Trebuchet MS', sans-serif;
  --font-body: 'Instrument Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

[data-theme="light"] {
  --bg:        #ffffff;
  --panel:     #f6f2ee;
  --panel-2:   #ffffff;
  --line:      #e2d8ce;
  --ink:       #1a1613;
  --ink-dim:   #5d5449;
  --ink-faint: #8d8377;
  --shadow:    0 14px 34px rgba(26, 22, 19, .10);
  --orange-deep: #b34700;
}

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

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

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

img { max-width: 100%; display: block; }

a { color: inherit; }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -.02em;
  line-height: 1.08;
  margin: 0 0 .5em;
}

h1 { font-size: clamp(2.1rem, 5vw, 3.4rem); }
h2 { font-size: clamp(1.5rem, 3vw, 2.1rem); }
h3 { font-size: 1.15rem; }

p { margin: 0 0 1em; }

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

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

.stack > * + * { margin-top: 1rem; }
.muted { color: var(--ink-dim); }
.small { font-size: .875rem; }
.center { text-align: center; }

/* ---------- Header ---------- */

.site-head {
  position: sticky;
  top: 0;
  z-index: 40;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.site-head__inner {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding: .85rem 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: .6rem;
  text-decoration: none;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.2rem;
  letter-spacing: -.03em;
}

.brand__mark {
  width: 30px;
  height: 30px;
  margin-right: 13px;      /* room for the handle that hangs off the right */
  flex: 0 0 auto;
  border-radius: 4px 4px 6px 6px;
  background: var(--orange);
  position: relative;
}

.brand__mark::after {
  content: "";
  position: absolute;
  right: -9px;
  top: 6px;
  width: 13px;
  height: 14px;
  border: 3px solid var(--orange);
  border-left: none;
  border-radius: 0 9px 9px 0;
}

.nav {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 1.4rem;
}

.nav a {
  text-decoration: none;
  color: var(--ink-dim);
  font-size: .95rem;
}

.nav a:hover { color: var(--ink); }

.cart-link {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  color: var(--ink) !important;
  font-weight: 600;
}

.cart-pip {
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 11px;
  background: var(--orange);
  color: #fff;
  font-size: .75rem;
  font-weight: 700;
  display: grid;
  place-items: center;
}

.theme-toggle {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink-dim);
  border-radius: 20px;
  padding: .35rem .8rem;
  font: inherit;
  font-size: .85rem;
  cursor: pointer;
}

.theme-toggle:hover { color: var(--ink); border-color: var(--orange); }

/* ---------- Hero: the wrap band ----------
   A mug's printed surface is a flat rectangle before it is wrapped
   onto the cylinder. The hero is that rectangle. */

.hero { padding: var(--step) 0 calc(var(--step) * 1.2); }

.wrap-band {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  background:
    repeating-linear-gradient(90deg,
      rgba(255, 255, 255, .05) 0 1px,
      transparent 1px 64px),
    linear-gradient(115deg, var(--orange-deep), var(--orange) 55%, var(--orange-lift));
  color: #fff;
  padding: clamp(1.75rem, 3.5vw, 2.75rem) clamp(1.75rem, 4vw, 3.25rem);
  box-shadow: var(--shadow);
}

/* the two seams where the print meets the handle */
.wrap-band::before,
.wrap-band::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  width: 14px;
  background: repeating-linear-gradient(180deg, rgba(0,0,0,.28) 0 6px, transparent 6px 12px);
}
.wrap-band::before { left: 0; }
.wrap-band::after  { right: 0; }

.wrap-band h1 { color: #fff; max-width: 22ch; }
.wrap-band p  { color: rgba(255, 255, 255, .9); max-width: 52ch; }

.hero-specs {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid rgba(255, 255, 255, .3);
  font-size: .92rem;
  color: rgba(255, 255, 255, .92);
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  border: 1px solid transparent;
  border-radius: var(--radius-s);
  padding: .7rem 1.3rem;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background-color .15s, color .15s, border-color .15s;
}

.btn--primary { background: var(--orange); color: #fff; }
.btn--primary:hover { background: var(--orange-lift); }

.btn--ghost { border-color: var(--line); color: var(--ink); background: transparent; }
.btn--ghost:hover { border-color: var(--orange); color: var(--orange); }

.btn--light { background: #fff; color: #171208; }
.btn--light:hover { background: rgba(255, 255, 255, .88); }

.btn--block { width: 100%; }
.btn--sm { padding: .45rem .85rem; font-size: .88rem; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* ---------- Section headings ---------- */

.section { padding: calc(var(--step) * 1.1) 0; }

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}

.section-head p { margin: 0; }

/* ---------- Product grid ---------- */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 1.4rem;
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
  position: relative;
}

.card:hover { border-color: var(--orange); }

.card__shot {
  aspect-ratio: 1 / 1;
  background: var(--panel-2);
  overflow: hidden;
}

.card__shot img { width: 100%; height: 100%; object-fit: cover; }

.card__body { padding: .95rem 1rem 1.1rem; }

.card__name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.02rem;
  margin: 0 0 .35rem;
}

/* Price sits directly under the mug, as asked */
.price {
  display: flex;
  align-items: baseline;
  gap: .55rem;
  flex-wrap: wrap;
}

.price__now {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.35rem;
  color: var(--orange);
}

.price__was {
  color: var(--ink-faint);
  text-decoration: line-through;
  font-size: .95rem;
}

.price__save {
  font-size: .78rem;
  font-weight: 700;
  color: var(--ok);
}

.flag {
  position: absolute;
  top: .8rem;
  left: .8rem;
  background: var(--orange);
  color: #fff;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .04em;
  padding: .28rem .6rem;
  border-radius: 4px;
  z-index: 2;
}

.flag--custom {
  background: var(--bg);
  color: var(--orange);
  border: 1px solid var(--orange);
  left: auto;
  right: .8rem;
}

/* ---------- Product page ---------- */

.product {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  gap: clamp(1.5rem, 4vw, 3rem);
  padding: var(--step) 0;
  align-items: start;
}

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

.product__shot {
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--panel);
}

.product__price { margin: .5rem 0 1.25rem; }
.product__price .price__now { font-size: 2rem; }

.spec-list {
  list-style: none;
  margin: 1.5rem 0 0;
  padding: 1.25rem 0 0;
  border-top: 1px solid var(--line);
  color: var(--ink-dim);
  font-size: .93rem;
}

.spec-list li { padding: .3rem 0; }

/* ---------- Personalise panel ---------- */

.personalise {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 1.25rem;
  margin: 1.5rem 0;
}

.dropzone {
  border: 2px dashed var(--line);
  border-radius: var(--radius-s);
  padding: 1.6rem 1rem;
  text-align: center;
  cursor: pointer;
  color: var(--ink-dim);
  transition: border-color .15s, background-color .15s;
}

.dropzone:hover,
.dropzone.is-over {
  border-color: var(--orange);
  color: var(--ink);
}

.dropzone input { display: none; }

/* Mug preview: the flat image curved back onto the cylinder */
.mug-preview {
  display: none;
  margin-top: 1.1rem;
  gap: 1rem;
  align-items: center;
}

.mug-preview.is-on { display: flex; }

.mug-body {
  position: relative;
  width: 132px;
  height: 116px;
  flex: 0 0 auto;
  border-radius: 8px 8px 12px 12px;
  overflow: hidden;
  background: #fff;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .18);
}

.mug-body img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* curvature: darker at both edges, light down the centre */
.mug-body::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg,
    rgba(0, 0, 0, .34) 0%,
    rgba(0, 0, 0, .06) 22%,
    rgba(255, 255, 255, .3) 47%,
    rgba(0, 0, 0, .08) 74%,
    rgba(0, 0, 0, .34) 100%);
  pointer-events: none;
}

.mug-handle {
  width: 34px;
  height: 54px;
  margin-left: -6px;
  border: 9px solid #fff;
  border-left: none;
  border-radius: 0 26px 26px 0;
  flex: 0 0 auto;
}

/* ---------- Forms ---------- */

.field { margin-bottom: 1rem; }

.field label {
  display: block;
  font-size: .88rem;
  font-weight: 600;
  margin-bottom: .35rem;
}

.field .hint {
  display: block;
  font-weight: 400;
  color: var(--ink-faint);
  font-size: .82rem;
  margin-top: .3rem;
}

input[type="text"], input[type="email"], input[type="tel"],
input[type="password"], input[type="number"], input[type="url"],
select, textarea {
  width: 100%;
  padding: .65rem .8rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-s);
  background: var(--panel-2);
  color: var(--ink);
  font: inherit;
}

textarea { min-height: 90px; resize: vertical; }

input:focus, select:focus, textarea:focus {
  border-color: var(--orange);
  outline: none;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--orange) 25%, transparent);
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

@media (max-width: 560px) { .field-row { grid-template-columns: 1fr; } }

.qty {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius-s);
  overflow: hidden;
}

.qty button {
  width: 38px;
  height: 40px;
  border: none;
  background: var(--panel-2);
  color: var(--ink);
  font-size: 1.1rem;
  cursor: pointer;
}

.qty button:hover { color: var(--orange); }

.qty input {
  width: 48px;
  height: 40px;
  border: none;
  border-inline: 1px solid var(--line);
  border-radius: 0;
  text-align: center;
  padding: 0;
}

/* ---------- Cart & checkout ---------- */

.layout-2 {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(280px, 1fr);
  gap: clamp(1.5rem, 4vw, 2.5rem);
  align-items: start;
  padding: var(--step) 0;
}

@media (max-width: 860px) { .layout-2 { grid-template-columns: 1fr; } }

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.35rem;
}

.panel h2 { font-size: 1.2rem; }

.line-item {
  display: grid;
  grid-template-columns: 86px 1fr auto;
  gap: 1rem;
  align-items: center;
  padding: 1rem 0;
  border-bottom: 1px solid var(--line);
}

.line-item:last-of-type { border-bottom: none; }

.line-item__shot {
  width: 86px;
  height: 86px;
  border-radius: var(--radius-s);
  overflow: hidden;
  background: var(--panel-2);
}

.line-item__shot img { width: 100%; height: 100%; object-fit: cover; }

.line-item__name { font-weight: 600; }

.totals { list-style: none; margin: 0; padding: 0; }

.totals li {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: .45rem 0;
  color: var(--ink-dim);
}

.totals li.grand {
  border-top: 1px solid var(--line);
  margin-top: .5rem;
  padding-top: .8rem;
  color: var(--ink);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.25rem;
}

.tag {
  display: inline-block;
  font-size: .75rem;
  font-weight: 600;
  padding: .18rem .5rem;
  border-radius: 4px;
  border: 1px solid var(--line);
  color: var(--ink-dim);
}

.tag--custom { border-color: var(--orange); color: var(--orange); }

/* ---------- Flash notices ---------- */

.notice {
  border-radius: var(--radius-s);
  padding: .8rem 1rem;
  margin: 1rem 0;
  border: 1px solid var(--line);
  background: var(--panel);
  font-size: .95rem;
}

.notice--ok   { border-color: var(--ok);   color: var(--ok); }
.notice--err  { border-color: var(--warn); color: var(--warn); }

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

.empty {
  text-align: center;
  padding: 3rem 1rem;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  color: var(--ink-dim);
}

/* ---------- Footer ---------- */

.site-foot {
  border-top: 1px solid var(--line);
  margin-top: calc(var(--step) * 1.5);
  padding: 2rem 0;
  color: var(--ink-dim);
  font-size: .9rem;
}

.site-foot__inner {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 2rem;
  justify-content: space-between;
}

.site-foot a { color: var(--ink-dim); }

/* ---------- Admin ---------- */

.admin-head {
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  padding: .8rem 0;
}

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

.admin-nav a { text-decoration: none; color: var(--ink-dim); font-size: .95rem; }
.admin-nav a.is-active, .admin-nav a:hover { color: var(--orange); }
.admin-nav .spacer { margin-left: auto; }

.table-wrap { overflow-x: auto; }

table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: .93rem;
}

table.data th, table.data td {
  text-align: left;
  padding: .7rem .75rem;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

table.data th {
  color: var(--ink-faint);
  font-weight: 600;
  font-size: .82rem;
}

table.data tbody tr:hover { background: var(--panel-2); }

.thumb {
  width: 52px;
  height: 52px;
  border-radius: 6px;
  object-fit: cover;
  background: var(--panel-2);
}

.pill {
  display: inline-block;
  font-size: .75rem;
  font-weight: 600;
  padding: .2rem .55rem;
  border-radius: 20px;
  border: 1px solid var(--line);
}

.pill--new      { border-color: var(--orange); color: var(--orange); }
.pill--printing { border-color: #d9a13b; color: #d9a13b; }
.pill--sent     { border-color: var(--ok); color: var(--ok); }
.pill--off      { color: var(--ink-faint); }

.login-box {
  max-width: 380px;
  margin: 12vh auto;
}

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