/* Buddy's Deli & Bakery: olive and cream from the logo, with a warm crust colour */
:root {
  --olive: #55692d;
  --olive-dark: #3d4c1f;
  --olive-soft: #e6ead6;
  --cream: #fff6ea;
  --paper: #fffbf5;
  --crust: #c8742f;
  --ink: #2a2f1f;
  --muted: #5f6452;
  --line: #eadfcd;
  --radius: 18px;
  --shadow: 0 10px 30px rgba(61, 76, 31, .12);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  font-family: 'Nunito', system-ui, sans-serif;
  font-size: 1.05rem;
  line-height: 1.6;
  color: var(--ink);
  background: var(--cream);
}

img { max-width: 100%; }
a { color: var(--olive); }

h1, h2, h3 { font-family: 'Fraunces', Georgia, serif; color: var(--olive-dark); line-height: 1.1; margin: 0 0 12px; }
h1 { font-weight: 900; font-size: clamp(2.3rem, 7vw, 3.9rem); letter-spacing: -1px; }
h2 { font-weight: 900; font-size: clamp(1.8rem, 5vw, 2.6rem); letter-spacing: -.5px; }
h3 { font-weight: 600; font-size: 1.3rem; }

.container { max-width: 1080px; margin: 0 auto; padding: 0 20px; }
.eyebrow { margin: 0 0 8px; font-weight: 800; text-transform: uppercase; letter-spacing: 3px; font-size: .8rem; color: var(--crust); }
.small { font-size: .9rem; color: var(--muted); }

.btn {
  display: inline-block; font-weight: 800; text-decoration: none; border-radius: 999px;
  padding: 13px 26px; border: 2px solid var(--olive); transition: transform .15s, background .15s, color .15s;
}
.btn:hover { transform: translateY(-2px); }
.btn-primary { background: var(--olive); color: var(--cream); }
.btn-primary:hover { background: var(--olive-dark); border-color: var(--olive-dark); }
.btn-secondary { background: transparent; color: var(--olive); }
.btn-secondary:hover { background: var(--olive); color: var(--cream); }
.btn-small { padding: 8px 18px; font-size: .95rem; }

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

.site-header {
  position: sticky; top: 0; z-index: 10; background: rgba(255, 246, 234, .92);
  backdrop-filter: blur(8px); border-bottom: 1px solid var(--line);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-top: 10px; padding-bottom: 10px; }
.brand img { display: block; width: 96px; height: auto; }
nav { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
nav a { text-decoration: none; font-weight: 800; color: var(--olive-dark); padding: 6px 10px; border-radius: 999px; }
nav a:hover { background: var(--olive-soft); }

/* ----- Hero ----- */

/* The shopfront photo fills the hero, shaded in the logo's olive so the text reads. */
.hero {
  position: relative; isolation: isolate; overflow: hidden; color: var(--cream);
  min-height: min(calc(100svh - 62px), 760px); display: flex; align-items: flex-end; padding: 48px 0 40px;
}
.hero::before {
  content: ''; position: absolute; inset: 0; z-index: -2;
  background: url(images/shopfront.jpg) center 35% / cover no-repeat;
}
.hero::after {
  content: ''; position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(180deg, rgba(36, 45, 18, .15) 0%, rgba(36, 45, 18, .55) 40%, rgba(36, 45, 18, .93) 72%);
}
.hero-inner { display: grid; gap: 40px; align-items: center; width: 100%; }
.hero h1 { color: var(--cream); text-shadow: 0 2px 18px rgba(0, 0, 0, .35); }
.hero .eyebrow { color: #f2c48f; }
.lede { font-size: 1.15rem; color: rgba(255, 246, 234, .92); max-width: 34em; margin: 0 0 24px; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.hero .btn-primary { background: var(--cream); border-color: var(--cream); color: var(--olive-dark); }
.hero .btn-primary:hover { background: #fff; border-color: #fff; }
.hero .btn-secondary { color: var(--cream); border-color: rgba(255, 246, 234, .85); }
.hero .btn-secondary:hover { background: var(--cream); color: var(--olive-dark); }
.hero-photo { display: none; margin: 0; position: relative; justify-self: center; }
.hero-photo img:first-child {
  display: block; width: min(400px, 100%); height: auto; border: 10px solid var(--cream); border-radius: 6px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .45); transform: rotate(2deg);
}
.hero-photo-logo {
  position: absolute; left: -26px; bottom: -18px; width: 120px; height: auto; border-radius: 12px;
  border: 3px solid var(--cream); box-shadow: 0 10px 24px rgba(0, 0, 0, .35); transform: rotate(-4deg);
}

/* ----- Sections ----- */

.section { padding: 64px 0; }
.cards { display: grid; gap: 16px; margin-top: 24px; }
.card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px 22px; box-shadow: var(--shadow); }
.card p { margin: 0; color: var(--muted); }
.icon { width: 48px; height: 48px; color: var(--crust); margin-bottom: 10px; }

.about { background: var(--olive); color: var(--cream); }
.about h2 { color: var(--cream); }
.about .eyebrow { color: #f2c48f; }
.about-inner { display: grid; gap: 32px; align-items: center; }
.about p { max-width: 36em; }
.promises { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.promises li {
  background: rgba(255, 246, 234, .1); border: 1px solid rgba(255, 246, 234, .25); border-radius: 14px;
  padding: 12px 16px; font-weight: 800; display: flex; gap: 12px; align-items: center;
}
.promises span { font-size: 1.4rem; }

.visit-grid { display: grid; gap: 16px; margin-top: 24px; }
.visit-card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px 22px; box-shadow: var(--shadow); }
.visit-card address { font-style: normal; margin-bottom: 16px; display: block; }
.hours { width: 100%; border-collapse: collapse; }
.hours th, .hours td { text-align: left; padding: 6px 0; border-bottom: 1px solid var(--line); }
.hours td { text-align: right; }
.hours th { font-weight: 700; }
.label { font-weight: 800; font-size: .85rem; text-transform: uppercase; letter-spacing: 1.5px; color: var(--muted); }

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

.site-footer { background: var(--olive-dark); color: var(--cream); padding: 36px 0; }
.footer-inner { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; }
.footer-inner img { width: 110px; height: auto; border-radius: 10px; }
.socials { display: flex; gap: 18px; margin: 0; }
.socials a { color: var(--cream); font-weight: 800; }
.site-footer .small { color: #cfd3bd; margin: 0; }

.hours tr.today th, .hours tr.today td { color: var(--olive); font-weight: 800; }
.hours tr.today th::after { content: ' (today)'; font-weight: 400; color: var(--muted); font-size: .85rem; }

/* ----- Wider screens ----- */

@media (min-width: 760px) {
  /* Wide screens: the photo is too small to fill the screen sharply, so the
     background is a blurred copy and the sharp photo sits framed on the right. */
  .hero { min-height: 0; align-items: center; padding: 72px 0 88px; }
  .hero::before { filter: blur(18px) saturate(1.1); transform: scale(1.15); }
  .hero::after { background: linear-gradient(90deg, rgba(36, 45, 18, .94) 0%, rgba(36, 45, 18, .8) 50%, rgba(36, 45, 18, .45) 100%); }
  .hero-inner { grid-template-columns: 1.15fr .85fr; }
  .hero-photo { display: block; }
  .cards { grid-template-columns: repeat(2, 1fr); }
  .about-inner { grid-template-columns: 1.2fr .8fr; }
  .visit-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (min-width: 1000px) {
  .cards { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 420px) {
  nav a { padding: 6px 6px; font-size: .92rem; }
}

/* ===================================================================== */
/* Cakes on the home page                                                */
/* ===================================================================== */

[hidden] { display: none !important; }
.section-intro { color: var(--muted); max-width: 40em; margin: 0; }
.cakes-section { background: var(--paper); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.product-grid { display: grid; gap: 18px; margin-top: 24px; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.product-card {
  display: flex; flex-direction: column; text-decoration: none; color: inherit; background: var(--cream);
  border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow);
  transition: transform .15s, box-shadow .15s;
}
.product-card:hover { transform: translateY(-3px); box-shadow: 0 14px 34px rgba(61, 76, 31, .18); }
.product-photo { aspect-ratio: 4 / 3; background: var(--olive-soft); display: grid; place-items: center; overflow: hidden; }
.product-photo img { width: 100%; height: 100%; object-fit: cover; }
.product-photo img.no-photo { width: 55%; height: auto; object-fit: contain; border-radius: 10px; }
.product-body { padding: 16px 18px 18px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.product-body h3 { margin: 0; }
.product-price { margin: 0; font-weight: 800; color: var(--crust); }
.product-cta { margin-top: auto; padding-top: 8px; font-weight: 800; color: var(--olive); }

/* ===================================================================== */
/* Cake page                                                             */
/* ===================================================================== */

.shop-page { padding-top: 20px; padding-bottom: 64px; min-height: 60vh; }
.crumb { margin: 0 0 16px; }
.crumb a { font-weight: 800; text-decoration: none; }
.notice { background: #fff0d6; border: 1px solid #e0a43a; border-radius: 12px; padding: 12px 16px; font-weight: 700; }
.cake-layout { display: grid; gap: 28px; }
.gallery-main { aspect-ratio: 1; border-radius: var(--radius); overflow: hidden; background: var(--olive-soft); box-shadow: var(--shadow); }
.gallery-main img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-placeholder { width: 100%; height: 100%; display: grid; place-items: center; }
.photo-placeholder img { width: 55%; height: auto; object-fit: contain; border-radius: 12px; }
.gallery-thumbs { display: flex; gap: 8px; margin-top: 10px; overflow-x: auto; padding-bottom: 4px; }
.gallery-thumbs button { flex: none; width: 68px; height: 68px; padding: 0; border: 3px solid transparent; border-radius: 12px; overflow: hidden; cursor: pointer; background: none; }
.gallery-thumbs button[aria-current="true"] { border-color: var(--olive); }
.gallery-thumbs img { width: 100%; height: 100%; object-fit: cover; display: block; }
.from-price { font-size: 1.3rem; font-weight: 800; color: var(--crust); margin: 0 0 12px; }
.cake-desc p { margin: 0 0 10px; color: var(--muted); }

#order-form fieldset { border: 0; padding: 0; margin: 22px 0 0; }
#order-form legend { font-family: 'Fraunces', Georgia, serif; font-weight: 600; font-size: 1.2rem; color: var(--olive-dark); margin-bottom: 8px; padding: 0; }
.req { color: var(--crust); }
.optional { color: var(--muted); font-family: 'Nunito', sans-serif; font-size: .9rem; font-weight: 400; }
.hint { margin: -4px 0 8px; }
.choices { display: grid; gap: 8px; }
.choice {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 2px solid var(--line); border-radius: 14px;
  background: var(--paper); cursor: pointer; transition: border-color .15s, background .15s;
}
.choice:has(input:checked) { border-color: var(--olive); background: var(--olive-soft); }
.choice input { width: 20px; height: 20px; accent-color: var(--olive); flex: none; margin: 0; }
.choice-label { flex: 1; font-weight: 700; }
.price-tag { font-weight: 800; color: var(--crust); white-space: nowrap; }
.text-option { display: block; }
.text-meta { display: flex; justify-content: space-between; margin-top: 4px; }

#order-form label, .admin label { display: block; font-weight: 800; margin: 12px 0 0; }
#order-form input:not([type=radio]):not([type=checkbox]), #order-form textarea,
.admin input:not([type=radio]):not([type=checkbox]):not([type=file]), .admin textarea, .admin select {
  display: block; width: 100%; margin-top: 4px; font: inherit; font-weight: 400; padding: 11px 13px;
  border: 2px solid var(--line); border-radius: 12px; background: var(--paper); color: var(--ink);
}
#order-form input:focus, #order-form textarea:focus, .admin input:focus, .admin textarea:focus, .admin select:focus { outline: none; border-color: var(--olive); }
.details .small { margin: 6px 0 0; }

.order-bar {
  position: sticky; bottom: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin: 24px -20px 0; padding: 14px 20px calc(14px + env(safe-area-inset-bottom)); background: rgba(255, 246, 234, .96);
  border-top: 1px solid var(--line); backdrop-filter: blur(6px);
}
.order-bar strong { display: block; font-family: 'Fraunces', Georgia, serif; font-size: 1.6rem; color: var(--olive-dark); line-height: 1; }
.order-bar .btn { border: 0; cursor: pointer; font: inherit; font-weight: 800; }
.form-error { color: #a12a1a; font-weight: 800; }
.btn:disabled { opacity: .6; cursor: default; transform: none; }

.done { max-width: 560px; margin: 0 auto; text-align: center; }
.done-icon { font-size: 3.5rem; }
.done .ref { font-size: 1.2rem; letter-spacing: 1px; }
.done-note { background: var(--olive-soft); border-radius: 12px; padding: 12px 16px; }
.summary { width: 100%; border-collapse: collapse; margin: 12px 0; text-align: left; }
.summary td, .summary th { padding: 6px 0; border-bottom: 1px solid var(--line); }
.summary td:last-child, .summary th:last-child { text-align: right; white-space: nowrap; padding-left: 12px; }
.summary .total-row th { border-bottom: 0; font-size: 1.1rem; }

@media (min-width: 860px) {
  .cake-layout { grid-template-columns: 1fr 1fr; gap: 48px; align-items: start; }
  .gallery { position: sticky; top: 96px; }
  .order-bar { margin: 24px 0 0; border: 1px solid var(--line); border-radius: var(--radius); bottom: 16px; }
}

/* ===================================================================== */
/* Admin                                                                 */
/* ===================================================================== */

.admin { background: #f7f1e6; }
.admin-main { padding-top: 24px; padding-bottom: 80px; max-width: 900px; }
.admin h1 { font-size: 2rem; }
.admin h2 { font-size: 1.4rem; }
.admin nav a[aria-current="true"] { background: var(--olive); color: var(--cream); }
.link-btn { font: inherit; font-weight: 800; background: none; border: 0; color: var(--olive); cursor: pointer; padding: 6px 10px; text-decoration: underline; }
.count-badge { display: inline-block; min-width: 20px; padding: 0 6px; border-radius: 999px; background: var(--crust); color: #fff; font-size: .8rem; text-align: center; }
.admin-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.admin-head h1 { margin: 0; }
.panel { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin: 16px 0; box-shadow: var(--shadow); }
.panel.narrow { max-width: 520px; }
.panel h2 { margin-top: 0; }
.admin .btn { cursor: pointer; font: inherit; font-weight: 800; }
.btn-danger { background: transparent; color: #a12a1a; border-color: #a12a1a; }
.btn-danger:hover { background: #a12a1a; color: #fff; }
.admin label.check { display: flex; align-items: center; gap: 10px; }
.admin label.check input { width: 20px; height: 20px; accent-color: var(--olive); margin: 0; }
.empty { text-align: center; color: var(--muted); padding: 32px 0; }
.saved { color: var(--olive); font-weight: 800; }
.tag { display: inline-block; font-size: .75rem; font-weight: 800; background: var(--olive-soft); color: var(--olive-dark); border-radius: 999px; padding: 2px 8px; }
.icon-btn {
  width: 34px; height: 34px; border-radius: 10px; border: 1px solid var(--line); background: var(--cream); cursor: pointer;
  font-weight: 800; color: var(--olive-dark); flex: none;
}
.icon-btn:disabled { opacity: .35; cursor: default; }
.icon-btn.danger { color: #a12a1a; }

.filters { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0 16px; }
.chip { font: inherit; font-weight: 800; border: 2px solid var(--line); background: var(--paper); border-radius: 999px; padding: 6px 12px; cursor: pointer; color: var(--olive-dark); }
.chip[aria-selected="true"] { background: var(--olive); border-color: var(--olive); color: var(--cream); }
.chip-n { margin-left: 6px; opacity: .75; }
.orders-list { display: grid; gap: 14px; }
.order-card { background: var(--paper); border: 1px solid var(--line); border-left: 6px solid var(--crust); border-radius: 14px; padding: 16px 18px; }
.order-card.status-confirmed { border-left-color: var(--olive); }
.order-card.status-ready { border-left-color: #2f7d9a; }
.order-card.status-collected, .order-card.status-cancelled { border-left-color: #b7b2a6; opacity: .8; }
.order-top { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.order-top p { margin: 0; }
.order-date { font-weight: 800; font-size: 1.1rem; }
.order-status { min-width: 180px; }
.order-status select { margin-top: 0 !important; }
.order-notes { background: #fff8e1; border-radius: 10px; padding: 8px 12px; margin: 8px 0; }
.order-customer { margin: 8px 0 0; overflow-wrap: anywhere; }

.cakes-list { display: grid; gap: 10px; margin-top: 12px; }
.cake-row { display: flex; align-items: center; gap: 14px; background: var(--paper); border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px; }
.cake-row.is-hidden { opacity: .65; }
.cake-row img, .thumb-empty { width: 64px; height: 64px; border-radius: 10px; object-fit: cover; flex: none; background: var(--olive-soft); display: grid; place-items: center; font-size: 1.6rem; }
.cake-row-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.cake-row-actions { display: flex; gap: 6px; align-items: center; }

.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; margin: 12px 0; }
.photo-tile { position: relative; border-radius: 12px; overflow: hidden; background: var(--olive-soft); aspect-ratio: 1; }
.photo-tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.main-tag { position: absolute; top: 6px; left: 6px; }
.photo-actions { position: absolute; bottom: 6px; left: 6px; right: 6px; display: flex; justify-content: space-between; }
.upload-btn { position: relative; cursor: pointer; }
.upload-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

.group-card { border: 2px solid var(--line); border-radius: 14px; padding: 14px; margin: 12px 0; background: var(--cream); }
.group-head { display: flex; gap: 8px; align-items: center; }
.group-head .group-name { margin-top: 0 !important; font-weight: 800 !important; font-size: 1.05rem !important; }
.group-tools { display: flex; gap: 6px; }
.row-2 { display: grid; gap: 12px; grid-template-columns: 1fr 1fr; align-items: end; }
.choice-rows { display: grid; gap: 8px; margin-top: 12px; }
.choice-row { display: grid; grid-template-columns: 1fr 110px auto auto; gap: 6px; align-items: center; }
.choice-row input { margin-top: 0 !important; }
.pound { display: flex; align-items: center; gap: 2px; font-weight: 800; color: var(--muted); }
.add-label { margin: 16px 0 6px; font-weight: 800; }
.preset-row { display: flex; gap: 8px; flex-wrap: wrap; }
.editor-actions { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; position: sticky; bottom: 0; padding: 12px 0; background: #f7f1e6; }
@media (max-width: 520px) {
  .choice-row { grid-template-columns: 1fr 96px auto auto; }
  .row-2 { grid-template-columns: 1fr; }
}

/* Choice cards and price inputs: these beat the general form-field rules above. */
#order-form label.choice { display: flex; margin: 0; }
.pound { white-space: nowrap; }
.pound input { min-width: 0; }
@media (max-width: 400px) {
  .brand img { width: 80px; }
  nav { gap: 0; }
  nav a { padding: 6px 7px; font-size: .9rem; }
}

/* Phones: show the whole shopfront at the top, fading into green under the text. */
@media (max-width: 759px) {
  .hero { display: block; min-height: 0; padding: 78vw 0 40px; background: #242d12; }
  .hero::before { background: url(images/shopfront.jpg) top center / 100% auto no-repeat; }
  .hero::after {
    background: linear-gradient(180deg, rgba(36, 45, 18, 0) 0, rgba(36, 45, 18, 0) 40vw, rgba(36, 45, 18, .85) 80vw, #242d12 105vw);
  }
}

/* Admin: shop details */
.form-sub { margin: 22px 0 0; font-size: 1.15rem; }
.hours-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.hours-grid label { margin-top: 8px; }
@media (max-width: 520px) { .hours-grid { grid-template-columns: 1fr; } }
