/* Rustic + warm baseline.
   --accent, --bg, --font-body and --font-head are injected per-request from the
   admin Customize panel (see base.html), so they must never be hardcoded here.
   Everything else is DERIVED from them with color-mix(), which is what lets a
   background change ripple through borders, muted text and placeholders instead
   of leaving them stranded. Static values are declared first as fallbacks for
   browsers without color-mix(). */
:root {
  --bg: #f7efe3;
  --ink: #33291e;
  --accent: #a9573b;
  --accent-ink: #ffffff;
  --danger: #b3402c;

  --font-body: Georgia, "Iowan Old Style", "Times New Roman", serif;
  --font-head: Baskerville, "Palatino Linotype", Palatino, "Book Antiqua", serif;

  /* Fallbacks, then derived. */
  --surface: #fffdf9;
  --line: #e4d7c4;
  --muted: #8a7963;
  --soft: #efe4d4;
  --body-ink: #4b4034;

  --radius: 12px;
  --shadow: 0 10px 30px rgba(74, 52, 32, 0.10);
  --shadow-sm: 0 2px 10px rgba(74, 52, 32, 0.06);
  --wrap: 1060px;
}

@supports (color: color-mix(in srgb, red 50%, blue)) {
  :root {
    --surface: color-mix(in srgb, #ffffff 74%, var(--bg));
    --line:    color-mix(in srgb, var(--bg) 84%, var(--ink));
    --muted:   color-mix(in srgb, var(--ink) 52%, var(--bg));
    --soft:    color-mix(in srgb, var(--bg) 88%, var(--ink));
    --body-ink: color-mix(in srgb, var(--ink) 82%, var(--bg));
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.65;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Paper grain. Inline SVG so nothing is fetched from a third party; sits above
   the background and below content, and never intercepts clicks. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.05;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)'/%3E%3C/svg%3E");
}
body > * { position: relative; z-index: 1; }

h1, h2, h3, .brand, .price, .total {
  font-family: var(--font-head);
  letter-spacing: 0.01em;
}
h1, h2, h3 { line-height: 1.25; font-weight: 700; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }

/* ---------- layout ---------- */
.container, .site-header, .site-footer > p { max-width: var(--wrap); margin: 0 auto; }
.container { width: 100%; padding: 28px 20px 64px; flex: 1; }

.site-header {
  width: 100%;
  padding: 18px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.brand {
  font-size: 1.45rem; font-weight: 700; color: var(--ink);
  display: inline-flex; align-items: center; letter-spacing: 0.02em;
}
.brand:hover { text-decoration: none; }
.logo { max-height: 46px; width: auto; }
.site-header nav { display: flex; gap: 22px; align-items: center; }
.site-header nav a { color: var(--ink); font-weight: 500; }
.site-header nav a:hover { color: var(--accent); }
.cart-link { position: relative; }
.badge {
  display: inline-block;
  min-width: 20px;
  padding: 0 6px;
  margin-left: 6px;
  font-size: 0.78rem;
  text-align: center;
  color: var(--accent-ink);
  background: var(--accent);
  border-radius: 999px;
}

.site-footer {
  border-top: 1px solid var(--line);
  padding: 26px 20px;
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
  background: var(--surface);
}

/* ---------- hero ---------- */
.hero { text-align: center; padding: 52px 0 40px; }
.hero h1 { font-size: 2.6rem; margin: 0 0 12px; }
.hero p { color: var(--muted); margin: 0 auto; max-width: 44ch; font-size: 1.06rem; }

/* Hand-drawn-ish divider under the hero. */
.hero::after {
  content: "";
  display: block;
  width: 64px;
  height: 2px;
  margin: 22px auto 0;
  background: var(--accent);
  opacity: 0.55;
  border-radius: 2px;
}
.hero.hero-image {
  background-size: cover;
  background-position: center;
  border-radius: var(--radius);
  padding: 92px 24px;
  margin-bottom: 10px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}
/* Scrim keeps the headline readable over any photo she uploads. */
.hero.hero-image::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(rgba(40, 28, 18, 0.30), rgba(40, 28, 18, 0.50));
}
.hero.hero-image h1, .hero.hero-image p {
  color: #fff;
  position: relative;
  text-shadow: 0 2px 12px rgba(30, 20, 12, 0.45);
}
.hero.hero-image::after { background: #fff; opacity: 0.8; position: relative; }

.about {
  max-width: 62ch;
  margin: 60px auto 0;
  text-align: center;
  padding-top: 40px;
  border-top: 1px solid var(--line);
}
.about h2 { margin: 0 0 12px; font-size: 1.7rem; }
.about p { color: var(--body-ink); }

/* ---------- blog ---------- */
.post-list { max-width: 700px; margin: 0 auto; display: flex; flex-direction: column; gap: 30px; }
.post-card { border-bottom: 1px solid var(--line); padding-bottom: 26px; }
.post-card h2 { margin: 0 0 6px; }
.post-card h2 a { color: var(--ink); }
.post-card h2 a:hover { color: var(--accent); text-decoration: none; }
.post-date { color: var(--muted); font-size: 0.86rem; margin: 0 0 10px; font-style: italic; }
.post-excerpt { margin: 0 0 10px; color: var(--body-ink); }
.read-more { font-weight: 600; }
.post { max-width: 700px; margin: 0 auto; }
.post > h1 { margin: 6px 0 4px; font-size: 2.1rem; }
.post-body { margin-top: 24px; line-height: 1.8; color: var(--body-ink); }
.post-body p { margin: 0 0 1em; }
.post-body h2, .post-body h3 { margin: 1.6em 0 0.4em; color: var(--ink); }
.post-body ul, .post-body ol { padding-left: 1.3em; margin: 0 0 1em; }
.post-body img { border-radius: var(--radius); margin: 1.2em 0; box-shadow: var(--shadow-sm); }
.post-body a { text-decoration: underline; }
.post-body blockquote {
  border-left: 3px solid var(--accent);
  margin: 1.2em 0;
  padding: 4px 0 4px 18px;
  color: var(--muted);
  font-style: italic;
}
.post-body pre {
  background: var(--soft); padding: 14px; border-radius: 10px; overflow-x: auto;
}
.post-body code { font-family: ui-monospace, Menlo, monospace; font-size: 0.92em; }
.post-editor { font-family: ui-monospace, "Cascadia Code", Menlo, monospace; line-height: 1.5; }

/* ---------- product grid ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(235px, 1fr));
  gap: 26px;
}
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  color: inherit;
  box-shadow: var(--shadow-sm);
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}
.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow);
  border-color: var(--accent);
  text-decoration: none;
}
.card-img, .product-img {
  background: var(--soft) center/cover no-repeat;
  aspect-ratio: 1 / 1;
}
.card-body { padding: 14px 16px 18px; }
.card-body h3 { margin: 0 0 6px; font-size: 1.1rem; }
.price { font-weight: 700; margin: 0; color: var(--accent); }
.sold-out {
  display: inline-block; margin-top: 6px; font-size: 0.8rem;
  color: var(--danger); font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase;
}
.empty { text-align: center; color: var(--muted); padding: 48px 0; font-style: italic; }

/* ---------- product detail ---------- */
.product { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; align-items: start; }
.product-img { border-radius: var(--radius); border: 1px solid var(--line); box-shadow: var(--shadow); }
.product-info h1 { margin: 0 0 10px; font-size: 2rem; }
.product-info .price { font-size: 1.6rem; margin-bottom: 18px; }
.desc { color: var(--body-ink); }
.back { font-size: 0.92rem; color: var(--muted); }
.back:hover { color: var(--accent); }

/* ---------- buttons ---------- */
.btn {
  display: inline-block;
  border: 1px solid transparent;
  background: var(--accent);
  color: var(--accent-ink);
  padding: 12px 22px;
  border-radius: 9px;
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: filter 0.14s ease, transform 0.14s ease;
}
.btn:hover { filter: brightness(0.93); transform: translateY(-1px); text-decoration: none; }
.btn:disabled { opacity: 0.55; cursor: default; transform: none; filter: none; }
.btn.ghost {
  background: transparent; color: var(--ink);
  border: 1px solid var(--line); box-shadow: none;
}
.btn.ghost:hover { border-color: var(--accent); color: var(--accent); filter: none; }

/* ---------- cart ---------- */
.cart-table { width: 100%; border-collapse: collapse; }
.cart-table th, .cart-table td { padding: 14px 8px; border-bottom: 1px solid var(--line); text-align: left; }
.cart-table th {
  font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--muted); font-weight: 600;
}
.qty-cell { display: flex; align-items: center; gap: 10px; }
.qty {
  width: 30px; height: 30px; border: 1px solid var(--line);
  background: var(--surface); border-radius: 8px; cursor: pointer;
  font-size: 1rem; color: var(--ink);
}
.qty:hover { border-color: var(--accent); color: var(--accent); }
.remove { border: none; background: none; color: var(--muted); font-size: 1.2rem; cursor: pointer; }
.remove:hover { color: var(--danger); }
.cart-footer { display: flex; justify-content: flex-end; align-items: center; gap: 22px; margin-top: 24px; }
.total { font-size: 1.35rem; font-weight: 700; }
.error { color: var(--danger); text-align: right; margin-top: 8px; }

/* ---------- flash ---------- */
.flash { list-style: none; padding: 0; margin: 0 0 20px; }
.flash li {
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  color: var(--body-ink);
  padding: 11px 15px;
  border-radius: 9px;
  margin-bottom: 8px;
  box-shadow: var(--shadow-sm);
}

/* ---------- admin ---------- */
.admin-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 30px; max-width: 420px; margin: 34px auto; box-shadow: var(--shadow);
}
.admin-card.wide { max-width: 620px; }
.admin-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; }
.admin-head .btn { margin-left: 8px; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.stack label { display: flex; flex-direction: column; gap: 5px; font-weight: 600; font-size: 0.92rem; }
.stack .row { flex-direction: row; display: flex; gap: 14px; }
.stack .row > label { flex: 1; }
.stack input[type="text"], .stack input[type="password"],
.stack input[type="number"], .stack textarea {
  padding: 10px 12px; border: 1px solid var(--line); border-radius: 9px;
  font: inherit; background: var(--surface); color: var(--ink); width: 100%;
}
.stack input:focus, .stack textarea:focus, .stack select:focus {
  outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent);
}
.checkbox { flex-direction: row !important; align-items: center; gap: 8px !important; }
.preview { max-width: 160px; border-radius: 10px; border: 1px solid var(--line); }
.preview.wide { max-width: 100%; }
.muted { color: var(--muted); }

.stack select {
  padding: 10px 12px; border: 1px solid var(--line); border-radius: 9px;
  font: inherit; background: var(--surface); color: var(--ink); width: 100%;
}
.stack input[type="color"] {
  width: 100%; height: 42px; padding: 4px; border: 1px solid var(--line);
  border-radius: 9px; background: var(--surface);
}
.customize fieldset {
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px 20px; margin: 0; display: flex; flex-direction: column; gap: 14px;
  background: var(--surface);
}
.customize legend { font-weight: 700; padding: 0 6px; font-family: var(--font-head); }
.customize small { font-weight: 400; color: var(--muted); }
.sep { border: none; border-top: 1px solid var(--line); margin: 24px 0; }

.admin-table { width: 100%; border-collapse: collapse; margin: 14px 0 30px; }
.admin-table th, .admin-table td { padding: 11px 8px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.admin-table th {
  font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted);
}
/* Shipping address: newlines shown as line breaks without injecting any HTML. */
.addr { white-space: pre-line; line-height: 1.4; }
.thumb { width: 46px; height: 46px; object-fit: cover; border-radius: 8px; }
.thumb.placeholder { display: inline-block; background: var(--soft); }
.row-actions { display: flex; gap: 14px; align-items: center; }
.row-actions form { margin: 0; }
.link-danger { border: none; background: none; color: var(--danger); cursor: pointer; font: inherit; padding: 0; }
.status { padding: 3px 11px; border-radius: 999px; font-size: 0.8rem; text-transform: capitalize; font-weight: 600; }
.status.paid { background: #e4f0e2; color: #3f6b3a; }
.status.pending { background: #f6e7cf; color: #8a6428; }
.status.expired { background: var(--soft); color: var(--muted); }

/* ---------- photo gallery ---------- */
/* Columns, not grid: her photos will be mixed portrait/landscape/square, and a
   masonry flow keeps each one's real proportions instead of cropping to a box. */
.gallery { columns: 3 260px; column-gap: 22px; }

.shot {
  break-inside: avoid;
  margin: 0 0 22px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}
.shot:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--accent); }

/* The clickable image is a real <button> so it's keyboard-reachable. */
.shot-btn {
  display: block; width: 100%; padding: 0; margin: 0;
  border: none; background: none; cursor: zoom-in; font: inherit;
}
.shot-btn img { width: 100%; height: auto; }
.shot-btn:focus-visible { outline: 3px solid var(--accent); outline-offset: -3px; }

.shot figcaption {
  padding: 12px 14px 14px;
  color: var(--body-ink);
  font-size: 0.94rem;
  line-height: 1.5;
}

/* ---------- lightbox ---------- */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
  background: rgba(38, 26, 16, 0.88);
}
.lightbox[hidden] { display: none; }
.lightbox figure {
  margin: 0;
  max-width: 100%;
  max-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}
.lightbox img {
  max-width: 100%;
  /* Leave room for the caption under a tall photo. */
  max-height: 78vh;
  width: auto;
  border-radius: var(--radius);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
}
.lightbox figcaption {
  color: #f6efe6;
  text-align: center;
  max-width: 60ch;
  font-size: 0.98rem;
}
.lightbox figcaption[hidden] { display: none; }
.lightbox-close {
  position: absolute;
  top: 18px;
  right: 22px;
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  font-size: 1.9rem;
  line-height: 1;
  cursor: pointer;
}
.lightbox-close:hover { background: rgba(255, 255, 255, 0.26); }

/* ---------- responsive ---------- */
@media (max-width: 680px) {
  .gallery { columns: 1; }
  .lightbox { padding: 16px; }
  .product { grid-template-columns: 1fr; gap: 24px; }
  .hero { padding: 36px 0 30px; }
  .hero h1 { font-size: 2rem; }
  .hero.hero-image { padding: 64px 20px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 18px; }
  .site-header { flex-direction: column; gap: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
  .card:hover, .btn:hover { transform: none; }
}
