/* Shared visual contract. Load after each section's component styles.
   The landing keeps its composition; these selectors target section hosts. */
@font-face {
  font-family: "Riviera Nights";
  src: url("/assets/fonts/RivieraNights-Light.woff") format("woff");
  font-style: normal;
  font-weight: 300;
  font-display: swap;
}
@font-face {
  font-family: "Riviera Nights";
  src: url("/assets/fonts/RivieraNights-Regular.woff") format("woff");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Riviera Nights";
  src: url("/assets/fonts/RivieraNights-Medium.woff") format("woff");
  font-style: normal;
  font-weight: 500;
  font-display: swap;
}

:root,
:host {
  --leo-font-ui: "Riviera Nights", Riviera, Arial, sans-serif;
  --leo-header-height: 80px;
  --leo-brand-width: 150px;
  --leo-control-height: 48px;
  --leo-control-compact: 44px;
  --leo-radius-control: 999px;
  --leo-radius-field: 12px;
  --leo-radius-panel: 12px;
  --leo-content-max: 1280px;
  --leo-page-gutter: clamp(20px, 4vw, 56px);
  --leo-page-space: clamp(28px, 4vw, 48px);
  --leo-text-body: 15px;
  --leo-text-small: 13px;
  --leo-title-page: clamp(32px, 3.6vw, 48px);
  --leo-title-section: clamp(24px, 2.4vw, 32px);
  --leo-space-1: 8px;
  --leo-space-2: 16px;
  --leo-space-3: 24px;
  --leo-space-4: 32px;
  --leo-space-5: 48px;
}

:host([data-section-key]) {
  --section-text: var(--leo-text);
  --section-muted: var(--leo-muted);
  --section-accent: var(--leo-action-text);
  --section-line: var(--leo-line);
  --section-border: var(--leo-control-border);
  font-family: var(--leo-font-ui);
  font-size: var(--leo-text-body);
  font-weight: 400;
  line-height: 1.65;
  color: var(--leo-text);
  background: var(--section-bg);
}

/* The same signature, bar height and touch targets as the landing. */
:host([data-section-key]) .shell > .topbar {
  position: relative;
  display: flex;
  align-items: center;
  flex: 0 0 var(--leo-header-height);
  height: var(--leo-header-height);
  min-height: var(--leo-header-height);
  padding: 0 24px;
  gap: 16px;
  box-sizing: border-box;
  background: var(--leo-header);
  color: var(--leo-text);
  border-bottom: 1px solid var(--leo-line);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}
:host([data-section-key]) .topbar > button[data-close] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-width: 44px;
  min-height: 44px;
  padding: 0 8px;
  border: 0;
  border-radius: var(--leo-radius-control);
  color: var(--leo-text);
  font: 400 13px/1.2 var(--leo-font-ui);
}
:host([data-section-key]) .topbar .section-home {
  display: inline-flex;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  align-items: center;
  justify-content: center;
  width: var(--leo-brand-width);
  height: 64px;
  min-height: 44px;
}
:host([data-section-key]) .topbar .logo {
  display: block;
  width: var(--leo-brand-width);
  height: 54px;
  object-fit: contain;
}
:host([data-section-key]) .topbar .section-switcher {
  flex: 0 1 180px;
  min-width: 0;
}
:host([data-section-key]) .topbar .section-switcher-toggle {
  min-height: 44px;
  padding: 8px 12px;
  border: 1px solid var(--leo-control-border);
  border-radius: var(--leo-radius-control);
  background: var(--leo-card);
  color: var(--leo-text);
  font: 400 13px/1.2 var(--leo-font-ui);
}
:host([data-section-key]) .topbar .topbar-actions {
  display: flex;
  align-items: center;
  flex: none;
  margin-left: auto;
  gap: 12px;
}
:host([data-section-key]) .topbar .section-help {
  min-height: 44px;
  padding: 0 14px;
  border-radius: var(--leo-radius-control);
  border-color: var(--leo-control-border);
  background: var(--leo-card);
  font: 400 13px/1.2 var(--leo-font-ui);
}
:host([data-section-key]) .topbar .close {
  width: 44px;
  min-width: 44px;
  height: 44px;
  padding: 0;
  color: var(--leo-text);
}
:host([data-section-key]) .section-switcher .section-nav {
  border-radius: var(--leo-radius-panel);
  font-family: var(--leo-font-ui);
}

/* A common reading measure; the multi-column LION workspace retains its sizing. */
:host([data-section-key]:not([data-section-key="lion"])) .shell main {
  width: 100%;
  max-width: var(--leo-content-max);
  margin-inline: auto;
  padding: var(--leo-page-space) var(--leo-page-gutter) 64px;
  font-family: var(--leo-font-ui);
}
:host([data-section-key]) .shell :is(.lc-booking, .lp-catalog, .lp-product, .lc-forum, .lc-buscatube) {
  font-family: var(--leo-font-ui);
}
:host([data-section-key]) .shell main h1 {
  padding-top: 0;
  border-top: 0;
  color: var(--leo-text);
}
:host([data-section-key]) .shell main h1:not(:has(img)) {
  font-family: var(--leo-font-ui);
  font-size: var(--leo-title-page);
  font-weight: 300;
  line-height: 1.16;
  letter-spacing: -.035em;
  text-transform: none;
  text-wrap: balance;
}
:host([data-section-key="lion"]) .shell .lion-intro h1 {
  font-size: 28px;
  letter-spacing: -.025em;
  line-height: 1.2;
}
:host([data-section-key="mentoria"]) .booking-shell main > h1 {
  margin-bottom: 24px;
  color: var(--leo-text);
}
:host([data-section-key]) .shell :is(.library-lead, .forum-intro, .lp-catalog-intro p, .book-description, .mc-welcome-access p, .mc-welcome-list span, .bt-preview-access p) {
  font-size: var(--leo-text-body);
  line-height: 1.7;
}
:host([data-section-key]) .shell :is(.book-info h2, .forum-view-title, .mc-welcome-access h2, .lp-catalog-intro h2) {
  font-family: var(--leo-font-ui);
  font-weight: 300;
  letter-spacing: -.025em;
}
:host([data-section-key]) .shell :is(.book-description, .piece-resource-content p, .mc-lock > p, .mc-welcome-access p, .bt-preview-access p, .forum-body p, .reading-panel p, .statement-body > p, .lead, .sci-body p, .lp-product-description, .lp-card-description, .lp-catalog-intro p, .lp-detail p, .lp-email-note p, .lp-product-note, .bk-host-description, .bk-reserve-note, .bk-rate-note, .bk-payment-state > p) {
  text-align: start;
  text-align-last: auto;
  hyphens: manual;
  -webkit-hyphens: manual;
}
:host([data-section-key="emissario"]) .hero > .rule {
  display: none;
}

/* Named actions share a pill; calendars, chapter rows, tabs and media are separate. */
:host([data-section-key]) .shell :is(.mc-button, .forum-primary, .forum-secondary, .forum-more, .book-open, .library-empty button, .practice-action, .material-actions a:first-child, .btn, .bt-preview-login, .bk-button, .bk-offer button, .bk-primary, .lp-primary) {
  min-height: var(--leo-control-height);
  border-radius: var(--leo-radius-control);
  padding: 12px 24px;
  font-family: var(--leo-font-ui);
  font-size: var(--leo-text-small);
  font-weight: 400;
  line-height: 1.45;
  letter-spacing: .015em;
  text-decoration: none;
  box-sizing: border-box;
}
:host([data-section-key]) .shell :is(.mc-button.primary, .forum-primary, .book-open, .practice-action, .material-actions a:first-child, .btn.primary, .bt-preview-login, .bk-primary, .bk-offer button, .lp-primary):not(:disabled) {
  border-color: var(--leo-action-fill);
  background: var(--leo-action-fill);
  color: var(--leo-on-action);
}
:host([data-section-key]) .shell :is(.mc-button.primary, .forum-primary, .book-open, .practice-action, .material-actions a:first-child, .btn.primary, .bt-preview-login, .bk-primary, .bk-offer button, .lp-primary):hover:not(:disabled) {
  border-color: var(--leo-action-hover);
  background: var(--leo-action-hover);
  color: var(--leo-on-action);
}
:host([data-section-key]) .shell :is(.library-categories button, .bt-welcome button, .book-download) {
  min-height: var(--leo-control-compact);
  border-radius: var(--leo-radius-control);
  font-family: var(--leo-font-ui);
  font-size: 13px;
}
:host([data-section-key]) .shell :is(.forum-compose input, .forum-compose textarea, .mc-search input, .lc-buscatube select) {
  border-radius: var(--leo-radius-field);
  font-family: var(--leo-font-ui);
  font-size: 16px;
  color: var(--leo-text);
}
:host([data-section-key]) .shell :is(.library-search, .forum-search) {
  min-height: var(--leo-control-height);
  border-radius: var(--leo-radius-control);
}
:host([data-section-key]) .shell :is(.library-search input, .forum-search input, .lc-buscatube .query input) {
  font-family: var(--leo-font-ui);
  font-size: 16px;
}
:host([data-section-key]) .shell :is(.mc-welcome-access, .forum-topic, .forum-detail, .forum-compose, .forum-gate, .forum-about, .lp-card, .lp-email-note, .bt-preview-search, .bt-player, .method-copy, .materials-copy) {
  border-radius: var(--leo-radius-panel);
  border-color: var(--leo-line);
}
:host([data-section-key]) .shell :is(a, button, input, select, textarea):focus-visible {
  outline: 2px solid var(--leo-focus);
  outline-offset: 3px;
}

/* Private journals inherit the same palette in their two entry points.
   Screen-only rules leave the journal's ink-on-paper print stylesheet intact. */
@media screen {
  :is(body[data-leo-ui="page"], :host([data-section-key="acompanhamento"])) .lj-journal {
    --lj-bg: var(--leo-bg);
    --lj-surface: var(--leo-surface);
    --lj-text: var(--leo-text);
    --lj-muted: var(--leo-muted);
    --lj-line: var(--leo-line);
    --lj-accent: var(--leo-action-text);
    color-scheme: inherit;
    padding: 0;
    border-radius: 0;
    font-family: var(--leo-font-ui);
  }
  :is(body[data-leo-ui="page"], :host([data-section-key="acompanhamento"])) .lj-journal :is(h1, h2) {
    font-family: var(--leo-font-ui);
    font-weight: 300;
  }
  :is(body[data-leo-ui="page"], :host([data-section-key="acompanhamento"])) .lj-journal :is(.lj-button, .doc-links a) {
    min-height: var(--leo-control-compact);
    border-radius: var(--leo-radius-control);
    font-size: var(--leo-text-small);
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
  :is(body[data-leo-ui="page"], :host([data-section-key="acompanhamento"])) .lj-journal .lj-primary {
    background: var(--leo-action-fill);
    border-color: var(--leo-action-fill);
    color: var(--leo-on-action);
  }
  :is(body[data-leo-ui="page"], :host([data-section-key="acompanhamento"])) .lj-filters :is(input, select) {
    border-color: var(--leo-control-border);
    border-radius: var(--leo-radius-field);
    font-size: 16px;
  }
  :is(body[data-leo-ui="page"], :host([data-section-key="acompanhamento"])) .lj-post {
    border-radius: var(--leo-radius-panel);
  }
}

@media (max-width: 1000px) and (min-width: 768px) {
  :host([data-section-key]) .topbar .section-switcher { flex-basis: 160px; }
  :host([data-section-key]) .topbar .section-help { width: 44px; padding: 0; }
  :host([data-section-key]) .topbar .section-help span { display: none; }
}

@media (max-width: 767px) {
  :root,
  :host {
    --leo-header-height: 72px;
    --leo-brand-width: clamp(104px, calc(100vw - 224px), 140px);
    --leo-page-gutter: 20px;
    --leo-page-space: 28px;
    --leo-title-page: clamp(30px, 7.2vw, 36px);
  }
  :host([data-section-key]) .shell > .topbar { padding-inline: 8px; gap: 4px; }
  :host([data-section-key]) .topbar > button[data-close] {
    width: 44px;
    flex: 0 0 44px;
    padding: 0;
    font-size: 22px;
  }
  :host([data-section-key]) .topbar > button[data-close] span { display: none; }
  :host([data-section-key]) .topbar .section-home {
    position: static;
    transform: none;
    flex: 0 0 var(--leo-brand-width);
    display: inline-flex;
    height: 54px;
  }
  :host([data-section-key]) .topbar .logo { display: block; height: 50px; }
  :host([data-section-key]) .topbar .section-switcher { flex: 0 0 44px; }
  :host([data-section-key]) .topbar .section-switcher-toggle {
    position: relative;
    width: 44px;
    min-width: 44px;
    height: 44px;
    padding: 0;
    justify-content: center;
    gap: 0;
  }
  :host([data-section-key]) .topbar .section-switcher-toggle::before {
    content: "";
    width: 16px;
    height: 12px;
    border-top: 1px solid currentColor;
    border-bottom: 1px solid currentColor;
    background: linear-gradient(currentColor, currentColor) center / 100% 1px no-repeat;
  }
  :host([data-section-key]) .topbar .section-switcher-toggle span {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }
  :host([data-section-key]) .topbar .section-switcher-toggle svg { display: none; }
  :host([data-section-key]) .topbar .topbar-actions { gap: 4px; }
  :host([data-section-key]) .topbar .section-help {
    width: 44px;
    height: 44px;
    padding: 0;
    gap: 0;
    border: 1px solid var(--leo-control-border);
  }
  :host([data-section-key]) .topbar .section-help span { display: none; }
  /* The leading return action already closes this dialog. */
  :host([data-section-key]) .topbar .close { display: none; }
  :host([data-section-key]) .topbar button.leo-theme-toggle[data-theme-toggle] {
    width: 44px;
    min-width: 44px;
    max-width: 44px;
    height: 44px;
    min-height: 44px;
    flex-basis: 44px;
    padding: 4px;
  }
  :host([data-section-key]) .topbar button.leo-theme-toggle[data-theme-toggle] span {
    width: 34px;
    height: 34px;
    flex-basis: 34px;
  }
  :host([data-section-key]) .topbar button.leo-theme-toggle[data-theme="dark"] .leo-theme-sun,
  :host([data-section-key]) .topbar button.leo-theme-toggle[data-theme="light"] .leo-theme-moon { display: none; }
  :host([data-section-key="lion"]) .shell .lion-intro h1 { font-size: 25px; }
  :host([data-section-key]) .shell :is(.book-open, .book-download) {
    min-height: 44px;
    padding: 10px 14px;
    font-size: 12px;
  }
  :host([data-section-key]) .shell .book-download { padding-inline: 10px; }
}
