/* ---------------------------------------------------------------------------
   Family Planner design system — "the fridge calendar"
   Paper, ink, and one marker-red pen. The circled date is the signature.
--------------------------------------------------------------------------- */

:root {
  color-scheme: light;
  --paper: #FBF7F0;
  --paper-raised: #FFFFFF;
  --ink: #2E2A26;
  --ink-soft: #6F675D;
  --line: #E7DED2;
  --marker: #D9432F;
  --marker-deep: #B93521;
  --marker-tint: #FDEEEA;
  --on-marker: #FFFFFF;
  --leaf: #3E7C59;
  --leaf-soft: #E4F0E7;
  --butter: #F5C64F;
  --butter-soft: #FBF0D2;
  --pending-ink: #8A6D1A;
  --placeholder: #B4AA9C;
  --day-disabled: #C9BFB1;
  --backdrop: rgba(46, 42, 38, 0.4);

  --font-display: "Bricolage Grotesque", "Avenir Next", -apple-system, sans-serif;
  --font-hand: "Caveat", "Bradley Hand", cursive;
  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

  --radius: 14px;
  --radius-small: 9px;
  --shadow: 0 1px 2px rgba(46, 42, 38, 0.06), 0 4px 14px rgba(46, 42, 38, 0.07);
  --space: 20px;
}

/* The fridge calendar after the kitchen light goes off: same paper-and-marker
   idea, warm charcoal instead of cream. Red gets a touch brighter so it still
   reads as the pen. */
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --paper: #211E1A;
    --paper-raised: #2C2823;
    --ink: #F1EBE1;
    --ink-soft: #A89E90;
    --line: #423B32;
    --marker: #E9604B;
    --marker-deep: #97301F;
    --marker-tint: #43271F;
    --leaf: #7CC29A;
    --leaf-soft: #2A3D31;
    --butter: #E9C464;
    --butter-soft: #3D3524;
    --pending-ink: #DCBE6E;
    --placeholder: #7E7568;
    --day-disabled: #5C5449;
    --backdrop: rgba(0, 0, 0, 0.55);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.25), 0 4px 14px rgba(0, 0, 0, 0.3);
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html {
  -webkit-text-size-adjust: 100%;
  background: var(--paper); /* overscroll rubber-band shows paper, not white */
}

::selection { background: var(--marker); color: #fff; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.5;
  min-height: 100dvh;
}

/* ---- chrome ---- */

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--ink);
  color: var(--paper);
  padding: 8px 14px;
  border-radius: 0 0 var(--radius-small) 0;
  z-index: 10;
}
.skip-link:focus { left: 0; }

.topbar {
  display: flex;
  justify-content: center;
  padding: calc(14px + env(safe-area-inset-top)) 20px 10px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  text-decoration: none;
  color: var(--ink);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 19px;
  letter-spacing: -0.01em;
}
.brand-mark { width: 26px; height: 26px; }

.view {
  max-width: 560px;
  margin: 0 auto;
  padding: 8px 20px calc(48px + env(safe-area-inset-bottom));
  outline: none;
}
.view.view-in { animation: view-in 0.22s ease-out; }
@keyframes view-in {
  from { opacity: 0; transform: translateY(7px); }
  to { opacity: 1; transform: none; }
}

/* ---- type ---- */

h1, h2, h3 {
  font-family: var(--font-display);
  letter-spacing: -0.02em;
  line-height: 1.12;
  margin: 0 0 8px;
}
h1 { font-size: 34px; font-weight: 800; }
h2 { font-size: 22px; font-weight: 700; }
h3 { font-size: 17px; font-weight: 700; }

.eyebrow {
  font-family: var(--font-hand);
  font-size: 22px;
  color: var(--marker);
  display: block;
  margin-bottom: 2px;
  transform: rotate(-1.2deg);
  transform-origin: left bottom;
}

.muted { color: var(--ink-soft); }
.small { font-size: 14px; }

/* ---- buttons ---- */

button { font: inherit; color: inherit; }
button, .btn {
  touch-action: manipulation; /* no double-tap zoom lag on iOS */
  -webkit-user-select: none;
  user-select: none;
}

.btn {
  display: block;
  width: 100%;
  padding: 15px 20px;
  border-radius: var(--radius);
  border: none;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 17px;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  transition: transform 0.08s ease, box-shadow 0.08s ease;
  min-height: 52px;
}
.btn:active { transform: translateY(1px); }

.btn-primary {
  background: var(--marker);
  color: var(--on-marker);
  box-shadow: 0 3px 0 var(--marker-deep);
}
.btn-primary:active { box-shadow: 0 1px 0 var(--marker-deep); }
.btn-primary:disabled {
  background: var(--line);
  color: var(--ink-soft);
  box-shadow: none;
  cursor: default;
}

.btn-quiet {
  background: transparent;
  color: var(--ink);
  border: 1.5px solid var(--line);
}

.btn-danger-quiet {
  background: transparent;
  color: var(--marker);
  border: none;
  font-family: var(--font-body);
  font-size: 15px;
  min-height: 44px;
}

.btn-row { display: flex; gap: 10px; }
.btn-row .btn { flex: 1; }

:where(button, a, input, textarea, select):focus-visible {
  outline: 2.5px solid var(--marker);
  outline-offset: 2px;
}

/* ---- forms ---- */

.field { margin-bottom: 18px; }
.field label {
  display: block;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 15px;
  margin-bottom: 6px;
}
.field .hint { font-size: 13.5px; color: var(--ink-soft); margin-top: 5px; }

input[type="text"], input[type="tel"], input[type="email"], textarea, select {
  width: 100%;
  padding: 13px 14px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-small);
  background: var(--paper-raised);
  font: inherit;
  color: var(--ink);
  min-height: 50px;
}
textarea { resize: vertical; min-height: 74px; }
input::placeholder, textarea::placeholder { color: var(--placeholder); }

/* ---- stepper ---- */

.stepper {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-small);
  background: var(--paper-raised);
}
.stepper button {
  width: 48px;
  height: 48px;
  border: none;
  background: none;
  font-size: 22px;
  cursor: pointer;
  color: var(--marker);
  font-weight: 700;
}
.stepper output {
  min-width: 56px;
  text-align: center;
  font-family: var(--font-display);
  font-weight: 700;
}

/* ---- cards & sections ---- */

.card {
  background: var(--paper-raised);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  margin-bottom: 14px;
}

.section { margin: 26px 0; }
.section-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.divider {
  border: none;
  border-top: 1.5px dashed var(--line);
  margin: 26px 0;
}

/* ---- home ---- */

.hero { padding: 26px 0 6px; text-align: center; }
.hero .eyebrow { transform: rotate(-2deg); display: inline-block; }
.hero p { color: var(--ink-soft); max-width: 40ch; margin: 6px auto 22px; }

/* The signature, up front: a strip of this week's days where the winning one
   gets circled in marker as the page settles. */
.hero-strip {
  display: flex;
  justify-content: center;
  gap: 6px;
  background: var(--paper-raised);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px 12px;
  max-width: 330px;
  margin: 0 auto 24px;
}
.hero-strip .strip-day {
  position: relative;
  width: 52px;
  padding: 6px 0 8px;
  border-radius: var(--radius-small);
}
.hero-strip .strip-dow {
  display: block;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.hero-strip .strip-num {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 19px;
  font-variant-numeric: tabular-nums;
}
.hero-strip .strip-day.winner .strip-num { font-weight: 800; color: var(--marker); }
.hero-strip .strip-day .ring {
  position: absolute;
  inset: -3px;
  width: calc(100% + 6px);
  height: calc(100% + 6px);
  color: var(--marker);
  pointer-events: none;
}
.hero-strip .strip-day .ring path {
  stroke-dasharray: 130;
  stroke-dashoffset: 130;
  animation: draw-ring 0.5s ease-out 0.7s forwards;
}

.event-item {
  display: block;
  width: 100%;
  text-align: left;
  background: var(--paper-raised);
  border: none;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px 18px;
  margin-bottom: 12px;
  cursor: pointer;
  transition: transform 0.1s ease;
}
.event-item:active { transform: scale(0.985); }
.event-item h3 { margin-bottom: 3px; }
.event-item .meta { font-size: 14px; color: var(--ink-soft); }

.chip {
  display: inline-block;
  font-size: 13px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 99px;
  margin-top: 8px;
}
.chip-pending { background: var(--butter-soft); color: var(--pending-ink); }
.chip-ready { background: var(--leaf-soft); color: var(--leaf); }
.chip-confirmed { background: var(--leaf); color: #fff; }

.empty {
  text-align: center;
  color: var(--ink-soft);
  padding: 30px 10px;
}
.empty .eyebrow { display: inline-block; }

/* ---- calendar (signature) ---- */

.cal-shortcuts { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.shortcut-chip {
  border: 1.5px solid var(--line);
  background: var(--paper-raised);
  border-radius: 99px;
  padding: 9px 15px;
  font-size: 14.5px;
  font-weight: 600;
  cursor: pointer;
  min-height: 44px;
  transition: border-color 0.12s ease, color 0.12s ease, background 0.12s ease, transform 0.1s ease;
}
.shortcut-chip:active { transform: scale(0.96); }
.shortcut-chip[aria-pressed="true"] {
  border-color: var(--marker);
  color: var(--marker);
  background: var(--marker-tint);
}

.weekend-days { display: flex; gap: 14px; margin-bottom: 16px; align-items: center; }
.weekend-days .label { font-size: 14px; color: var(--ink-soft); }
.weekend-days label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 15px;
  font-weight: 600;
  min-height: 44px;
}
.weekend-days input { width: 20px; height: 20px; accent-color: var(--marker); }

.cal-month { margin-bottom: 18px; }
.cal-month-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}
.cal-month-head h3 { font-size: 16px; }
.cal-nav {
  border: none;
  background: none;
  font-size: 20px;
  width: 44px;
  height: 44px;
  cursor: pointer;
  color: var(--ink-soft);
  border-radius: 50%;
}

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}
.cal-dow {
  text-align: center;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 4px 0;
}

.cal-day {
  position: relative;
  aspect-ratio: 1;
  border: none;
  background: none;
  border-radius: 50%;
  font-size: 15.5px;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
}
.cal-day:disabled { color: var(--day-disabled); cursor: default; }
.cal-day.other-month { visibility: hidden; }
.cal-day .ring {
  position: absolute;
  inset: -2px;
  width: calc(100% + 4px);
  height: calc(100% + 4px);
  color: var(--marker);
  pointer-events: none;
}
.cal-day .ring path {
  stroke-dasharray: 130;
  stroke-dashoffset: 0;
}
.cal-day.selected { font-weight: 700; }
.cal-day.just-selected .ring path {
  animation: draw-ring 0.28s ease-out;
}
@keyframes draw-ring {
  from { stroke-dashoffset: 130; }
  to { stroke-dashoffset: 0; }
}

.cal-count {
  font-family: var(--font-hand);
  font-size: 21px;
  color: var(--marker);
  text-align: center;
  min-height: 30px;
  transform: rotate(-1deg);
}

/* ---- availability chunks ---- */

.day-card {
  background: var(--paper-raised);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px 16px;
  margin-bottom: 12px;
}
.day-card.answered-busy { opacity: 0.75; }
.day-card-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 10px;
}
.day-card-head .dow { font-family: var(--font-display); font-weight: 700; }
.day-card-head .status { font-size: 13px; color: var(--ink-soft); }
.day-card-head .status.done { color: var(--leaf); font-weight: 600; }

.chunk-row { display: flex; gap: 8px; margin-bottom: 8px; }
.chunk-btn {
  flex: 1;
  padding: 9px 4px;
  border-radius: var(--radius-small);
  border: 1.5px solid var(--line);
  background: var(--paper-raised);
  font-size: 14.5px;
  font-weight: 600;
  cursor: pointer;
  min-height: 52px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease, transform 0.1s ease;
}
.chunk-btn:active { transform: scale(0.96); }
.chunk-btn .chunk-time {
  font-size: 11.5px;
  font-weight: 500;
  opacity: 0.65;
}
.chunk-btn[aria-pressed="true"] {
  background: var(--marker);
  border-color: var(--marker);
  color: var(--on-marker);
}

.quick-row { display: flex; gap: 8px; }
.quick-btn {
  flex: 1;
  padding: 8px;
  border: none;
  background: none;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink-soft);
  cursor: pointer;
  border-radius: var(--radius-small);
  min-height: 44px;
}
.quick-btn:active { background: var(--paper); }

.adjust-btn {
  width: 100%;
  margin-top: 8px;
  padding: 10px;
  min-height: 44px;
  border: 1.5px dashed var(--marker);
  border-radius: var(--radius-small);
  background: var(--paper-raised);
  color: var(--marker);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}
.adjust-btn:active { background: var(--paper); }

/* ---- "How this works" explainer on the respond page ---- */

.howto {
  background: var(--paper-raised);
  border: 1.5px solid var(--line);
  border-left: 4px solid var(--marker);
  border-radius: var(--radius-small);
  padding: 12px 14px;
  margin: 14px 0 18px;
}
.howto-title {
  font-family: var(--font-display);
  font-weight: 700;
  margin-bottom: 6px;
}
.howto ol {
  margin: 0;
  padding-left: 20px;
  font-size: 14px;
  color: var(--ink-soft);
}
.howto li { margin-bottom: 6px; }
.howto li:last-child { margin-bottom: 0; }
.howto strong { color: var(--ink); }

/* ---- sticky submit bar ---- */

.sticky-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(transparent, var(--paper) 30%);
  padding: 18px 20px calc(16px + env(safe-area-inset-bottom));
}
.sticky-bar-inner { max-width: 560px; margin: 0 auto; }
.sticky-bar .progress {
  text-align: center;
  font-size: 13.5px;
  color: var(--ink-soft);
  margin-bottom: 8px;
}
.has-sticky { padding-bottom: 140px; }

/* ---- share & responses ---- */

.share-card { margin-bottom: 12px; }
.share-card .who {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.share-msg {
  background: var(--paper);
  border-radius: var(--radius-small);
  padding: 12px;
  font-size: 14px;
  color: var(--ink-soft);
  margin-bottom: 10px;
  word-break: break-word;
}

.person-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
}
.person-row:last-child { border-bottom: none; }
.person-dot {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}
.person-dot.done { background: var(--leaf-soft); color: var(--leaf); }
.person-dot.waiting { background: var(--butter-soft); color: var(--pending-ink); }
.person-row .name { font-weight: 600; }
.person-row .state { margin-left: auto; font-size: 13.5px; color: var(--ink-soft); }

/* ---- best times ---- */

.window-item {
  display: block;
  width: 100%;
  text-align: left;
  background: var(--paper-raised);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 10px;
  cursor: pointer;
  transition: transform 0.1s ease, border-color 0.12s ease;
}
.window-item:active { transform: scale(0.985); }
.window-item .when { font-family: var(--font-display); font-weight: 700; font-size: 16.5px; }
.window-item .who { font-size: 14px; color: var(--ink-soft); margin-top: 2px; }
.window-item.everyone { border-color: var(--leaf); }
.window-item.everyone .who { color: var(--leaf); font-weight: 600; }

/* ---- confirmed event page ---- */

.confirmed-hero {
  text-align: center;
  padding: 24px 0 8px;
}
.confirmed-hero .circled {
  position: relative;
  display: inline-block;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 40px;
  letter-spacing: -0.02em;
  padding: 14px 26px;
}
.confirmed-hero .circled svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  color: var(--marker);
  overflow: visible;
}
.hero-ring-path {
  stroke-dasharray: 100;
  stroke-dashoffset: 0;
  animation: draw-hero-ring 0.9s cubic-bezier(0.65, 0, 0.35, 1) 0.35s backwards;
}
@keyframes draw-hero-ring {
  from { stroke-dashoffset: 100; }
  to { stroke-dashoffset: 0; }
}
.confirmed-hero .time {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  margin-top: 6px;
}
.confirmed-hero .place { color: var(--ink-soft); margin-top: 4px; }

/* ---- dialog sheet ---- */

.sheet-backdrop {
  position: fixed;
  inset: 0;
  background: var(--backdrop);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 20;
}
.sheet {
  background: var(--paper);
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 22px 20px calc(22px + env(safe-area-inset-bottom));
  width: 100%;
  max-width: 560px;
  max-height: 85dvh;
  overflow-y: auto;
}

/* ---- toast ---- */

.toast {
  position: fixed;
  bottom: calc(24px + env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: var(--paper);
  padding: 11px 20px;
  border-radius: 99px;
  font-size: 14.5px;
  font-weight: 600;
  z-index: 30;
  animation: toast-in 0.2s ease-out;
  max-width: calc(100vw - 40px);
}
@keyframes toast-in {
  from { opacity: 0; transform: translateX(-50%) translateY(8px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ---- misc ---- */

.spinner {
  margin: 60px auto;
  width: 30px;
  height: 30px;
  border: 3px solid var(--line);
  border-top-color: var(--marker);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.site-footer {
  text-align: center;
  font-size: 12.5px;
  color: var(--ink-soft);
  padding: 18px 20px calc(24px + env(safe-area-inset-bottom));
}
.site-footer a { color: var(--ink-soft); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

@media (min-width: 640px) {
  .hero { padding-top: 44px; }
  h1 { font-size: 40px; }
}
