/* =====================================================================
   Chef's Palette Staff Clock — style.css
   A warm, modern café look: soft off-white, charcoal text,
   sage green accents and terracotta details.
   ===================================================================== */

/* ---------- Design tokens ---------- */
:root {
  --cream:       #FAF6F0;   /* soft off-white background */
  --cream-deep:  #F1EAE0;   /* slightly deeper cream for cards */
  --charcoal:    #2C2A27;   /* main text */
  --charcoal-soft: #5A554E; /* secondary text */
  --sage:        #7C8B6F;   /* muted sage green accent */
  --sage-deep:   #56674B;   /* darker sage for text/buttons (strong contrast) */
  --terracotta:  #A85B3F;   /* warm terracotta detail */
  --brown:       #6E543F;   /* warm brown detail */
  --white:       #FFFFFF;
  --error:       #9C3B2E;

  /* Accent that changes with the day of the week (set by script.js) */
  --day-accent: #A85B3F;

  --radius-lg: 22px;
  --radius-md: 14px;
  --shadow-soft: 0 10px 30px rgba(60, 48, 36, 0.10);
  --shadow-lift: 0 4px 14px rgba(60, 48, 36, 0.12);

  --font-display: "Fraunces", Georgia, "Times New Roman", serif;
  --font-body: "Nunito Sans", -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

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

/* The hidden attribute must always beat any display rule below
   (e.g. .loading-state uses display:flex, which would otherwise
   override it and leave the spinner permanently on screen). */
[hidden] {
  display: none !important;
}

html {
  /* Responsive base font size: comfortable on tablets and desktops */
  font-size: clamp(16px, 1.1vw + 12px, 19px);
}

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--charcoal);
  background-color: var(--cream);
  /* Gentle café texture: two soft colour washes, no images required */
  background-image:
    radial-gradient(1100px 500px at 85% -10%, rgba(124, 139, 111, 0.12), transparent 60%),
    radial-gradient(900px 460px at -10% 110%, rgba(168, 91, 63, 0.10), transparent 60%);
  background-attachment: fixed;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden; /* no horizontal scrolling */
}

.page {
  max-width: 60rem;
  margin: 0 auto;
  /* Safe spacing around tablet screen edges (incl. notches) */
  padding:
    calc(1.25rem + env(safe-area-inset-top))
    calc(1.1rem + env(safe-area-inset-right))
    calc(1.5rem + env(safe-area-inset-bottom))
    calc(1.1rem + env(safe-area-inset-left));
}

/* ---------- Header ---------- */
.site-header {
  text-align: center;
  padding: 0.75rem 0 0.25rem;
  /* Decorative header shouldn't be text-selectable on a kiosk tablet */
  user-select: none;
  -webkit-user-select: none;
}

.brand-eyebrow {
  margin: 0 0 0.2rem;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--day-accent);
}

.site-header h1 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(1.9rem, 4.5vw, 2.9rem);
  line-height: 1.15;
  color: var(--charcoal);
}

.tagline {
  margin: 0.35rem 0 0;
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 500;
  font-size: clamp(1.05rem, 2.2vw, 1.35rem);
  color: var(--sage-deep);
}

.support-text {
  margin: 0.6rem auto 0;
  max-width: 34rem;
  color: var(--charcoal-soft);
}

.staff-notice {
  display: inline-block;
  margin: 0.85rem auto 0;
  padding: 0.4rem 1rem;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--brown);
  background: rgba(110, 84, 63, 0.10);
  border: 1px solid rgba(110, 84, 63, 0.25);
  border-radius: 999px;
}

/* ---------- Clock card ---------- */
.clock-card {
  margin: 1.25rem auto 0;
  max-width: 26rem;
  text-align: center;
  background: var(--white);
  border: 1px solid rgba(124, 139, 111, 0.28);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
  padding: 1rem 1.25rem 0.9rem;
  user-select: none;
  -webkit-user-select: none;
}

.clock-date {
  margin: 0;
  font-weight: 600;
  color: var(--charcoal-soft);
}

.clock-time {
  margin: 0.1rem 0 0;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(2.1rem, 6vw, 3rem);
  line-height: 1.1;
  color: var(--charcoal);
  font-variant-numeric: tabular-nums;
}

.clock-zone {
  margin: 0.15rem 0 0;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--sage-deep);
}

/* ---------- Rotating staff message ---------- */
.staff-message {
  min-height: 2.2em;
  margin: 1.1rem auto 0;
  max-width: 34rem;
  text-align: center;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--day-accent);
  opacity: 1;
  transition: opacity 0.45s ease;
  user-select: none;
  -webkit-user-select: none;
}

.staff-message.is-fading {
  opacity: 0;
}

/* ---------- Cards ---------- */
.card {
  background: var(--white);
  border: 1px solid rgba(44, 42, 39, 0.07);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
  margin: 1.25rem auto 0;
  padding: 1.25rem;
}

/* ---------- Access-code screen ---------- */
.access-card {
  max-width: 26rem;
  text-align: center;
}

.access-card h2 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.5rem;
}

.access-help {
  margin: 0.4rem 0 1rem;
  color: var(--charcoal-soft);
}

.access-form label {
  display: block;
  margin-bottom: 0.4rem;
  font-weight: 700;
  font-size: 0.95rem;
}

.access-form input {
  width: 100%;
  max-width: 12rem;
  margin: 0 auto;
  display: block;
  padding: 0.7rem 0.9rem;
  font-size: 1.5rem;
  letter-spacing: 0.45em;
  text-align: center;
  color: var(--charcoal);
  background: var(--cream);
  border: 2px solid rgba(124, 139, 111, 0.5);
  border-radius: var(--radius-md);
}

.access-form input:focus {
  outline: 3px solid var(--sage);
  outline-offset: 2px;
  border-color: var(--sage-deep);
}

.access-error {
  margin: 0.75rem 0 0;
  font-weight: 700;
  color: var(--error);
}

.access-form .btn {
  margin-top: 1rem;
}

/* ---------- Form card & controls ---------- */
.form-card {
  padding: 1rem;
}

.form-controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem;
  padding: 0.25rem 0 0.75rem;
}

/* ---------- Buttons (large, touch-friendly: ≥ 44px targets) ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0.65rem 1.4rem;
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 700;
  border-radius: 999px;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background-color 0.12s ease;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}

.btn:focus-visible {
  outline: 3px solid var(--terracotta);
  outline-offset: 3px;
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: var(--sage-deep);
  color: var(--white);
  box-shadow: var(--shadow-lift);
}

.btn-primary:hover {
  background: #465440;
}

.btn-secondary {
  background: var(--cream-deep);
  color: var(--brown);
  border-color: rgba(110, 84, 63, 0.35);
}

.btn-secondary:hover {
  background: #EAE0D2;
}

/* ---------- Status + loading + errors ---------- */
.status-message {
  margin: 0 0 0.75rem;
  text-align: center;
  font-weight: 700;
  color: var(--sage-deep);
}

.loading-state {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.7rem;
  padding: 2rem 1rem;
  color: var(--charcoal-soft);
  font-weight: 600;
}

.spinner {
  width: 1.5rem;
  height: 1.5rem;
  flex: none;
  border-radius: 50%;
  border: 3px solid rgba(124, 139, 111, 0.3);
  border-top-color: var(--sage-deep);
  animation: spin 0.9s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.config-error {
  margin: 0.5rem;
  padding: 1rem 1.25rem;
  background: rgba(156, 59, 46, 0.08);
  border: 1px solid rgba(156, 59, 46, 0.35);
  border-radius: var(--radius-md);
  color: var(--error);
  text-align: center;
}

.config-error code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  background: rgba(156, 59, 46, 0.10);
  padding: 0.05rem 0.3rem;
  border-radius: 6px;
}

/* ---------- Google Form iframe ---------- */
.form-container {
  display: flex;
  justify-content: center;
}

.form-container iframe {
  width: 100%;
  max-width: 46rem;
  /* Tall enough to minimise scrolling on tablets, responsive to viewport */
  height: clamp(560px, 78vh, 1100px);
  border: 0;
  border-radius: var(--radius-md);
  background: var(--white);
}

/* ---------- Connection banner ---------- */
.connection-banner {
  position: sticky;
  top: 0;
  z-index: 50;
  padding: 0.7rem 1rem;
  text-align: center;
  font-weight: 700;
  color: var(--white);
}

.connection-banner.offline {
  background: var(--error);
}

.connection-banner.online {
  background: var(--sage-deep);
}

/* ---------- Footer ---------- */
.site-footer {
  margin-top: 1.75rem;
  text-align: center;
  color: var(--charcoal-soft);
  user-select: none;
  -webkit-user-select: none;
}

.footer-title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--brown);
}

.footer-help {
  margin: 0.2rem 0 0;
  font-size: 0.9rem;
}

/* ---------- Day/night theme (class set on <body> by script.js) ---------- */
/* Morning: a soft sunrise glow */
body.theme-morning {
  background-image:
    radial-gradient(1100px 500px at 85% -10%, rgba(194, 141, 60, 0.16), transparent 60%),
    radial-gradient(900px 460px at -10% 110%, rgba(124, 139, 111, 0.12), transparent 60%);
}

/* Daytime: the default fresh sage/terracotta wash */
body.theme-day {
  background-image:
    radial-gradient(1100px 500px at 85% -10%, rgba(124, 139, 111, 0.12), transparent 60%),
    radial-gradient(900px 460px at -10% 110%, rgba(168, 91, 63, 0.10), transparent 60%);
}

/* Evening: deeper, dusky tones */
body.theme-evening {
  background-color: #F3EDE4;
  background-image:
    radial-gradient(1100px 500px at 85% -10%, rgba(110, 84, 63, 0.18), transparent 60%),
    radial-gradient(900px 460px at -10% 110%, rgba(86, 103, 75, 0.16), transparent 60%);
}

/* ---------- Focus visibility (keyboard users) ---------- */
:focus-visible {
  outline: 3px solid var(--terracotta);
  outline-offset: 2px;
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ---------- Small phones (just in case) ---------- */
@media (max-width: 420px) {
  .form-controls .btn {
    flex: 1 1 100%;
  }
}

/* ---------- Landscape tablets: keep the form generous ---------- */
@media (orientation: landscape) and (min-width: 900px) {
  .form-container iframe {
    height: clamp(520px, 82vh, 1100px);
  }
}
