/* Apta · Em breve · Editorial direction
   Tokens mirror DESIGN.md (_bmad-output/planning-artifacts/ux-designs/ux-apta-website-2026-11-14). */

:root {
  color-scheme: light dark;
  --bg: #FAF9F6;
  --fg: #434142;
  --primary: #336463;
  --sage: #648670;
  --sage-ink: #587862;
  --sage-tint: #E3EAE5;
  --leaf: #92B56D;
  --muted: #6B6968;
  --line: rgba(67, 65, 66, .14);
  --media-shade: rgba(51, 100, 99, .28);
  --tag-bg: rgba(250, 249, 246, .62);
  --tag-border: rgba(255, 255, 255, .6);
  --surface: #FAF9F6;
  --field-line: #8C8987;
  --error: #A1442F;
  --error-tint: #F6E7E2;
  --scrim: rgba(35, 52, 50, .38);
  --gutter: clamp(20px, 3.4vw, 48px);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1A1D1C;
    --fg: #ECEAE5;
    --primary: #7FB3B0;
    --sage: #8FAE99;
    --sage-ink: #8FAE99;
    --sage-tint: #33403A;
    --leaf: #92B56D;
    --muted: #A3A19C;
    --line: rgba(236, 234, 229, .12);
    --media-shade: rgba(14, 20, 18, .55);
    --tag-bg: rgba(26, 29, 28, .58);
    --tag-border: rgba(236, 234, 229, .12);
    --surface: #1F2322;
    --field-line: #77756F;
    --error: #E8998A;
    --error-tint: #3A2723;
    --scrim: rgba(8, 11, 10, .66);
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: "Montserrat", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-weight: 400;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

p, h1, h2, figure, ul { margin: 0; padding: 0; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

:focus-visible { outline: 2px solid var(--primary); outline-offset: 3px; border-radius: 6px; }

/* ── Frame ─────────────────────────────────────────── */
.page {
  min-height: 100vh;
  min-height: 100svh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  padding: 0 var(--gutter);
  max-width: 1360px;
  margin: 0 auto;
}

.top { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 28px 0; }

.logo { display: block; flex: none; border-radius: 8px; }
.logo img { display: block; height: 34px; width: auto; }

/* ── Language switcher ─────────────────────────────── */
.lang { display: flex; gap: 4px; list-style: none; font-size: 13px; letter-spacing: .01em; }
.lang a {
  display: block;
  padding: 8px 12px;
  border-radius: 999px;
  color: var(--muted);
  text-decoration: none;
  transition: color .2s, background-color .2s;
}
.lang a:hover { color: var(--fg); background: var(--sage-tint); }
.lang a[aria-current="page"] { color: var(--primary); font-weight: 500; background: var(--sage-tint); }
.lang a:focus-visible { border-radius: 999px; outline-offset: 2px; }

/* ── Hero ──────────────────────────────────────────── */
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: clamp(24px, 5vw, 80px);
  align-items: center;
  padding-bottom: var(--gutter);
}

.copy {
  container-type: inline-size;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding-bottom: 0;
}

.kicker {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--sage-ink);
  margin-bottom: clamp(16px, 2vw, 28px);
}
.kicker::before { content: ""; flex: none; width: 40px; height: 1px; background: var(--leaf); }

/* Display heading. Size is fitted to the copy column (cqi), per locale,
   so the longest line always fits: see the --fit values below. */
.display {
  --fit: 29cqi;
  --max: 236px;
  font-weight: 200;
  font-size: clamp(56px, var(--fit), var(--max));
  line-height: .86;
  letter-spacing: -.045em;
  color: var(--fg);
  margin-left: -.06em;
}
.display > span { display: block; }
.display .accent { color: var(--primary); }
.display .dot,
.contact-title .dot {
  display: inline-block;
  width: .13em;
  height: .13em;
  border-radius: 50%;
  background: var(--leaf);
  margin-left: .04em;
  animation: pulse 2.8s ease-in-out infinite;
}
.display--en { --fit: 24.5cqi; --max: 210px; }
.display--es { --fit: 19.5cqi; --max: 170px; line-height: .9; }
.display--404 { --fit: 34cqi; --max: 260px; }

.lede {
  margin-top: clamp(24px, 3vw, 44px);
  max-width: 31ch;
  font-size: clamp(17px, 1.45vw, 21px);
  line-height: 1.55;
  font-weight: 300;
}
.lede strong { font-weight: 500; color: var(--primary); white-space: nowrap; }

/* ── Media panel ───────────────────────────────────── */
.media {
  position: relative;
  border-radius: 32px;
  overflow: hidden;
  background: var(--sage-tint);
  min-height: 420px;
  height: min(72svh, 720px);
  isolation: isolate;
}
.media img,
.media video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(1.08);
}
.media video { animation: drift 24s ease-in-out infinite alternate; }
.media::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 55%, var(--media-shade));
  pointer-events: none;
}
.tag {
  position: absolute;
  left: 20px;
  bottom: 20px;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px 10px 12px;
  border-radius: 999px;
  background: var(--tag-bg);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  backdrop-filter: blur(14px) saturate(140%);
  border: 1px solid var(--tag-border);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: .04em;
  color: var(--primary);
}
.tag i { width: 8px; height: 8px; border-radius: 50%; background: var(--leaf); box-shadow: 0 0 0 4px rgba(146, 181, 109, .25); }

/* ── Primary pill (CTA, form submit, 404 home) ───── */
.cta,
.home {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 13px 22px;
  border: 0;
  border-radius: 999px;
  background: var(--primary);
  color: var(--bg);
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: background-color .2s;
}
.cta .arrow,
.home .arrow { flex: none; transition: transform .2s; }
.cta:hover,
.home:hover { background: var(--fg); }
.cta:hover .arrow { transform: translateX(3px); }
.home:hover .arrow { transform: translateX(-3px); }
.cta:focus-visible,
.home:focus-visible { border-radius: 999px; }
.cta { line-height: 1.25; }
.copy > .cta { align-self: flex-start; margin-top: clamp(28px, 3vw, 44px); padding: 15px 26px; font-size: 15px; }

/* ── 404 extras ────────────────────────────────────── */
.notfound { margin-top: clamp(24px, 3vw, 44px); display: grid; gap: 6px; font-size: clamp(17px, 1.45vw, 21px); line-height: 1.45; font-weight: 300; }
.notfound p:not(:first-child) { color: var(--muted); }
.home { align-self: flex-start; margin-top: clamp(24px, 2.6vw, 36px); }
.home .sep { opacity: .55; }

/* ── Contact dialog ────────────────────────────────── */
html:has(.contact[open]) { overflow: hidden; }

.contact {
  width: min(640px, calc(100% - 2 * var(--gutter)));
  max-width: none;
  max-height: calc(100vh - 48px);
  max-height: calc(100dvh - 48px);
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 32px;
  background: var(--surface);
  color: var(--fg);
  overflow-y: auto;
  overscroll-behavior: contain;
}
.contact::backdrop {
  background: var(--scrim);
  -webkit-backdrop-filter: blur(8px) saturate(120%);
  backdrop-filter: blur(8px) saturate(120%);
}
.contact[open] { animation: sheet-in .4s cubic-bezier(.2, .7, .2, 1); }
.contact[open]::backdrop { animation: fade-in .3s ease-out; }
.contact [hidden] { display: none; }

.sheet { position: relative; padding: clamp(32px, 4vw, 48px); }

.close {
  position: absolute;
  top: 20px;
  right: 20px;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 999px;
  color: var(--muted);
  transition: color .2s, background-color .2s;
}
.close:hover { color: var(--fg); background: var(--sage-tint); }
.close:focus-visible { border-radius: 999px; outline-offset: 2px; }

.contact .kicker { margin-bottom: 18px; }
.contact-title {
  font-weight: 200;
  font-size: clamp(38px, 4.2vw, 52px);
  line-height: 1;
  letter-spacing: -.04em;
  margin-left: -.04em;
  padding-right: 40px;
}
.contact-title:focus { outline: none; }
.contact-intro { margin-top: 14px; max-width: 44ch; font-size: 16px; font-weight: 300; line-height: 1.55; text-wrap: pretty; }

.contact-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px 16px;
  margin-top: 32px;
}
.field { min-width: 0; }
.field--wide,
.contact-alert,
.contact-actions { grid-column: 1 / -1; }

.field label { display: block; margin: 0 0 8px 2px; font-size: 13px; font-weight: 500; letter-spacing: .01em; }
.field .optional { font-weight: 400; color: var(--muted); }

.field input,
.field textarea {
  display: block;
  width: 100%;
  margin: 0;
  border: 1px solid var(--field-line);
  border-radius: 999px;
  background: transparent;
  color: var(--fg);
  font-family: inherit;
  font-size: 16px;
  font-weight: 400;
  line-height: 1.5;
  transition: border-color .2s, box-shadow .2s;
}
.field input { height: 50px; padding: 0 20px; }
.field textarea { min-height: 148px; padding: 13px 20px; border-radius: 22px; resize: vertical; }
.field input:hover,
.field textarea:hover { border-color: var(--fg); }
.field input:focus-visible,
.field textarea:focus-visible { border-color: var(--primary); outline: 2px solid var(--primary); outline-offset: 2px; }
.field input:focus-visible { border-radius: 999px; }
.field textarea:focus-visible { border-radius: 22px; }
.field [aria-invalid="true"] { border-color: var(--error); }
.field [aria-invalid="true"]:focus-visible { border-color: var(--error); outline-color: var(--error); }

.field-error { margin: 8px 0 0 20px; font-size: 12.5px; line-height: 1.4; color: var(--error); }
.field-error:empty { display: none; }
.field-foot { display: flex; align-items: flex-start; gap: 12px; }
.field-foot .field-error { flex: 1; }
.count { margin: 8px 20px 0 auto; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.count.is-over { color: var(--error); }

/* Honeypot: off-screen, not display:none (some bots skip hidden fields). */
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

.contact-alert {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px 16px;
  padding: 12px 12px 12px 20px;
  border-radius: 22px;
  background: var(--error-tint);
  font-size: 14px;
  line-height: 1.45;
}
.contact-retry {
  flex: none;
  padding: 8px 16px;
  border: 1px solid currentColor;
  border-radius: 999px;
  background: transparent;
  color: var(--error);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.25;
  cursor: pointer;
  transition: background-color .2s;
}
.contact-retry:hover { background: var(--surface); }
.contact-retry:focus-visible { border-radius: 999px; }

.contact-actions { display: flex; align-items: center; justify-content: space-between; gap: 16px 24px; margin-top: 4px; }
.contact-note { max-width: 30ch; text-wrap: pretty; font-size: 12.5px; line-height: 1.45; color: var(--muted); }
.contact-actions .cta { flex: none; }
.cta:disabled { cursor: progress; background: var(--primary); opacity: .75; }
.cta:disabled .arrow { display: none; }
.cta:disabled::after {
  content: "";
  width: 14px;
  height: 14px;
  border: 1.5px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin .8s linear infinite;
}

.contact-success { display: flex; flex-direction: column; align-items: flex-start; padding: 8px 0 4px; }
.check {
  display: grid;
  place-items: center;
  width: 60px;
  height: 60px;
  margin-bottom: 28px;
  border-radius: 50%;
  background: var(--sage-tint);
  color: var(--primary);
  box-shadow: 0 0 0 6px rgba(146, 181, 109, .18);
}
.contact-success .contact-title { padding-right: 0; }
.btn-quiet {
  margin-top: 36px;
  padding: 13px 24px;
  border-radius: 999px;
  background: var(--sage-tint);
  color: var(--primary);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  transition: color .2s, background-color .2s;
}
.btn-quiet:hover { color: var(--fg); }
.btn-quiet:focus-visible { border-radius: 999px; }

/* No JS: the CTA is a plain #anchor and the dialog shows through :target.
   The form posts urlencoded; the API redirects back to the success or error id. */
html:not(.js) .contact:is(:target, :has(:target)) {
  display: block;
  position: fixed;
  inset: 0;
  z-index: 10;
  margin: auto;
  outline: 100vmax solid var(--scrim);
}
html:not(.js) .contact-alert:target { display: flex; }
html:not(.js) .contact-success:target { display: flex; }
html:not(.js) .contact:has(.contact-success:target) .contact-main { display: none; }

/* ── Footer ────────────────────────────────────────── */
.foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  border-top: 1px solid var(--line);
  padding: 18px 0 22px;
  font-size: 12px;
  color: var(--muted);
  letter-spacing: .02em;
}

/* ── Motion ────────────────────────────────────────── */
.rise { opacity: 0; transform: translateY(18px); animation: rise .9s cubic-bezier(.2, .7, .2, 1) forwards; }
.d1 { animation-delay: .05s; } .d2 { animation-delay: .18s; } .d3 { animation-delay: .32s; } .d4 { animation-delay: .45s; } .d5 { animation-delay: .58s; }
@keyframes rise { to { opacity: 1; transform: none; } }
@keyframes drift { from { transform: scale(1.08); } to { transform: scale(1.16) translate(-2%, -1.5%); } }
@keyframes pulse { 50% { transform: scale(.7); opacity: .6; } }
@keyframes sheet-in { from { opacity: 0; transform: translateY(16px) scale(.985); } }
@keyframes fade-in { from { opacity: 0; } }
@keyframes spin { to { transform: rotate(1turn); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .rise { opacity: 1; transform: none; }
  .media video { display: none; }
}

/* ── Small screens ─────────────────────────────────── */
@media (max-width: 860px) {
  .top { padding: 20px 0; }
  .logo img { height: 28px; }
  .lang { gap: 0; font-size: 12px; }
  .lang a { padding: 7px 10px; }
  .hero { grid-template-columns: 1fr; grid-template-rows: auto auto; gap: 28px; align-content: start; }
  .media { order: -1; min-height: 0; height: 40svh; min-height: 220px; max-height: 420px; border-radius: 24px; }
  .copy { justify-content: flex-start; padding-bottom: 0; }
  .kicker { font-size: 12px; letter-spacing: .12em; gap: 12px; }
  .kicker::before { width: 28px; }
  .lede { max-width: 34ch; font-size: 17px; }
  .notfound { font-size: 17px; }
  .foot { font-size: 11px; }
}

/* Contact dialog becomes a near-full-screen sheet on phones. */
@media (max-width: 640px) {
  .contact {
    width: 100%;
    height: calc(100vh - 12px);
    height: calc(100dvh - 12px);
    max-height: none;
    margin: auto 0 0;
    border-width: 1px 0 0;
    border-radius: 24px 24px 0 0;
  }
  html:not(.js) .contact:is(:target, :has(:target)) { inset: auto 0 0; margin: 0; }
  @keyframes sheet-in { from { transform: translateY(40px); opacity: 0; } }
  .sheet { min-height: 100%; display: flex; flex-direction: column; padding: 28px 20px calc(24px + env(safe-area-inset-bottom)); }
  .close { top: 14px; right: 14px; width: 44px; height: 44px; }
  .contact-title { font-size: 38px; padding-right: 44px; }
  .contact-intro { font-size: 15px; }
  .contact-form { grid-template-columns: minmax(0, 1fr); gap: 18px; margin-top: 26px; }
  .contact-alert { flex-direction: column; align-items: flex-start; padding: 14px 16px 14px 20px; }
  .contact-actions { flex-direction: column-reverse; align-items: stretch; gap: 14px; }
  .contact-actions .cta { width: 100%; padding: 15px 22px; font-size: 15px; }
  .contact-note { max-width: none; text-align: center; }
  .contact-success { flex: 1; justify-content: center; padding-bottom: 12vh; }
  .btn-quiet { align-self: stretch; text-align: center; }
}

@media (max-width: 360px) {
  .lang a { padding: 7px 7px; }
  .kicker { letter-spacing: .1em; gap: 10px; }
  .kicker::before { width: 20px; }
}

/* Browsers without container query units (e.g. Safari < 16): a var() holding cqi is invalid at computed time,
   so a plain fallback declaration would not apply. Size from the viewport instead. */
@supports not (width: 1cqi) {
  .display { font-size: clamp(56px, 11vw, var(--max)); }
}
