/* ============================================
   Dr. Karam S3 Hub — Prototype Styles
   ============================================ */

/* --- Reset & Base --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* Brand palette — matched to drkaram.com */
  --black: #111111;
  --white: #FFFFFF;
  --off-white: #f9f9f9;
  --deep-gray: #f2f2f2;
  --light-gray: #d9d9d9;
  --gray: #838383;
  --midnight: #1a1a1a;
  --dark-gray: #505050;
  --neutrals-cream: #f9f9f9;
  --white-20: rgba(0,0,0,0.06);

  /* Semantic aliases — light theme */
  --karam-dark: var(--off-white);
  --karam-darker: var(--off-white);
  --karam-card-dark: var(--deep-gray);
  --karam-warm: #e8e0d8;
  --karam-text: var(--black);
  --karam-text-muted: var(--gray);
  --karam-text-body: var(--dark-gray);
  --karam-border: var(--light-gray);
  --karam-accent: var(--black);
  --karam-star: #111111;
  --karam-tag-bg: var(--white);
  --karam-tag-border: rgba(0,0,0,0.15);
  --karam-gold: #111111;
  --karam-gold-light: #505050;

  /* Placeholder photo tones (light neutrals) */
  --ph-warm-1: #e8e0d8;
  --ph-warm-2: #ddd5cd;
  --ph-warm-3: #d6cec6;
  --ph-warm-4: #e2dad2;
  --ph-warm-5: #d9d1c9;
  --ph-skin-1: #c9bfb5;
  --ph-skin-2: #bdb3a9;
  --ph-skin-3: #d1c7bd;
  --ph-skin-4: #d8cec4;
  --ph-skin-5: #b3a99f;
  --ph-skin-6: #c5bbb1;

  /* Layout */
  --hub-max-width: 100%;
  --header-height: 56px;
  --bottom-nav-height: 60px;
  --grid-gap: 2px;
  --card-radius: 0px;
  --chip-radius: 20px;

  /* Typography — Google Fonts stand-ins for brand fonts
     Production: minerva-modern + proxima-nova (Adobe Fonts, domain-locked)
     Prototype:  Playfair Display + DM Sans (closest Google Fonts matches) */
  --font-display: 'Playfair Display', 'Didot', Georgia, serif;
  --font-body: 'DM Sans', 'system-ui', -apple-system, 'Helvetica Neue', sans-serif;
  --font-heading: var(--font-display);

  /* Figma type scale */
  --fs-xs: 12px;
  --fs-sm: 17px;
  --fs-med: 17px;
  --fs-lg: 21px;
  --fs-xl: 28px;
  --fs-2xl: 48px;
  --fs-3xl: 75px;
  --fs-4xl: 85px;
  --lh-xs: 16px;
  --lh-sm: 30px;
  --lh-med: 36px;
  --lh-lg: 55px;
  --lh-xl: 68px;
  --lh-2xl: 76px;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-body);
  background: var(--off-white);
  color: var(--black);
  min-height: 100dvh;
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }
img, video { display: block; max-width: 100%; height: auto; }
button { font: inherit; cursor: pointer; border: none; background: none; color: inherit; }
ul, ol { list-style: none; }

/* --- App Shell --- */
.app {
  max-width: 430px;
  margin: 0 auto;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  position: relative;
}

/* --- Sticky Header --- */
.hub-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--white);
  padding: 12px 16px 0;
  border-bottom: 1px solid rgba(0,0,0,0.06);
}

.hub-header__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 44px;
  margin-bottom: 8px;
}

.hub-header__logo {
  font-family: var(--font-display);
  font-size: 15px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--black);
  font-weight: 400;
}

.hub-header__title {
  font-family: var(--font-heading);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 0.3px;
}

.hub-header__actions {
  display: flex;
  gap: 16px;
  align-items: center;
}

.hub-header__action {
  width: 24px;
  height: 24px;
  opacity: 0.7;
  transition: opacity 0.2s;
}

.hub-header__action:hover { opacity: 1; }

/* Patient Avatar Carousel */
.avatar-carousel {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding: 8px 0 12px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.avatar-carousel::-webkit-scrollbar { display: none; }

.avatar-item {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  width: 56px;
}

.avatar-ring {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  padding: 2px;
  background: linear-gradient(135deg, #999, #bbb, #999);
}

.avatar-ring.active {
  background: linear-gradient(135deg, #111, #333, #111);
}

.avatar-img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 2px solid var(--white);
  object-fit: cover;
  background: var(--deep-gray);
}

.avatar-name {
  font-size: 10px;
  color: var(--karam-text-muted);
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 100%;
}

/* Filter Chips */
.filter-chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 0 12px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.filter-chips::-webkit-scrollbar { display: none; }

.chip {
  flex: 0 0 auto;
  padding: 6px 14px;
  border: 1px solid rgba(0,0,0,0.2);
  border-radius: var(--chip-radius);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.3px;
  white-space: nowrap;
  transition: all 0.2s;
  color: var(--dark-gray);
}

.chip:hover {
  border-color: rgba(0,0,0,0.5);
  color: var(--black);
}

.chip.active {
  background: var(--black);
  border-color: var(--black);
  color: var(--white);
  font-weight: 600;
}

.chip.dismissible {
  background: rgba(0,0,0,0.05);
  border-color: rgba(0,0,0,0.15);
  color: var(--black);
}

.chip.dismissible::after {
  content: ' ✕';
  font-size: 10px;
  margin-left: 4px;
}

/* Content Type Tabs (bottom of header) */
.content-tabs {
  display: flex;
  border-bottom: 1px solid rgba(0,0,0,0.1);
}

.content-tab {
  flex: 1;
  padding: 8px 0;
  text-align: center;
  font-size: 12px;
  font-weight: 500;
  color: var(--gray);
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
}

.content-tab:hover { color: var(--black); }

.content-tab.active {
  color: var(--black);
  border-bottom-color: var(--black);
}

/* --- Main Content Area --- */
.hub-content {
  flex: 1;
  padding-bottom: calc(var(--bottom-nav-height) + 16px);
}

/* --- Progressive Disclosure Grid --- */
.hub-grid {
  display: grid;
  gap: var(--grid-gap);
  padding: var(--grid-gap);
}

/* 2-column layout (default) */
.hub-grid.grid-2col {
  grid-template-columns: 1fr 1fr;
}

/* 3-column layout */
.hub-grid.grid-3col {
  grid-template-columns: 1fr 1fr 1fr;
}

/* --- Card Base --- */
.hub-card {
  position: relative;
  overflow: hidden;
  background: var(--white);
  border-radius: var(--card-radius);
  cursor: pointer;
  transition: transform 0.15s ease;
}

.hub-card:active { transform: scale(0.98); }

/* Card size tiers */
.hub-card.size-sm { aspect-ratio: 1 / 1; }       /* 130-195px — grid tile */
.hub-card.size-md { aspect-ratio: 1 / 1; }       /* 390px — full-width square */
.hub-card.size-feed { aspect-ratio: 390 / 546; }  /* Feed — metadata reveal */
.hub-card.size-hero {                              /* Hero — spans full width */
  grid-column: 1 / -1;
  aspect-ratio: 390 / 280;
}
.hub-card.size-full {                              /* Post — full reveal */
  grid-column: 1 / -1;
  aspect-ratio: auto;
}

/* Card image layer */
.hub-card__img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hub-card__overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.7) 0%, rgba(0,0,0,0.1) 50%, transparent 100%);
}

/* Card content positioned at bottom */
.hub-card__body {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 12px;
  z-index: 2;
}

/* --- Testimonial Card --- */
.card-testimonial {
  display: flex;
  flex-direction: column;
}

.card-testimonial .quote-icon {
  font-family: var(--font-display);
  font-size: 36px;
  line-height: 1;
  color: rgba(0,0,0,0.25);
  margin-bottom: 6px;
  opacity: 0.8;
}

.card-testimonial .quote-text {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 14px;
  line-height: 1.4;
  color: var(--black);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Testimonial info row */
.card-testimonial .info-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}

.card-testimonial .info-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid rgba(0,0,0,0.15);
  object-fit: cover;
  background: var(--deep-gray);
  flex-shrink: 0;
}

.card-testimonial .info-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--gray);
}

.card-testimonial .stars {
  display: flex;
  gap: 2px;
  margin-top: 4px;
}

.card-testimonial .star {
  width: 12px;
  height: 12px;
  color: #111;
}

/* Feed-size reveal: date + tags appear */
.card-testimonial .meta-row {
  display: none;
  margin-top: 8px;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}

.size-feed .card-testimonial .meta-row,
.size-full .card-testimonial .meta-row {
  display: flex;
}

.meta-date {
  font-size: 11px;
  font-weight: 600;
  color: var(--karam-text-muted);
}

.meta-tag {
  display: inline-block;
  padding: 3px 8px;
  border: 0.5px solid rgba(0,0,0,0.15);
  border-radius: 4px;
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  background: rgba(0,0,0,0.04);
  color: var(--dark-gray);
}

/* Post-size: full text + CTA */
.card-testimonial .full-text {
  display: none;
  margin-top: 10px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--dark-gray);
}

.size-full .card-testimonial .full-text { display: block; }

.card-testimonial .read-more {
  display: none;
  margin-top: 8px;
  font-family: var(--font-display);
  font-size: 13px;
  text-decoration: underline;
  color: var(--black);
}

.size-feed .card-testimonial .read-more { display: inline-block; }

.card-cta {
  display: none;
  margin-top: 14px;
  padding: 12px 24px;
  background: var(--black);
  color: var(--white);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-align: center;
  border-radius: 0;
}

.size-full .card-cta { display: block; }

/* --- B&A Card --- */
.card-ba {
  display: grid;
  grid-template-columns: 1fr 1fr;
  height: 100%;
}

.card-ba__half {
  position: relative;
  overflow: hidden;
}

.card-ba__half img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card-ba__label {
  position: absolute;
  bottom: 6px;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0,0,0,0.6);
  padding: 2px 6px;
}

.card-ba__label.before { left: 6px; }
.card-ba__label.after { right: 6px; }

.card-ba__procedure {
  position: absolute;
  top: 8px;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: #fff;
  text-shadow: 0 1px 4px rgba(0,0,0,0.8);
  z-index: 2;
}

/* --- Video Card --- */
.card-video .play-btn {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(0,0,0,0.5);
  border: 2px solid rgba(255,255,255,0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 3;
  backdrop-filter: blur(4px);
}

.card-video .play-btn::after {
  content: '';
  display: block;
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 8px 0 8px 14px;
  border-color: transparent transparent transparent #fff;
  margin-left: 3px;
}

.card-video .video-title {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
  color: #fff;
}

/* --- Product Card (KaramMD) --- */
.card-product {
  background: var(--white);
}

.card-product__brand {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--gray);
  margin-bottom: 4px;
}

.card-product__name {
  font-family: var(--font-display);
  font-size: 16px;
  color: var(--black);
  margin-bottom: 8px;
}

.card-product__cta {
  display: inline-block;
  padding: 6px 16px;
  border: 1px solid var(--black);
  color: var(--black);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.5px;
  border-radius: 0;
}

/* --- Social Post Card --- */
.card-social {
  padding: 14px;
  display: flex;
  flex-direction: column;
  height: 100%;
  justify-content: space-between;
}

.card-social__date {
  font-size: 11px;
  color: var(--karam-text-muted);
  margin-bottom: 6px;
}

.card-social__text {
  font-size: 13px;
  line-height: 1.45;
  color: var(--dark-gray);
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-social__handle {
  font-size: 12px;
  color: var(--black);
  margin-top: 8px;
}

/* --- Patient Update Badge --- */
.patient-update-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  background: rgba(0,0,0,0.05);
  border: 1px solid rgba(0,0,0,0.15);
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--black);
}

/* --- Pull Quote Card --- */
.card-pullquote {
  background: var(--off-white);
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  height: 100%;
  border: 1px solid rgba(0,0,0,0.08);
}

.card-pullquote .quote-mark {
  font-family: var(--font-display);
  font-size: 48px;
  line-height: 0.8;
  color: rgba(0,0,0,0.15);
}

.card-pullquote .quote-body {
  font-family: var(--font-display);
  font-size: 16px;
  line-height: 1.4;
  color: var(--black);
  margin-top: 4px;
}

/* --- Bottom Navigation --- */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 430px;
  height: var(--bottom-nav-height);
  background: rgba(255, 255, 255, 0.97);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid rgba(0,0,0,0.1);
  display: flex;
  align-items: center;
  justify-content: space-around;
  z-index: 200;
  padding-bottom: env(safe-area-inset-bottom, 0);
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 12px;
  border-radius: 8px;
  transition: all 0.2s;
}

.nav-item:hover { background: rgba(0,0,0,0.04); }

.nav-item.active .nav-icon { color: var(--black); }
.nav-item.active .nav-label { color: var(--black); }

.nav-icon {
  width: 22px;
  height: 22px;
  color: var(--karam-text-muted);
}

.nav-label {
  font-size: 9px;
  font-weight: 500;
  color: var(--karam-text-muted);
  letter-spacing: 0.3px;
}

/* --- Patient Journey Page --- */
.journey-hero {
  position: relative;
  width: 100%;
  aspect-ratio: 390 / 480;
  overflow: hidden;
}

.journey-hero__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.journey-hero__overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.8) 0%, rgba(0,0,0,0.2) 40%, transparent 60%);
}

.journey-hero__back {
  position: absolute;
  top: 16px;
  left: 16px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: #fff;
  z-index: 5;
  text-shadow: 0 1px 4px rgba(0,0,0,0.5);
}

.journey-hero__content {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 20px 16px;
  z-index: 3;
}

.journey-hero__name {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 400;
  line-height: 1.15;
  color: #fff;
}

.journey-hero__subtitle {
  font-size: 13px;
  color: rgba(255,255,255,0.7);
  margin-top: 4px;
}

/* Procedure Tags */
.procedure-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 16px;
}

.procedure-tag {
  padding: 5px 12px;
  border: 1px solid rgba(0,0,0,0.2);
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
  color: var(--black);
  letter-spacing: 0.3px;
}

/* Journey Sections */
.journey-section {
  padding: 20px 16px;
  border-top: 1px solid rgba(0,0,0,0.06);
}

.journey-section__label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--gray);
  margin-bottom: 8px;
}

.journey-section__title {
  font-family: var(--font-display);
  font-size: 22px;
  color: var(--black);
  margin-bottom: 12px;
}

.journey-section__text {
  font-size: 14px;
  line-height: 1.6;
  color: var(--dark-gray);
}

/* KPI Metrics Row */
.kpi-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  padding: 20px 16px;
  background: var(--white);
  border-top: 1px solid rgba(0,0,0,0.06);
  border-bottom: 1px solid rgba(0,0,0,0.06);
}

.kpi-item { text-align: center; }

.kpi-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--black);
  line-height: 1.2;
}

.kpi-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--karam-text-muted);
  margin-top: 2px;
}

/* Recovery Journal Timeline */
.recovery-timeline {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 12px 16px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.recovery-timeline::-webkit-scrollbar { display: none; }

.timeline-item {
  flex: 0 0 72px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.timeline-img {
  width: 72px;
  height: 72px;
  border-radius: 8px;
  object-fit: cover;
  border: 2px solid transparent;
  background: var(--deep-gray);
}

.timeline-item.active .timeline-img {
  border-color: var(--black);
}

.timeline-label {
  font-size: 9px;
  color: var(--karam-text-muted);
  white-space: nowrap;
}

/* Accordion/Expandable */
.accordion {
  border-top: 1px solid rgba(0,0,0,0.06);
}

.accordion__trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 14px 16px;
  font-size: 14px;
  font-weight: 600;
  color: var(--karam-text);
}

.accordion__arrow {
  font-size: 12px;
  color: var(--karam-text-muted);
  transition: transform 0.2s;
}

.accordion.open .accordion__arrow { transform: rotate(180deg); }

.accordion__body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}

.accordion.open .accordion__body {
  max-height: 500px;
}

.accordion__body-inner {
  padding: 0 16px 16px;
  font-size: 14px;
  line-height: 1.6;
  color: var(--dark-gray);
}

/* --- Utility --- */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/* Page transition */
.page { display: none; }
.page.active { display: flex; flex-direction: column; }

/* Placeholder images */
.placeholder-img {
  background: var(--deep-gray);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--karam-text-muted);
  font-size: 11px;
}

/* ============================================
   Responsive Breakpoints
   Mobile-first: base = mobile (< 768px)
   ============================================ */

/* --- Tablet (768px+) --- */
@media (min-width: 768px) {
  :root {
    --grid-gap: 3px;
    --bottom-nav-height: 64px;
  }

  .app {
    max-width: 768px;
    border-left: 1px solid rgba(0,0,0,0.08);
    border-right: 1px solid rgba(0,0,0,0.08);
  }

  .hub-header {
    padding: 14px 20px 0;
  }

  .hub-header__title {
    font-size: 19px;
  }

  .chip {
    padding: 7px 16px;
    font-size: 13px;
  }

  .content-tab {
    font-size: 13px;
    padding: 10px 0;
  }

  /* Tablet: still 2-col grid but cards are bigger */
  .hub-card.size-hero {
    aspect-ratio: 390 / 240;
  }

  .card-testimonial .quote-text {
    font-size: 15px;
  }

  .avatar-item {
    width: 62px;
  }

  .avatar-ring {
    width: 56px;
    height: 56px;
  }

  .avatar-name {
    font-size: 11px;
  }

  /* Journey page wider on tablet */
  .journey-hero {
    aspect-ratio: 768 / 480;
  }

  .journey-hero__name {
    font-size: 32px;
  }

  .kpi-value {
    font-size: 32px;
  }

  .procedure-tags {
    padding: 20px;
  }

  .journey-section {
    padding: 24px 20px;
  }

  /* Bottom nav wider */
  .bottom-nav {
    max-width: 768px;
  }
}

/* --- Desktop (1024px+) --- */
@media (min-width: 1024px) {
  :root {
    --grid-gap: 4px;
  }

  .app {
    max-width: 960px;
  }

  .hub-header {
    padding: 16px 24px 0;
  }

  .hub-header__title {
    font-size: 20px;
  }

  /* Desktop: 3-column grid by default */
  .hub-grid.grid-2col {
    grid-template-columns: 1fr 1fr 1fr;
  }

  /* Hero cards span 2 cols on desktop 3-col grid */
  .hub-card.size-hero {
    grid-column: 1 / 3;
    aspect-ratio: auto;
    min-height: 280px;
  }

  /* Feed-size cards can span 1 col */
  .hub-card.size-feed {
    aspect-ratio: auto;
    min-height: 300px;
  }

  .avatar-carousel {
    gap: 16px;
  }

  .filter-chips {
    gap: 10px;
  }

  /* Journey page desktop */
  .journey-hero {
    aspect-ratio: 960 / 420;
  }

  .journey-hero__name {
    font-size: 36px;
  }

  .kpi-row {
    padding: 24px;
  }

  .procedure-tags {
    padding: 24px;
    gap: 8px;
  }

  .procedure-tag {
    font-size: 12px;
    padding: 6px 14px;
  }

  /* Bottom nav wider */
  .bottom-nav {
    max-width: 960px;
  }
}

/* --- Large Desktop (1280px+) --- */
@media (min-width: 1280px) {
  .app {
    max-width: 1200px;
  }

  .hub-grid.grid-2col {
    grid-template-columns: 1fr 1fr 1fr;
    gap: 4px;
  }

  /* Hero cards span full on large desktop */
  .hub-card.size-hero {
    grid-column: 1 / -1;
    min-height: 320px;
  }

  .bottom-nav {
    max-width: 1200px;
  }

  .journey-hero {
    aspect-ratio: 1200 / 400;
  }
}

/* --- Layout toggle override: force 2-col on desktop --- */
.hub-grid.grid-2col-forced {
  grid-template-columns: 1fr 1fr !important;
}

.hub-grid.grid-3col-forced {
  grid-template-columns: 1fr 1fr 1fr !important;
}

/* ============================================
   Phase 3: New Components
   ============================================ */

/* --- Disabled Chip --- */
.chip[disabled] {
  opacity: 0.35;
  pointer-events: none;
  cursor: default;
}

/* --- Skeleton Loading Cards --- */
.skeleton-card {
  aspect-ratio: 1 / 1;
  background: var(--deep-gray);
  border-radius: var(--card-radius);
  position: relative;
  overflow: hidden;
}

.skeleton-card::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255,255,255,0.4) 50%,
    transparent 100%
  );
  animation: skeleton-shimmer 1.5s infinite;
}

@keyframes skeleton-shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

/* --- Empty State --- */
.empty-state {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  text-align: center;
}

.empty-state__text {
  font-family: var(--font-body);
  font-size: 15px;
  color: var(--gray);
  font-weight: 400;
}

/* --- Lightbox Overlay --- */
.lightbox-overlay {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: rgba(0, 0, 0, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: lightbox-fade-in 0.2s ease;
}

@keyframes lightbox-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.lightbox-content {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.lightbox-close {
  position: absolute;
  top: -40px;
  right: 0;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  font-size: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: none;
  transition: background 0.2s;
  z-index: 10;
}

.lightbox-close:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* Lightbox B&A card override */
.lightbox-content .card-ba {
  border-radius: 4px;
  overflow: hidden;
}

.lightbox-content .card-ba__label {
  font-size: 11px;
  padding: 4px 10px;
}

/* ─── Video Card Additions ─── */

/* Position the video overlay (play btn + duration) */
.card-video {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
}

.card-video__duration {
  position: absolute;
  bottom: 8px;
  right: 8px;
  padding: 2px 6px;
  background: rgba(0, 0, 0, 0.75);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  border-radius: 3px;
  letter-spacing: 0.3px;
  pointer-events: none;
}

.card-video__title {
  font-size: 12px;
  font-weight: 500;
  line-height: 1.3;
  color: #fff;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin: 0;
}

/* ─── Reels-Style Video Viewer ─── */

.reels-overlay {
  position: fixed;
  inset: 0;
  z-index: 400;
  background: #000;
  display: flex;
  flex-direction: column;
  animation: reels-fade-in 0.3s ease;
}

@keyframes reels-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Close button */
.reels-close {
  position: absolute;
  top: max(12px, env(safe-area-inset-top, 12px));
  right: 12px;
  z-index: 20;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: #fff;
  font-size: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: none;
  transition: background 0.2s;
}

.reels-close:hover {
  background: rgba(255, 255, 255, 0.25);
}

/* Mute/unmute button */
.reels-mute {
  position: absolute;
  top: max(12px, env(safe-area-inset-top, 12px));
  right: 60px;
  z-index: 20;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: none;
  transition: background 0.2s;
}

.reels-mute:hover {
  background: rgba(255, 255, 255, 0.25);
}

/* Viewport — full screen, clips overflow */
.reels-viewport {
  flex: 1;
  position: relative;
  overflow: hidden;
  touch-action: pan-x;
}

/* Track — positioned container, translated on swipe */
.reels-track {
  position: absolute;
  inset: 0;
}

/* Slides — stacked via absolute positioning */
.reels-slide {
  position: absolute;
  left: 0;
  right: 0;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.reels-slide--prev { top: -100%; }
.reels-slide--current { top: 0; }
.reels-slide--next { top: 100%; }

/* YouTube player wrapper — vertical 9:16 on desktop, full on mobile */
.reels-player-wrap {
  width: 100%;
  height: 100%;
  max-width: 420px;
  margin: 0 auto;
  position: relative;
  background: #000;
}

.reels-player-wrap iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
}

/* Tap zone — invisible overlay for play/pause */
.reels-tap-zone {
  position: absolute;
  inset: 0;
  z-index: 5;
  cursor: pointer;
}

/* Pause indicator */
.reels-pause-icon {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.6);
  opacity: 0;
  z-index: 6;
  pointer-events: none;
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.reels-pause-icon--visible {
  opacity: 0.7;
  transform: translate(-50%, -50%) scale(1);
}

/* Dark gradient scrim — makes bottom text readable over any video */
.reels-overlay::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 45%;
  background: linear-gradient(
    to top,
    rgba(0, 0, 0, 0.7) 0%,
    rgba(0, 0, 0, 0.4) 40%,
    transparent 100%
  );
  z-index: 8;
  pointer-events: none;
}

/* Bottom info bar — patient name + video title */
.reels-info {
  position: absolute;
  bottom: max(80px, calc(env(safe-area-inset-bottom, 20px) + 60px));
  left: 16px;
  right: 80px;
  z-index: 10;
  pointer-events: none;
}

.reels-info__name {
  font-family: var(--font-display, "Playfair Display", serif);
  font-size: 16px;
  font-weight: 600;
  color: #fff;
  margin: 0 0 4px;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.6);
}

.reels-info__title {
  font-family: var(--font-body, "DM Sans", sans-serif);
  font-size: 13px;
  color: rgba(255, 255, 255, 0.75);
  margin: 0;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

/* Navigation counter */
.reels-nav {
  position: absolute;
  bottom: max(80px, calc(env(safe-area-inset-bottom, 20px) + 60px));
  right: 16px;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.reels-counter {
  font-family: var(--font-body, "DM Sans", sans-serif);
  font-size: 12px;
  color: rgba(255, 255, 255, 0.6);
  letter-spacing: 0.5px;
}

/* Swipe hint */
.reels-hint {
  position: absolute;
  bottom: max(130px, calc(env(safe-area-inset-bottom, 20px) + 110px));
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-radius: 20px;
  color: #fff;
  font-family: var(--font-body, "DM Sans", sans-serif);
  font-size: 13px;
  font-weight: 500;
  transition: opacity 0.5s ease, transform 0.5s ease;
  animation: reels-hint-pulse 2s ease infinite;
}

.reels-hint--hidden {
  opacity: 0;
  transform: translateX(-50%) translateY(10px);
  pointer-events: none;
}

@keyframes reels-hint-pulse {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50% { transform: translateX(-50%) translateY(-4px); }
}

/* Desktop — constrain width, show rounded corners */
@media (min-width: 481px) {
  .reels-player-wrap {
    max-width: 400px;
    height: 100%;
    border-radius: 12px;
    overflow: hidden;
  }

  .reels-overlay {
    background: rgba(0, 0, 0, 0.95);
  }
}

/* Mobile — true fullscreen edge-to-edge */
@media (max-width: 480px) {
  .reels-player-wrap {
    max-width: 100%;
    border-radius: 0;
  }

  .reels-info {
    bottom: max(60px, calc(env(safe-area-inset-bottom, 16px) + 40px));
  }

  .reels-nav {
    bottom: max(60px, calc(env(safe-area-inset-bottom, 16px) + 40px));
  }

  .reels-hint {
    bottom: max(110px, calc(env(safe-area-inset-bottom, 16px) + 90px));
  }
}

/* ─── Journey Page Video Scroll ─── */

.journey-videos-scroll {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding: 4px 0 16px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.journey-videos-scroll::-webkit-scrollbar {
  display: none;
}

.journey-video-card {
  flex: 0 0 200px;
  cursor: pointer;
  transition: transform 0.15s ease;
}

.journey-video-card:active {
  transform: scale(0.97);
}

.journey-video-card__thumb {
  position: relative;
  width: 200px;
  height: 112px;
  border-radius: 6px;
  overflow: hidden;
  background: var(--deep-gray);
}

.journey-video-card__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.play-btn-sm {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.5);
  border: 2px solid rgba(255, 255, 255, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}

.play-btn-sm::after {
  content: '';
  display: block;
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 6px 0 6px 10px;
  border-color: transparent transparent transparent #fff;
  margin-left: 2px;
}

.journey-video-card__duration {
  position: absolute;
  bottom: 4px;
  right: 4px;
  padding: 1px 5px;
  background: rgba(0, 0, 0, 0.75);
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  border-radius: 2px;
}

.journey-video-card__title {
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 500;
  color: var(--dark-gray);
  line-height: 1.3;
  margin-top: 6px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
