/* =================================================================
   site.css — "liquid glass" on a soft grid background.
   Look: Birol's "August 23" calendar + Apple's WWDC25 glass.
   Rules (designparser): 8pt spacing, line-heights in 4s, targets ≥ 44px,
   state never by colour alone, reflow at 320px, contrast ≥ 4.5:1.
   ================================================================= */

:root {
  --ink: #0f172a;        /* 15:1+ on the glass */
  --ink-2: #3d4a5c;      /* ≥ 7:1 */
  --ink-3: #556377;      /* ≥ 4.8:1 */
  --accent: #2f4f86;
  --danger: #b42318;
  --ok: #15803d;
  --free: #22c55e;       /* the green "libre" dot — always paired with text for screen readers */

  /* Liquid glass */
  --lg-fill: linear-gradient(140deg, rgba(255, 255, 255, 0.62), rgba(255, 255, 255, 0.28) 60%, rgba(255, 255, 255, 0.4));
  --lg-bubble: rgba(255, 255, 255, 0.5);
  --lg-bubble-hover: rgba(255, 255, 255, 0.72);
  --lg-edge: inset 0 1px 1px rgba(255, 255, 255, 0.95), inset 0 -1px 1px rgba(15, 23, 42, 0.06), inset 0 0 0 1px rgba(255, 255, 255, 0.55);
  --lg-shadow: 0 40px 90px -36px rgba(30, 41, 59, 0.45), 0 4px 12px -4px rgba(30, 41, 59, 0.08);
  --bubble-shadow: 0 6px 18px -8px rgba(15, 23, 42, 0.35), 0 1px 2px rgba(15, 23, 42, 0.08);

  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px; --s8: 64px;
  --r-card: 40px; --r-box: 24px; --r-control: 16px; --r-pill: 999px;

  --font: "Outfit", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --t-xs: 13px; --t-sm: 15px; --t-md: 17px; --t-lg: 20px; --t-xl: 28px;

  /* Apple-like motion: quick out, soft spring back */
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  color-scheme: light;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100dvh;
  color: var(--ink);
  font: 400 var(--t-md) / 28px var(--font);
  -webkit-font-smoothing: antialiased;
  /* Soft studio light + a faint notebook grid that fades out at the edges */
  background:
    radial-gradient(120% 90% at 30% 10%, #f7f8fa 0%, #e6e8ec 55%, #b9bec7 100%);
}
html { background: #c9cdd4; }
body::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background-image:
    linear-gradient(rgba(15, 23, 42, 0.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(15, 23, 42, 0.07) 1px, transparent 1px),
    radial-gradient(rgba(15, 23, 42, 0.16) 1.2px, transparent 1.6px);
  background-size: 96px 96px, 96px 96px, 24px 24px;
  background-position: -1px -1px, -1px -1px, 11px 11px;
  -webkit-mask-image: radial-gradient(ellipse 75% 65% at 50% 45%, #000 20%, transparent 85%);
  mask-image: radial-gradient(ellipse 75% 65% at 50% 45%, #000 20%, transparent 85%);
}
img { max-width: 100%; display: block; }
h1, h2, h3, p { margin: 0; }
h2 { font-size: var(--t-xl); line-height: 36px; font-weight: 600; }
a { color: var(--accent); text-underline-offset: 3px; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 12px; }
[tabindex="-1"]:focus { outline: none; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.stack > * + * { margin-top: var(--s4); }
.muted { color: var(--ink-2); }
.small { font-size: var(--t-sm); line-height: 24px; }
.eyebrow { font-size: var(--t-xs); line-height: 16px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); font-weight: 600; }

/* ---------- Page: one centred card ---------- */
.page { min-height: 100dvh; display: grid; place-items: center; padding: var(--s6) var(--s4); }
@media (max-width: 480px) { .page { padding: var(--s3) var(--s2) var(--s6); place-items: start center; } }

/* ---------- Liquid glass ---------- */
.glass {
  position: relative; isolation: isolate;
  width: min(100%, 560px);
  padding: var(--s6);
  border-radius: var(--r-card);
  background: var(--lg-fill);
  -webkit-backdrop-filter: blur(24px) saturate(170%);
  backdrop-filter: blur(24px) saturate(170%);
  box-shadow: var(--lg-edge), var(--lg-shadow);
  overflow: clip;
  container-type: inline-size;
}
.glass::before { /* light bending at the rim: brighter top-left, darker bottom-right */
  content: ""; position: absolute; inset: 0; z-index: -1; border-radius: inherit; pointer-events: none;
  background:
    radial-gradient(60% 40% at 15% 0%, rgba(255, 255, 255, 0.75), transparent 70%),
    radial-gradient(50% 35% at 100% 100%, rgba(15, 23, 42, 0.07), transparent 70%);
}
.glass::after { /* the faint rainbow caustic on the bottom edge (WWDC25) */
  content: ""; position: absolute; left: 18%; right: 18%; bottom: 0; height: 2px; pointer-events: none;
  background: linear-gradient(90deg, transparent, #ffb3d9 20%, #b3ecff 45%, #fff3b3 70%, transparent);
  opacity: 0.55; filter: blur(0.5px);
}
@media (max-width: 480px) { .glass { padding: var(--s5) var(--s4); border-radius: 32px; } }
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) { .glass { background: #f4f5f7; } }

/* A small glass bubble (chips, slots, round buttons) */
.bubble {
  background: var(--lg-bubble);
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.9), inset 0 0 0 1px rgba(255, 255, 255, 0.5), 0 1px 2px rgba(15, 23, 42, 0.06);
}

/* ---------- Press feel: shrink fast, spring back (Apple-like) ---------- */
.press { transition: transform 420ms var(--spring), background-color 200ms var(--ease), box-shadow 200ms var(--ease), color 200ms; }
.press:active:not(:disabled) { transform: scale(0.95); transition-duration: 90ms; transition-timing-function: var(--ease); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s2);
  min-height: 52px; padding: 0 var(--s5); border: 0; border-radius: var(--r-pill);
  font-weight: 600; font-size: var(--t-md); text-decoration: none; white-space: nowrap;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--ink); color: #fff; box-shadow: 0 12px 28px -12px rgba(15, 23, 42, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.18); }
.btn-primary:hover:not(:disabled) { background: #1e293b; }
.btn-glass { background: var(--lg-bubble); color: var(--ink); box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.9), inset 0 0 0 1px rgba(255, 255, 255, 0.55), var(--bubble-shadow); }
.btn-glass:hover:not(:disabled) { background: var(--lg-bubble-hover); }
.btn-danger { background: transparent; color: var(--danger); box-shadow: inset 0 0 0 1.5px currentColor; }
.btn-block { width: 100%; }
.icon-btn { display: inline-grid; place-items: center; width: 52px; height: 52px; border: 0; border-radius: 50%; color: var(--ink); flex: none; }
.icon-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.icon { width: 22px; height: 22px; flex: none; }

/* ---------- Segmented controls with a sliding "liquid" thumb ---------- */
.seg { position: relative; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; padding: 6px; border-radius: 22px; background: rgba(15, 23, 42, 0.06); box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.08); }
.seg button { position: relative; z-index: 1; min-height: 48px; padding: 0 var(--s4); border: 0; border-radius: var(--r-control); background: transparent; color: var(--ink-2); font-weight: 500; }
.seg button[aria-pressed="true"] { color: var(--ink); font-weight: 700; }
.seg .thumb { position: absolute; z-index: 0; top: 0; left: 0; border-radius: var(--r-control); background: #fff; box-shadow: var(--bubble-shadow), inset 0 1px 0 #fff; pointer-events: none; }

/* Service chips: wrap onto a second line instead of hiding options */
.chips { display: flex; flex-wrap: wrap; gap: var(--s1); }
.chips button { flex: 1 1 auto; display: grid; justify-items: center; line-height: 20px; padding: var(--s2) var(--s3); min-height: 56px; }
.chips .meta { font-size: var(--t-xs); font-weight: 500; color: var(--ink-3); }

.top-row { display: grid; grid-template-columns: 1fr auto; gap: var(--s3); align-items: center; }

/* ---------- Big date with a rolling number ---------- */
.big-date { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s4); font-size: clamp(44px, 15.5cqi, 96px); /* sized to the card, so "Septiembre 30" always fits */ line-height: 1; font-weight: 500; letter-spacing: -0.045em; margin-top: var(--s5); }
.big-date .num { display: inline-grid; overflow: hidden; font-weight: 400; font-variant-numeric: tabular-nums; }
.big-date .num > span { grid-area: 1 / 1; }
.sub-date { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); color: var(--ink-2); font-weight: 500; }

/* ---------- Curved week strip ---------- */
.strip { position: relative; display: grid; grid-template-columns: repeat(7, 1fr); margin: var(--s3) calc(-1 * var(--s4)) 0; padding-top: var(--s3); }
.strip::before { /* the glass arc behind the numbers */
  content: ""; position: absolute; left: -10%; right: -10%; top: 50px; height: 96px; z-index: -1;
  border-radius: 50% 50% 50% 50% / 48px 48px 48px 48px;
  background: linear-gradient(rgba(255, 255, 255, 0.55), rgba(255, 255, 255, 0.15));
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.95), inset 0 -1px 1px rgba(15, 23, 42, 0.05);
}
.day { --lift: 0px; position: relative; display: grid; justify-items: center; gap: var(--s2); min-height: 116px; padding: var(--s1) 0; border: 0; background: none; transform: translateY(var(--lift)); }
.day .dname { font-size: var(--t-sm); line-height: 20px; font-weight: 500; color: var(--ink-2); }
.day .dnum { position: relative; display: grid; place-items: center; width: 52px; height: 52px; border-radius: 50%; font-size: var(--t-lg); font-weight: 500; font-variant-numeric: tabular-nums; transition: transform 420ms var(--spring), background-color 200ms, color 200ms; }
.day:active:not(:disabled) .dnum { transform: scale(0.9); transition-duration: 90ms; }
.day[aria-pressed="true"] .dnum { background: var(--ink); color: #fff; font-size: var(--t-xl); font-weight: 700; box-shadow: 0 12px 24px -10px rgba(15, 23, 42, 0.7); }
.day:disabled { cursor: not-allowed; }
.day:disabled .dnum { color: var(--ink-3); text-decoration: line-through; text-decoration-thickness: 1.5px; }
.day.edge { opacity: 0.7; } /* still ≥ 4.5:1 — 0.45 dropped below */
.day:nth-child(1), .day:nth-child(7) { --lift: 30px; }
.day:nth-child(2), .day:nth-child(6) { --lift: 12px; }
.day:nth-child(3), .day:nth-child(5) { --lift: 3px; }
@media (max-width: 420px) {
  .day .dnum { width: 44px; height: 44px; font-size: var(--t-md); }
  .day[aria-pressed="true"] .dnum { font-size: var(--t-lg); }
}

/* The green "libre" dot, on days, barbers and hours */
.dot-free { position: absolute; top: -2px; right: -2px; width: 12px; height: 12px; border-radius: 50%; background: var(--free); box-shadow: 0 0 0 2.5px rgba(255, 255, 255, 0.95); animation: dot-in 360ms var(--spring) both; }
@keyframes dot-in { from { transform: scale(0); } }

/* ---------- Month grid ---------- */
.month-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s2); margin-top: var(--s4); }
.month-title { font-size: var(--t-lg); line-height: 28px; font-weight: 600; }
.month-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: var(--s1); text-align: center; margin-top: var(--s2); }
.month-grid .wd { font-size: var(--t-xs); line-height: 32px; font-weight: 600; color: var(--ink-3); }
.month-grid button { position: relative; aspect-ratio: 1; min-height: 44px; border: 0; border-radius: 50%; background: transparent; font-weight: 500; font-variant-numeric: tabular-nums; }
.month-grid button:hover:not(:disabled) { background: var(--lg-bubble); }
.month-grid button[aria-pressed="true"] { background: var(--ink); color: #fff; font-weight: 700; }
.month-grid button:disabled { color: var(--ink-3); text-decoration: line-through; cursor: not-allowed; }
.month-grid .dot-free { top: 2px; right: 4px; width: 9px; height: 9px; }

/* ---------- Sections inside the card ---------- */
.section { margin-top: var(--s5); padding-top: var(--s5); border-top: 1px solid rgba(255, 255, 255, 0.7); box-shadow: 0 -1px 0 rgba(15, 23, 42, 0.05); }
.section-label { display: flex; align-items: center; justify-content: space-between; gap: var(--s2); margin-bottom: var(--s3); font-size: var(--t-sm); line-height: 24px; font-weight: 600; color: var(--ink-2); }
.legend { display: inline-flex; align-items: center; gap: var(--s2); font-weight: 500; color: var(--ink-3); }
.legend i { width: 9px; height: 9px; border-radius: 50%; background: var(--free); }
.hint-box { padding: var(--s4); border-radius: var(--r-box); text-align: center; color: var(--ink-2); }

/* Barbers row */
.people { display: flex; gap: var(--s2); overflow-x: auto; scrollbar-width: none; padding: var(--s1) var(--s1) var(--s2); margin: 0 calc(-1 * var(--s1)); }
.people::-webkit-scrollbar { display: none; }
.person { flex: none; display: grid; justify-items: center; gap: var(--s1); width: 84px; padding: var(--s2) var(--s1); border: 0; border-radius: var(--r-box); background: transparent; }
.person:hover:not(:disabled) { background: rgba(255, 255, 255, 0.4); }
.person[aria-pressed="true"] { background: #fff; box-shadow: var(--bubble-shadow); }
.person .avatar-wrap { position: relative; }
.person .name { font-weight: 600; font-size: var(--t-sm); line-height: 20px; }
.person .state { font-size: var(--t-xs); line-height: 16px; color: var(--ink-3); }
.person.off .avatar { filter: grayscale(1); opacity: 0.5; }
.avatar { width: 52px; height: 52px; border-radius: 50%; object-fit: cover; display: grid; place-items: center; font-weight: 700; color: #fff; background: linear-gradient(150deg, #8b97aa, #56667f); box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.4); }

/* Hours */
.slot-group + .slot-group { margin-top: var(--s4); }
.slot-group h3 { font-size: var(--t-xs); line-height: 16px; letter-spacing: 0.06em; text-transform: uppercase; font-weight: 600; color: var(--ink-3); margin-bottom: var(--s2); }
.slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: var(--s2); }
.slot { position: relative; min-height: 48px; border: 0; border-radius: var(--r-control); font-weight: 600; font-variant-numeric: tabular-nums; }
.slot:hover:not(:disabled) { background: var(--lg-bubble-hover); }
.slot[aria-pressed="true"] { background: var(--ink); color: #fff; box-shadow: 0 10px 22px -10px rgba(15, 23, 42, 0.7); }
.slot:disabled { background: transparent; box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.08); color: var(--ink-3); text-decoration: line-through; cursor: not-allowed; font-weight: 400; }
.slot .dot-free { top: -3px; right: -3px; width: 10px; height: 10px; }

/* Booking footer: like the reference's "Add a note…  + New Event" */
.foot { margin-top: var(--s5); padding-top: var(--s4); border-top: 1px solid rgba(255, 255, 255, 0.7); }
.foot-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s3); }
.summary { font-weight: 600; }
.summary .muted { display: block; font-weight: 400; font-size: var(--t-sm); line-height: 20px; }
.ghost-input { flex: 1 1 160px; display: flex; align-items: center; gap: var(--s2); min-height: 52px; padding: 0 var(--s4); border-radius: var(--r-pill); }
.ghost-input input { flex: 1; min-width: 0; border: 0; background: transparent; font-size: var(--t-md); min-height: 48px; }
.ghost-input input:focus { outline: none; }
.ghost-input:focus-within { box-shadow: 0 0 0 3px rgba(47, 79, 134, 0.35), inset 0 1px 1px #fff; }
.ghost-input[data-invalid="true"] { box-shadow: 0 0 0 2px var(--danger); }
.ghost-input .icon { color: var(--ink-3); }
.field-error { color: var(--danger); font-size: var(--t-sm); line-height: 20px; font-weight: 500; margin-top: var(--s2); }
.field-error:empty { display: none; }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

/* ---------- Alerts / toast / misc ---------- */
.alert { display: flex; gap: var(--s3); align-items: flex-start; padding: var(--s4); border-radius: var(--r-control); background: rgba(253, 236, 234, 0.9); color: var(--danger); font-weight: 500; }
.alert.info { background: rgba(232, 238, 248, 0.9); color: var(--accent); }
.alert.ok { background: rgba(230, 244, 236, 0.9); color: var(--ok); }
.my-booking { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2); padding: var(--s2) var(--s4); border-radius: var(--r-pill); font-size: var(--t-sm); font-weight: 500; margin-bottom: var(--s4); }
.my-booking a { font-weight: 700; color: var(--ink); }
.toast-host { position: fixed; left: 50%; bottom: var(--s5); transform: translateX(-50%); z-index: 50; display: grid; gap: var(--s2); width: min(100% - 32px, 420px); }
.toast { padding: var(--s3) var(--s5); border-radius: var(--r-pill); background: var(--ink); color: #fff; text-align: center; animation: rise 320ms var(--spring); }
.spinner { width: 20px; height: 20px; border-radius: 50%; border: 2.5px solid currentColor; border-right-color: transparent; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes rise { from { opacity: 0; transform: translateY(10px) scale(0.98); } }
.rise { animation: rise 420ms var(--spring) both; }

/* Confirmation */
.done { text-align: center; display: grid; gap: var(--s4); justify-items: center; }
.done .check { width: 76px; height: 76px; border-radius: 50%; display: grid; place-items: center; background: var(--ink); color: #fff; box-shadow: 0 16px 32px -14px rgba(15, 23, 42, 0.7); animation: pop 520ms var(--spring); }
.done .check .icon { width: 36px; height: 36px; stroke-width: 2.5; }
@keyframes pop { from { transform: scale(0.4); opacity: 0; } }
.detail-list { display: grid; margin: 0; width: 100%; text-align: left; }
.detail-list div { display: flex; justify-content: space-between; gap: var(--s4); padding: var(--s3) 0; border-bottom: 1px solid rgba(255, 255, 255, 0.7); box-shadow: 0 1px 0 rgba(15, 23, 42, 0.05); }
.detail-list dt { color: var(--ink-2); }
.detail-list dd { margin: 0; font-weight: 600; text-align: right; }
.actions { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--s3); }

/* Spark lines (tap feedback) */
.spark { position: fixed; z-index: 100; width: 2px; height: 9px; border-radius: 2px; background: var(--ink); pointer-events: none; transform-origin: 50% 100%; }

/* "Reduce transparency" / "Increase contrast" on the phone: solid glass, firmer edges */
@media (prefers-reduced-transparency: reduce), (prefers-contrast: more) {
  .glass, .dlg { background: #f4f5f7; -webkit-backdrop-filter: none; backdrop-filter: none; }
  .bubble, .btn-glass, .seg { background: #fff; box-shadow: inset 0 0 0 1.5px rgba(15, 23, 42, 0.35); }
  .day.edge { opacity: 1; }
  body::before { display: none; }
}

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