/* ==========================================================================
   Lacey's Lemonade — site stylesheet
   1. Tokens      (brand colours live here; the admin can override :root values)
   2. Base        (reset, body, lemon background)
   3. Layout      (header, sections, cards, footer)
   4. Components  (buttons, hours, events, feed, form)
   5. Utilities + responsive
   ========================================================================== */

/* ---------- 1. Tokens ---------- */
@font-face {
  font-family: "Cailesta";
  src: url("../fonts/cailesta-webfont.woff2") format("woff2"),
       url("../fonts/cailesta-webfont.woff") format("woff");
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

:root {
  /* Brand. The admin "Appearance" page writes overrides for these five. */
  --blue:        #0878d8;
  --blue-deep:   #0a5fb0;
  --blue-ink:    #0b3e72;
  --blue-footer: #073e7e;
  --yellow:      #f8d808;
  --blue-rgb:    8, 120, 216;
  --yellow-rgb:  248, 216, 8;

  /* Derived */
  --blue-light:  color-mix(in srgb, var(--blue) 90%, white);
  --yellow-soft: color-mix(in srgb, var(--yellow) 80%, white);
  --ink:         #143a5e;
  --ink-soft:    #3f5d7d;
  --surface:     #ffffff;
  --surface-2:   #eef5fd;
  --rule:        #d9e6f4;
  --today:       #fff7c9;

  --shadow:      0 4px 18px rgba(3, 30, 62, .5);
  --shadow-sm:   0 8px 22px rgba(5, 38, 79, .16);
  --radius:      30px;
  --radius-sm:   18px;
  --pad:         clamp(20px, 4vw, 32px);
  --gap:         24px;
  --measure:     960px;

  --font-body:    "Quicksand", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-display: "Cailesta", system-ui, sans-serif;

  /* Lemon artwork. Each layer: image, position, size. Edit here to re-arrange. */
  --lemon-layers:
    url("../img/lemons/lemon-4.svg") 48% 50% / 240px,
    url("../img/lemons/slice-1.svg") 86%  8% / 120px,
    url("../img/lemons/lemon-3.svg") 18% 14% / 220px,
    url("../img/lemons/lemon-5.svg") 16% 86% / 215px,
    url("../img/lemons/slice-2.svg") 62% 22% / 110px,
    url("../img/lemons/lemon-6.svg") 52% 91% / 205px,
    url("../img/lemons/lemon-4.svg") 92% 51% / 205px,
    url("../img/lemons/lemon-3.svg") 49%  9% / 195px,
    url("../img/lemons/slice-1.svg") 10% 44% / 105px,
    url("../img/lemons/lemon-5.svg") 97% 97% / 190px,
    url("../img/lemons/lemon-6.svg") 65% 70% / 185px,
    url("../img/lemons/lemon-3.svg") 26% 62% / 180px,
    url("../img/lemons/slice-2.svg") 78% 86% / 100px,
    url("../img/lemons/lemon-4.svg")  3% 67% / 170px,
    url("../img/lemons/lemon-5.svg")  1% 27% / 170px,
    url("../img/lemons/lemon-6.svg") 99% 31% / 170px,
    url("../img/lemons/lemon-3.svg") 98%  1% / 160px,
    url("../img/lemons/slice-1.svg") 36% 80% /  95px,
    url("../img/lemons/lemon-5.svg") 54% 28% / 150px,
    url("../img/lemons/lemon-6.svg") 73% 42% / 150px;
  --sky: linear-gradient(180deg, var(--blue-light) 0%, var(--blue) 45%, var(--blue-deep) 100%);
}

/* ---------- 2. Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } *, *::before, *::after { transition: none !important; } }

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  min-height: 100dvh;
  /* Lemons are plain SVG files layered as fixed backgrounds: no markup, no JS, same every load. */
  background: var(--lemon-layers), var(--sky);
  background-repeat: no-repeat;
  background-attachment: fixed;
  background-color: var(--blue);
}
body[data-lemons="off"], body[data-lemons="canvas"] { background: var(--sky); background-attachment: fixed; }
/* One canvas, drawn once per load by site.js, sits between the gradient and the content. */
.lemon-canvas { position: fixed; inset: 0; width: 100%; height: 100%; z-index: -1; pointer-events: none; }
.icon { width: 1.15em; height: 1.15em; vertical-align: -.2em; margin-inline-end: .4em; }
.ig-link, .ig-handle { display: inline-flex; align-items: center; }

img { max-width: 100%; height: auto; }
a { color: inherit; }
:focus-visible { outline: 3px solid var(--yellow); outline-offset: 3px; border-radius: 6px; }

/* ---------- 3. Layout ---------- */
.site-header {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 12px 20px;
  backdrop-filter: blur(8px);
  background: linear-gradient(180deg, rgba(var(--blue-rgb), .92), rgba(var(--blue-rgb), .55));
}
.brand { display: flex; align-items: center; gap: 11px; text-decoration: none; color: #fff; font-weight: 700; font-size: 1.12rem; letter-spacing: .2px; }
.brand img { width: 42px; height: 42px; border-radius: 50%; background: #fff; object-fit: contain; padding: 2px; box-shadow: 0 4px 12px rgba(0, 0, 0, .15); }
.site-header nav { display: flex; gap: 22px; flex-wrap: wrap; }
.site-header nav a {
  color: #fff; text-decoration: none; font-weight: 600; font-size: .98rem; opacity: .92;
  padding: 6px 2px; border-bottom: 2px solid transparent; transition: border-color .18s, opacity .18s;
}
.site-header nav a:hover { opacity: 1; border-color: var(--yellow); }

main { display: grid; gap: var(--gap); max-inline-size: var(--measure); margin-inline: auto; padding: 0 20px 48px; }
section { position: relative; }

.card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: var(--pad);
}

h2.sec { margin: 0 0 22px; color: var(--blue-ink); font-weight: 700; line-height: 1.08; font-size: clamp(1.7rem, 5.5vw, 2.4rem); }
h2.sec { text-decoration: underline; text-decoration-color: var(--yellow); text-decoration-thickness: 5px; text-underline-offset: .18em; text-decoration-skip-ink: none; }
h2.sec-light { color: #fff; text-shadow: 0 2px 10px rgba(3, 30, 62, .6); }

/* Hero */
.hero { text-align: center; padding: 46px 0 20px; }
.medallion {
  width: 156px; height: 156px; border-radius: 50%; background: #fff; margin: 0 auto 26px;
  object-fit: contain; padding: 5px; display: block;
  box-shadow: 0 22px 50px rgba(4, 32, 66, .34); border: 4px solid rgba(255, 255, 255, .55);
}
.hero h1 {
  margin: 0 auto; max-width: 14ch; color: #fff; font-weight: 400; line-height: .98;
  font-family: var(--font-display); font-size: clamp(2.4rem, 8.4vw, 4rem);
  text-wrap: balance; letter-spacing: .5px; text-shadow: 0 4px 18px rgba(3, 30, 62, 1);
}
.hero h1 .hl { color: var(--yellow); font-style: normal; }
.hero-card { max-width: 560px; margin: 30px auto 0; }
.hero-card .tag { margin: 0 0 22px; font-weight: 500; font-size: clamp(1.2rem, 3.9vw, 1.45rem); line-height: 1.38; text-wrap: pretty; color: #111; }

/* Visit + hours */
.info { display: grid; grid-template-columns: 1.25fr .9fr; gap: var(--gap); align-items: stretch; }
.info > .card { display: flex; flex-direction: column; align-items: flex-start; }
.info > .card > * { width: 100%; }
.info > .card > .btn { width: auto; }
.info > .card > table.hours { width: calc(100% + 24px); flex: 1 1 auto; }
.info > .card > .map { flex: 1 1 auto; min-height: 280px; }
.addr { font-style: normal; display: grid; gap: 4px; margin: 0 0 20px; }
.addr strong { font-size: 1.18rem; font-weight: 600; line-height: 1.5; }
.addr .pin { color: var(--blue); }
.muted { color: var(--ink-soft); font-weight: 500; }
.map { display: block; width: 100%; height: 280px; min-height: 280px; border: 4px solid var(--surface-2); margin-top: 18px; border-radius: 20px; box-shadow: var(--shadow-sm); }

table.hours { width: calc(100% + 24px); margin-inline: -12px; border-collapse: collapse; font-size: 1.05rem; }
table.hours tr { border-bottom: 1px dashed var(--rule); }
table.hours tr:last-child { border-bottom: 0; }
table.hours th, table.hours td { padding: 13px 12px; text-align: left; vertical-align: baseline; }
table.hours th { font-weight: 700; color: var(--blue-ink); }
table.hours td { text-align: right; color: var(--ink-soft); font-weight: 600; white-space: nowrap; }
table.hours tr[aria-current] { background: var(--today); border-bottom-color: transparent; }
table.hours tr[aria-current] th { border-radius: 12px 0 0 12px; }
table.hours tr[aria-current] td { border-radius: 0 12px 12px 0; }
table.hours tr[aria-current] th::after { content: " · Today"; color: var(--blue); font-weight: 700; font-size: .82rem; }
.hours-note { margin: 18px 0 0; font-size: .92rem; color: var(--ink-soft); }

/* Events */
.events { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }
.event { display: grid; gap: 8px; padding: 22px; border-radius: var(--radius-sm); height: 100%; container-type: inline-size; }
.event time { display: inline-grid; justify-items: center; justify-self: start; background: var(--yellow); color: #111; border-radius: 14px; padding: 8px 14px; line-height: 1; }
.event time .mo { font-size: .72rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.event time .d { font-size: 1.6rem; font-weight: 700; }
.event h3 { margin: 6px 0 0; font-size: 1.2rem; color: var(--blue-ink); line-height: 1.2; text-wrap: balance; }
.event .when { margin: 0; color: var(--blue); font-weight: 700; font-size: .92rem; }
.event p { margin: 0; color: var(--ink-soft); font-size: .95rem; line-height: 1.5; }
.event img { border-radius: 12px; aspect-ratio: 4 / 3; object-fit: cover; width: 100%; }
.event a { color: var(--blue); font-weight: 700; text-decoration: none; }
.event a:hover { text-decoration: underline; }

/* Instagram */
#happenings { display: grid; grid-template-columns: 1fr auto; align-items: end; column-gap: 16px; }
#happenings h2 { grid-column: 1; }
.ig-handle { color: var(--blue); font-weight: 700; text-decoration: none; font-size: 1.05rem; margin-bottom: 26px; }
.ig-feed { grid-column: 1 / -1; list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.ig-feed a {
  position: relative; display: block; aspect-ratio: 325 / 435; border-radius: var(--radius-sm); overflow: hidden;
  background: var(--blue); box-shadow: var(--shadow-sm);
}
.ig-feed a > img:first-child { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .3s ease; }
.ig-feed a:hover > img:first-child { transform: scale(1.04); }
.ig-mark { position: absolute; top: 10px; right: 10px; width: 26px; height: 26px; opacity: 0; transition: opacity .2s; filter: drop-shadow(0 1px 3px rgba(0, 0, 0, .4)); }
.ig-feed a:hover .ig-mark, .ig-feed a:focus-visible .ig-mark { opacity: 1; }

/* Contact */
.contact .intro { margin: -8px 0 22px; color: var(--ink-soft); font-weight: 500; max-width: 60ch; }
.contact-form fieldset { border: 0; padding: 0; margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.contact-form p { margin: 0; display: grid; gap: 6px; }
.contact-form .full { grid-column: 1 / -1; }
.contact-form label { font-weight: 700; color: var(--blue-ink); font-size: .95rem; }
.contact-form input, .contact-form textarea {
  font: inherit; color: var(--ink); background: var(--surface-2);
  border: 2px solid transparent; border-radius: 14px; padding: 12px 14px; width: 100%;
  transition: border-color .15s, background .15s;
}
.contact-form input:focus, .contact-form textarea:focus { outline: none; border-color: var(--blue); background: #fff; }
.contact-form textarea { resize: vertical; min-height: 120px; }
.contact-form .hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.contact-form .actions { margin-top: 18px; display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.form-status { font-weight: 600; }
.form-status.ok, .notice.ok { color: #1b7a3d; }
.form-status.err, .notice.err { color: #b3261e; }
.notice { margin: 0 0 18px; padding: 12px 16px; border-radius: 12px; background: var(--surface-2); font-weight: 600; }

/* Footer */
.site-footer {
  background: var(--blue-footer); color: #dcebfb; margin-top: 24px; padding: 48px 20px 30px;
  display: grid; gap: 34px; grid-template-columns: 1.3fr 1fr 1fr;
  grid-template-areas: "brand contact visit" "bottom bottom bottom";
}
.site-footer > * { margin: 0; }
.site-footer > :nth-child(1) { grid-area: brand; }
.site-footer > :nth-child(2) { grid-area: contact; }
.site-footer > :nth-child(3) { grid-area: visit; }
.site-footer > :nth-child(4) { grid-area: bottom; }
.foot-brand { display: grid; grid-template-columns: auto 1fr; align-items: center; column-gap: 13px; }
.foot-brand img { width: 54px; height: 54px; border-radius: 50%; background: #fff; object-fit: contain; padding: 3px; grid-row: span 2; }
.foot-brand strong { color: #fff; font-size: 1.3rem; }
.foot-tag { color: #9fc4ec; font-weight: 600; font-size: .95rem; }
.foot-h { color: var(--yellow); font-size: .82rem; letter-spacing: .13em; text-transform: uppercase; margin: 0 0 12px; font-weight: 700; }
.site-footer address { font-style: normal; line-height: 1.6; margin-bottom: 6px; }
.site-footer a { color: #dcebfb; text-decoration: none; border-bottom: 1px solid rgba(220, 235, 251, .3); }
.site-footer a:hover { color: #fff; border-color: var(--yellow); }
.site-footer ul.plain { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; line-height: 1.6; }
.foot-bottom { padding-top: 20px; border-top: 1px solid rgba(255, 255, 255, .15); color: #9fc4ec; font-size: .86rem; }
.site-footer > .foot-brand, .site-footer > section, .site-footer > .foot-bottom { max-width: var(--measure); width: 100%; }
@supports (grid-template-columns: subgrid) {
  .site-footer { grid-template-columns: 1fr minmax(0, calc(var(--measure) * .39)) minmax(0, calc(var(--measure) * .3)) minmax(0, calc(var(--measure) * .3)) 1fr;
    grid-template-areas: ". brand contact visit ." ". bottom bottom bottom ."; }
}

/* ---------- 4. Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 9px; font-family: inherit; font-weight: 700; font-size: 1rem;
  padding: 14px 28px; border-radius: 999px; text-decoration: none; cursor: pointer; border: 0;
  transition: transform .16s ease, box-shadow .16s ease, background .16s;
}
.btn-primary { background: var(--yellow); color: #111; box-shadow: 0 10px 22px rgba(var(--yellow-rgb), .45); }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 14px 28px rgba(var(--yellow-rgb), .55); }
.btn-blue { background: var(--blue); color: #fff; box-shadow: var(--shadow-sm); }
.btn-blue:hover { transform: translateY(-2px); background: var(--blue-deep); }
.btn[disabled] { opacity: .6; cursor: wait; transform: none; }

/* ---------- 5. Utilities + responsive ---------- */
.visually-hidden { position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0; }

@media (max-width: 840px) {
  .events { grid-template-columns: repeat(2, 1fr); }
  .info { grid-template-columns: 1fr; }
  .site-footer { grid-template-columns: 1fr; grid-template-areas: "brand" "contact" "visit" "bottom"; gap: 26px; }
  @supports (grid-template-columns: subgrid) { .site-footer { grid-template-columns: 1fr; grid-template-areas: "brand" "contact" "visit" "bottom"; } }
}
@media (max-width: 620px) {
  .site-header nav { display: none; }
  .brand { font-size: 1rem; }
  .ig-feed { grid-template-columns: repeat(2, 1fr); gap: 11px; }
  .contact-form fieldset { grid-template-columns: 1fr; }
  #happenings { grid-template-columns: 1fr; }
  .ig-handle { margin: -10px 0 18px; }
}
@media (max-width: 520px) {
  .events { grid-template-columns: 1fr; }
  :root { --radius: 22px; }
}
/* Phones: fewer, smaller lemons; iOS ignores fixed attachment so scroll with the page. */
@media (max-width: 700px) {
  body {
    background-attachment: scroll;
    background-image:
      url("../img/lemons/lemon-4.svg"), url("../img/lemons/slice-1.svg"), url("../img/lemons/lemon-3.svg"),
      url("../img/lemons/lemon-5.svg"), url("../img/lemons/slice-2.svg"), url("../img/lemons/lemon-6.svg"),
      url("../img/lemons/lemon-3.svg"), url("../img/lemons/lemon-5.svg"), var(--sky);
    background-position: 92% 4%, 6% 10%, 88% 24%, 4% 38%, 94% 52%, 3% 66%, 90% 80%, 8% 94%, 0 0;
    background-size: 150px, 80px, 140px, 140px, 76px, 140px, 130px, 130px, 100% 100%;
  }
  body[data-lemons="off"], body[data-lemons="canvas"] { background-image: var(--sky); background-size: 100% 100%; }
}
@media print {
  body { background: #fff; }
  .site-header, .ig-feed, .contact, .map { display: none; }
  .card { box-shadow: none; border: 1px solid #ccc; }
}
