/* Medibit: page CSS. Only what sits inside a visual or the theme (references/system.md, Cards). */

/* ---------------------------------------------------------------- theme */
:root { color-scheme: light; --ui-bg: #ffffff; }
:root[data-theme="dark"] { color-scheme: dark; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { color-scheme: dark; } }

/* the client's logo: the positive file on light, the negative file on dark */
.logo { display: block; height: 50px; width: auto; }
.logo--dark { display: none; }
:root[data-theme="dark"] .logo--light { display: none; }
:root[data-theme="dark"] .logo--dark { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .logo--light { display: none; }
  :root:not([data-theme="light"]) .logo--dark { display: block; }
}
.nav__logo { display: inline-flex; align-items: center; }
.footer__logo { height: 56px; width: auto; }   /* display comes from .logo, so the light/dark pair still swaps */

/* the theme toggle: one 44px square at the end of the bar, the secondary button's border and radius */
.theme-toggle {
  display: inline-grid; place-items: center; width: var(--btn-h); height: var(--btn-h); padding: 0; cursor: pointer;
  border-radius: var(--r-btn); border: 1px solid var(--line-strong); background: var(--bg); color: var(--ink);
  transition: background-color var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.theme-toggle:hover { background: color-mix(in oklab, var(--ink) 6%, var(--bg)); border-color: var(--ink); }
.theme-toggle svg { width: 18px; height: 18px; }
.theme-toggle .i-sun { display: none; }
.theme-toggle[aria-pressed="true"] .i-sun { display: block; }
.theme-toggle[aria-pressed="true"] .i-moon { display: none; }
.nav__actions { display: flex; align-items: center; gap: var(--s-4); }

/* ---------------------------------------------------------------- photographs */
.frame--photo { --ratio: 80%; }
.frame--pair { --ratio: 66.67%; }
.frame--wide { --ratio: 30%; }
@media (max-width: 639px) { .frame--wide { --ratio: 66.67%; } }

/* ---------------------------------------------------------------- the small agenda on the project photograph */
.mini {
  --fx-bg: var(--ui-bg); --fx-ink: var(--ink); --fx-muted: var(--muted); --fx-accent: var(--accent); --fx-accent-ink: var(--accent-ink);
  --ui-font: var(--font-text); --ui-radius: 12px;
  overflow: hidden; background: var(--u-bg); border: 1px solid var(--u-border); border-radius: var(--u-r); box-shadow: var(--u-shadow-sm);
}
.mini--over { position: absolute; z-index: 2; left: var(--s-5); bottom: var(--s-5); width: min(300px, calc(100% - 2 * var(--s-5))); }
.frame--wide > .frame__img { object-position: 50% 38%; }
.mini__head { display: grid; gap: 2px; padding: 12px 16px 10px; border-bottom: 1px solid var(--u-line); }
.mini__head b { font-weight: 500; font-size: 14px; line-height: 20px; }
.mini__head span { font-size: 13px; line-height: 16px; color: var(--u-muted); }
.mini__rows { margin: 0; padding: 0; list-style: none; }
.mini__rows li { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; align-items: center; gap: 10px; min-height: 40px; padding: 0 16px; font-size: 13px; }
.mini__rows li + li { box-shadow: inset 0 1px 0 var(--u-line); }
.mini__rows i { font-style: normal; color: var(--u-muted); }
.mini__rows b { font-weight: 500; }
.mini__rows span { color: var(--u-muted); }
.mini__rows .is-new { background: var(--u-tint); }
.mini__rows .is-new span { color: var(--u-accent-text); font-weight: 500; }
@media (max-width: 639px) { .mini--over { display: none; } }

/* the hero h1 on a phone: 34px (the smallest the page allows) so the longest headline still stays within two lines at 390 */
@media (max-width: 639px) { .hero--product { --ly-h1: 34px; } }

/* ---------------------------------------------------------------- statement and sections */
/* spacing only: the gap from the hero to #accesible at tablet and phone widths */
@media (min-width: 800px) and (max-width: 1023px) { #accesible { padding-top: calc(var(--section) + 240px); } }
@media (min-width: 640px) and (max-width: 799px) { #accesible { padding-top: calc(var(--section) + 148px); } }
@media (max-width: 639px) { #accesible { padding-top: calc(var(--section) + 120px); } }
/* a phone: the photograph takes what the screen leaves under the words, down to the section's foot (the .fill rule) */
@media (max-width: 639px) { #medibit > .wrap { grid-template-rows: auto minmax(0, 1fr); } #medibit > .wrap > photo-frame { display: flex; min-height: 0; align-self: stretch; } #medibit .frame--photo { flex: 1 1 0; height: auto; min-height: 0; aspect-ratio: auto; } #medibit .frame__img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; } }
#enfoque .mo-wh__text { max-width: none; font-size: var(--t-h1); line-height: 1.1; letter-spacing: var(--display-tracking-xl, var(--display-tracking)); }
.section-head + .t-lead, .section-head + p { max-width: 46ch; }
.split-text > * + * { margin-top: var(--s-5); }
.split-text .t-lead { max-width: 40ch; }
.frame--split { --ratio: 85%; }
@media (max-width: 639px) { .frame--split { --ratio: 100%; } }

/* the funding credit: the official CORFO lockup on its own white plate in both modes, never filtered */
.footer__legal-text { display: grid; gap: var(--s-2); }
.footer__funding { display: flex; align-items: center; gap: var(--s-4); margin-top: var(--s-5); }
.footer__corfo { display: block; width: 128px; height: auto; padding: var(--s-3); background: #ffffff; border-radius: var(--r-md); box-sizing: content-box; }
.footer__funding p { margin: 0; max-width: 28ch; font-size: var(--t-small); }
@media (min-width: 640px) and (max-width: 1023px) {
  #contact .closing__links .grid > .span-5 { grid-column: 1 / -1; }
  #contact .closing__links .grid > .footer__col { grid-column: span 4; }
  #contact .closing__links .grid > .start-6 { grid-column: 1 / span 4; }
}

/* picture ratios: tall on a desktop, shorter where the words stack above them, so each section keeps its screen */
.frame--tall { --ratio: 85%; }
@media (max-width: 1023px) { .frame--split, .frame--tall { --ratio: 62%; } .frame--wide { --ratio: 62%; } }
@media (max-width: 639px) {
  .frame--split, .frame--tall { --ratio: 75%; } .frame--wide { --ratio: 75%; }
  .hero--product .hero__stage:has(> img) { flex: 1 1 auto; aspect-ratio: auto; min-height: 200px; }
}
@media (min-width: 1024px) and (max-width: 1279px) { .frame--tall, .frame--split { --ratio: 100%; } }

/* the client's logo at its own proportions: at least 124px wide in the bar (nothing within 10% of its height) */
.nav__logo img.logo { height: 50px; width: auto; }
.nav__logo img.footer__logo { height: 56px; }
@media (max-width: 639px) { .nav__logo img.logo { height: 49px; } }

@media (max-width: 359px) { .nav:not(.is-open) .nav__actions { display: none; } }
#hacemos { --mo-gap: 32px; }
/* the iris ring of #hacemos (assets/moments/iris-opens): the kit grows it through width, height, left and top on every
   scroll frame, a layout change that the layout-shift metric counts (CLS 0.28 at 1440). Here the ring fills the stage
   once, and its hairline circle is painted with a gradient on the same centre and radius (--mo-cx, --mo-cy, --mo-r),
   so only paint changes. */
#hacemos .mo-io__stage > .mo-io__ring {
  left: 0; top: 0; width: 100%; height: 100%; transform: none; border: 0; border-radius: 0;
  background: radial-gradient(circle at var(--mo-cx) var(--mo-cy), transparent calc(var(--mo-r) - 1px), var(--accent) calc(var(--mo-r) - 0.5px), var(--accent) calc(var(--mo-r) + 0.5px), transparent calc(var(--mo-r) + 1px));
}

/* the closing button takes the page's action pair in both modes (light #211915 on #00E5DE, dark #00DFD9 on #000000):
   the kit's own rule skips a dark page (data-tone="dark"), so the footer's ground ink would fill it instead */
.footer.closing .closing__cta .btn--primary { --action: var(--p-action); --action-ink: var(--p-action-ink); }
