:root {
  --bg: #F6F3EE;
  --surface: #FFFDFA;
  --ink: #2E3A3F;
  --muted: #5E6A6F;
  --line: #E4DFD6;
  --sage: #8FA596;
  --sage-deep: #5F7A6B;
  --sage-text: #4F6A5B;
  --sage-soft: #E6EDE7;
  --blue-soft: #E3EAEF;
  --blue-deep: #55707F;
  --clay: #C98B6B;
  --clay-soft: #F4E6DD;
  --clay-deep: #8A5136;
  --honey-soft: #F5ECD2;
  --honey-deep: #7A6122;
  --radius: 14px;
  --serif: "Fraunces", "Iowan Old Style", Georgia, serif;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
}

.masthead, main, footer {
  max-width: 760px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Masthead */
.masthead {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  padding-top: 36px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
}
.home-link { flex-basis: 100%; color: var(--muted); font-size: 14px; text-decoration: none; }
.home-link:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
.brand { display: flex; align-items: center; gap: 14px; }
.brand h1 {
  margin: 0;
  font: 500 34px/1 var(--serif);
  letter-spacing: -0.01em;
}
.brand p { margin: 4px 0 0; color: var(--muted); font-size: 14px; letter-spacing: 0.02em; }
.selma { flex: none; }
#hour-hand, #minute-hand { transform-origin: 27.5px 30.5px; transition: transform .6s ease; }

.tabs { display: flex; gap: 4px; }
.tab {
  font: 500 15px var(--sans);
  color: var(--muted);
  background: none;
  border: 0;
  padding: 8px 14px;
  border-radius: 999px;
  cursor: pointer;
}
.tab:hover { color: var(--ink); }
.tab[aria-current="page"] { background: var(--sage-soft); color: var(--sage-text); }

main { padding-top: 40px; padding-bottom: 48px; min-height: 60vh; }

/* Greeting */
.hello { margin-bottom: 28px; }
.hello h2 { margin: 0; font: 400 40px/1.15 var(--serif); letter-spacing: -0.015em; }
.hello p { margin: 8px 0 0; color: var(--muted); font-size: 18px; }

/* Time filter (and the checkboxes in the add-your-own form) */
.segmented { border: 0; padding: 0; margin: 0; display: flex; gap: 8px; flex-wrap: wrap; }
.segmented legend { font-size: 14px; font-weight: 500; padding: 0; margin-bottom: 8px; }
.segmented label { display: block; }
.segmented input { position: absolute; opacity: 0; width: 0; }
.segmented span {
  display: block;
  padding: 8px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
  font-size: 15px;
  font-weight: 400;
}
.segmented span:hover { border-color: var(--sage); }
.segmented input:checked + span { background: var(--sage-soft); border-color: var(--sage); color: var(--sage-text); font-weight: 500; }
.segmented input:focus-visible + span { outline: 2px solid var(--sage); outline-offset: 2px; }

#kind-filter, #place-filter { margin-top: 18px; }
#choose-start { margin-top: 0; }
/* The small colour dot ties each kind to its tiles. */
.segmented .dot::before {
  content: "";
  display: inline-block;
  width: 9px; height: 9px;
  border-radius: 50%;
  margin-right: 8px;
}
.dot.blue::before { background: #A9BDCA; }
.dot.clay::before { background: var(--clay); }
.dot.honey::before { background: #D9BC6A; }
.dot.sage::before { background: var(--sage); }

.choose { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin: 24px 0 20px; }
.choose span { color: var(--muted); font-size: 14px; }

/* Buttons */
.btn {
  font: 500 15px var(--sans);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  padding: 10px 16px;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
}
.btn:hover { border-color: var(--sage); }
.btn.primary { background: var(--sage-deep); border-color: var(--sage-deep); color: #fff; }
.btn.primary:hover { background: #52695C; }
.btn.quiet { background: none; }
.btn.danger { background: none; border-color: transparent; color: var(--muted); padding: 6px 2px; font-weight: 400; font-size: 13px; }
.btn.danger:hover { color: var(--clay-deep); }

button:focus-visible, input:focus-visible, a:focus-visible {
  outline: 2px solid var(--sage);
  outline-offset: 2px;
}

.link {
  font: inherit; font-size: 14px;
  color: var(--sage-text);
  background: none; border: 0; padding: 0;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* Invitations */
.invites {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 12px;
}
.invite {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  text-align: left;
  font: inherit;
  color: inherit;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  cursor: pointer;
  transition: border-color .15s, transform .15s;
}
.invite:hover { border-color: var(--sage); transform: translateY(-1px); }
.invite h3 { margin: 0; font: 500 19px/1.3 var(--serif); }
.invite p { margin: 2px 0 0; color: var(--muted); font-size: 14px; line-height: 1.4; }
.invite.own { background: none; border-style: dashed; align-items: center; color: var(--muted); }

.invite-icon {
  flex: none;
  width: 40px; height: 40px;
  border-radius: 10px;
  display: grid; place-items: center;
}
.invite-icon svg { width: 22px; height: 22px; }
.invite-icon.clay { background: var(--clay-soft); color: var(--clay-deep); }
.invite-icon.blue { background: var(--blue-soft); color: var(--blue-deep); }
.invite-icon.sage { background: var(--sage-soft); color: var(--sage-text); }
.invite-icon.honey { background: var(--honey-soft); color: var(--honey-deep); }
.invite-icon.plain { border: 1px dashed var(--line); color: var(--muted); }
.invite-icon.large { width: 64px; height: 64px; border-radius: 16px; }
.invite-icon.large svg { width: 34px; height: 34px; }

/* Trail */
.trail-intro { color: var(--muted); margin: 0 0 24px; max-width: 46ch; }
.trail-path {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.trail-path > svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.trail-path > svg path {
  fill: none;
  stroke: var(--sage);
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-dasharray: 0.1 9;
  vector-effect: non-scaling-stroke;
  opacity: .65;
}
.trail-path .invite-icon, .trail-path img {
  position: absolute;
  transform: translate(-50%, -50%);
}
.trail-path .invite-icon { border-radius: 50%; border: 0; padding: 0; cursor: default; }
.trail-path img { width: 52px; height: 52px; }
.trail-path img.leftward { transform: translate(-50%, -50%) scaleX(-1); }
.trail-actions { margin-top: 16px; }

.empty { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty img { width: 96px; height: 96px; opacity: .9; }
.empty h3 { font: 400 22px var(--serif); color: var(--ink); margin: 12px 0 4px; }
.empty p { margin: 0; }

/* Dialogs */
dialog {
  border: 0;
  border-radius: 18px;
  padding: 0;
  width: min(480px, calc(100vw - 24px));
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 20px 60px rgba(46, 58, 63, .18);
}
dialog::backdrop { background: rgba(46, 58, 63, .28); }
dialog h2 { margin: 0; font: 500 26px var(--serif); }

.invitation { padding: 28px 24px 22px; display: grid; gap: 12px; justify-items: start; }
.invitation .prompt { margin: 0; font: 400 20px/1.45 var(--serif); }
.invitation .dialog-actions { width: 100%; margin-top: 10px; }
.eyebrow {
  margin: 0;
  font: 500 13px var(--sans);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.farewell { justify-items: center; text-align: center; padding-top: 36px; }

dialog form { padding: 24px; display: grid; gap: 14px; }
dialog label { display: block; font-size: 14px; font-weight: 500; }
dialog form > label input {
  display: block;
  width: 100%;
  margin-top: 6px;
  font: inherit;
  font-weight: 400;
  color: inherit;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
}
input::placeholder { color: #869094; }
.optional { font-weight: 400; color: var(--muted); }

.dialog-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 6px; }
.dialog-actions.centered { justify-content: center; }
.spacer { flex: 1; }

/* Footer */
footer {
  border-top: 1px solid var(--line);
  padding-top: 20px;
  padding-bottom: 40px;
  color: var(--muted);
  font-size: 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
footer p { margin: 0; flex: 1 1 260px; }

/* Toast */
#toast {
  position: fixed;
  left: 50%; bottom: 24px;
  transform: translate(-50%, 20px);
  background: var(--ink);
  color: #fff;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s, transform .2s;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }

[hidden] { display: none !important; }

@media (max-width: 560px) {
  .hello h2 { font-size: 32px; }
  .invites { grid-template-columns: 1fr; }
  .choose .btn { flex: 1 1 100%; }
  .trail-path .invite-icon { width: 30px; height: 30px; }
  .trail-path .invite-icon svg { width: 17px; height: 17px; }
  .trail-path img { width: 42px; height: 42px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
