/* ──────────────────────────────────────────────────────────────────────────
   maplesmile · editorial dental landing
   Design tokens — see [data-palette] for runtime swap.
   ────────────────────────────────────────────────────────────────────────── */

:root {
  /* Type */
  --font-display: "Instrument Serif", "Newsreader", Georgia, serif;
  --font-body: "Geist", "Söhne", ui-sans-serif, system-ui, -apple-system, sans-serif;
  --font-mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, monospace;

  /* Default palette: Rosewood & Cream (matches brand mark) */
  --bg: #F4EEE6;
  --bg-elev: #FBF6EE;
  --bg-deep: #ECE3D6;
  --ink: #2B1B22;          /* deep plum-black */
  --ink-soft: #5B4750;
  --ink-mute: #8A7A82;
  --rule: #E2D5C6;
  --brand: #9A5566;        /* rosewood from mark */
  --brand-deep: #6E3B49;
  --brand-soft: #F0DCE0;
  --accent: #C8954A;       /* warm maple */
  --sage: #6F8A6B;
  --ok: #4F7A4A;
  --warn: #C26A3A;
  --err: #B43A3A;
}

[data-palette="snow"] {
  --bg: #FAFAF7;
  --bg-elev: #FFFFFF;
  --bg-deep: #F0EFEA;
  --ink: #14181A;
  --ink-soft: #4C5258;
  --ink-mute: #8A9098;
  --rule: #E6E4DE;
  --brand: #9A5566;
  --brand-deep: #6E3B49;
  --brand-soft: #F4E6E9;
  --accent: #B47A2E;
  --sage: #6F8A6B;
}

[data-palette="forest"] {
  --bg: #F2EEE5;
  --bg-elev: #FAF5EA;
  --bg-deep: #E2DCC9;
  --ink: #131C18;
  --ink-soft: #3A4940;
  --ink-mute: #7A8A80;
  --rule: #D5CFB8;
  --brand: #2C5042;
  --brand-deep: #1B362C;
  --brand-soft: #D6E1D6;
  --accent: #C8954A;
  --sage: #6F8A6B;
}

[data-palette="clinical"] {
  --bg: #F6F7F9;
  --bg-elev: #FFFFFF;
  --bg-deep: #ECEFF3;
  --ink: #0E1726;
  --ink-soft: #3F4A5C;
  --ink-mute: #7C8699;
  --rule: #DBE0E8;
  --brand: #1F3A6B;
  --brand-deep: #122548;
  --brand-soft: #D9E3F2;
  --accent: #B47A2E;
  --sage: #6F8A6B;
}

/* ── Base ───────────────────────────────────────────────────────────────── */

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; }

/* Display type */
.display {
  font-family: var(--font-display);
  font-weight: 400;
  letter-spacing: -0.012em;
  line-height: 1.06;
  padding-bottom: 0.22em;       /* clearance for Instrument Serif italic descenders */
  text-wrap: balance;
}
.display em {
  font-style: italic;
  font-feature-settings: "ss01" on;
  color: var(--brand);
}

.eyebrow {
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-mute);
}

.serif-it { font-family: var(--font-display); font-style: italic; }

/* Layout helpers */
.container {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 32px;
}
.container-wide {
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 32px;
}

.rule { height: 1px; background: var(--rule); width: 100%; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.01em;
  cursor: pointer;
  border: 1px solid transparent;
  transition: transform .15s ease, background .15s ease, color .15s ease, border-color .15s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary {
  background: var(--ink);
  color: var(--bg-elev);
}
.btn-primary:hover { background: var(--brand-deep); }
.btn-ghost {
  background: transparent;
  color: var(--ink);
  border-color: var(--rule);
}
.btn-ghost:hover { border-color: var(--ink); }
.btn-brand {
  background: var(--brand);
  color: #FFF8F0;
}
.btn-brand:hover { background: var(--brand-deep); }

/* Cards */
.card {
  background: var(--bg-elev);
  border: 1px solid var(--rule);
  border-radius: 18px;
}

/* Channels stat tile */
.stat-num {
  font-family: var(--font-display);
  font-size: 56px;
  line-height: 1;
  letter-spacing: -0.02em;
}

/* Nav */
.nav-link {
  font-size: 13.5px;
  color: var(--ink-soft);
  padding: 8px 4px;
  transition: color .15s ease;
  white-space: nowrap;
}
.nav-link:hover { color: var(--ink); }

/* Hero photo placeholder — used when no real photography is available */
.photo-ph {
  background: linear-gradient(135deg, var(--brand-soft) 0%, var(--bg-deep) 60%, var(--accent) 140%);
  position: relative;
  overflow: hidden;
  border-radius: 18px;
}
.photo-ph::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 30% 25%, rgba(255,255,255,.55), transparent 45%),
    radial-gradient(circle at 75% 80%, rgba(110,59,73,.18), transparent 50%);
  mix-blend-mode: screen;
}
.photo-ph .photo-label {
  position: absolute;
  bottom: 14px;
  left: 14px;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(43,27,34,.55);
  background: rgba(251,246,238,.7);
  padding: 6px 10px;
  border-radius: 999px;
  backdrop-filter: blur(8px);
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(28, 18, 22, 0.5);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
  animation: fadeIn .25s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--bg-elev);
  border: 1px solid var(--rule);
  border-radius: 20px;
  width: min(960px, 100%);
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 30px 80px rgba(28,18,22,.32);
  animation: rise .3s cubic-bezier(.2,.7,.2,1);
}
@keyframes rise {
  from { opacity: 0; transform: translateY(16px) scale(.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Tab pill */
.tab-pill {
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink-soft);
  cursor: pointer;
  transition: all .15s ease;
}
.tab-pill:hover { color: var(--ink); }
.tab-pill[data-active="true"] {
  background: var(--ink);
  color: var(--bg-elev);
}

/* Audit trail */
.trail {
  position: relative;
  padding-left: 28px;
}
.trail::before {
  content: "";
  position: absolute;
  left: 8px;
  top: 6px;
  bottom: 6px;
  width: 1px;
  background: var(--rule);
}
.trail-step {
  position: relative;
  padding: 10px 0;
}
.trail-step::before {
  content: "";
  position: absolute;
  left: -24px;
  top: 16px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--bg-elev);
  border: 2px solid var(--brand);
}
.trail-step[data-state="auto"]::before { border-color: var(--sage); }
.trail-step[data-state="model"]::before { border-color: var(--brand); }
.trail-step[data-state="human"]::before { border-color: var(--accent); }

/* Framework chain item */
.fw-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border: 1px solid var(--rule);
  border-radius: 12px;
  background: var(--bg);
  transition: border-color .15s ease;
}
.fw-item:hover { border-color: var(--brand); }
.fw-arrow {
  display: flex;
  justify-content: center;
  color: var(--ink-mute);
  font-size: 14px;
  padding: 2px 0;
}

/* Code-ish chips */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--bg-deep);
  color: var(--ink-soft);
  font-size: 11px;
  font-family: var(--font-mono);
  letter-spacing: 0.01em;
}
.chip-brand { background: var(--brand-soft); color: var(--brand-deep); }
.chip-sage  { background: #E1EAD9; color: #2F4A2A; }
.chip-amber { background: #F5E6CA; color: #6E4715; }

/* Section divider w/ small dot */
.section-mark {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}
.section-mark::before {
  content: "";
  display: block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--brand);
}

/* Subtle marquee for channels */
.channel-cell {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 28px 24px;
  border-right: 1px solid var(--rule);
}
.channel-cell:last-child { border-right: 0; }

/* Persona card */
.persona-card {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 28px;
  background: var(--bg-elev);
  border: 1px solid var(--rule);
  border-radius: 18px;
  transition: transform .2s ease, border-color .2s ease;
}
.persona-card:hover { transform: translateY(-2px); border-color: var(--brand); }

/* Location card */
.location-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 28px;
  background: var(--bg-elev);
  border: 1px solid var(--rule);
  border-radius: 18px;
  min-height: 280px;
}

/* Misc */
.kbd {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--bg-deep);
  border: 1px solid var(--rule);
  border-bottom-width: 2px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-soft);
}

/* Confidence bar */
.conf-bar {
  height: 6px;
  background: var(--bg-deep);
  border-radius: 999px;
  overflow: hidden;
  position: relative;
}
.conf-bar > div {
  height: 100%;
  background: linear-gradient(90deg, var(--sage), var(--brand));
  border-radius: 999px;
}

/* Hero ornamental brand mark backdrop */
.hero-mark-bg {
  position: absolute;
  pointer-events: none;
  opacity: 0.07;
  filter: blur(0.5px);
  z-index: 0;
}

/* ── Live Ops Console (hero right) ───────────────────────────────────────── */

.hero-right {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.liveops {
  background: var(--bg-elev);
  border: 1px solid var(--rule);
  border-radius: 22px;
  padding: 18px 20px 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-shadow: 0 22px 60px -32px rgba(43, 27, 34, 0.22);
  position: relative;
  overflow: hidden;
}
.liveops::before {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: 22px;
  pointer-events: none;
  background: radial-gradient(circle at 90% -10%, var(--brand-soft), transparent 40%);
  opacity: 0.6;
}
.liveops > * { position: relative; z-index: 1; }

.liveops-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.liveops-status { display: flex; align-items: center; gap: 8px; }
.liveops-dot {
  width: 8px; height: 8px; border-radius: 999px;
  background: var(--ok);
  box-shadow: 0 0 0 0 rgba(79, 122, 74, 0.55);
  animation: ops-pulse 1.8s ease-out infinite;
}
@keyframes ops-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(79, 122, 74, 0.55); }
  70%  { box-shadow: 0 0 0 8px rgba(79, 122, 74, 0);  }
  100% { box-shadow: 0 0 0 0 rgba(79, 122, 74, 0);    }
}
.liveops-meta {
  font-size: 11px;
  color: var(--ink-mute);
  display: flex;
  gap: 8px;
  align-items: center;
  font-family: var(--font-mono);
}
.liveops-meta b { color: var(--ink); font-weight: 500; }
.liveops-sep { opacity: 0.4; }

.liveops-section { display: flex; flex-direction: column; gap: 10px; }
.liveops-section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.liveops-tag {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--ink-mute);
  letter-spacing: 0.02em;
}
.liveops-tag-live {
  color: var(--ok);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.liveops-tag-live::before {
  content: "";
  width: 5px; height: 5px; border-radius: 999px; background: var(--ok);
}

.liveops-clinics {
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.liveops-row {
  display: grid;
  grid-template-columns: 80px 1fr 44px;
  align-items: center;
  gap: 10px;
}
.liveops-row-name {
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.liveops-bar {
  height: 5px;
  background: var(--bg-deep);
  border-radius: 999px;
  overflow: hidden;
}
.liveops-bar-fill {
  height: 100%;
  background: var(--brand);
  border-radius: 999px;
  transition: width .9s cubic-bezier(.4,.0,.2,1), background .3s ease;
}
.liveops-row-time {
  font-family: var(--font-mono);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  text-align: right;
  font-weight: 500;
  transition: color .3s ease;
}

.liveops-divider {
  height: 1px;
  background: var(--rule);
  margin: 2px -20px;
}

.liveops-avatar {
  width: 30px; height: 30px;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand-deep);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
  font-size: 13px;
}

.liveops-steps {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.liveops-step {
  display: grid;
  grid-template-columns: 14px 1fr auto auto;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
  font-size: 12.5px;
  color: var(--ink-mute);
  border-bottom: 1px dashed transparent;
  transition: color .3s ease;
}
.liveops-step[data-state="done"]   { color: var(--ink-soft); }
.liveops-step[data-state="active"] { color: var(--ink); }
.liveops-step-marker {
  width: 14px; height: 14px;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--ink-mute);
}
.liveops-step[data-state="done"] .liveops-step-marker {
  background: var(--sage);
  color: #FFF;
  border-radius: 999px;
}
.liveops-step[data-state="active"] .liveops-step-marker { color: var(--brand); }
.liveops-idle-dot {
  width: 6px; height: 6px; border-radius: 999px;
  background: var(--rule);
}
.liveops-spin {
  width: 10px; height: 10px;
  border-radius: 999px;
  border: 1.6px solid var(--brand);
  border-top-color: transparent;
  animation: ops-spin .9s linear infinite;
}
@keyframes ops-spin { to { transform: rotate(360deg); } }
.liveops-step-label { font-weight: 500; }
.liveops-step-detail {
  font-size: 11.5px;
  color: var(--ink-mute);
  font-family: var(--font-mono);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 240px;
}
.liveops-step-dur {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--ink-mute);
  min-width: 28px;
  text-align: right;
}

.liveops-reasoning {
  margin-top: 4px;
  background: var(--bg);
  border: 1px solid var(--rule);
  border-radius: 14px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.liveops-reasoning-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-mute);
}
.liveops-typing {
  display: inline-flex; gap: 3px;
}
.liveops-typing i {
  width: 4px; height: 4px; border-radius: 999px;
  background: var(--brand);
  display: inline-block;
  animation: ops-bounce 1.2s ease-in-out infinite;
}
.liveops-typing i:nth-child(2) { animation-delay: 0.15s; }
.liveops-typing i:nth-child(3) { animation-delay: 0.3s; }
@keyframes ops-bounce {
  0%, 80%, 100% { opacity: 0.3; transform: translateY(0); }
  40%           { opacity: 1;   transform: translateY(-3px); }
}
.liveops-reasoning-text {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 15px;
  line-height: 1.4;
  color: var(--ink);
  animation: ops-fade-in .5s ease;
}
@keyframes ops-fade-in {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.liveops-why {
  align-self: flex-start;
  margin-top: 4px;
  font-size: 13px;
  padding: 10px 16px;
}

/* Hero mini cards (phone + onboarding) */
.hero-right-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.hero-mini {
  padding: 18px 20px;
  border-radius: 18px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 16px;
  min-height: 150px;
  text-decoration: none;
  transition: transform .18s ease, border-color .18s ease;
  border: 1px solid transparent;
}
.hero-mini:hover { transform: translateY(-2px); }
.hero-mini-dark {
  background: var(--ink);
  color: var(--bg);
}
.hero-mini-light {
  background: var(--bg-elev);
  border-color: var(--rule);
  color: var(--ink);
}
.hero-mini-light:hover { border-color: var(--brand); }

/* ── Contact section ─────────────────────────────────────────────────────── */

.contact-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 40px;
  margin-bottom: 40px;
  flex-wrap: wrap;
}
.contact-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}
.contact-card {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 22px 24px;
  background: var(--bg-elev);
  border: 1px solid var(--rule);
  border-radius: 18px;
  color: var(--ink);
  text-decoration: none;
  transition: border-color .18s ease, transform .18s ease, background .18s ease;
}
.contact-card:hover {
  border-color: var(--brand);
  transform: translateY(-2px);
  background: var(--bg);
}
.contact-card:hover .contact-arrow { transform: translateX(3px); color: var(--brand); }
.contact-glyph {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--brand-soft);
  color: var(--brand-deep);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.contact-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.contact-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
}
.contact-handle {
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--ink-soft);
  letter-spacing: 0.01em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.contact-note { font-size: 11.5px; color: var(--ink-mute); margin-top: 2px; }
.contact-arrow {
  color: var(--ink-mute);
  font-size: 20px;
  flex-shrink: 0;
  transition: transform .18s ease, color .18s ease;
}
.contact-footnote {
  margin-top: 28px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ── Responsive ──────────────────────────────────────────────────────────── */

@media (max-width: 1024px) {
  .container, .container-wide { padding: 0 24px; }
  .contact-grid { grid-template-columns: repeat(2, 1fr); }
  .channels-grid { grid-template-columns: repeat(5, 1fr); }
  /* Drop phone link from nav (redundant w/ CTA); shorten Privacy label */
  .nav-links a[href^="tel:"] { display: none; }
  .nav-cta-secondary { display: none; }
}

@media (max-width: 860px) {
  .container, .container-wide { padding: 0 20px; }

  /* Nav: drop link bar + secondary CTA */
  .nav-links { display: none !important; }
  .nav-cta-secondary { display: none !important; }
  .nav-row { padding: 12px 20px !important; }

  /* Hero */
  .hero-grid { grid-template-columns: 1fr !important; gap: 36px !important; align-items: start !important; }
  .hero-stats { gap: 28px !important; margin-top: 40px !important; }
  .hero-stats .stat-num { font-size: 44px !important; }

  /* Sections */
  .aria-grid,
  .trust-grid,
  .locations-grid { grid-template-columns: 1fr !important; gap: 32px !important; }

  .location-detail-inner { grid-template-columns: 1fr !important; gap: 20px !important; }

  .care-grid,
  .personas-grid { grid-template-columns: 1fr !important; }

  .channels-grid { grid-template-columns: repeat(2, 1fr) !important; }
  .channels-grid .channel-cell {
    border-right: 1px solid var(--rule);
    border-bottom: 1px solid var(--rule);
  }
  .channels-grid .channel-cell:nth-child(2n) { border-right: none; }
  .channels-grid .channel-cell:nth-last-child(-n+2) { border-bottom: none; }
  .channels-grid .channel-cell:last-child:nth-child(odd) {
    grid-column: span 2;
    border-right: none;
  }

  .contact-grid { grid-template-columns: 1fr !important; }
  .contact-head { gap: 18px; margin-bottom: 28px; }

  .footer-grid { grid-template-columns: 1fr 1fr !important; gap: 28px !important; }
  .footer-bottom { flex-direction: column; align-items: flex-start; gap: 8px; }

  /* Section padding */
  section { padding-left: 0 !important; padding-right: 0 !important; }
  section[id] { padding-top: 72px !important; padding-bottom: 72px !important; }

  /* Modal */
  .modal { max-height: 92vh; }
  .modal-summary { grid-template-columns: repeat(2, 1fr) !important; }
  .art13-grid { grid-template-columns: 1fr !important; }
  .modal > div:first-child { padding: 18px 20px 0 !important; }
  .modal > div:nth-child(2) { padding: 16px 20px 20px !important; }
  .modal > div:last-child { padding: 12px 20px !important; flex-wrap: wrap; gap: 8px; }

  /* Trail step chips can wrap their timestamp */
  .trail-step .chip { min-width: auto !important; }
}

@media (max-width: 560px) {
  .container, .container-wide { padding: 0 16px; }

  .channels-grid { grid-template-columns: 1fr !important; }
  .channels-grid .channel-cell {
    border-right: none !important;
    border-bottom: 1px solid var(--rule);
  }
  .channels-grid .channel-cell:last-child { border-bottom: none; }

  .footer-grid { grid-template-columns: 1fr !important; }

  .hero-stats { gap: 20px !important; }
  .hero-stats .stat-num { font-size: 36px !important; }

  /* Decision card chat header — let phone number wrap nicely */
  .contact-card { padding: 18px 18px; gap: 14px; }
  .contact-glyph { width: 38px; height: 38px; border-radius: 10px; }

  /* Persona cards: tighten */
  .persona-card { padding: 22px !important; }
  .location-card { padding: 22px !important; }

  /* Reduce display font on smallest screens via clamp already, but ensure modal title is sane */
  .modal .display { font-size: 22px !important; }
}
