/* Moonshine Store — minimal, low-bandwidth styles */
:root {
  --c-bg: #fff;
  --c-ink: #1b1b1b;
  --c-muted: #5a5a5a;
  --c-line: #e6e6e6;
  --c-accent: #146c43;
  --c-accent-ink: #fff;
  --c-warm: #fff8ec;
  --c-price: #c0392b;
  --radius: 8px;
  --maxw: 1180px;
  font-size: 16px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--c-ink);
  background: var(--c-bg);
  line-height: 1.45;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--c-accent); text-decoration: none; }
a:hover, a:focus { text-decoration: underline; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; }
h2 { font-size: 1.4rem; margin-top: 2rem; border-bottom: 1px solid var(--c-line); padding-bottom: .35rem; }

.skip {
  position: absolute; left: -9999px;
}
.skip:focus { left: 8px; top: 8px; background: #000; color: #fff; padding: .5em 1em; z-index: 100; }

/* ---------- Top bar ---------- */
.topbar { border-bottom: 1px solid var(--c-line); position: sticky; top: 0; background: var(--c-bg); z-index: 10; }
.topbar__inner {
  max-width: var(--maxw); margin: 0 auto; padding: .75rem 1rem;
  display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
}
.logo { font-weight: 800; font-size: 1.25rem; color: var(--c-ink); }
.logo span { color: var(--c-accent); margin-left: 2px; }
.nav { display: flex; gap: 1rem; flex: 1; flex-wrap: wrap; }
.nav a { color: var(--c-ink); font-weight: 500; }
.cart-btn {
  background: var(--c-accent); color: var(--c-accent-ink);
  padding: .5rem .9rem; border-radius: var(--radius); font-weight: 600;
}
.cart-btn:hover { text-decoration: none; filter: brightness(1.05); }
.cart-count {
  display: inline-block; min-width: 1.4em; padding: 0 .35em;
  background: #fff; color: var(--c-accent); border-radius: 999px;
  font-size: .85em; text-align: center; margin-left: .35em;
}
.login-btn {
  background: #fff; color: var(--c-accent);
  border: 1px solid var(--c-accent);
  padding: .5rem .9rem; border-radius: var(--radius);
  font-weight: 600; font-size: 1rem; cursor: pointer;
  font-family: inherit;
}
.login-btn:hover, .login-btn:focus { background: var(--c-warm); }

/* ---------- Account menu (My Account / Logout) ---------- */
.account-menu {
  position: absolute; margin-top: 2.75rem; right: 1rem;
  background: #fff; border: 1px solid var(--c-line); border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0,0,0,.15); z-index: 20; overflow: hidden;
  display: flex; flex-direction: column; min-width: 140px;
}
.account-menu[hidden] { display: none; }
.account-menu__item {
  padding: .6rem .9rem; text-align: left; font-size: .9rem; font-family: inherit;
  background: none; border: 0; color: var(--c-ink); cursor: pointer;
}
.account-menu__item:hover { background: var(--c-warm); text-decoration: none; }

/* ---------- Modal (login) ---------- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 100;
  display: flex; align-items: center; justify-content: center;
  background: rgba(20, 30, 25, 0.45);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  padding: 1rem;
}
.modal-backdrop[hidden] { display: none; }
.modal {
  background: #fff;
  border-radius: var(--radius);
  width: 100%; max-width: 380px;
  padding: 1.5rem 1.4rem 1.2rem;
  box-shadow: 0 12px 40px rgba(0,0,0,.25);
  position: relative;
  outline: none;
}
.modal h2 { margin: 0 0 1rem; font-size: 1.25rem; }
.modal__error {
  background: #fdecea; color: #b00020; border: 1px solid #f5c2c7;
  border-radius: var(--radius); padding: .55rem .75rem; font-size: .85rem;
  margin: 0 0 .75rem;
}
.modal__error[hidden] { display: none; }
.modal__close {
  position: absolute; top: .4rem; right: .5rem;
  background: none; border: 0; font-size: 1.2rem;
  color: var(--c-muted); cursor: pointer; line-height: 1;
  padding: .25rem .5rem;
}
.modal__close:hover { color: var(--c-ink); }
.modal__form { display: grid; gap: .75rem; }
.modal__form label { display: grid; gap: .25rem; font-weight: 600; font-size: .9rem; }
.modal__form input {
  padding: .55rem; font-size: 1rem; font-family: inherit;
  border: 1px solid var(--c-line); border-radius: var(--radius);
}
.modal__form .btn { margin-top: .25rem; }
.modal__alt {
  margin: .9rem 0 0; text-align: center; font-size: .85rem; color: var(--c-muted);
}
html.has-modal, html.has-modal body { overflow: hidden; }

@media (prefers-reduced-motion: no-preference) {
  .modal { animation: modalIn 140ms ease-out; }
  @keyframes modalIn {
    from { opacity: 0; transform: translateY(8px) scale(.98); }
    to   { opacity: 1; transform: none; }
  }
}
.announce {
  background: var(--c-warm); color: #6b4f1a;
  font-size: .85rem; text-align: center; padding: .35rem 1rem;
  border-top: 1px solid var(--c-line);
}

/* ---------- Hero ---------- */
.hero {
  max-width: var(--maxw); margin: 1rem auto; padding: 1.5rem 1rem;
  background: linear-gradient(135deg, #f6fbf7 0%, #fff8ec 100%);
  border-radius: var(--radius);
}
.hero h1 { font-size: 1.8rem; max-width: 32ch; }
.hero p { color: var(--c-muted); max-width: 50ch; margin-bottom: 1rem; }

/* ---------- Categories nav ---------- */
.categories { max-width: var(--maxw); margin: 1.5rem auto; padding: 0 1rem; }
.category-grid {
  list-style: none; padding: 0; margin: 0;
  display: grid; gap: .5rem;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
}
.category-grid a {
  display: block; text-align: center; padding: .8rem .5rem;
  border: 1px solid var(--c-line); border-radius: var(--radius);
  color: var(--c-ink); font-weight: 600; background: #fafafa;
}
.category-grid a:hover { background: var(--c-warm); text-decoration: none; }

/* ---------- Product grid ---------- */
.products { max-width: var(--maxw); margin: 0 auto 3rem; padding: 0 1rem; }
.grid {
  display: grid; gap: 1rem;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  margin-bottom: 1rem;
}
.card {
  border: 1px solid var(--c-line); border-radius: var(--radius);
  padding: .75rem; display: flex; flex-direction: column; background: #fff;
}
.card__img {
  background: #f1f5f2; border-radius: 6px;
  aspect-ratio: 1/1; display: flex; align-items: center; justify-content: center;
  margin-bottom: .6rem; padding: .5rem; text-align: center;
}
.card__img span { font-weight: 600; color: var(--c-muted); font-size: .95rem; }
.card h3 { font-size: 1rem; margin: 0 0 .15rem; }
.card .unit { color: var(--c-muted); font-size: .85rem; margin: 0 0 .4rem; }
.card .price { color: var(--c-price); font-weight: 700; margin: 0 0 .6rem; }
.card .price s { color: var(--c-muted); font-weight: 400; margin-right: .3em; font-size: .9em; }
.badge {
  align-self: flex-start; font-size: .7rem; font-weight: 700;
  padding: .15rem .45rem; border-radius: 3px;
  background: var(--c-warm); color: #6b4f1a; text-transform: uppercase;
  margin: 0 0 .35rem; letter-spacing: .03em;
}
.badge--bestseller { background: #fff1e5; color: #b04200; }
.badge--new { background: #e8f3ec; color: var(--c-accent); }
.badge--value_deal { background: #fde9e7; color: var(--c-price); }
.btn:disabled { background: #eee; color: #999; border-color: #ddd; cursor: not-allowed; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-block; padding: .55rem 1rem;
  border: 1px solid var(--c-accent); border-radius: var(--radius);
  background: #fff; color: var(--c-accent); font-weight: 600;
  cursor: pointer; font-size: 1rem;
  text-align: center;
}
.btn:hover, .btn:focus { background: var(--c-warm); }
.btn--primary { background: var(--c-accent); color: var(--c-accent-ink); }
.btn--primary:hover { filter: brightness(1.05); }
.btn--add { margin-top: auto; }
.btn--added { background: #e8f3ec; color: var(--c-accent); }

/* ---------- Cart page ---------- */
.cartpage { max-width: 900px; margin: 1.5rem auto 3rem; padding: 0 1rem; }
.empty { text-align: center; padding: 2rem 1rem; color: var(--c-muted); }
.cart-table { width: 100%; border-collapse: collapse; margin-bottom: 1.5rem; }
.cart-table th, .cart-table td { padding: .6rem; border-bottom: 1px solid var(--c-line); text-align: left; vertical-align: middle; }
.cart-table tfoot th, .cart-table tfoot td { text-align: right; }
.cart-table tfoot tr:last-child th, .cart-table tfoot tr:last-child td {
  font-size: 1.1rem; font-weight: 700; color: var(--c-price);
}
.qty { width: 4.5rem; padding: .3rem; }
.remove-btn { background: none; border: 0; color: #b00; cursor: pointer; font-size: 1rem; }

.checkout { display: grid; gap: .8rem; max-width: 520px; }
.checkout label { display: grid; gap: .25rem; font-weight: 600; }
.checkout input, .checkout textarea {
  padding: .55rem; font-size: 1rem; border: 1px solid var(--c-line); border-radius: var(--radius); font-family: inherit;
}
.pay { border: 1px solid var(--c-line); border-radius: var(--radius); padding: .8rem; }
.pay legend { padding: 0 .4rem; font-weight: 600; }
.pay label { display: inline-flex; align-items: center; gap: .35rem; margin-right: 1rem; font-weight: 500; }
.note { color: var(--c-muted); font-size: .85rem; }

/* ---------- Static pages ---------- */
.page { max-width: 720px; margin: 1.5rem auto 3rem; padding: 0 1rem; }
.page--about { max-width: 900px; }
.page .lede { font-size: 1.05rem; color: var(--c-muted); }

/* ---------- About: timeline / flow diagram ---------- */
.timeline {
  list-style: none; padding: 0; margin: 1.5rem 0 2.5rem;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-auto-rows: auto;
  column-gap: 1.5rem;
  row-gap: 4.5rem;
  position: relative;
}
.tl-step {
  position: relative;
  background: #fff;
  border: 1px solid var(--c-line);
  border-radius: var(--radius);
  padding: 2.1rem .9rem 1rem;
  text-align: center;
  z-index: 1;
  box-shadow: 0 6px 22px rgba(20,108,67,.08);
}
/* Zigzag placement: TL → MR → BL */
.tl-step:nth-child(1) { grid-column: 1; grid-row: 1; }
.tl-step:nth-child(2) { grid-column: 2; grid-row: 2; }
.tl-step:nth-child(3) { grid-column: 1; grid-row: 3; }

/* Curvy glowing connectors (sit in the row-gap above each step) */
.tl-connector {
  position: absolute;
  top: -4.5rem;
  height: 4.5rem;
  width: calc(200% + 1.5rem);
  pointer-events: none;
  overflow: visible;
  z-index: 0;
}
.tl-step:nth-child(2) > .tl-connector { left: calc(-100% - 1.5rem); }
.tl-step:nth-child(3) > .tl-connector { left: 0; }
.tl-connector path {
  fill: none;
  stroke: var(--c-accent);
  stroke-width: 3;
  stroke-linecap: round;
  filter: drop-shadow(0 0 4px rgba(20,108,67,.65))
          drop-shadow(0 0 10px rgba(20,108,67,.35));
}
.tl-step h3 { font-size: 1rem; margin: .35rem 0 .25rem; }
.tl-step p  { font-size: .9rem; color: var(--c-ink); margin: 0; text-align: left; }
.tl-year {
  position: absolute; top: -.85rem; left: 50%; transform: translateX(-50%);
  background: var(--c-accent); color: #fff;
  font-weight: 700; font-size: .85rem;
  padding: .25rem .8rem; border-radius: 999px;
  letter-spacing: .04em;
}
.tl-figure { margin: 0 0 .6rem; }
.tl-art {
  display: block; width: 100%; height: auto; aspect-ratio: 16/10;
  border-radius: 6px; border: 1px solid var(--c-line);
  background: #f6f6f6;
  /* B&W treatment for the 1965 image; later steps override it. */
  filter: grayscale(100%) contrast(1.05) sepia(.05);
}
.tl-art--era2 { filter: sepia(.25) contrast(1.02); }
.tl-art--era3 { filter: none; }
.tl-figure figcaption {
  font-size: .8rem; color: var(--c-muted); margin-top: .3rem;
  font-style: italic;
}

@media (max-width: 700px) {
  .timeline { grid-template-columns: 1fr; row-gap: 1rem; }
  .tl-step:nth-child(1),
  .tl-step:nth-child(2),
  .tl-step:nth-child(3) { grid-column: 1; grid-row: auto; }
  .tl-connector { display: none; }
}

/* ---------- Footer ---------- */
.foot { border-top: 1px solid var(--c-line); background: #fafafa; }
.foot__inner {
  max-width: var(--maxw); margin: 0 auto; padding: 1.25rem 1rem;
  display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}
.foot__copy { text-align: center; color: var(--c-muted); font-size: .85rem; padding: 0 1rem 1rem; margin: 0; }

/* ---------- Mobile tweaks ---------- */
@media (max-width: 540px) {
  .nav { order: 3; width: 100%; justify-content: space-between; }
  .hero h1 { font-size: 1.4rem; }
  h2 { font-size: 1.2rem; }
}
