@font-face {
  font-family: "Fraunces";
  font-style: normal;
  font-weight: 500 700;
  font-display: swap;
  src: url("/fonts/fraunces-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Outfit";
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url("/fonts/outfit-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  color-scheme: light;
  --paper: #f3ecdf;
  --ink: #241c16;
  --muted: #5c5147;
  --line: rgba(36, 28, 22, 0.14);
  --card: #fffdf8;
  --sienna: #c24d2c;
  --sienna-deep: #8e3116;
  --pine: #1e4a38;
  --danger: #8d2b2b;
  --free: #d9f2df;
  --free-strong: #c4ebcd;
  --taken: #f8d9d6;
  --shadow: 0 22px 50px rgba(48, 32, 18, 0.16);
  --serif: "Fraunces", "Iowan Old Style", Palatino, Georgia, serif;
  --sans: "Outfit", "Avenir Next", "Segoe UI", sans-serif;
}

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

[hidden] {
  display: none !important;
}

html {
  scroll-behavior: auto;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background-color: var(--paper);
  background-image: radial-gradient(rgba(36, 28, 22, 0.045) 0.7px, transparent 0.8px);
  background-size: 8px 8px;
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.45;
}

.stripe {
  height: 8px;
  background: linear-gradient(90deg, var(--sienna) 0 50%, var(--pine) 50% 100%);
}

.skip {
  position: absolute;
  left: 12px;
  top: -48px;
  z-index: 5;
  background: var(--ink);
  color: #f6f0e6;
  padding: 8px 12px;
}

.skip:focus {
  top: 12px;
}

.wrap {
  width: min(1080px, calc(100% - 32px));
  margin: 0 auto;
  padding-bottom: 56px;
}

h1,
h2,
.day-num,
.day-month,
.slot-time,
.when,
.choice {
  font-family: var(--serif);
}

h1 {
  margin: 0;
  font-weight: 650;
  font-size: clamp(2.5rem, 6vw, 4.4rem);
  letter-spacing: -0.04em;
  line-height: 0.92;
}

h2 {
  font-weight: 650;
}

p {
  margin: 0;
}

a {
  color: inherit;
}

button,
input {
  font: inherit;
  color: inherit;
}

button {
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}

.masthead {
  padding: 32px 0 22px;
}

.mast-top,
.mast-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.mast-top .brand {
  margin: 0;
}

.mast-actions {
  justify-content: flex-end;
}

.brand {
  margin: 0 0 16px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.brand-year {
  color: var(--sienna-deep);
}

.lead {
  max-width: 40rem;
  margin-top: 14px;
  color: var(--muted);
  font-size: 1.05rem;
}

.admin-link {
  margin-left: auto;
  text-underline-offset: 3px;
}

.days {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
}

.day {
  background: rgba(255, 253, 248, 0.94);
  border: 1px solid var(--line);
  box-shadow: 0 16px 40px rgba(48, 32, 18, 0.05);
}

.day-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 12px;
  padding: 16px 16px 12px;
  border-bottom: 1px solid var(--line);
}

.weekday {
  margin-bottom: 2px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.day-title {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: 0;
}

.day-num {
  font-weight: 650;
  font-size: clamp(3rem, 6vw, 4.5rem);
  line-height: 0.8;
  letter-spacing: -0.045em;
  color: var(--sienna);
  font-variant-numeric: tabular-nums;
}

.day-month {
  font-size: 1.35rem;
  font-weight: 560;
}

.free-count {
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.92rem;
  text-align: right;
}

.block-label {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px 4px;
  color: var(--sienna-deep);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.slot {
  display: flex;
  width: 100%;
  min-height: 56px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

.slot-time {
  font-weight: 560;
  font-size: 1.28rem;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.slot-state {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.slot.is-free,
.choice {
  background: var(--free);
}

.slot.is-free .slot-state {
  color: #1b5c38;
}

.slot.is-free:hover,
.slot.is-free:focus-visible,
.choice:hover,
.choice:focus-visible {
  background: var(--free-strong);
}

.slot.is-taken {
  background: var(--taken);
  color: var(--ink);
  cursor: default;
}

.slot.is-taken .slot-state {
  color: var(--danger);
}

.slot.is-taken .slot-state::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 8px;
  border-radius: 50%;
  background: var(--danger);
  vertical-align: 1px;
}

.slot-row {
  border-bottom: 1px solid var(--line);
  background: var(--taken);
}

.appt {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 4px 8px;
  align-items: center;
  min-height: 72px;
  padding: 6px 8px 6px 0;
  border-left: 4px solid #c45a52;
  background: var(--taken);
}

.appt.is-ghost-source {
  opacity: 0.38;
}

.grip {
  display: grid;
  place-items: center;
  width: 44px;
  height: 52px;
  color: #7b6d60;
  cursor: grab;
  touch-action: none;
}

.grip:hover,
.grip:focus-visible {
  background: rgba(36, 28, 22, 0.05);
  color: var(--ink);
}

.appt-name {
  font-weight: 600;
  overflow-wrap: anywhere;
}

.appt-phone {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.appt-actions {
  display: grid;
  gap: 6px;
}

.appt-actions .btn {
  min-height: 36px;
  padding: 6px 10px;
  font-size: 0.82rem;
}

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

.summary {
  margin-top: 8px;
  color: var(--muted);
}

.gate,
.boot {
  min-height: calc(100vh - 8px);
  display: grid;
  place-items: center;
  padding: 24px 16px;
}

.boot {
  color: var(--muted);
}

dialog {
  width: min(460px, calc(100vw - 24px));
  max-width: calc(100vw - 24px);
  margin: auto;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
}

dialog::backdrop {
  background: rgba(36, 28, 20, 0.48);
}

.sheet {
  display: grid;
  gap: 14px;
  padding: 22px 20px calc(18px + env(safe-area-inset-bottom));
  background: var(--card);
  border-top: 7px solid var(--sienna);
  box-shadow: var(--shadow);
}

.sheet h1,
.sheet h2 {
  margin: 0;
  font-size: clamp(1.7rem, 4vw, 2.3rem);
  letter-spacing: -0.03em;
  line-height: 1.05;
}

#book-title,
#assign-title {
  display: grid;
  gap: 4px;
}

#book-title .when,
#assign-title .when {
  font-size: clamp(1.8rem, 7vw, 2.6rem);
}

.eyebrow {
  color: var(--sienna-deep);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.field {
  display: grid;
  gap: 6px;
  font-size: 0.95rem;
}

input {
  width: 100%;
  min-height: 48px;
  padding: 10px 12px;
  border: 1px solid rgba(36, 28, 22, 0.22);
  border-radius: 0;
  background: #fff;
  font-size: 16px;
}

input::placeholder {
  color: #8a7d70;
}

input:focus-visible {
  outline-offset: 1px;
  border-color: var(--sienna-deep);
}

.sheet-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.btn {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  padding: 10px 16px;
  border: 1px solid transparent;
  background: var(--ink);
  color: #f6f0e6;
  text-decoration: none;
}

.btn.quiet {
  background: transparent;
  border-color: rgba(36, 28, 22, 0.28);
  color: var(--ink);
}

.btn.danger {
  background: var(--danger);
  color: #fffaf7;
}

.btn:disabled {
  opacity: 0.55;
  cursor: wait;
}

.alert {
  padding: 10px 12px;
  background: #fdecec;
  color: var(--danger);
}

.when {
  margin: 0;
  font-size: clamp(2.2rem, 6vw, 3rem);
  font-weight: 650;
  letter-spacing: -0.04em;
  line-height: 0.95;
  font-variant-numeric: tabular-nums;
}

.choice-list {
  max-height: min(52vh, 380px);
  overflow: auto;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.choice {
  display: flex;
  width: 100%;
  min-height: 52px;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  font-size: 1.2rem;
  text-align: left;
}

.choice:last-child {
  border-bottom: 0;
}

.choice-day {
  padding: 12px 12px 4px;
  color: var(--sienna-deep);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.toast {
  position: fixed;
  z-index: 90;
  left: 50%;
  bottom: 16px;
  max-width: min(440px, calc(100vw - 24px));
  padding: 12px 14px;
  background: var(--ink);
  color: #f6f0e6;
  opacity: 0;
  pointer-events: none;
  transform: translateX(-50%) translateY(12px);
  transition: opacity 160ms ease, transform 160ms ease;
}

.toast.is-on {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

body.is-dragging,
body.is-dragging .grip {
  cursor: grabbing;
  user-select: none;
}

body.is-dragging [data-free="1"] {
  background: var(--free);
  box-shadow: inset 0 0 0 1px #3d8f5a;
}

body.is-dragging [data-free="0"] {
  opacity: 0.72;
}

body.is-dragging [data-drop].is-drop-target {
  background: var(--free-strong);
  box-shadow: inset 0 0 0 2px #1b5c38;
  opacity: 1;
}

.appt.drag-ghost {
  position: fixed;
  z-index: 80;
  display: block;
  width: min(300px, calc(100vw - 32px));
  margin: 0;
  padding: 10px 14px;
  pointer-events: none;
  background: var(--taken);
  border-left: 4px solid #c45a52;
  box-shadow: 0 18px 44px rgba(36, 28, 18, 0.24);
  transform: translate(-24px, -28px) rotate(-1.5deg);
}

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

::selection {
  background: #f0c7b4;
}

@media (min-width: 860px) {
  .days {
    grid-template-columns: 1fr 1fr;
    gap: 22px;
    align-items: start;
  }
}

@media (max-width: 640px) {
  dialog {
    width: 100%;
    max-width: none;
    margin: 0;
    position: fixed;
    inset: auto 0 0 0;
  }

  .sheet-actions {
    flex-direction: column;
  }

  .sheet-actions .btn {
    width: 100%;
  }
}

@media (max-width: 420px) {
  .appt {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .appt-actions {
    grid-column: 2;
    grid-auto-flow: column;
    justify-content: start;
  }
}

@media (prefers-reduced-motion: reduce) {
  .toast {
    transition: none;
  }

  .appt.drag-ghost {
    transform: translate(-24px, -28px);
  }
}

@media print {
  .stripe,
  .skip,
  .admin-link,
  .mast-actions,
  .appt-actions,
  .grip,
  .toast,
  dialog {
    display: none !important;
  }

  body {
    background: white;
  }

  .day {
    box-shadow: none;
    break-inside: avoid;
  }
}
