/*
 * medSpeak public site stylesheet.
 *
 * Accent colour: teal #2f91a3 — derived from the brand SVG stroke colour.
 * Overrides Tabler's default `--tblr-primary` so buttons, links, focus
 * rings and other Tabler primaries pick up the medSpeak tone.
 */

:root {
  --ms-accent: #2f91a3;
  --ms-accent-rgb: 47, 145, 163;
  --ms-accent-dark: #1f6c7a;
  --ms-accent-light: #a7d9e2;
  --tblr-primary: var(--ms-accent);
  --tblr-primary-rgb: var(--ms-accent-rgb);
  --tblr-primary-darken: var(--ms-accent-dark);
}

/* --- Sidebar disabled site-wide ---------------------------------------- *
 * The medspeak base template blanks out the sidebar and sidebar-toggle
 * blocks from conjunto/app_base.html. Conjunto still styles the page
 * canvas with `margin-left: var(--cj-sidebar-width)` and a 0.25s
 * `margin-left` transition (so it can animate the sidebar collapse).
 * With no sidebar present that reserved gutter would be empty space,
 * and the transition would fire on every page load when the inline
 * bootstrap script toggles `.cj-sidebar-collapsed` — visible as the
 * content sliding in from the right.
 *
 * The override is gated on `body:not(:has(#cj-sidebar))` so it only
 * applies when the aside element is genuinely absent. Any page that
 * does render a sidebar (conjunto defaults, future admin layouts, ...)
 * keeps conjunto's original margin + transition untouched.
 */
body:not(:has(#cj-sidebar)) .cj-page-content {
  margin-left: 0;
  transition: none;
}

/* --- Public topbar ----------------------------------------------------- */

.ms-public-topbar {
  background-color: var(--tblr-bg-surface, #fff);
  border-bottom: 1px solid var(--tblr-border-color, rgba(0, 0, 0, .1));
}

.ms-public-topbar .navbar-brand-image {
  height: 2rem;
  width: auto;
}

/* --- Hero carousel -----------------------------------------------------
 *
 * Each .ms-hero__item carries the slide image as a CSS background so it
 * fully covers the slide regardless of aspect ratio. A gradient overlay
 * darkens the lower portion to keep the caption legible. The caption is
 * positioned in the lower third of the slide via flex layout.
 */

.ms-hero {
  position: relative;
  overflow: hidden;
}

/* Desktop: constrain hero so the slide image isn't stretched across the
 * full viewport width. Mobile keeps full bleed for impact on small
 * screens. Max-width matches Tabler's container-xl. */
@media (min-width: 768px) {
  .ms-hero {
    max-width: 1320px;
    margin-inline: auto;
    border-radius: var(--tblr-border-radius, .5rem);
  }
}

.ms-hero__carousel,
.ms-hero .carousel-inner,
.ms-hero__item {
  min-height: min(80vh, 720px);
}

.ms-hero__item {
  background-size: cover;
  background-position: center center;
  background-repeat: no-repeat;
  position: relative;
  display: flex;
  align-items: flex-end;
}

.ms-hero__item[data-ms-hero-fallback="true"] {
  background-image: linear-gradient(
    135deg,
    var(--tblr-primary, #2f91a3),
    var(--ms-accent-dark, #1f6c7a)
  );
}

.ms-hero__overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(
    180deg,
    rgba(0, 0, 0, .15) 0%,
    rgba(0, 0, 0, .45) 40%,
    rgba(0, 0, 0, .75) 100%
  );
  z-index: 1;
}

.ms-hero__caption {
  position: relative;
  z-index: 2;
  width: 100%;
  padding: 3rem 1rem 5rem;
}

.ms-hero__caption-inner {
  max-width: 720px;
}

.ms-hero__caption .display-3 {
  text-shadow: 0 2px 12px rgba(0, 0, 0, .55);
  font-size: clamp(2rem, 5vw, 3.5rem);
}

.ms-hero__caption .lead {
  text-shadow: 0 2px 12px rgba(0, 0, 0, .85), 0 0 4px rgba(0, 0, 0, .6);
  font-size: clamp(1.25rem, 2.25vw, 1.75rem);
  line-height: 1.5;
  font-weight: 500;
}

.ms-hero__caption .lead p {
  margin-bottom: 0;
}

/* Larger hit target for prev/next controls. */
.ms-hero__control {
  width: 7%;
  z-index: 3;
}

.ms-hero__control .carousel-control-prev-icon,
.ms-hero__control .carousel-control-next-icon {
  width: 2.5rem;
  height: 2.5rem;
  background-size: 100% 100%;
}

/* Indicators sit just above the bottom edge, Tabler-styled dots. */
.ms-hero .carousel-indicators {
  z-index: 3;
  margin-bottom: 1.25rem;
}

/* --- Partner marquee ("sushi belt") ------------------------------------ */

.ms-marquee {
  overflow: hidden;
  mask-image: linear-gradient(
    90deg,
    transparent,
    #000 10%,
    #000 90%,
    transparent
  );
  -webkit-mask-image: linear-gradient(
    90deg,
    transparent,
    #000 10%,
    #000 90%,
    transparent
  );
}

.ms-marquee__track {
  display: flex;
  gap: 3rem;
  align-items: center;
  width: max-content;
  animation: ms-marquee 45s linear infinite;
}

.ms-marquee:hover .ms-marquee__track {
  animation-play-state: paused;
}

.ms-marquee__item img {
  max-height: 60px;
  max-width: 180px;
  width: auto;
  object-fit: contain;
  filter: grayscale(1) opacity(.7);
  transition: filter .3s ease;
}

.ms-marquee__item:hover img {
  filter: none;
}

@keyframes ms-marquee {
  to {
    transform: translateX(-50%);
  }
}

@media (prefers-reduced-motion: reduce) {
  .ms-marquee__track {
    animation: none;
    flex-wrap: wrap;
    justify-content: center;
  }
}

/* --- Section wrapper (render_blocks) ----------------------------------- */

.ms-section {
  padding-block: 4rem;
}

.ms-section--light {
  background: var(--tblr-bg-surface, #fff);
}

.ms-section--accent {
  background: var(--tblr-bg-surface-secondary, #f8fafc);
}

@media (max-width: 768px) {
  .ms-section {
    padding-block: 2.5rem;
  }
}

/* First section after the hero gets extra breathing room. */
.ms-hero + .ms-section {
  padding-top: 5rem;
}

/* --- Prose (text blocks) ----------------------------------------------- */

.ms-prose {
  max-width: 680px;
  margin-inline: auto;
}

.ms-prose p:first-of-type {
  font-size: 1.25rem;
  color: var(--tblr-secondary);
}

.ms-prose a {
  color: var(--tblr-primary);
  text-decoration: underline;
  text-decoration-color: transparent;
}

.ms-prose a:hover {
  text-decoration-color: currentColor;
}

/* --- Section headings -------------------------------------------------- */

h2.ms-section__heading {
  font-size: clamp(1.75rem, 3vw, 2.5rem);
  font-weight: 700;
  margin-bottom: 1rem;
}

/* --- Partner badge fallback -------------------------------------------- */

.ms-partner-badge {
  display: inline-block;
  padding: .5rem 1rem;
  border: 1px solid var(--tblr-border-color, rgba(0, 0, 0, .15));
  border-radius: .25rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  font-size: .875rem;
  font-weight: 500;
  color: var(--tblr-secondary);
  white-space: nowrap;
}

/* --- Public footer ----------------------------------------------------- */

.ms-public-footer {
  background-color: var(--tblr-bg-surface-secondary, #f8fafc);
  border-top: 1px solid var(--tblr-border-color, rgba(0, 0, 0, .1));
  padding-block: 3rem 2rem;
  margin-top: 0;
}

.ms-public-footer__heading {
  font-size: .875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-bottom: .75rem;
  color: var(--tblr-secondary-color, #6c757d);
}

.ms-public-footer__list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.ms-public-footer__list li + li {
  margin-top: .25rem;
}

.ms-public-footer__list a {
  color: inherit;
  text-decoration: none;
}

.ms-public-footer__list a:hover {
  color: var(--ms-accent);
  text-decoration: underline;
}

.ms-public-footer__copyright {
  border-top: 1px solid var(--tblr-border-color, rgba(0, 0, 0, .1));
  padding-top: 1rem;
  margin-top: 2rem;
  font-size: .875rem;
  color: var(--tblr-secondary-color, #6c757d);
}

/* --- Inline CMS edit overlay ------------------------------------------- *
 *
 * Rendered by the {% cms_edit_button %} tag and by the render_blocks
 * wrapper when a user in the ``Content editor`` group is logged in.
 * The overlay sits in the top-right corner of the nearest positioned
 * ancestor (``.cms-page-wrapper``, ``.cms-block-wrapper``) and fades
 * in on hover.
 */

.cms-page-wrapper,
.cms-block-wrapper {
  position: relative;
}

.cms-edit-overlay {
  position: absolute;
  top: .75rem;
  right: .75rem;
  z-index: 20;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 50%;
  background-color: var(--ms-accent);
  color: #fff !important;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .18);
  text-decoration: none;
  opacity: .2;
  transition: opacity .15s ease, background-color .15s ease;
  pointer-events: auto;
}

/* Page-level pencil sits on the left to avoid colliding with any
 * block-level pencil rendered in the top-right of the first block
 * (carousel, steps, …). */
.cms-page-wrapper > .cms-edit-overlay {
  right: auto;
  left: .75rem;
}

.cms-edit-overlay:hover,
.cms-edit-overlay:focus {
  background-color: var(--ms-accent-dark);
  color: #fff !important;
  outline: none;
}

.cms-edit-overlay .ti {
  font-size: 1.1rem;
  line-height: 1;
}

/* Reveal fully on hover / focus-within of the wrapping element. The
 * overlay itself stays fully visible while focused (keyboard nav). */
.cms-page-wrapper:hover > .cms-edit-overlay,
.cms-page-wrapper:focus-within > .cms-edit-overlay,
.cms-block-wrapper:hover > .cms-edit-overlay,
.cms-block-wrapper:focus-within > .cms-edit-overlay,
.cms-edit-overlay:focus,
.cms-edit-overlay:hover {
  opacity: 1;
}

/* Full-bleed blocks (carousel) have no container padding, so nudge the
 * overlay inward to clear the carousel indicators/controls. */
.cms-block-wrapper--full-bleed > .cms-edit-overlay {
  top: 1rem;
  right: 1.25rem;
}
