/* ==========================================================
   Anna's Cookies – styles
   Look: an old-fashioned blue cookie tin with a scalloped lid,
   butter-yellow highlights and cookies drawn in SVG.
   System fonts only, so nothing extra has to download.
   ========================================================== */

:root {
  --tin: #1f3f9a;        /* cookie-tin blue: main colour */
  --tin-dark: #152c6b;
  --tin-light: #e8ecf8;
  --butter: #f5c542;     /* highlight */
  --butter-light: #fdf0c4;
  --ink: #2b1a12;        /* cocoa brown text */
  --muted: #6b5e57;
  --line: #e4ddd3;
  --paper: #fffdf8;
  --error: #b3261e;

  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  --radius: 18px;
  color-scheme: light;
}

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 1.0625rem/1.55 var(--sans);
}

h1, h2, h3, legend {
  font-family: var(--serif);
  line-height: 1.1;
  font-weight: 700;
}

h2, legend {
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  letter-spacing: -0.01em;
  margin: 0 0 0.5rem;
}

h3 {
  font-size: 1.35rem;
  margin: 0;
}

a {
  color: var(--tin);
}

:focus-visible {
  outline: 3px solid var(--butter);
  outline-offset: 3px;
}

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

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

.small {
  font-size: 0.9rem;
  color: var(--muted);
}

.lead {
  color: var(--muted);
  font-size: 1.1rem;
  margin: 0 0 1.75rem;
}


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

.button {
  display: inline-block;
  border: 0;
  border-radius: 999px;
  padding: 1rem 1.9rem;
  background: var(--tin);
  color: #fff;
  font: 700 1.05rem var(--sans);
  text-decoration: none;
  text-align: center;
  cursor: pointer;
  transition: transform 0.15s, background-color 0.15s;
}

.button:hover {
  background: var(--tin-dark);
  transform: translateY(-1px);
}

.button:disabled {
  opacity: 0.6;
  cursor: wait;
  transform: none;
}

.button--butter {
  background: var(--butter);
  color: var(--ink);
}

.button--butter:hover {
  background: #fff;
}

.button--wide {
  width: 100%;
}


/* ---------- Hero: the tin lid ---------- */

.hero {
  position: relative;
  background: var(--tin);
  color: #fff;
  padding: 3.5rem 0 3rem;
  overflow-x: clip;
}

/* Scalloped edge: a row of half circles hanging under the blue band */
.hero::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -15px;
  height: 16px;
  background: radial-gradient(circle at 16px 0, var(--tin) 15px, transparent 16px) 0 0 / 32px 16px repeat-x;
}

.hero__grid {
  display: grid;
  gap: 2rem;
  align-items: center;
}

.hero h1 {
  font-size: clamp(3.25rem, 11vw, 6.5rem);
  letter-spacing: -0.03em;
  line-height: 0.95;
  margin: 0 0 1.25rem;
}

.hero p {
  font-size: 1.25rem;
  max-width: 26ch;
  margin: 0 0 2rem;
  color: #dfe5f7;
}

/* Two overlapping cookies */
.hero__cookies {
  position: relative;
  width: min(100%, 17rem);
  aspect-ratio: 1.15;
  justify-self: center;
}

.hero__cookie {
  position: absolute;
  filter: drop-shadow(0 18px 24px rgb(0 0 0 / 0.3));
}

.hero__cookie--back {
  width: 62%;
  height: 62%;
  top: 0;
  right: 0;
  transform: rotate(20deg);
}

.hero__cookie--front {
  width: 72%;
  height: 72%;
  bottom: 0;
  left: 0;
  transform: rotate(-12deg);
}

/* The one moment of motion: the cookies land on the page */
@media (prefers-reduced-motion: no-preference) {
  .hero__cookie--front { animation: land 0.7s cubic-bezier(0.2, 0.8, 0.3, 1.2) both; }
  .hero__cookie--back  { animation: land 0.7s 0.12s cubic-bezier(0.2, 0.8, 0.3, 1.2) both; }
}

@keyframes land {
  from { opacity: 0; translate: 0 -40px; rotate: -25deg; }
}

@media (min-width: 48rem) {
  .hero {
    padding: 5rem 0 4.5rem;
  }

  .hero__grid {
    grid-template-columns: 1.15fr 0.85fr;
  }

  .hero__cookies {
    width: min(100%, 26rem);
  }
}


/* ---------- How it works ---------- */

.steps {
  list-style: none;
  counter-reset: step;
  display: grid;
  gap: 1.5rem;
  padding: 0;
  margin-top: 4.5rem;
  margin-bottom: 4.5rem;
}

.steps li {
  counter-increment: step;
  display: grid;
  grid-template-columns: 2.75rem 1fr;
  column-gap: 1rem;
  color: var(--muted);
}

.steps li::before {
  content: counter(step);
  grid-row: span 2;
  display: grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 50%;
  background: var(--butter);
  color: var(--ink);
  font: 700 1.3rem var(--serif);
}

.steps strong {
  display: block;
  color: var(--ink);
  font: 700 1.2rem var(--serif);
}

@media (min-width: 48rem) {
  .steps {
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
  }
}


/* ---------- Cookie menu ---------- */

.menu {
  list-style: none;
  margin: 0 0 5rem;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
  gap: 1.25rem;
}

.item {
  display: flex;
  flex-direction: column;
  padding: 1.5rem;
  border: 2px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  transition: border-color 0.2s, background-color 0.2s;
}

/* Set by script.js when this cookie is in the order */
.item.is-added {
  border-color: var(--tin);
  background: var(--tin-light);
}

.item__cookie {
  width: 8.5rem;
  height: 8.5rem;
  margin: 0 auto 1.25rem;
  filter: drop-shadow(0 8px 10px rgb(60 30 10 / 0.18));
  transition: transform 0.3s;
}

.item.is-added .item__cookie {
  transform: rotate(-10deg) scale(1.05);
}

.item__text {
  flex: 1;
}

.item__text p {
  margin: 0.35rem 0 1.25rem;
  color: var(--muted);
  font-size: 0.95rem;
}

.item__buy {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}

.item__price {
  margin: 0;
  font: 700 1.3rem var(--serif);
}

/* On phones, a row per cookie with the drawing on the left */
@media (max-width: 35rem) {
  .menu {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

  .item {
    display: grid;
    grid-template-columns: 5rem 1fr;
    column-gap: 1rem;
    padding: 1rem;
  }

  .item__cookie {
    width: 5rem;
    height: 5rem;
    margin: 0;
    grid-row: span 2;
  }

  .item__text p {
    margin-bottom: 0.75rem;
  }
}

/* Quantity stepper */
.qty {
  display: flex;
  align-items: center;
}

.qty button {
  width: 2.5rem;
  height: 2.5rem;
  border: 2px solid var(--tin);
  border-radius: 50%;
  background: #fff;
  color: var(--tin);
  font-size: 1.3rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
}

.qty button[data-step="1"] {
  background: var(--tin);
  color: #fff;
}

.qty button:hover {
  background: var(--tin-dark);
  border-color: var(--tin-dark);
  color: #fff;
}

.qty input {
  width: 2.5rem;
  border: 0;
  background: transparent;
  text-align: center;
  font: 700 1.15rem var(--sans);
  color: var(--ink);
  -moz-appearance: textfield;
  appearance: textfield;
}

.qty input::-webkit-inner-spin-button,
.qty input::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}


/* ---------- Checkout: form + summary ---------- */

.checkout {
  display: grid;
  gap: 2.5rem;
  align-items: start;
  margin-bottom: 5rem;
}

@media (min-width: 56rem) {
  .checkout {
    grid-template-columns: 1fr 22rem;
    gap: 4rem;
  }

  .summary {
    position: sticky;
    top: 1.5rem;
  }
}

fieldset {
  border: 0;
  padding: 0;
  margin: 0 0 1.5rem;
  min-width: 0;
}

legend {
  padding: 0;
  margin-bottom: 1.25rem;
}

.field-row {
  display: grid;
  gap: 0 1rem;
}

@media (min-width: 35rem) {
  .field-row {
    grid-template-columns: 1fr 1fr;
  }
}

.field {
  display: block;
  font-weight: 600;
  margin: 0 0 1.1rem;
}

.optional {
  font-weight: 400;
  color: var(--muted);
}

.field input,
.field textarea {
  display: block;
  width: 100%;
  margin-top: 0.4rem;
  padding: 0.8rem 0.9rem;
  border: 2px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  font: 400 1rem var(--sans);
}

.field input:focus,
.field textarea:focus {
  border-color: var(--tin);
  outline: none;
}

/* Pickup time buttons */
.pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin: -0.5rem 0 1.25rem;
}

.pill input {
  position: absolute;
  opacity: 0;
}

.pill span {
  display: block;
  padding: 0.65rem 1.2rem;
  border: 2px solid var(--line);
  border-radius: 999px;
  background: #fff;
  font-weight: 600;
  cursor: pointer;
}

.pill input:checked + span {
  border-color: var(--tin);
  background: var(--tin);
  color: #fff;
}

.pill input:focus-visible + span {
  outline: 3px solid var(--butter);
  outline-offset: 3px;
}

/* Cash on delivery notice */
.pay-info {
  padding: 1.1rem 1.2rem;
  border: 2px dashed var(--butter);
  border-radius: 14px;
  background: var(--butter-light);
  color: var(--muted);
}

.pay-info strong {
  display: block;
  color: var(--ink);
  font-size: 1.1rem;
}

/* The summary looks like the label on the tin */
.summary {
  background: var(--tin);
  color: #fff;
  border-radius: var(--radius);
  padding: 1.75rem;
}

.summary h2 {
  font-size: 1.75rem;
  margin-bottom: 1.25rem;
}

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

.summary__lines li {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.55rem 0;
  border-bottom: 1px dashed rgb(255 255 255 / 0.3);
}

.summary__empty {
  margin: 0;
  color: #c9d2f0;
}

.summary__total {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin: 1.25rem 0 1.5rem;
  font: 700 1.25rem var(--serif);
}

.summary__total output {
  font-size: 2.25rem;
}

.summary__note {
  margin: 0.85rem 0 0;
  text-align: center;
  font-size: 0.9rem;
  color: #c9d2f0;
}

.error {
  padding: 0.75rem 1rem;
  border-radius: 10px;
  background: #fff;
  color: var(--error);
  font-weight: 600;
}


/* ---------- Confirmation (cash orders and thanks page) ---------- */

.confirmation {
  max-width: 36rem;
  padding: 4rem 0 5rem;
  text-align: center;
}

.confirmation h2 {
  font-size: clamp(2.5rem, 8vw, 3.5rem);
  color: var(--tin);
}

.confirmation p {
  font-size: 1.1rem;
}

.confirmation__cookie {
  width: 7rem;
  height: 7rem;
  margin-bottom: 1rem;
  transform: rotate(-12deg);
}


/* ---------- Footer: the bottom of the tin ---------- */

.footer {
  position: relative;
  margin-top: 2rem;
  padding: 3rem 0;
  background: var(--tin);
  color: #dfe5f7;
}

/* Scallops pointing up */
.footer::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: -15px;
  height: 16px;
  background: radial-gradient(circle at 16px 16px, var(--tin) 15px, transparent 16px) 0 0 / 32px 16px repeat-x;
}

.footer__grid {
  display: grid;
  gap: 1.5rem;
}

@media (min-width: 48rem) {
  .footer__grid {
    grid-template-columns: 1fr 1fr;
  }
}

.footer p {
  margin: 0 0 0.35rem;
}

.footer a {
  color: #fff;
}

.footer__name {
  color: #fff;
  font: 700 1.5rem var(--serif);
}

.footer__allergens {
  font-size: 0.9rem;
  max-width: 40ch;
}


/* ---------- Thanks page ---------- */

.hero--small {
  padding: 1.5rem 0;
}

.home-link {
  color: #fff;
  font: 700 1.75rem var(--serif);
  text-decoration: none;
}


/* ==========================================================
   Order board (/admin)
   ========================================================== */

.board {
  padding: 2.5rem 0 5rem;
}

.board__top {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.board h1 {
  font-size: clamp(2.25rem, 6vw, 3rem);
  margin: 0;
}

.board__tools {
  display: flex;
  gap: 0.5rem;
}

/* Buttons on the board */
.board-button {
  display: inline-block;
  padding: 0.6rem 1rem;
  border: 2px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
  font: 600 0.95rem var(--sans);
  text-decoration: none;
  cursor: pointer;
}

.board-button:hover {
  border-color: var(--tin);
}

.board-button--main {
  border-color: var(--tin);
  background: var(--tin);
  color: #fff;
}

.board-button--main:hover {
  background: var(--tin-dark);
}

.board-button--butter {
  border-color: var(--butter);
  background: var(--butter);
}

.board-button--quiet {
  border-color: transparent;
  background: transparent;
  color: var(--muted);
  text-decoration: underline;
}

/* Tabs */
.tabs {
  display: flex;
  gap: 0.25rem;
  margin-bottom: 2rem;
  border-bottom: 2px solid var(--line);
}

.tabs a {
  padding: 0.75rem 1.1rem;
  margin-bottom: -2px;
  border-bottom: 3px solid transparent;
  color: var(--muted);
  font-weight: 600;
  text-decoration: none;
}

.tabs a[aria-current="page"] {
  border-bottom-color: var(--tin);
  color: var(--ink);
}

.tabs span,
.count {
  display: inline-block;
  min-width: 1.6rem;
  padding: 0.05rem 0.45rem;
  border-radius: 999px;
  background: var(--tin-light);
  color: var(--tin);
  font: 700 0.85rem var(--sans);
  text-align: center;
  vertical-align: middle;
}

/* Overview cards */
.stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 3rem;
}

.stats .stat--bake {
  grid-column: 1 / -1;
}

@media (min-width: 48rem) {
  .stats {
    grid-template-columns: 1.4fr 1fr 1fr;
  }

  .stats .stat--bake {
    grid-column: auto;
  }
}

.stat {
  padding: 1.25rem 1.5rem;
  border: 2px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.stat h2 {
  font-size: 1.1rem;
  margin: 0 0 0.6rem;
  font-family: var(--sans);
  color: var(--muted);
}

.stat__number {
  margin: 0;
  font: 700 2.5rem/1 var(--serif);
}

.stat__small {
  margin: 0.5rem 0 0;
  font-size: 0.85rem;
  color: var(--muted);
}

/* "To bake" is what matters most on baking day, so it gets the tin colours */
.stat--bake {
  border-color: var(--tin);
  background: var(--tin);
  color: #fff;
}

.stat--bake h2,
.stat--bake .stat__small {
  color: #c9d2f0;
}

.stat--bake ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr));
  gap: 0.35rem 1rem;
  font-size: 1.1rem;
}

.stat--bake strong {
  display: inline-block;
  min-width: 2rem;
  font: 700 1.6rem var(--serif);
  color: var(--butter);
}

/* Orders, grouped per delivery time */
.delivery-group {
  margin-bottom: 3rem;
}

.delivery-group h2 {
  font-size: 1.6rem;
  margin-bottom: 1rem;
}

.order-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 21rem), 1fr));
  gap: 1rem;
  align-items: start;
}

.order-card {
  padding: 1.25rem;
  border: 2px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  scroll-margin-top: 1rem;
}

.order-card:target {
  border-color: var(--butter);
  box-shadow: 0 0 0 4px var(--butter-light);
}

.order-card--done {
  background: #fbfaf7;
}

.order-card__head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}

.order-card__head > div {
  min-width: 0;
}

.order-card h3 {
  font-size: 1.3rem;
  overflow-wrap: anywhere;
}

.order-card__meta {
  margin: 0.2rem 0 0;
  font-size: 0.85rem;
  color: var(--muted);
}

.order-card__total {
  margin: 0;
  font: 700 1.4rem var(--serif);
  white-space: nowrap;
}

.order-card__badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0.75rem 0;
}

.badge {
  padding: 0.15rem 0.65rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
}

.badge--paid  { background: #d8f0dc; color: #1d5b2a; }
.badge--due   { background: var(--butter-light); color: #6b4d00; }
.badge--warn  { background: #fbe0de; color: var(--error); }
.badge--done  { background: var(--tin-light); color: var(--tin); }
.badge--muted { background: #eee; color: var(--muted); }

.order-card__items {
  list-style: none;
  margin: 0 0 1rem;
  padding: 0.75rem 0;
  border-block: 1px dashed var(--line);
  font-size: 1.05rem;
}

.order-card__items strong {
  display: inline-block;
  min-width: 2.25rem;
  color: var(--tin);
}

.order-card__contact {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.3rem 0.85rem;
  margin: 0 0 1rem;
  font-size: 0.95rem;
}

.order-card__contact dt {
  color: var(--muted);
}

.order-card__contact dd {
  margin: 0;
  overflow-wrap: anywhere;
  white-space: pre-line; /* keeps line breaks in addresses */
}

.order-card__note {
  margin: 0 0 1rem;
  padding: 0.6rem 0.8rem;
  border-left: 4px solid var(--butter);
  background: var(--butter-light);
  font-size: 0.95rem;
  white-space: pre-line;
}

.order-card__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.empty {
  padding: 3rem 0;
  color: var(--muted);
  font-size: 1.1rem;
  text-align: center;
}

/* Printing the board gives a clean delivery list */
@media print {
  .hero,
  .tabs,
  .board__tools,
  .order-card__actions {
    display: none;
  }

  .stat--bake {
    background: #fff;
    color: var(--ink);
  }

  .stat--bake strong {
    color: var(--ink);
  }

  .order-card {
    break-inside: avoid;
  }
}
