/* Before — public booking pages. Tokens follow the spec's Design section. */

/* `hidden` must win over classes that set display (e.g. .actions is a grid), or "Cancel meeting" kept the old
   buttons on screen next to the reason box. */
[hidden] { display: none !important; }

:root {
  --primary: #504184;
  --primary-text: #504184;
  --on-primary: #ffffff;
  --primary-tint: rgba(80, 65, 132, 0.1);
  --primary-tint-strong: rgba(80, 65, 132, 0.18);
  --gold: #e2b63d; /* the logo's dot and small highlights; never text on white */
  --bg: #ffffff;
  --surface: #ffffff;
  --surface-2: #f2f2f7;
  --text: #111114;
  --text-2: #6b6b73;
  --border: #e5e5ea;
  --success: #1c8f4e;
  --danger: #d92d20;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 8px 32px rgba(0, 0, 0, 0.06);
  --radius: 10px;
  --radius-s: 6px;
  --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --primary: #5e4ea0;
    --primary-text: #b9aef0;
    --primary-tint: rgba(185, 174, 240, 0.14);
    --primary-tint-strong: rgba(185, 174, 240, 0.24);
    --bg: #000000;
    --surface: #1c1c1e;
    --surface-2: #2c2c2e;
    --text: #f5f5f7;
    --text-2: #a1a1a6;
    --border: #2c2c2e;
    --success: #4cc787;
    --danger: #ff6961;
    --shadow: none;
  }
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

a { color: var(--primary-text); }

.page {
  max-width: 980px;
  margin: 0 auto;
  padding: 24px 16px 48px;
}

/* The logo: the Ahead mark (gold dot, hard-edged chevron) and the "before" wordmark, as in the apps. */
@font-face {
  font-family: "Montserrat";
  font-weight: 800;
  font-display: swap;
  src: url("fonts/Montserrat-ExtraBold.ttf") format("truetype");
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin: 0 0 20px;
  color: var(--primary-text);
  font-family: "Montserrat", -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 19px;
  font-weight: 800;
  letter-spacing: -0.04em;
  text-decoration: none;
}
.brand-mark { width: 28px; height: 28px; flex: none; }
.brand-mark .dot { fill: var(--gold); }
.brand-mark .arrow { fill: currentColor; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* Booking layout: link info beside the steps on wide screens, stacked on phones. */
.booking {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  overflow: hidden;
}
/* Grid children may shrink below their content (long time-zone names would otherwise widen the page). */
.booking > *, .picker > * { min-width: 0; }
@media (min-width: 820px) {
  .booking { grid-template-columns: 300px minmax(0, 1fr); }
  .info { border-right: 1px solid var(--border); }
}

.info { padding: 24px; }
.step { padding: 20px 20px 24px; min-height: 420px; }
@media (min-width: 820px) { .step { padding: 28px; } }

.avatars { display: flex; margin-bottom: 16px; }
.avatar {
  width: 48px; height: 48px; border-radius: 50%;
  background: var(--primary-tint-strong);
  color: var(--primary-text);
  display: grid; place-items: center;
  font-weight: 700; font-size: 17px;
  border: 3px solid var(--surface);
}
.avatar + .avatar { margin-left: -12px; }
.avatar-lg { width: 72px; height: 72px; font-size: 26px; }

.eyebrow { margin: 0; color: var(--text-2); font-size: 15px; font-weight: 500; }
h1 { margin: 2px 0 12px; font-size: 26px; line-height: 1.2; letter-spacing: -0.01em; }
h2 { margin: 0 0 16px; font-size: 20px; line-height: 1.25; }

.facts { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; color: var(--text-2); }
.facts li { display: flex; gap: 10px; align-items: flex-start; }
.facts svg { flex: none; width: 20px; height: 20px; margin-top: 2px; }
.description { margin: 16px 0 0; color: var(--text-2); white-space: pre-line; }

/* Calendar */
.month-bar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.month-bar h2 { margin: 0; }
.icon-btn {
  width: 48px; height: 48px; border-radius: var(--radius-s);
  border: 0; background: var(--surface-2); color: var(--text);
  display: grid; place-items: center; cursor: pointer;
  transition: transform 0.35s var(--spring), background 0.2s;
}
.icon-btn:hover { background: var(--primary-tint); }
.icon-btn:active { transform: scale(0.9); }
.icon-btn[disabled] { opacity: 0.35; pointer-events: none; }
.month-nav { display: flex; gap: 8px; }

.weekdays, .days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.weekdays { margin-bottom: 4px; color: var(--text-2); font-size: 12px; font-weight: 600; text-align: center; text-transform: uppercase; letter-spacing: 0.04em; }
.day {
  aspect-ratio: 1; min-height: 44px;
  border: 0; border-radius: var(--radius-s);
  background: transparent; color: var(--text-2);
  font: inherit; font-size: 16px;
  display: grid; place-items: center;
  position: relative;
}
.day.out { visibility: hidden; }
.day.available {
  background: var(--primary-tint); color: var(--primary-text);
  font-weight: 700; cursor: pointer;
  transition: transform 0.35s var(--spring), background 0.2s, color 0.2s;
}
.day.available:hover { background: var(--primary-tint-strong); }
.day.available:active { transform: scale(0.88); }
.day.selected, .day.selected:hover { background: var(--primary); color: var(--on-primary); }
.day.today::after {
  content: ""; position: absolute; bottom: 6px;
  width: 5px; height: 5px; border-radius: 50%; background: currentColor;
}

.tz-row { display: flex; align-items: center; gap: 8px; margin-top: 16px; color: var(--text-2); font-size: 14px; }
.tz-row select {
  flex: 1; width: 100%; min-width: 0; min-height: 44px;
  border: 1px solid var(--border); border-radius: var(--radius-s);
  background: var(--surface); color: var(--text);
  font: inherit; font-size: 15px; padding: 0 12px;
}

/* Time chips */
.picker { display: grid; gap: 24px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 1000px) { .picker { grid-template-columns: minmax(0, 1fr) 220px; } }
.times h3 { margin: 0 0 12px; font-size: 16px; }
.chips { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
@media (min-width: 1000px) { .chips { grid-template-columns: 1fr; max-height: 420px; overflow-y: auto; padding-right: 4px; } }
.chip {
  min-height: 52px;
  border: 1.5px solid var(--primary-tint-strong); border-radius: var(--radius-s);
  background: var(--surface); color: var(--primary-text);
  font: inherit; font-size: 17px; font-weight: 700;
  cursor: pointer;
  opacity: 0; animation: rise 0.45s var(--ease) forwards;
  transition: transform 0.35s var(--spring), background 0.2s, border-color 0.2s;
}
.chip:hover { background: var(--primary-tint); border-color: var(--primary); }
.chip:active { transform: scale(0.94); }
.empty { color: var(--text-2); padding: 24px 0; }

/* Forms */
.summary {
  display: flex; gap: 12px; align-items: center;
  padding: 14px 16px; margin-bottom: 20px;
  border-radius: var(--radius-s); background: var(--primary-tint);
}
.summary strong { display: block; }
.summary span { color: var(--text-2); font-size: 14px; }
.field { display: grid; gap: 6px; margin-bottom: 16px; }
.field label { font-weight: 600; font-size: 15px; }
.field input, .field textarea {
  width: 100%; min-height: 52px;
  border: 1.5px solid var(--border); border-radius: var(--radius-s);
  background: var(--surface); color: var(--text);
  font: inherit; font-size: 17px; padding: 12px 14px;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.field textarea { min-height: 96px; resize: vertical; }
.field input:focus, .field textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-tint); }
.field .error { color: var(--danger); font-size: 14px; }

.actions { display: grid; gap: 10px; margin-top: 8px; }
@media (min-width: 820px) { .actions { grid-template-columns: auto 1fr; } }
.btn {
  min-height: 56px; padding: 0 24px;
  border: 0; border-radius: var(--radius-s);
  font: inherit; font-size: 17px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  cursor: pointer; text-decoration: none;
  transition: transform 0.35s var(--spring), background 0.2s, opacity 0.2s;
}
.btn:active { transform: scale(0.96); }
.btn-primary { background: var(--primary); color: var(--on-primary); }
.btn-primary:hover { filter: brightness(1.08); }
.btn-quiet { background: var(--surface-2); color: var(--text); }
.btn-danger { background: transparent; color: var(--danger); border: 1.5px solid currentColor; }
.btn-block { width: 100%; }
.htmx-request .btn-primary, .btn-primary.htmx-request, .btn-primary.is-busy { opacity: 0.7; pointer-events: none; }
/* A spinner in front of the label while the request runs (htmx marks the form or button; plain forms get .is-busy). */
.htmx-request .btn-primary::before, .btn-primary.htmx-request::before, .btn-primary.is-busy::before {
  content: ""; flex: none; width: 18px; height: 18px;
  border: 2.5px solid currentColor; border-right-color: transparent; border-radius: 50%;
  animation: btn-spin 0.7s linear infinite;
}
@keyframes btn-spin { to { transform: rotate(360deg); } }
.chip.htmx-request, .day.htmx-request { opacity: 0.6; pointer-events: none; }

/* Sticky confirm on phones, so it stays in reach of the thumb. */
@media (max-width: 819px) {
  .sticky-actions {
    position: sticky; bottom: 0;
    margin: 16px -20px -24px; padding: 12px 20px calc(12px + env(safe-area-inset-bottom));
    background: linear-gradient(to top, var(--surface) 70%, transparent);
  }
}

.alert {
  padding: 12px 16px; margin-bottom: 16px; border-radius: var(--radius-s);
  background: color-mix(in srgb, var(--danger) 12%, transparent); color: var(--danger); font-weight: 600;
  animation: shake 0.4s var(--ease);
}

/* Confirmation */
.done { text-align: center; padding: 24px 8px; }
.done h2 { font-size: 24px; margin: 20px 0 8px; }
.done p { color: var(--text-2); margin: 0 auto 8px; max-width: 420px; }
.done .when { color: var(--text); font-weight: 600; font-size: 18px; }
.check { width: 88px; height: 88px; margin: 8px auto 0; }
.check circle { fill: var(--primary-tint); transform-origin: center; animation: pop 0.6s var(--spring) both; }
.check path {
  fill: none; stroke: var(--primary-text); stroke-width: 6; stroke-linecap: round; stroke-linejoin: round;
  stroke-dasharray: 60; stroke-dashoffset: 60; animation: draw 0.45s 0.3s var(--ease) forwards;
}
.check.pending path { stroke-dasharray: none; stroke-dashoffset: 0; animation: none; }
.done .actions { max-width: 420px; margin: 24px auto 0; grid-template-columns: 1fr; }

/* Profile */
.profile { text-align: center; padding: 32px 20px; }
.profile .avatar-lg { margin: 0 auto 12px; }
.links { display: grid; gap: 12px; margin-top: 24px; text-align: left; }
.link-card {
  display: flex; align-items: center; gap: 16px;
  padding: 18px 20px; border-radius: var(--radius-s);
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text); text-decoration: none;
  transition: transform 0.35s var(--spring), border-color 0.2s, box-shadow 0.2s;
  opacity: 0; animation: rise 0.5s var(--ease) forwards;
}
.link-card:hover { border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-tint); }
.link-card:active { transform: scale(0.98); }
.link-card strong { display: block; font-size: 17px; }
.link-card span { color: var(--text-2); font-size: 14px; }
.link-card .go { margin-left: auto; color: var(--primary-text); }
.narrow { max-width: 560px; margin: 0 auto; }

/* Loading: shimmering skeleton while a step loads */
.skeleton { display: grid; gap: 12px; }
.skeleton div {
  height: 44px; border-radius: var(--radius-s);
  background: linear-gradient(90deg, var(--surface-2) 0%, var(--primary-tint) 50%, var(--surface-2) 100%);
  background-size: 200% 100%; animation: shimmer 1.2s linear infinite;
}
.skeleton div:first-child { width: 50%; }

/* Motion */
.enter { animation: rise 0.45s var(--ease); }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes pop { from { transform: scale(0.4); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes shimmer { to { background-position: -200% 0; } }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }

::view-transition-old(root), ::view-transition-new(root) { animation-duration: 0.28s; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-delay: 0ms !important; transition-duration: 0.01ms !important; }
  .chip, .link-card { opacity: 1; }
  .btn-primary::before { animation-duration: 1.6s !important; }  /* keep the spinner turning, slowly */
  .check path { stroke-dashoffset: 0; }
}

.muted { color: var(--text-2); }
.center { text-align: center; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Privacy policy and terms: long text, easy to read. */
.narrow-wide { max-width: 720px; margin: 0 auto; }
.legal { padding: 8px 4px 0; }  /* plain page: no card around long text */
.legal h2 { margin: 28px 0 8px; font-size: 19px; }
.legal p, .legal li { line-height: 1.6; color: var(--text); }
.legal ul { padding-left: 20px; margin: 8px 0; }
.legal li { margin: 6px 0; }
.legal a, .site-footer a { color: var(--primary-text); }
.site-footer { margin-top: 32px; text-align: center; font-size: 14px; color: var(--text-2); }

/* A button that reads as a link, inside a sentence (the AI app sign-in's "Use another account"). */
.text-button { padding: 0; border: 0; background: none; color: var(--primary-text); font: inherit; cursor: pointer; text-decoration: underline; }

/* Connecting an AI app (apps/mcp, canvas "AI apps") and the /ai help page. */
.connect { padding: 28px 24px; }
@media (min-width: 820px) { .connect { padding: 36px 40px; } }
.connect h1 { font-size: 28px; font-weight: 800; letter-spacing: -0.02em; margin: 20px 0 6px; }
.connect .actions { grid-template-columns: 1fr; }
.pair { display: flex; align-items: center; gap: 12px; }
.pair span {
  width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center;
  background: var(--surface-2); color: var(--text);
}
.pair span.ours { background: var(--primary-tint); }
.pair span svg { width: 28px; height: 28px; }
.pair i { width: 36px; border-top: 2px dashed var(--border); }
.or { display: flex; align-items: center; gap: 12px; margin: 20px 0; color: var(--text-2); font-size: 14px; }
.or::before, .or::after { content: ""; flex: 1; border-top: 1px solid var(--border); }
.field input.code { min-height: 64px; font-size: 30px; font-weight: 600; letter-spacing: 0.4em; }
.connect .facts { margin: 22px 0 26px; gap: 16px; color: var(--text); }
.connect .facts svg { color: var(--primary-text); }
.connect .facts span { display: block; color: var(--text-2); font-size: 14px; margin-top: 2px; }
.connect .small { margin: 14px 0 0; font-size: 14px; color: var(--text-2); text-align: center; }
.plan-chip {
  display: inline-flex; align-items: center; gap: 7px; margin-top: 14px; padding: 6px 12px;
  border-radius: 14px; background: var(--surface-2); font-size: 13px; font-weight: 500; color: var(--text-2);
}
.plan-chip::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--gold); }

.ai-page h1 { font-size: 30px; font-weight: 800; letter-spacing: -0.02em; margin: 4px 0 10px; }
@media (min-width: 820px) { .ai-page h1 { font-size: 44px; } }
.ai-page .lead { color: var(--text-2); font-size: 17px; line-height: 1.5; margin: 0; }
.paste {
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; margin: 24px 0 28px;
  padding: 14px 14px 14px 20px; border-radius: var(--radius-s); background: var(--surface-2);
}
.paste div { flex: 1 1 220px; min-width: 0; }
.paste small { display: block; color: var(--text-2); font-size: 13px; }
.paste strong { font-size: 20px; overflow-wrap: anywhere; }
.paste .btn { min-height: 48px; flex: 1 1 auto; }
@media (min-width: 560px) { .paste .btn { flex: 0 0 auto; } }
.tabs { display: inline-flex; gap: 4px; padding: 4px; border-radius: var(--radius-s); background: var(--surface-2); }
/* The radios sit before .tabs (siblings of the panels), so CSS alone switches tabs. */
.tab-input { position: absolute; opacity: 0; pointer-events: none; }
.tabs label { padding: 8px 18px; border-radius: 6px; font-size: 15px; font-weight: 500; cursor: pointer; color: var(--text-2); }
#tab-claude:checked ~ .tabs [for="tab-claude"], #tab-chatgpt:checked ~ .tabs [for="tab-chatgpt"],
#tab-other:checked ~ .tabs [for="tab-other"] {
  background: var(--surface); color: var(--text); font-weight: 600; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}
#tab-claude:focus-visible ~ .tabs [for="tab-claude"], #tab-chatgpt:focus-visible ~ .tabs [for="tab-chatgpt"],
#tab-other:focus-visible ~ .tabs [for="tab-other"] { outline: 2px solid var(--primary); }
.steps { list-style: none; counter-reset: step; margin: 18px 0 0; padding: 0; display: grid; gap: 14px; }
.steps li { counter-increment: step; display: flex; gap: 14px; align-items: flex-start; font-size: 17px; line-height: 1.5; }
.steps li::before {
  content: counter(step); flex: none; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  background: var(--primary-tint); color: var(--primary-text); font-size: 15px; font-weight: 700;
}
.for-app { display: none; }
#tab-claude:checked ~ .for-claude, #tab-chatgpt:checked ~ .for-chatgpt, #tab-other:checked ~ .for-other { display: block; }
.asks { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.asks span { padding: 9px 14px; border-radius: var(--radius-s); border: 1px solid var(--border); font-size: 15px; }
.ai-page h2 { font-size: 13px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-2); margin: 32px 0 0; }
.promises { display: grid; gap: 20px; margin-top: 32px; }
@media (min-width: 720px) { .promises { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.promises strong { display: block; font-size: 16px; }
.promises span { color: var(--text-2); font-size: 15px; line-height: 1.45; }
