/* ================================================================
   Slushy Summer — Casa Branko
   Brand palette: navy #182a4e | red #ec1c3d | gold #f4b813 | cream #FBF5EB
   Green accents: #4caf3f (bright) / #1d8a4c (deep)
   ================================================================ */

:root {
  --cream: #FBF5EB;
  --navy: #182a4e;
  --red: #ec1c3d;
  --gold: #f4b813;
  --green: #4caf3f;
  --green-deep: #1d8a4c;
  --line: #ece4d4;
  --slush: #9fb3c8;        /* set from the API; gray-blue when the machine is off */
  --slush-deep: #8299b1;   /* darker companion shade, set from JS */
  --radius-card: 16px;
  --shadow-card: 0 8px 24px rgba(24, 42, 78, 0.09);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  /* Cream base + gold radial glow from top-center + very subtle sun-ray conic stripes */
  background:
    radial-gradient(circle at 50% -10%, rgba(244, 184, 19, 0.22), transparent 52%),
    repeating-conic-gradient(from 270deg at 50% -8%,
      rgba(244, 184, 19, 0.032) 0deg 5deg,
      transparent 5deg 14deg),
    var(--cream);
  color: var(--navy);
  font-family: 'Poppins', sans-serif;
  min-height: 100vh;
  opacity: 1;
  transition: opacity 0.3s ease;
}

/* ---- Page header ---- */
.page-header {
  display: flex;
  justify-content: flex-end;
  align-items: flex-start;
  padding: 14px 24px 0;
  position: relative;
  z-index: 10;
}

.sticker-logo {
  width: clamp(180px, 28vw, 268px);
  height: auto;
  /* Top-right sticker, tilted slightly inwards (top leans toward the page) */
  transform: rotate(-5deg);
  transform-origin: top right;
  filter: drop-shadow(2px 5px 10px rgba(0, 0, 0, 0.16));
  display: block;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(76, 175, 63, 0.5); }
  50%       { opacity: 0.7; box-shadow: 0 0 0 5px rgba(76, 175, 63, 0); }
}

/* ---- Hero: two-column layout ---- */
.hero-section {
  max-width: 960px;
  margin: -16px auto 0;
  padding: 0 24px 40px;
  display: flex;
  align-items: flex-start;
  gap: 44px;
}

.machine-col {
  flex: 0 0 auto;
  padding-top: 0;
  /* Lift the machine into the space the header logo used to occupy */
  margin-top: -20px;
}

.machine-wrap {
  width: min(320px, 72vw);
}

.machine {
  width: 100%;
  height: auto;
  display: block;
  filter: drop-shadow(0 16px 32px rgba(24, 42, 78, 0.2));
}

/* ---- Status column ---- */
.status-col {
  flex: 1;
  min-width: 0;
  padding-top: 48px;
}

/* Machine on/off badge pill */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: 'Poppins', sans-serif;
  font-weight: 700;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 10px 22px;
  border-radius: 999px;
  background: #b8c6d4;
  color: var(--navy);
  transition: background 0.4s ease, color 0.4s ease;
}

/* The pulsing dot inside the pill */
.status-pill::before {
  content: '';
  flex: none;
  display: block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: rgba(24, 42, 78, 0.35);
  transition: background 0.4s ease;
}

.machine--on .status-pill {
  background: var(--green-deep);
  color: #fff;
}

.machine--on .status-pill::before {
  background: rgba(200, 255, 210, 0.8);
  animation: pulse-dot 2s ease-in-out infinite;
}

/* "Now spinning:" label in Caveat red */
.spinning-label {
  margin: 20px 0 0;
  font-family: 'Caveat', cursive;
  font-weight: 700;
  font-size: 26px;
  color: var(--red);
  line-height: 1;
}

/* Hide spinning label and decorative elements in off state */
.machine--off .spinning-label,
.machine--off .flavor-squiggle,
.machine--off .status-arrow {
  display: none;
}

/* Flavor name — huge Anton, navy */
.status-flavor {
  margin: 4px 0 0;
  font-family: 'Anton', sans-serif;
  font-weight: 400;
  font-size: clamp(48px, 8vw, 80px);
  line-height: 1;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--navy);
  min-height: 1em;
}

.machine--off .status-flavor {
  font-size: clamp(36px, 6vw, 60px);
  opacity: 0.65;
}

/* Wavy squiggle underline */
.flavor-squiggle {
  display: block;
  width: clamp(140px, 60%, 220px);
  height: 14px;
  margin: 6px 0 0;
}

/* Status note in Caveat */
.status-note {
  margin: 14px 0 0;
  font-family: 'Caveat', cursive;
  font-weight: 600;
  font-size: 24px;
  color: var(--navy);
  line-height: 1.3;
}

/* Curved arrow */
.status-arrow {
  display: block;
  width: 56px;
  height: 44px;
  margin: 2px 0 6px 10px;
}

/* ---- Info card ---- */
.info-card {
  background: #fff;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  margin-top: 14px;
}

.info-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
}

.info-row + .info-row {
  border-top: 1px solid var(--line);
}

.info-icon {
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
}

.info-icon svg { width: 100%; height: 100%; display: block; }

.info-icon--red  { background: rgba(236, 28, 61, 0.1); }
.info-icon--green { background: rgba(76, 175, 63, 0.1); }
.info-icon--gold  { background: rgba(244, 184, 19, 0.12); }

.info-row__body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.info-row__title {
  font-weight: 700;
  font-size: 14px;
  color: var(--navy);
  line-height: 1.2;
}

.info-row__sub {
  font-size: 13px;
  font-weight: 400;
  color: rgba(24, 42, 78, 0.55);
  line-height: 1.3;
}

/* ---- Machine SVG (do not restyle here) ---- */
/* Preserve all rules for the animated machine internals. */

.liquid__body { fill: var(--slush); transition: fill 0.6s ease; }
.wave { fill: var(--slush); transition: fill 0.6s ease; }
.wave--back { fill: var(--slush-deep); }
.wave--front { animation: slosh 5s linear infinite; }
.wave--back  { animation: slosh 7.5s linear infinite reverse; }
@keyframes slosh { to { transform: translateX(-100px); } }

.liquid { transition: transform 0.8s ease; }
.machine--off .liquid { transform: translateY(70px); }

.auger__arm { stroke: rgba(255, 255, 255, 0.85); stroke-width: 7; stroke-linecap: round; stroke-linejoin: round; fill: none; }
.auger__arm--back { opacity: 0.4; }
.auger__screw {
  animation: screwspin 2.4s linear infinite;
  /* Explicit origin in viewBox units — the arms' bounding box is asymmetric,
     so fill-box "center" wobbles off the true spiral center. */
  transform-box: view-box;
  transform-origin: 180px 150px;
}
@keyframes screwspin { to { transform: rotate(360deg); } }

.bubble { fill: rgba(255, 255, 255, 0.7); animation: rise 3s ease-in infinite; }
.b2 { animation-duration: 2.4s; animation-delay: 0.6s; }
.b3 { animation-duration: 3.6s; animation-delay: 1.1s; }
.b4 { animation-duration: 2.8s; animation-delay: 1.7s; }
.b5 { animation-duration: 3.2s; animation-delay: 0.3s; }
@keyframes rise {
  0%   { transform: translateY(0); opacity: 0; }
  15%  { opacity: 0.8; }
  100% { transform: translateY(-110px); opacity: 0; }
}

.machine--off .wave--front,
.machine--off .wave--back,
.machine--off .auger__screw { animation-play-state: paused; }
.machine--off .bubbles { display: none; }

.led { fill: #e0263d; }
.machine--on .led { fill: #43e06c; filter: drop-shadow(0 0 6px rgba(67, 224, 108, 0.9)); }

.cup { opacity: 0; transition: opacity 0.6s ease; }
.machine--on .cup { opacity: 1; }
.cup__fill { fill: var(--slush); transition: fill 0.6s ease; }

.machine__label {
  font-family: 'Anton', sans-serif;
  font-size: 22px;
  letter-spacing: 0.12em;
  fill: #ffffff;
}
.machine__sparkle use { fill: rgba(255, 255, 255, 0.9); }
.m2-maxfill {
  font-family: 'Poppins', sans-serif;
  font-size: 6.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  fill: #8a94a8;
}
.machine__panel-text {
  font-family: 'Poppins', sans-serif;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  fill: rgba(255, 255, 255, 0.9);
}
.panel-state--on { display: none; }
.machine--on .panel-state--on { display: initial; }
.machine--on .panel-state--off { display: none; }
.cup__dome { fill: #ffffff; transition: fill 0.6s ease; }
@supports (fill: color-mix(in srgb, red 50%, white)) {
  .cup__dome { fill: color-mix(in srgb, var(--slush) 55%, #ffffff); }
}

@media (prefers-reduced-motion: reduce) {
  .wave--front, .wave--back, .auger__screw, .bubble,
  .status-pill::before { animation: none !important; }
}
/* ---- End Machine SVG ---- */

/* ---- Flavor History ---- */
.flavor-history {
  max-width: 1040px;
  margin: 16px auto 0;
  padding: 0 24px 48px;
}

.fh-head {
  display: flex;
  align-items: baseline;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.fh-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  font-family: 'Anton', sans-serif;
  font-weight: 400;
  font-size: clamp(24px, 4vw, 34px);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--navy);
}

.fh-chevron {
  flex: none;
  width: 18px;
  height: 24px;
}

.fh-chevron--flip {
  transform: scaleX(-1);
}

.fh-aside {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}

.fh-aside-text {
  font-family: 'Caveat', cursive;
  font-weight: 600;
  font-size: 22px;
  color: rgba(24, 42, 78, 0.65);
  white-space: nowrap;
}

.fh-arrow {
  flex: none;
  width: 44px;
  height: 30px;
}

/* History grid: 6 cards wide on desktop */
.history-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 14px;
}

/* Each history card */
.history-card {
  background: #fff;
  border: 1.5px solid var(--line);
  border-radius: 14px;
  padding: 14px 10px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  box-shadow: var(--shadow-card);
  text-align: center;
}

.history-cup {
  width: 72px;
  height: 88px;
  display: block;
  flex: none;
}

.history-card__name {
  font-family: 'Anton', sans-serif;
  font-weight: 400;
  font-size: 13px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--navy);
  line-height: 1.2;
  word-break: break-word;
}

.history-card__date {
  display: block;
  font-size: 11px;
  font-weight: 500;
  color: rgba(24, 42, 78, 0.5);
  line-height: 1.3;
}

/* ---- FAQ accordion ---- */
.faq {
  max-width: 720px;
  margin: 8px auto 0;
  padding: 0 24px 48px;
}

.faq-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 18px;
  font-family: 'Anton', sans-serif;
  font-weight: 400;
  font-size: clamp(24px, 4vw, 34px);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--navy);
}

.faq-item {
  background: #fff;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

.faq-item + .faq-item {
  margin-top: 10px;
}

.faq-q {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  width: 100%;
  border: none;
  background: none;
  cursor: pointer;
  text-align: left;
  padding: 16px 18px;
  font-family: 'Poppins', sans-serif;
  font-weight: 700;
  font-size: 15px;
  color: var(--navy);
  line-height: 1.3;
}

.faq-caret {
  flex: none;
  width: 20px;
  height: 20px;
  color: var(--green);
  transition: transform 0.3s ease;
}

.faq-q[aria-expanded="true"] .faq-caret {
  transform: rotate(180deg);
}

/* Sliding answer: 0fr -> 1fr grid row animates the reveal */
.faq-a {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.35s ease;
}

.faq-item--open .faq-a {
  grid-template-rows: 1fr;
}

.faq-a__inner {
  overflow: hidden;
  min-height: 0;
}

.faq-a__inner p {
  margin: 0;
  padding: 0 18px 16px;
  font-family: 'Caveat', cursive;
  font-weight: 600;
  font-size: 24px;
  color: var(--red);
  line-height: 1.2;
}

@media (prefers-reduced-motion: reduce) {
  .faq-a, .faq-caret { transition: none !important; }
}

/* ---- Error Banner ---- */
.error-banner {
  max-width: 860px;
  margin: 0 auto 32px;
  align-items: center;
  gap: 20px;
  background: #fff;
  border: 1.5px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow-card);
  /* Overflow visible so it doesn't clip the mascot SVG */
}

/* When hidden attribute is removed, show as flex */
.error-banner:not([hidden]) {
  display: flex;
  padding: 20px 24px;
}

.error-banner__mascot {
  flex: none;
  width: 72px;
}

.error-banner__mascot svg {
  width: 100%;
  height: auto;
  display: block;
}

.error-banner__msg {
  flex: 1;
  min-width: 0;
}

.error-banner__title {
  display: block;
  font-family: 'Anton', sans-serif;
  font-weight: 400;
  font-size: 18px;
  letter-spacing: 0.03em;
  color: var(--navy);
  margin-bottom: 4px;
}

.error-banner__sub {
  margin: 0;
  font-size: 13px;
  color: rgba(24, 42, 78, 0.6);
  line-height: 1.4;
}

.error-retry-btn {
  flex: none;
  border: none;
  cursor: pointer;
  background: var(--red);
  color: #fff;
  font-family: 'Poppins', sans-serif;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.06em;
  padding: 12px 22px;
  border-radius: 999px;
  transition: transform 0.1s ease, filter 0.15s ease;
  white-space: nowrap;
}

.error-retry-btn:hover { filter: brightness(1.1); transform: translateY(-1px); }
.error-retry-btn:active { transform: translateY(0); }

/* ---- Site Footer ---- */
.site-footer {
  margin-top: 24px;
  position: relative;
}

.footer-wave {
  display: block;
  width: 100%;
  height: 80px;
  margin-bottom: -2px; /* close gap between wave and body */
}

.footer-body {
  background: var(--navy);
  padding: 32px 24px 48px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  position: relative;
  overflow: hidden;
}

/* Palm silhouettes — positioned inside footer body */
.footer-palm {
  position: absolute;
  bottom: 0;
  width: 140px;
  height: 240px;
  opacity: 0.45;
  pointer-events: none;
}

.footer-palm--l { left: -10px; }
.footer-palm--r { right: -10px; transform: scaleX(-1); }

.footer-presented {
  margin: 0;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.6);
}

.footer-logo {
  width: clamp(180px, 40%, 300px);
  height: auto;
  display: block;
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.35));
}

.footer-url {
  font-size: 15px;
  font-weight: 700;
  color: var(--gold);
  text-decoration: none;
  letter-spacing: 0.03em;
  transition: opacity 0.15s ease;
}

.footer-url:hover { opacity: 0.8; }

/* ================================================================
   Responsive
   ================================================================ */

/* Medium: 4 history columns */
@media (max-width: 960px) {
  .history-grid { grid-template-columns: repeat(4, 1fr); }
}

/* Tablet: stack hero, 3 history columns */
@media (max-width: 720px) {
  .hero-section {
    flex-direction: column;
    align-items: center;
    gap: 24px;
    padding-top: 10px;
  }

  .machine-col { width: 100%; display: flex; justify-content: center; margin-top: 0; }
  .machine-wrap { width: min(280px, 72vw); }

  .status-col {
    width: 100%;
    padding-top: 0;
    text-align: center;
  }

  .flavor-squiggle,
  .status-arrow { margin-left: auto; margin-right: auto; }

  .info-card { text-align: left; }

  .fh-aside { display: none; } /* too cramped on tablet */

  .history-grid { grid-template-columns: repeat(3, 1fr); }
}

/* Mobile: 2 history columns */
@media (max-width: 500px) {
  .page-header { padding: 10px 16px 0; }

  .sticker-logo { width: clamp(140px, 44vw, 210px); }

  .hero-section { padding: 0 16px 28px; }

  .status-col { padding-top: 4px; }

  .status-note { font-size: 20px; }

  .flavor-history { padding: 0 16px 36px; }

  .faq { padding: 0 16px 36px; }

  .history-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }

  .error-banner:not([hidden]) {
    flex-wrap: wrap;
    gap: 14px;
    padding: 16px;
  }

  .error-banner__mascot { width: 58px; }

  .error-retry-btn { width: 100%; text-align: center; }

  .footer-logo { width: clamp(140px, 60%, 220px); }
}
