:root {
  --paper: #fff;
  --ink: #111;
  --gray: #5f5f5f;
  --gray-2: #9a9a9a;
  --line: rgba(0, 0, 0, 0.08);
  --sunk: #f7f7f6;
  --plum: #201420;
  --petal: #f7b8cb;
  --petal-deep: #ee8fae;
  --sun: #f4c34d;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --radius: 18px;
  color-scheme: light;
}

* { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 15px/1.5 system-ui, -apple-system, "SF Pro Text", "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

:focus-visible {
  outline: 2px solid var(--plum);
  outline-offset: 2px;
  border-radius: 6px;
}

/* Loader */

.loader {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 6px;
  background: var(--paper);
  transition: opacity 320ms var(--ease-out), visibility 0s linear 320ms;
}
.loader img { display: block; }
.loader-line {
  margin: 0;
  min-height: 1.5em;
  color: var(--gray);
  font-family: ui-rounded, system-ui, sans-serif;
  font-size: 15px;
  transition: opacity 180ms var(--ease-out), transform 180ms var(--ease-out);
}
.loader-line.swap { opacity: 0; transform: translateY(4px); }
.loader.done { opacity: 0; visibility: hidden; pointer-events: none; }
.loader.done img { transform: scale(0.92); transition: transform 320ms var(--ease-out); }
.retry {
  margin-top: 8px;
  padding: 8px 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper);
}

/* Bar */

.bar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  max-width: 1120px;
  margin: 0 auto;
  padding: calc(12px + env(safe-area-inset-top)) 24px 12px;
  background: rgba(255, 255, 255, 0.86);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
  backdrop-filter: saturate(1.4) blur(12px);
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--plum);
  text-decoration: none;
  font-family: ui-rounded, system-ui, sans-serif;
  font-weight: 600;
  font-size: 17px;
}
.bar-right { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--gray); }
.editing-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 4px 4px 10px;
  border-radius: 999px;
  background: var(--sunk);
  color: var(--ink);
}
.editing-pill button {
  position: relative;
  border: 0;
  border-radius: 999px;
  padding: 2px 10px;
  background: var(--paper);
  color: var(--gray);
  font-size: 12px;
}

.editing-pill button::before { content: ""; position: absolute; inset: -10px -4px; }
button { touch-action: manipulation; }

/* Page */

.page {
  max-width: 1120px;
  margin: 0 auto;
  padding: 8px 24px 32px;
}

.hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 24px 0 8px;
}
.eyebrow {
  margin: 0 0 6px;
  color: var(--gray);
  font-size: 13px;
}
h1 {
  margin: 0;
  font-family: ui-rounded, system-ui, sans-serif;
  font-weight: 650;
  font-size: clamp(30px, 6vw, 44px);
  line-height: 1.08;
  letter-spacing: -0.01em;
  color: var(--plum);
  text-wrap: balance;
}
.lede { margin: 10px 0 0; color: var(--gray); }
.status { margin: 4px 0 0; font-weight: 500; }

.desk {
  flex: none;
  padding: 0;
  border: 0;
  background: none;
  border-radius: 24px;
  -webkit-tap-highlight-color: transparent;
}
.desk img { display: block; transition: transform 200ms var(--ease-out); }
.desk:active img { transform: scale(0.96); }

.section-title {
  margin: 36px 0 12px;
  font-size: 13px;
  font-weight: 500;
  color: var(--gray);
}


/* Clocks */

.clocks {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 24px;
  margin-top: 20px;
  font-size: 13px;
}
.clock { display: inline-flex; align-items: baseline; gap: 6px; }
.clock b { font-weight: 500; }
.clock time { font-variant-numeric: tabular-nums; }
.clock small { color: var(--gray-2); font-size: 13px; }

/* Calls */

.call {
  display: grid;
  grid-template-columns: 112px 1fr auto;
  align-items: baseline;
  gap: 12px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}
.call:last-child { border-bottom: 1px solid var(--line); }
.call-name { font-weight: 500; }
.call-when time { font-variant-numeric: tabular-nums; }
.call-when .muted, .call-rel { color: var(--gray-2); font-size: 13px; }

/* Weeks and days */

.week { margin-bottom: 28px; }
.week-title {
  margin: 0 0 10px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
}
.days {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 12px;
}

.day {
  position: relative;
  padding: 16px 16px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  scroll-margin-top: 72px;
}
.day.is-today {
  border-color: transparent;
  box-shadow: 0 0 0 1.5px var(--plum);
}
.day.is-past { background: var(--sunk); border-color: transparent; }

.day-head {
  display: flex;
  align-items: center;
  gap: 10px;
}
.day-head h3 {
  margin: 0;
  font-family: ui-rounded, system-ui, sans-serif;
  font-size: 17px;
  font-weight: 600;
  color: var(--plum);
}
.day-head h3 span { color: var(--gray); font-weight: 500; }
.day-num { margin-left: auto; color: var(--gray-2); font-size: 12px; font-variant-numeric: tabular-nums; }
.today-tag {
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--plum);
  color: var(--paper);
  font-size: 11px;
  font-weight: 500;
}

.blossom { flex: none; width: 28px; height: 28px; overflow: visible; }
.blossom .petal {
  fill: var(--petal);
  transform-box: view-box;
  transform-origin: 15px 15px;
  transition: transform 520ms var(--ease-out), fill 300ms ease;
}
.blossom .core { fill: var(--sun); }
.blossom[data-stage="0"] .petal { transform: scale(0.5); fill: #ece6e8; }
.blossom[data-stage="0"] .core { fill: #ddd3d7; }
.blossom[data-stage="1"] .petal { transform: scale(0.68); }
.blossom[data-stage="2"] .petal { transform: scale(0.85); }
.blossom[data-stage="3"] .petal { transform: scale(1); fill: var(--petal-deep); }
.is-today .blossom { animation: sway 4.8s ease-in-out infinite; transform-origin: 50% 90%; }
@keyframes sway {
  0%, 100% { transform: rotate(-5deg); }
  50% { transform: rotate(5deg); }
}

.poster, .event {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 10px 0 0;
  font-size: 13px;
  color: var(--gray);
}
.event { gap: 6px; color: var(--ink); }
.event b { font-weight: 500; }
.event time { font-variant-numeric: tabular-nums; }

/* Layout switch */

.plan-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 36px 0 12px;
}
.plan-head .section-title { margin: 0; }
.view-switch {
  display: inline-flex;
  padding: 2px;
  border-radius: 999px;
  background: var(--sunk);
  font-size: 13px;
}
.view-switch button {
  position: relative;
  min-height: 28px;
  padding: 0 12px;
  border: 0;
  border-radius: 999px;
  background: none;
  color: var(--gray);
  -webkit-tap-highlight-color: transparent;
  transition: color 150ms ease-out;
}
.view-switch button::before { content: ""; position: absolute; inset: -8px 0; }
@media (hover: hover) and (pointer: fine) {
  .view-switch button:hover { color: var(--ink); }
}
.view-switch button[aria-pressed="true"] {
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 0 0 1px var(--line), 0 1px 2px rgba(0, 0, 0, 0.06);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* Notes: one box per person per day */

.notes {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}
.note {
  padding: 10px 12px 12px;
  border-radius: 12px;
  background: var(--sunk);
}
.note.is-empty:not(.is-mine) { padding-bottom: 10px; }
.is-past .note { background: var(--paper); }
.note-head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 500;
}
.note-head .you { color: var(--gray-2); font-weight: 400; }
.save-state {
  margin-left: auto;
  color: var(--gray-2);
  font-size: 12px;
  font-weight: 400;
  transition: opacity 200ms ease;
}
.save-state[data-state="error"] { color: #c0392b; }
.note-text {
  margin: 4px 0 0;
  font-size: 14px;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.note-text.muted { color: var(--gray-2); font-size: 13px; }

.note.is-mine {
  background: var(--paper);
  box-shadow: 0 0 0 1px var(--line);
  transition: box-shadow 160ms ease;
}
.note.is-mine:focus-within { box-shadow: 0 0 0 1.5px var(--plum); }
.note-input {
  display: block;
  width: 100%;
  min-height: 52px;
  margin-top: 6px;
  padding: 0;
  border: 0;
  outline: none;
  resize: none;
  background: transparent;
  font-size: 16px;
  line-height: 1.5;
  overflow: hidden;
}
.note-input::placeholder { color: var(--gray-2); }

.callout {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin: 0 0 18px;
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--sunk);
  font-size: 14px;
  color: var(--gray);
}
.callout::before {
  content: "";
  flex: none;
  width: 30px;
  height: 24px;
  margin-top: -1px;
  background: url("/floof/body-30-2x.png") center / contain no-repeat;
}
.callout p { margin: 0; }
.callout b { color: var(--ink); font-weight: 500; }

/* Agenda and planner rows: one per person */

.rows { display: grid; margin-top: 12px; }
.row {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 12px;
  align-items: baseline;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}
.row-name { font-size: 13px; font-weight: 500; }
.row-name .you { display: block; color: var(--gray-2); font-size: 12px; font-weight: 400; }
.row-text {
  margin: 0;
  max-width: 65ch;
  font-size: 14px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.rows-quiet { margin: 0; padding: 8px 0; font-size: 13px; color: var(--gray-2); }
.row-body {
  position: relative;
  max-width: 720px;
  padding: 8px 10px 18px;
  border-radius: 10px;
  background: var(--sunk);
  transition: background-color 150ms ease-out, box-shadow 150ms ease-out;
}
.row-body:focus-within { background: var(--paper); box-shadow: 0 0 0 1.5px var(--plum); }
.row-body .note-input { min-height: 48px; margin: 0; }
.row-body .save-state { position: absolute; right: 10px; bottom: 4px; }

/* Layout: agenda */

.ag-week + .ag-week { margin-top: 32px; }
.ag-week-title {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: 0 0 4px;
  font-size: 13px;
  font-weight: 500;
}
.ag-week-title span { color: var(--gray-2); font-weight: 400; }
.ag-day {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 16px;
  padding: 18px 0 8px;
  border-top: 1px solid var(--line);
  scroll-margin-top: 72px;
}
.ag-date { display: grid; justify-items: start; align-content: start; gap: 4px; }
.ag-dow { font-size: 12px; color: var(--gray); }
.ag-num {
  font-family: ui-rounded, system-ui, sans-serif;
  font-size: 30px;
  font-weight: 600;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  color: var(--plum);
}
.ag-day.is-past .ag-num { color: var(--gray-2); }
.ag-day.is-today .ag-dow { color: var(--plum); font-weight: 600; }
.ag-day.is-today .ag-num {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  margin-left: -4px;
  border-radius: 999px;
  background: var(--plum);
  color: var(--paper);
  font-size: 21px;
}
.ag-date .blossom { width: 24px; height: 24px; margin-top: 4px; }
.ag-day.is-today .blossom { margin-left: 4px; }
.ag-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--gray);
}
.ag-body .event { margin-top: 6px; }
.ag .rows { margin-top: 6px; }
.ag .row { padding: 8px 0; border-top: 0; }
.ag-weekend {
  margin: 0;
  padding: 12px 0 0 80px;
  border-top: 1px solid var(--line);
  font-size: 13px;
  color: var(--gray-2);
}

/* Layout: planner */

.pl-week { margin-bottom: 28px; }
.pl-grid {
  display: grid;
  grid-template-columns: 84px repeat(5, minmax(0, 1fr));
}
.pl-grid > * { grid-row: var(--r); min-width: 0; }
.pl-corner, .pl-name { grid-column: 1; }
.pl-head, .pl-cell { grid-column: var(--dc); border-left: 1px solid var(--line); }
.pl-skip {
  grid-column: 2 / span 2;
  grid-row: 1;
  padding: 2px 12px 10px 0;
  font-size: 13px;
  color: var(--gray-2);
}
.pl-skip p { margin: 0; }
.pl-head { padding: 0 12px 10px; scroll-margin-top: 72px; }
.pl-date { display: flex; align-items: center; gap: 6px; }
.pl-date b { font-weight: 500; color: var(--gray); font-size: 13px; }
.pl-num {
  font-family: ui-rounded, system-ui, sans-serif;
  font-size: 22px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--plum);
}
.pl-head .blossom { width: 22px; height: 22px; margin-left: auto; }
.pl-head.is-past .pl-num { color: var(--gray-2); }
.pl-head.is-today .pl-date b { color: var(--plum); }
.pl-sub { display: flex; flex-wrap: wrap; column-gap: 6px; margin: 2px 0 0; font-size: 12px; color: var(--gray); }
.pl-head .event { flex-wrap: wrap; column-gap: 6px; margin: 4px 0 0; font-size: 12px; }
.pl-head.is-today, .pl-cell.is-today { background: var(--sunk); }
.pl-head.is-today { border-radius: 12px 12px 0 0; }
.pl-cell.is-today.is-last { border-radius: 0 0 12px 12px; }
.pl-name {
  padding: 12px 8px 12px 0;
  border-top: 1px solid var(--line);
  font-size: 13px;
  font-weight: 500;
}
.pl-name .you { display: block; color: var(--gray-2); font-size: 12px; font-weight: 400; }
.pl-cell { position: relative; padding: 12px; border-top: 1px solid var(--line); }
.pl-text { margin: 0; font-size: 14px; white-space: pre-wrap; overflow-wrap: anywhere; }
.pl-cell.is-mine { padding-bottom: 20px; }
.pl-cell.is-mine:focus-within { box-shadow: inset 0 0 0 1.5px var(--plum); background: var(--paper); }
.pl-cell .note-input {
  min-height: 64px;
  margin: 0;
  padding: 6px 8px;
  border-radius: 8px;
  background: var(--sunk);
}
.pl-cell.is-today .note-input { background: var(--paper); }
.pl-cell.is-mine:focus-within .note-input { background: var(--paper); }
@media (hover: hover) and (pointer: fine) {
  .pl-cell .note-input { font-size: 14px; }
}
.pl-cell .save-state { position: absolute; right: 12px; bottom: 4px; }

/* Entrance */

.reveal { opacity: 0; transform: translateY(8px); }
.revealed .reveal {
  opacity: 1;
  transform: none;
  transition: opacity 420ms var(--ease-out), transform 420ms var(--ease-out);
  transition-delay: calc(var(--i, 0) * 45ms);
}

/* Footer */

.foot {
  display: grid;
  justify-items: center;
  gap: 2px;
  padding: 24px 24px calc(40px + env(safe-area-inset-bottom));
  color: var(--gray);
  text-align: center;
}
.foot p { margin: 0; }
.foot .fine { margin-top: 10px; color: var(--gray-2); font-size: 12px; }

/* Cheer and toast */

.cheer {
  position: fixed;
  right: max(16px, env(safe-area-inset-right));
  bottom: calc(16px + env(safe-area-inset-bottom));
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 16px 4px 4px;
  border-radius: 999px;
  background: var(--paper);
  box-shadow: 0 12px 32px -14px rgba(32, 20, 32, 0.45), 0 0 0 1px var(--line);
  opacity: 0;
  transform: translateY(16px) scale(0.96);
  pointer-events: none;
  transition: opacity 220ms var(--ease-out), transform 260ms var(--ease-out);
}
.cheer img { display: block; width: 72px; height: 72px; }
.cheer p { margin: 0; font-family: ui-rounded, system-ui, sans-serif; font-weight: 600; color: var(--plum); }
.cheer.show { opacity: 1; transform: none; }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(20px + env(safe-area-inset-bottom));
  z-index: 11;
  max-width: calc(100vw - 32px);
  padding: 9px 16px;
  border-radius: 999px;
  background: var(--plum);
  color: var(--paper);
  font-size: 13px;
  opacity: 0;
  transform: translate(-50%, 12px);
  pointer-events: none;
  transition: opacity 200ms var(--ease-out), transform 200ms var(--ease-out);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* Planner below 900px: five columns get too narrow, so it scrolls sideways a day at a time
   with the names pinned. --gutter matches the page's side padding. */

@media (max-width: 900px) {
  .pl { --gutter: 24px; }
  .pl-scroll {
    margin: 0 calc(-1 * var(--gutter));
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-padding-left: calc(64px + var(--gutter));
    overscroll-behavior-x: contain;
  }
  .pl-grid {
    grid-template-columns: calc(64px + var(--gutter)) repeat(var(--n), min(74vw, 300px));
    width: max-content;
    padding-right: var(--gutter);
  }
  .pl-head, .pl-cell { grid-column: var(--pc); scroll-snap-align: start; }
  .pl-skip { display: none; }
  .pl-corner, .pl-name { position: sticky; left: 0; z-index: 1; padding-left: var(--gutter); background: var(--paper); }
}

/* Phone */

@media (max-width: 640px) {
  .bar { padding-left: 16px; padding-right: 16px; }
  .page { padding: 4px 16px 24px; }
  .hero { align-items: flex-start; padding-top: 12px; }
  .desk img { width: 96px; height: 96px; }
  .days { grid-template-columns: 1fr; }
  .call { grid-template-columns: 1fr auto; }
  .call-when { grid-column: 1 / -1; grid-row: 2; }

  .row { grid-template-columns: 60px minmax(0, 1fr); gap: 10px; }
  .ag-day { grid-template-columns: 48px minmax(0, 1fr); gap: 12px; }
  .ag-num { font-size: 26px; }
  .ag-day.is-today .ag-num { margin-left: 0; }
  .ag-day.is-today .blossom { margin-left: 8px; }
  .ag-weekend { padding-left: 60px; }

  .pl { --gutter: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition-duration: 0.01ms !important;
    transition-delay: 0s !important;
  }
  .reveal { opacity: 1; transform: none; }
}
