/* Snack Sched — warm, print-safe, no remote assets */
:root {
  --cream: #f6ebd4;
  --paper: #fffdf7;
  --paper-2: #fff8ee;
  --ink: #2c1b12;
  --ink-soft: #5c4033;
  --muted: #7a5c4a;
  --line: #e4cfb0;
  --terracotta: #c45c26;
  --terracotta-deep: #9a4318;
  --gold: #e8b84a;
  --gold-deep: #c4922a;
  --sage: #4f7a54;
  --sage-deep: #355a3a;
  --berry: #b54444;
  --sky: #3f6f8c;
  --focus: #c45c26;
  --shadow: 0 10px 28px rgba(44, 27, 18, 0.08), 0 2px 6px rgba(44, 27, 18, 0.05);
  --radius: 18px;
  --font-display: Georgia, "Iowan Old Style", "Palatino Linotype", Palatino, "Times New Roman", serif;
  --font-ui: "Avenir Next", "Segoe UI", "Trebuchet MS", ui-rounded, system-ui, sans-serif;
}

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

html {
  scroll-behavior: smooth;
  color-scheme: light;
  max-width: 100%;
  overflow-x: hidden;
}

body {
  margin: 0;
  min-height: 100vh;
  max-width: 100%;
  overflow-x: hidden;
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 1rem;
  line-height: 1.5;
  background-color: var(--cream);
  background-image:
    repeating-linear-gradient(
      90deg,
      rgba(196, 92, 38, 0.035) 0 14px,
      transparent 14px 28px
    ),
    repeating-linear-gradient(
      0deg,
      rgba(79, 122, 84, 0.035) 0 14px,
      transparent 14px 28px
    );
}

.skip {
  position: absolute;
  left: 0.75rem;
  top: -3rem;
  z-index: 20;
  padding: 0.4rem 0.7rem;
  background: var(--ink);
  color: #fff;
  border-radius: 8px;
  text-decoration: none;
}
.skip:focus {
  top: 0.75rem;
}

a {
  color: var(--terracotta-deep);
}
a:hover {
  color: var(--terracotta);
}

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.wrap {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.15rem 0.75rem 3rem;
  min-width: 0;
}

/* Header */
.site-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.9rem 1.1rem;
  margin-bottom: 1.25rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: inherit;
}

.brand-mark {
  width: 64px;
  height: 58px;
  flex: 0 0 auto;
}

.wordmark {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.85rem, 4vw, 2.35rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1;
}
.wordmark .snack {
  color: var(--terracotta);
}
.wordmark .sched {
  color: var(--ink);
}

.tagline {
  margin: 0.28rem 0 0;
  color: var(--ink-soft);
  font-size: 0.95rem;
}

.header-note {
  margin-left: auto;
  max-width: 20rem;
  padding: 0.55rem 0.75rem;
  background: var(--paper);
  border: 1px dashed var(--line);
  border-radius: 12px;
  color: var(--ink-soft);
  font-size: 0.85rem;
}

.lede {
  margin: 0 0 1.25rem;
  max-width: 38rem;
  color: var(--ink-soft);
}

/* Layout */
.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1.15rem;
  align-items: start;
  min-width: 0;
}

.layout > * {
  min-width: 0;
  max-width: 100%;
}

@media (min-width: 900px) {
  .layout {
    grid-template-columns: minmax(280px, 400px) minmax(0, 1fr);
  }
  .panel-form {
    position: sticky;
    top: 0.75rem;
  }
}

.panel {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  min-width: 0;
  max-width: 100%;
  overflow-x: hidden;
}

.panel-form {
  padding: 1.1rem 1.1rem 1.2rem;
}

.panel-out {
  padding: 1.15rem 1.15rem 1.25rem;
  min-height: 22rem;
  position: relative;
}

.panel-out::before {
  content: "";
  position: absolute;
  top: -8px;
  right: 2.2rem;
  width: 58px;
  height: 18px;
  background: repeating-linear-gradient(
    -18deg,
    rgba(232, 184, 74, 0.55) 0 4px,
    rgba(255, 255, 255, 0.15) 4px 8px
  );
  border-radius: 2px;
  box-shadow: 0 1px 0 rgba(44, 27, 18, 0.12);
  pointer-events: none;
}

h2 {
  margin: 0 0 0.75rem;
  font-family: var(--font-display);
  font-size: 1.28rem;
  letter-spacing: -0.02em;
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.55rem;
}

.section-head h2 {
  margin: 0;
}

.hint {
  color: var(--muted);
  font-size: 0.8rem;
}

fieldset {
  margin: 0 0 1rem;
  padding: 0;
  border: 0;
}

legend {
  padding: 0;
  margin-bottom: 0.4rem;
  font-weight: 650;
  font-size: 0.92rem;
}

label.field {
  display: block;
  margin-bottom: 0.85rem;
}

label.field > span,
.lbl {
  display: block;
  margin-bottom: 0.28rem;
  font-weight: 650;
  font-size: 0.92rem;
}

.optional {
  font-weight: 500;
  color: var(--muted);
  font-size: 0.8rem;
}

input[type="text"],
input[type="date"],
textarea,
select {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  padding: 0.55rem 0.7rem;
  border: 1.5px solid #d8c09a;
  border-radius: 11px;
  background: var(--paper-2);
  color: var(--ink);
  font: inherit;
  font-size: 1rem;
}

input[type="text"]:hover,
input[type="date"]:hover,
textarea:hover {
  border-color: #c9a87a;
}

input[type="text"]:focus,
input[type="date"]:focus,
textarea:focus {
  border-color: var(--terracotta);
  background: #fff;
}

textarea {
  min-height: 9.5rem;
  resize: vertical;
  line-height: 1.45;
}

.row-2 {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 0.6rem;
  align-items: end;
}
.row-2 > button {
  min-height: 2.7rem;
}

.weekdays {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.weekdays label {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.35rem;
  padding: 0.32rem 0.4rem;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  background: var(--paper-2);
  font-size: 0.8rem;
  font-weight: 650;
  cursor: pointer;
  user-select: none;
}

.weekdays input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.weekdays label:has(input:checked) {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff8ee;
}

.weekdays label:has(input:focus-visible) {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.inline-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0.45rem 0 0.7rem;
}

.date-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  min-height: 2rem;
  margin: 0.2rem 0 0.7rem;
}

.date-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.18rem 0.25rem 0.18rem 0.5rem;
  background: #f4e6cc;
  border: 1px solid #e0c89a;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
}

.date-chip button {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--ink-soft);
  width: 1.35rem;
  height: 1.35rem;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
}
.date-chip button:hover {
  background: rgba(44, 27, 18, 0.08);
  color: var(--berry);
}

.empty-dates {
  color: var(--muted);
  font-size: 0.85rem;
  padding: 0.25rem 0;
}

.slots {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 0.55rem;
}

.slots label {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.5rem 0.4rem;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  background: var(--paper-2);
  cursor: pointer;
  font-weight: 650;
}

.slots input {
  accent-color: var(--terracotta);
}

.slots label:has(input:checked) {
  border-color: var(--terracotta);
  background: #fde8d4;
}

.slot-labels {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.5rem;
  margin-bottom: 0.9rem;
}

.slot-labels.two {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

button,
.btn {
  appearance: none;
  border: 1.5px solid transparent;
  border-radius: 12px;
  padding: 0.55rem 0.85rem;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  background: #efe3cb;
  color: var(--ink);
}

.btn-primary {
  background: #7a3210;
  color: #fff8f2;
  border-color: #4e1e08;
  box-shadow: 0 1px 0 rgba(44, 27, 18, 0.15);
}
.btn-primary:hover {
  background: #8f3c14;
}

.btn-secondary {
  background: var(--ink);
  color: #fff8ee;
  border-color: #1c100b;
}
.btn-secondary:hover {
  background: #3d261b;
}

.btn-ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--ink-soft);
}
.btn-ghost:hover {
  background: #f4e8d2;
}

.btn-tiny {
  padding: 0.28rem 0.55rem;
  font-size: 0.82rem;
  font-weight: 650;
  border-radius: 9px;
}

.fair-note {
  margin: 0.75rem 0 0;
  color: var(--muted);
  font-size: 0.8rem;
}

/* Output */
.out-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0 0 0.85rem;
}

.out-title {
  margin: 0 0 0.15rem;
  font-family: var(--font-display);
  font-size: clamp(1.4rem, 3vw, 1.85rem);
  letter-spacing: -0.03em;
}

.out-sub {
  margin: 0 0 0.9rem;
  color: var(--ink-soft);
  font-size: 0.92rem;
}

.schedule-table-wrap {
  overflow-x: auto;
  max-width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
}

table.schedule {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

table.schedule th,
table.schedule td {
  padding: 0.62rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid #f0e2c8;
  vertical-align: middle;
}

table.schedule th {
  background: #f7edd8;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

table.schedule tr:last-child td {
  border-bottom: 0;
}

table.schedule tbody tr:nth-child(even) td {
  background: #fffaf1;
}

.dow {
  display: inline-block;
  min-width: 2.4rem;
  margin-right: 0.35rem;
  padding: 0.08rem 0.35rem;
  border-radius: 6px;
  background: #efe0c2;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.name-chip {
  display: inline-block;
  padding: 0.12rem 0.5rem;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.9rem;
}

/* Fairness */
.fairness {
  margin-top: 1rem;
  padding: 0.8rem 0.85rem;
  background: #f4f7ef;
  border: 1px solid #d5e0cc;
  border-radius: 14px;
}

.fairness h3 {
  margin: 0 0 0.45rem;
  font-size: 0.95rem;
  font-family: var(--font-display);
}

.fair-ok {
  color: var(--sage-deep);
  font-weight: 750;
}

.bars {
  display: grid;
  gap: 0.35rem;
}

.bar-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 2fr) auto;
  gap: 0.45rem;
  align-items: center;
  font-size: 0.85rem;
}
.bar-row > div:first-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bar-track {
  height: 8px;
  background: #e4ecd9;
  border-radius: 99px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  background: var(--sage);
  border-radius: 99px;
}

.bar-n {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: var(--sage-deep);
}

/* Empty */
.empty {
  text-align: center;
  padding: 1.4rem 0.6rem 1.1rem;
}

.empty-art {
  width: min(220px, 70%);
  height: auto;
  margin: 0 auto 0.8rem;
}

.empty h2 {
  font-size: 1.45rem;
}

.empty p {
  margin: 0.35rem auto 1rem;
  max-width: 28rem;
  color: var(--ink-soft);
}

/* Footer */
.site-footer {
  margin-top: 1.6rem;
  padding: 1rem 0.2rem 0;
  border-top: 1px dashed var(--line);
  color: var(--ink-soft);
  font-size: 0.88rem;
  display: grid;
  gap: 0.35rem;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 1.1rem;
  transform: translateX(-50%) translateY(120%);
  max-width: calc(100% - 1.5rem);
  padding: 0.5rem 0.85rem;
  background: var(--ink);
  color: #fff8ee;
  border-radius: 999px;
  font-size: 0.88rem;
  font-weight: 650;
  opacity: 0;
  pointer-events: none;
  transition: transform 0.25s ease, opacity 0.25s ease;
  z-index: 30;
}
.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

@media (max-width: 420px) {
  .row-2,
  .slot-labels.two {
    grid-template-columns: minmax(0, 1fr);
  }
  .slots {
    flex-direction: column;
  }
  .header-note {
    margin-left: 0;
    max-width: none;
  }
  .bar-row {
    grid-template-columns: minmax(0, 1fr) auto;
  }
  .bar-track {
    display: none;
  }
  .actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *,
  *::before,
  *::after {
    transition: none !important;
    animation: none !important;
  }
}

@media print {
  body {
    background: #fff;
    color: #111;
  }
  .skip,
  .no-print,
  .panel-form,
  .out-toolbar,
  .header-note,
  .lede,
  .panel-out::before,
  .toast,
  .empty {
    display: none !important;
  }
  .wrap {
    width: 100%;
    padding: 0;
  }
  .layout {
    display: block;
  }
  .panel,
  .panel-out {
    box-shadow: none;
    border: 0;
    padding: 0;
    background: #fff;
    min-height: 0;
  }
  .site-header {
    margin-bottom: 0.6rem;
  }
  .tagline,
  .site-footer .tip,
  .site-footer .contact {
    display: none;
  }
  .site-footer {
    border-top: 1px solid #ddd;
    color: #444;
    font-size: 0.75rem;
  }
  table.schedule th,
  table.schedule td {
    border-bottom: 1px solid #ddd;
    background: #fff !important;
  }
  table.schedule th {
    background: #f3f3f3 !important;
  }
  .name-chip {
    border: 1px solid #ccc;
  }
  .fairness {
    background: #f7f7f7;
    border-color: #ddd;
  }
  .bar-fill {
    background: #444;
  }
  a {
    color: inherit;
    text-decoration: none;
  }
  @page {
    margin: 0.6in;
  }
}
