/* 10 Dollar Meal — Australian $10 Polymer Banknote Design System, Dual Color Scheme, Native Dialog & Print Modes */

:root {
  color-scheme: light dark;
  --target-size: 24px;

  /* Typography */
  --font-family-sans: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-family-mono: "JetBrains Mono", "SFMono-Regular", Consolas, monospace;

  /* Australian $10 Polymer Banknote Palette */
  --color-primary: #007a99;
  --color-primary-dark: #004860;
  --color-primary-light: #e0f5fa;
  --color-cyan-vivid: #00c2cb;
  --color-cyan-glow: rgba(0, 194, 203, 0.15);

  --primary: #007a99;
  --primary-hover: #006078;
  --primary-dark: #004860;
  --primary-subtle: #e0f5fa;
  --cyan-accent: #00c2cb;

  --brand-primary: #007a99;
  --brand-primary-container: #004860;
  --brand-secondary: #855300;
  --brand-secondary-container: #fea619;
  --brand-tertiary: #006194;

  /* Surfaces & Neutrals */
  --color-surface: #f9f9ff;
  --color-surface-dim: #cfdaf3;
  --color-surface-lowest: #ffffff;
  --color-surface-low: #f0f3ff;
  --color-text-main: #0f172a;
  --color-text-muted: #64748b;

  --bg-canvas: #f9f9ff;
  --bg-card: #ffffff;
  --bg-card-subtle: #f0f3ff;
  --border-subtle: #cfdaf3;
  --border-muted: #e2e8f0;

  /* Breach & Compliance Ceiling Alerts */
  --color-breach: #c61b1b;
  --color-breach-bg: #fef2f2;
  --color-breach-border: #fecaca;
  --color-safe: #0d9668;
  --color-safe-bg: #ecfdf5;

  --breach-red: #c61b1b;
  --breach-red-bg: #fef2f2;
  --safe-green: #0d9668;
  --safe-green-bg: #ecfdf5;

  /* Geometry & Shadows */
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-full: 9999px;
  --shadow-card: 0 1px 3px rgba(0, 72, 96, 0.05), 0 1px 2px rgba(0, 72, 96, 0.03);
  --shadow-hover: 0 4px 12px rgba(0, 122, 153, 0.12);
}

:root:has(> head > meta[name="color-scheme"][content="dark"]) {
  color-scheme: dark;
}

:root:has(> head > meta[name="color-scheme"][content="light"]) {
  color-scheme: light;
}

@media (pointer: coarse) {
  :root {
    --target-size: 44px;
  }
}

html {
  font-family: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  scroll-padding-top: 11.5rem;
  scroll-padding-bottom: calc(8rem + env(safe-area-inset-bottom, 0px));
}

body {
  overscroll-behavior-y: none;
  overflow-wrap: break-word;
  -webkit-tap-highlight-color: transparent;
  transition: background-color 0.22s ease, color 0.18s ease;
}

h1,
h2,
h3 {
  text-wrap: balance;
}

.tabular-nums {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" on, "zero" on;
}

/* Monospace numerals for currency & percentage figures */
.metric-num,
.price-val,
.code-tag {
  font-family: var(--font-family-mono);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" on, "zero" on;
}

/* ==========================================================================
   Pill, Badge & Status Indicator Standards (Post-Refinement Padding)
   ========================================================================== */

.badge-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  font-family: var(--font-family-sans);
  font-weight: 600;
  font-size: 0.75rem;
  line-height: 1.25;
  letter-spacing: 0.015em;
  border-radius: 9999px;
  white-space: nowrap;
  box-sizing: border-box;
}

.badge-breach {
  background-color: #c61b1b;
  color: #ffffff;
  padding: 0.375rem 0.875rem;
  box-shadow: 0 1px 2px rgba(198, 27, 27, 0.2);
}

.badge-info {
  background-color: #e0f5fa;
  color: #004860;
  border: 1px solid rgba(0, 122, 153, 0.2);
  padding: 0.3125rem 0.75rem;
}

html.dark .badge-info {
  background-color: rgba(0, 194, 203, 0.16);
  color: #7adbee;
  border-color: rgba(0, 194, 203, 0.35);
}

.badge-safe {
  background-color: #ecfdf5;
  color: #065f46;
  border: 1px solid #a7f3d0;
  padding: 0.3125rem 0.75rem;
}

html.dark .badge-safe {
  background-color: rgba(13, 150, 104, 0.18);
  color: #6ee7b7;
  border-color: rgba(110, 231, 183, 0.35);
}

.chip-delta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.25rem 0.625rem;
  font-family: var(--font-family-mono);
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1.25;
  border-radius: 6px;
}

.no-scrollbar::-webkit-scrollbar {
  display: none;
}

.no-scrollbar {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.print-only {
  display: none;
}

/* Theme toggle icon & accessible label visibility driven by active scheme */
.theme-icon-dark,
.theme-label-dark {
  display: none;
}

@media (prefers-color-scheme: dark) {

  :root:not(:has(> head > meta[name="color-scheme"][content="light"])) .theme-icon-light,
  :root:not(:has(> head > meta[name="color-scheme"][content="light"])) .theme-label-light {
    display: none;
  }

  :root:not(:has(> head > meta[name="color-scheme"][content="light"])) .theme-icon-dark,
  :root:not(:has(> head > meta[name="color-scheme"][content="light"])) .theme-label-dark {
    display: inline;
  }
}

html.dark .theme-icon-light,
html.dark .theme-label-light,
:root:has(> head > meta[name="color-scheme"][content="dark"]) .theme-icon-light,
:root:has(> head > meta[name="color-scheme"][content="dark"]) .theme-label-light {
  display: none;
}

html.dark .theme-icon-dark,
html.dark .theme-label-dark,
:root:has(> head > meta[name="color-scheme"][content="dark"]) .theme-icon-dark,
:root:has(> head > meta[name="color-scheme"][content="dark"]) .theme-label-dark {
  display: inline;
}

/* Floating dock & mobile bottom navigation safe-area clearance */
#mobileBottomNav {
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

#floatingDock {
  bottom: calc(4.5rem + env(safe-area-inset-bottom, 0px));
}

.site-footer {
  padding-top: 1.5rem;
  padding-bottom: calc(10rem + env(safe-area-inset-bottom, 0px));
}

@media (min-width: 1024px) {
  #floatingDock {
    bottom: max(0.85rem, env(safe-area-inset-bottom, 0px));
  }

  .site-footer {
    padding-bottom: 6.25rem;
  }
}

/* Native Modal Dialog (Top-Layer + Scroll Containment per modern-web-guidance) */
.menu-dialog {
  max-width: 640px;
  width: calc(100% - 1.5rem);
  max-height: 88vh;
  max-height: 88dvh;
  margin: auto;
}

.menu-dialog[open] {
  display: flex;
  flex-direction: column;
}

.dialog-inner {
  overflow-y: auto;
}

dialog:modal {
  overscroll-behavior: contain;
}

dialog::backdrop {
  background: rgba(15, 23, 42, 0.68);
  backdrop-filter: blur(4px);
  overflow: hidden;
  overscroll-behavior: contain;
}

/* Deferred form validation (:user-invalid) */
.error-msg {
  display: none;
  color: #c61b1b;
  font-size: 0.78rem;
  margin-top: 0.25rem;
}

html.dark .error-msg {
  color: #fca5a5;
}

.field :is(input, select, textarea):user-invalid {
  border-color: #c61b1b;
  background-color: #fef2f2;
}

html.dark .field :is(input, select, textarea):user-invalid {
  border-color: #f87171;
  background-color: rgba(127, 29, 29, 0.25);
}

.field :is(input, select, textarea):user-invalid+.error-msg {
  display: block;
}

.field :is(input, select, textarea):user-valid {
  border-color: #007a99;
}

/* Screen-reader only live region */
.visually-hidden:where(:not(:focus-within, :active)) {
  position: absolute !important;
  clip-path: inset(50%) !important;
  overflow: hidden !important;
  width: 1px !important;
  height: 1px !important;
  margin: -1px !important;
  padding: 0 !important;
  border: 0 !important;
  white-space: nowrap !important;
}

/* Dedicated Print Sheet Typography (Weekly Plan, Selections & Recipes PDF) */
.print-frame {
  background: #ffffff;
  border: 1px solid #cfdaf3;
  border-top: 4px solid #007a99;
  border-radius: 16px;
  padding: 1.75rem 2rem;
  color: #0f172a;
  font-family: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.print-frame-header {
  text-align: center;
  border-bottom: 1px solid #e7eeff;
  padding-bottom: 1.15rem;
  margin-bottom: 1.5rem;
}

.print-brand-pill {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  background: #e0f5fa;
  color: #004860;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.print-title {
  color: #0f172a;
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-top: 0.45rem;
  line-height: 1.15;
}

.print-subtitle {
  color: #334155;
  font-size: 0.92rem;
  margin-top: 0.3rem;
}

.print-day-block {
  break-inside: avoid;
  padding: 0.85rem 0;
  border-bottom: 1px solid #e7eeff;
}

.print-day-block:last-child {
  border-bottom: none;
}

.print-day-name {
  color: #007a99;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.8rem;
  font-weight: 800;
  margin-bottom: 0.5rem;
}

.print-day-dish {
  display: flex;
  gap: 0.9rem;
  align-items: center;
  margin-bottom: 0.55rem;
}

.print-day-dish:last-child {
  margin-bottom: 0;
}

.print-day-thumb {
  width: 112px;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid #d8e3fb;
  flex-shrink: 0;
}

.print-dish-name {
  color: #111c2d;
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.25;
}

.print-dish-desc {
  font-size: 0.82rem;
  color: #3d4a42;
  line-height: 1.45;
  margin-top: 0.15rem;
}

.print-selected-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.print-selected-card {
  break-inside: avoid;
  background: #f9f9ff;
  border: 1px solid #d8e3fb;
  border-radius: 12px;
  overflow: hidden;
}

.print-selected-card img {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  display: block;
}

.print-selected-body {
  padding: 0.8rem;
}

.print-recipe-stack {
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
}

.print-recipe-card {
  break-inside: avoid;
  background: #f9f9ff;
  border: 1px solid #d8e3fb;
  border-radius: 12px;
  padding: 1rem 1.2rem;
}

.print-recipe-header {
  display: flex;
  gap: 1rem;
  align-items: center;
  padding-bottom: 0.75rem;
  margin-bottom: 0.75rem;
  border-bottom: 1px solid #e7eeff;
}

.print-recipe-thumb {
  width: 120px;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid #d8e3fb;
  flex-shrink: 0;
}

.print-recipe-meta {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: #007a99;
  font-weight: 700;
  margin-bottom: 0.2rem;
}

.print-recipe-subhead {
  color: #007a99;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 0.8rem;
  font-weight: 800;
  margin: 0.65rem 0 0.3rem;
}

.print-recipe-body>.print-recipe-subhead:first-child {
  margin-top: 0;
}

.print-recipe-list {
  margin: 0 0 0.5rem 1.15rem;
  padding: 0;
  font-size: 0.84rem;
  color: #111c2d;
  line-height: 1.45;
  columns: 2;
  column-gap: 1.5rem;
}

.print-recipe-list li {
  margin-bottom: 0.18rem;
  break-inside: avoid;
}

.print-recipe-line {
  font-size: 0.84rem;
  color: #3d4a42;
  line-height: 1.5;
  margin-bottom: 0.35rem;
}

/* Crisp Light-Only Print / PDF Mode (always light regardless of Dark Mode) */
@media print {

  html,
  body {
    background: #ffffff !important;
    color: #111c2d !important;
    padding: 0 !important;
    margin: 0 !important;
  }

  .no-print,
  header,
  footer,
  dialog,
  #floatingDock,
  #mobileBottomNav,
  #menuDrawer,
  #drawerOverlay,
  #toastNotification,
  .card-actions-bar,
  .day-assign-bar,
  .selection-pill,
  .provisions-accordion-wrap {
    display: none !important;
  }

  .print-only {
    display: block !important;
  }

  main {
    padding-top: 0 !important;
  }

  body.print-custom-sheet #menuView,
  body.print-custom-sheet #plannerView,
  body.print-custom-sheet #provisionsView {
    display: none !important;
  }

  body.print-custom-sheet #printSheet {
    display: block !important;
  }

  .dish-card {
    break-inside: avoid;
    box-shadow: none !important;
    border: 1px solid #d8e3fb !important;
    background: #ffffff !important;
    color: #111c2d !important;
  }

  .dish-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 1rem !important;
  }
}