/* base.css — shared design tokens + reset + shared layout/components.
   Ported from the demo (MKD-Vibes-Demo-Site-Brief). Portal-specific tokens
   live in tokens-men.css / tokens-ladies.css and are scoped by
   html[data-portal]. This file always loads. */

/* ============================================================
   Shared tokens
   ============================================================ */
:root {
  --transition-fast: 160ms cubic-bezier(.2,.7,.2,1);
  --transition: 240ms cubic-bezier(.2,.7,.2,1);
  --transition-slow: 520ms cubic-bezier(.22,.61,.36,1);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

/* Splash / portal-less pages get a neutral, dark canvas. */
html:not([data-portal]) {
  --bg:#0B0C10;
  --surface:#15171C;
  --surface-2:#1F242D;
  --line:#2A2F38;
  --text:#F4F6FA;
  --text-muted:#9AA4B2;
  --accent:#3E82FF;
  --accent-press:#2E6BE0;
  --gold:#C8A24A;
  --success:#34C77B;
  --danger:#FF5A5F;
  --radius:14px;
  --radius-lg:22px;
  --shadow:0 14px 40px rgba(0,0,0,.5);
  --ring:0 0 0 3px rgba(62,130,255,.35);
  --font-head-latin: "Sora", system-ui, sans-serif;
  --font-head-ar: "Cairo", system-ui, sans-serif;
  --font-body: "IBM Plex Sans Arabic", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, monospace;
  --head-weight: 800;
  --head-track: -0.02em;
  --motion: var(--transition);
}
html:not([data-portal])[lang="ar"] {
  --font-head-latin: "Cairo", system-ui, sans-serif;
}

/* ============================================================
   Reset
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { -webkit-tap-highlight-color: transparent; }
body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img { max-width: 100%; display: block; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
a { color: inherit; text-decoration: none; }
input, select, textarea { font: inherit; color: inherit; }

h1, h2, h3, h4 {
  font-family: var(--font-head-latin);
  font-weight: var(--head-weight);
  letter-spacing: var(--head-track);
  margin: 0;
  line-height: 1.15;
}
h1 { font-size: clamp(28px, 7vw, 40px); }
h2 { font-size: clamp(22px, 5vw, 28px); }
h3 { font-size: 18px; }
p  { margin: 0; }

/* ============================================================
   App shell
   ============================================================ */
#app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding-top: var(--safe-top);
  padding-bottom: calc(var(--safe-bottom) + 32px);
}

.app-header {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  background: color-mix(in oklab, var(--bg) 85%, transparent);
  backdrop-filter: saturate(140%) blur(14px);
  -webkit-backdrop-filter: saturate(140%) blur(14px);
  border-bottom: 1px solid var(--line);
}
.app-header .brand {
  font-family: var(--font-head-latin);
  font-weight: var(--head-weight);
  letter-spacing: var(--head-track);
  font-size: 17px;
  display: flex; align-items: center; gap: 8px;
}
.app-header .brand .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 14px var(--accent);
}
.app-header .header-actions { display: flex; align-items: center; gap: 8px; }

.icon-btn {
  width: 38px; height: 38px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  transition: transform var(--motion), background var(--motion), border-color var(--motion);
}
.icon-btn:hover { background: var(--surface-2); }
.icon-btn:active { transform: scale(.96); }
.icon-btn[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); }

.lang-toggle {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.lang-toggle .pip { opacity: .45; }
.lang-toggle .pip.active { opacity: 1; color: var(--accent); }

.view {
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: 22px 18px 24px;
  flex: 1;
}

.section { margin-top: 22px; }
.section-title {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  margin: 0 0 12px;
}
.section-title h2 { font-size: 20px; }
.section-title .more {
  font-size: 12px; color: var(--text-muted);
  font-family: var(--font-mono); letter-spacing: .05em; text-transform: uppercase;
}

/* ============================================================
   Buttons
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 52px;
  padding: 0 22px;
  border-radius: var(--radius);
  font-family: var(--font-head-latin);
  font-weight: 700;
  letter-spacing: var(--head-track);
  font-size: 15px;
  background: var(--accent);
  color: #fff;
  transition: transform var(--motion), background var(--motion), box-shadow var(--motion);
  width: 100%;
}
.btn:hover { background: var(--accent-press); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: none; box-shadow: var(--ring); }
.btn--ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--line);
}
.btn--ghost:hover { background: var(--surface-2); }
.btn--gold { background: var(--gold); color: #1A1407; }
.btn--gold:hover { filter: brightness(.96); }
.btn--inline { width: auto; }
.btn--sm { height: 38px; padding: 0 14px; font-size: 13px; border-radius: 999px; }

/* ============================================================
   Card
   ============================================================ */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 16px;
  transition: transform var(--motion), border-color var(--motion), box-shadow var(--motion);
}
.card.is-link { cursor: pointer; }
.card.is-link:hover { border-color: color-mix(in oklab, var(--accent) 40%, var(--line)); }
.card.is-link:active { transform: scale(.99); }

/* ============================================================
   Chips & pills
   ============================================================ */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  font-size: 12.5px;
  color: var(--text-muted);
  transition: all var(--motion);
}
.chip.is-active { border-color: var(--accent); color: var(--accent); background: color-mix(in oklab, var(--accent) 12%, var(--surface)); }
.chip--gold { color: var(--gold); border-color: color-mix(in oklab, var(--gold) 60%, var(--line)); }
.chip--success { color: var(--success); border-color: color-mix(in oklab, var(--success) 50%, var(--line)); }
.chip--mono { font-family: var(--font-mono); letter-spacing: .04em; }
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }

/* ============================================================
   Stepper
   ============================================================ */
.stepper {
  display: flex; align-items: center; gap: 6px;
  margin: 0 0 10px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.stepper .step { display: inline-flex; align-items: center; gap: 6px; }
.stepper .pip { width: 18px; height: 2px; background: var(--line); border-radius: 2px; }
.stepper .step.is-done .pip,
.stepper .step.is-current .pip { background: var(--accent); }
.stepper .step.is-current { color: var(--text); }

/* ============================================================
   Slot grid + day strip
   ============================================================ */
.slot-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.slot {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 12px 6px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--surface);
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: .02em;
  transition: all var(--motion);
}
.slot .tag { display: block; margin-top: 4px; font-size: 9.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--gold); }
.slot:hover { border-color: var(--accent); }
.slot.is-busy { opacity: .35; text-decoration: line-through; pointer-events: none; }
.slot.is-selected { background: var(--accent); color: #fff; border-color: var(--accent); }
.slot.is-selected .tag { color: rgba(255,255,255,.85); }

.day-strip {
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 8px;
  overflow-x: auto; scrollbar-width: none; padding-bottom: 4px;
}
.day-strip::-webkit-scrollbar { display: none; }
.day {
  display: flex; flex-direction: column; align-items: center;
  padding: 10px 6px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--surface);
  text-align: center;
  font-family: var(--font-mono);
  transition: all var(--motion);
}
.day .dow { font-size: 10.5px; text-transform: uppercase; letter-spacing: .12em; color: var(--text-muted); }
.day .num { font-size: 20px; font-weight: 600; margin-top: 4px; }
.day.is-selected { background: var(--accent); color: #fff; border-color: var(--accent); }
.day.is-selected .dow { color: rgba(255,255,255,.8); }

/* ============================================================
   Sheet (bottom modal)
   ============================================================ */
.sheet-backdrop {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(0,0,0,.55);
  opacity: 0; pointer-events: none;
  transition: opacity var(--motion);
}
.sheet-backdrop.is-open { opacity: 1; pointer-events: auto; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 61;
  background: var(--surface);
  border-top-left-radius: var(--radius-lg);
  border-top-right-radius: var(--radius-lg);
  border: 1px solid var(--line);
  border-bottom: none;
  padding: 18px 18px calc(28px + var(--safe-bottom));
  transform: translateY(100%);
  transition: transform var(--motion);
  max-height: 86vh;
  overflow-y: auto;
}
.sheet.is-open { transform: translateY(0); }
.sheet .handle { width: 38px; height: 4px; border-radius: 99px; background: var(--line); margin: -4px auto 12px; }

/* ============================================================
   Toast
   ============================================================ */
.toast-stack {
  position: fixed; left: 0; right: 0; top: calc(var(--safe-top) + 12px);
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  z-index: 100; pointer-events: none;
}
.toast {
  pointer-events: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 10px 14px 10px 12px;
  border-radius: 999px;
  font-size: 13.5px;
  display: inline-flex; align-items: center; gap: 8px;
  box-shadow: var(--shadow);
  transform: translateY(-10px) scale(.98);
  opacity: 0;
  transition: all var(--motion);
}
.toast.is-on { transform: none; opacity: 1; }
.toast .ic { color: var(--success); }

/* ============================================================
   Motion — staggered reveals
   ============================================================ */
@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}
.view > * { animation: rise var(--motion) both; }
.view > *:nth-child(1) { animation-delay: 20ms; }
.view > *:nth-child(2) { animation-delay: 80ms; }
.view > *:nth-child(3) { animation-delay: 140ms; }
.view > *:nth-child(4) { animation-delay: 200ms; }
.view > *:nth-child(5) { animation-delay: 260ms; }
.view > *:nth-child(6) { animation-delay: 320ms; }
.view > *:nth-child(7) { animation-delay: 380ms; }
.view > *:nth-child(n+8) { animation-delay: 440ms; }

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

/* ============================================================
   Utility
   ============================================================ */
.muted { color: var(--text-muted); }
.mono { font-family: var(--font-mono); }
.row  { display: flex; align-items: center; gap: 10px; }
.row.spread { justify-content: space-between; }
.stack > * + * { margin-top: 12px; }
.stack-lg > * + * { margin-top: 20px; }
.hide { display: none !important; }
[hidden] { display: none !important; }

.field {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.field input { flex: 1; background: transparent; border: 0; outline: none; font-family: var(--font-mono); letter-spacing: .04em; }
.field:focus-within { box-shadow: var(--ring); border-color: var(--accent); }

.action-bar {
  position: sticky; bottom: 0; z-index: 20;
  margin: 20px -18px -24px;
  padding: 14px 18px calc(20px + var(--safe-bottom));
  background: linear-gradient(180deg, transparent 0%, var(--bg) 30%, var(--bg) 100%);
  border-top: 1px solid var(--line);
}

/* RTL tweaks */
html[dir="rtl"] .stepper { direction: rtl; }
html[dir="rtl"] .day-strip { direction: rtl; }

.noscript-note { padding: 12px 18px; background: var(--surface); color: var(--text-muted); font-size: 13px; text-align: center; }

/* Error pages */
.error-page { text-align: center; padding: 40px 0; }
.error-page h1 { font-size: clamp(48px, 16vw, 88px); color: var(--text-muted); letter-spacing: .04em; }
.error-page p { margin: 8px 0 20px; }
.error-page .btn { margin-inline: auto; }

/* ============================================================
   Splash
   ============================================================ */
.view--splash {
  padding: 12px 18px 24px;
  min-height: calc(100vh - 70px);
  display: flex;
  flex-direction: column;
  gap: 22px;
}
.splash-head { text-align: center; padding: 18px 0 4px; }
.splash-eyebrow { font-size: 11px; letter-spacing: .32em; color: var(--accent); margin-bottom: 18px; }
.splash-title { font-family: var(--font-head-latin); font-weight: 800; font-size: clamp(32px, 9vw, 44px); letter-spacing: -.02em; line-height: 1.05; }
.splash-sub { margin-top: 12px; color: var(--text-muted); font-size: 14.5px; max-width: 30ch; margin-inline: auto; }

.splash-portals { display: grid; gap: 14px; flex: 1; grid-template-columns: 1fr; grid-auto-rows: 1fr; min-height: 60vh; }
@media (min-width: 720px) { .splash-portals { grid-template-columns: 1fr 1fr; } }

.portal-card {
  position: relative;
  border-radius: 28px;
  padding: 26px 22px;
  border: 1px solid var(--line);
  text-align: start;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 240px;
  cursor: pointer;
  transition: transform 240ms cubic-bezier(.2,.7,.2,1), box-shadow 240ms;
}
.portal-card:hover { transform: translateY(-2px); }
.portal-card:active { transform: translateY(0); }
.portal-card .portal-eyebrow { font-size: 11px; letter-spacing: .28em; text-transform: uppercase; opacity: .8; }
.portal-card .portal-title { font-family: var(--font-head-latin); font-weight: 800; font-size: clamp(22px, 5.4vw, 30px); letter-spacing: -.02em; margin-top: 10px; }
.portal-card .portal-cta { margin-top: 22px; display: inline-flex; align-items: center; gap: 8px; font-family: var(--font-mono); font-size: 12.5px; letter-spacing: .14em; text-transform: uppercase; }
.portal-card .portal-cta .ic { display: inline-flex; width: 30px; height: 30px; border-radius: 999px; align-items: center; justify-content: center; border: 1px solid currentColor; }
.portal-card .portal-discreet { position: absolute; inset-block-start: 26px; inset-inline-end: 22px; font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: var(--gold, #C39A4E); opacity: .85; }

/* Men card (always dark, regardless of current portal) */
.portal-card--men {
  background:
    radial-gradient(700px 320px at 100% 0%, rgba(62,130,255,.22), transparent 60%),
    radial-gradient(600px 320px at 0% 100%, rgba(18,42,77,.55), transparent 55%),
    #0E1014;
  color: #F4F6FA;
  border-color: #232936;
  font-family: "Sora", system-ui, sans-serif;
}
.portal-card--men .portal-eyebrow { color: #3E82FF; }
.portal-card--men::after {
  content: "";
  position: absolute; inset: 0;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 0.05 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
  mix-blend-mode: overlay;
  opacity: .6;
  pointer-events: none;
}

/* Ladies card (always cream, regardless of current portal) */
.portal-card--ladies {
  background: linear-gradient(160deg, #FFFFFF 0%, #FBEBE6 60%, #F4DDE3 100%);
  color: #3A2C30;
  border-color: #EFE0D8;
  font-family: "Fraunces", Georgia, serif;
}
.portal-card--ladies .portal-eyebrow { color: #C39A4E; }
.portal-card--ladies .portal-title { font-weight: 500; font-style: normal; }
.portal-card--ladies::before {
  content: "";
  position: absolute;
  inset: -50% -30% auto auto;
  width: 240px; height: 240px;
  border-radius: 50%;
  border: 1px solid #C39A4E;
  opacity: .35;
  pointer-events: none;
}
