/* Hero. Themed via .theme-dark (forest-led) or .theme-light on the section. */

.hero {
  position: relative;
  background: var(--surface);
  color: var(--on-surface);
  padding-block: 36px 28px;
}

/* Dynamic background, first half of the mirrored pair with CTA final
   (cta-final.css): the WAAGS symbol tiled at low opacity, drifting slowly
   to the right as the visitor arrives — bookends the page rather than
   covering every section, so it reads as a deliberate opening/closing
   moment, not ambient wallpaper (Andrés's call, 2026-09-23).
   pattern-lime.svg is a tiling-only variant of symbol-lime.svg — the
   original mark has a small vertical gap between its "W" and "m" halves
   that shows as a seam between the flat leg-ends when repeated as a
   pattern (Andrés's feedback, same day); this copy closes exactly that
   gap without touching the rounded tips or the logo used elsewhere. See
   the comment in pattern-lime.svg itself for the exact numbers. Don't
   swap this back to symbol-lime.svg or reuse pattern-lime.svg for the
   logo/avatar/watermarks — they're for two different jobs now.
   .hero__inner gets position:relative purely so it paints above this
   pseudo-element (position:absolute siblings otherwise stack above plain
   static content regardless of DOM order). */
.hero.theme-dark::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url(../../assets/brand/pattern-lime.svg);
  background-repeat: repeat;
  background-size: 160px auto;
  opacity: 0.06;
  pointer-events: none;
  animation: hero-pattern-drift 26s linear infinite;
}
@keyframes hero-pattern-drift {
  to { background-position: 160px 0; }
}
@media (prefers-reduced-motion: reduce) {
  .hero.theme-dark::before { animation: none; }
}

.hero__inner { position: relative; } /* paints above the pattern pseudo above */

.hero.theme-dark {
  --panel-bg: var(--gradient-panel);
  --panel-mark-opacity: 0.18;
  --note-bg: rgb(157 196 213 / 0.12);
  --note-border: rgb(157 196 213 / 0.25);
  --note-fg: rgb(255 255 255 / 0.88);
}

.hero.theme-light {
  --panel-bg: var(--color-sky);
  --panel-mark-opacity: 0.22;
  --note-bg: var(--color-sky);
  --note-border: transparent;
  --note-fg: var(--color-forest);
}

.hero__content {
  display: flex;
  flex-direction: column;
  gap: 22px;
  max-width: 40rem;
}

/* Eyebrow: a lime rule and text on dark, a sky chip on light. */
.hero__eyebrow {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.75rem;
  font-weight: var(--fw-semibold);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--color-lime);
}
.hero__eyebrow::before {
  content: '';
  width: 22px;
  height: 1px;
  background: currentColor;
}
.hero__eyebrow-extra { display: none; }

.hero.theme-light .hero__eyebrow {
  align-self: flex-start;
  gap: 8px;
  height: 32px;
  padding-inline: 14px;
  border-radius: var(--radius-pill);
  background: var(--color-sky);
  color: var(--color-forest);
  font-size: var(--text-eyebrow);
  letter-spacing: 0.06em;
  text-transform: none;
}
.hero.theme-light .hero__eyebrow::before {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.hero__title {
  font-size: var(--text-display);
  font-weight: var(--fw-bold);
  line-height: 1.12;
  letter-spacing: -0.015em;
  text-wrap: pretty;
}

.hero__lead {
  max-width: 34ch;
  font-size: var(--text-lead);
  font-weight: var(--body-weight);
  line-height: 1.55;
  color: var(--on-surface-muted);
}

.hero__actions {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

/* Phone-only callout. On desktop the panel takes its place. */
.hero__note {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: var(--space-2);
  padding: 16px 18px;
  overflow: hidden;
  border: 1px solid var(--note-border);
  border-radius: var(--radius-card);
  background: var(--note-bg);
  color: var(--note-fg);
  font-size: 1rem;
  font-weight: var(--fw-regular);
  line-height: 1.4;
}
.hero__note-mark {
  flex-shrink: 0;
  width: 34px;
  height: 28px;
  background-color: var(--logo-color);
  -webkit-mask: url(../../assets/brand/symbol-black.svg) center / contain no-repeat;
  mask: url(../../assets/brand/symbol-black.svg) center / contain no-repeat;
}
.hero.theme-light .hero__note { padding: 22px 20px 22px 24px; }
.hero.theme-light .hero__note::before {
  content: '';
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--color-lime);
}

/* Desktop-only panel. Was a flat gradient with the logo watermark and a
   line of text repeating the headline — replaced with the example phone
   conversation (Claude Design brief "WAAGS Hero Phone", ported
   2026-09-24: see js/hero-phone.js for the message loop and zoom). */
.hero__panel {
  display: none;
  position: relative;
  overflow: hidden;
  height: 560px;
  padding: 32px;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  border-radius: var(--radius-lg);
  background: var(--panel-bg);
  color: var(--color-forest);
}
/* Its own flex row so the phone (however far its 3D tilt visually reaches)
   never overlaps .hero__panel-hint below — that used to be absolutely
   positioned over the same area and the phone's tilted corner sometimes
   painted over the tail end of the hint text (Andrés's/the audit's report,
   2026-09-24). Reserving the hint its own row makes the overlap impossible
   regardless of tilt/scale, instead of tuning coordinates by eye. */
.hero__panel-stage {
  flex: 1;
  min-height: 0;
  width: 100%;
  overflow: hidden; /* safety net: the phone can never paint into the hint's row below, whatever the scale/tilt math works out to */
  display: flex;
  align-items: center;
  justify-content: center;
}
.hero.theme-light .hero__panel::after {
  content: '';
  position: absolute;
  inset: auto 0 0 0;
  height: 6px;
  background: var(--gradient-signature);
}
.hero__panel-mark {
  position: absolute;
  top: 22px;
  right: 60px;
  height: 217px;
  width: auto;
  opacity: var(--panel-mark-opacity);
}
.hero__panel-label {
  position: absolute;
  left: 26px;
  top: 24px;
  font-size: 0.75rem;
  font-weight: var(--fw-bold);
  letter-spacing: 0.18em;
  text-transform: uppercase;
}
.hero__panel-hint {
  align-self: flex-end;
  font-size: 0.8125rem;
  font-weight: var(--fw-semibold);
}

/* ---- Example phone (shared: desktop panel + lightbox) ---- */

/* Built once at a fixed 360×680 native size (all the chrome measurements
   below are tuned to that), then scaled down per placement via
   --phone-scale on the wrapping .phone-trigger/.phone-zoom__stage — same
   technique the Claude Design brief used for its own breakpoint frames,
   so every measurement stays proportional instead of needing its own
   recomputed set of numbers. */
.phone-trigger {
  position: relative;
  display: block;
  padding: 0;
  border: none;
  background: none;
  cursor: zoom-in;
  width: calc(360px * var(--phone-scale, 0.6));
  height: calc(680px * var(--phone-scale, 0.6));
  perspective: 1500px;
}
/* Sized to comfortably clear .hero__panel-stage's own height budget (panel
   height minus padding, gap and the hint line below) with real margin for
   the 3D tilt's visual reach — 0.72 measured flush against the ceiling and
   its tilted corner clipped into the hint text (2026-09-24 fix). */
.hero__panel .phone-trigger { --phone-scale: 0.6; }
.phone-trigger:focus-visible { outline: 2px solid var(--color-forest); outline-offset: 4px; }

.phone {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 360px;
  height: 680px;
  margin: -340px 0 0 -180px;
  transform-style: preserve-3d;
  transform: scale(var(--phone-scale, 0.6)) rotateY(calc(var(--phone-tilt, -16) * 1deg)) rotateX(7deg) rotateZ(1.5deg);
  animation: phone-float 9s ease-in-out infinite;
}
@keyframes phone-float {
  0%, 100% { translate: 0 0; }
  50% { translate: 0 -14px; }
}
@media (prefers-reduced-motion: reduce) {
  .phone { animation: none; }
}

/* Stacked, darkening layers behind the body give the tilted phone a sense
   of physical thickness along its edge. */
.phone__edges { position: absolute; inset: 0; }
.phone__edge {
  position: absolute;
  inset: 0;
  border-radius: 54px;
}
.phone__edge--1 { background: #0d1410; transform: translateZ(-16px); }
.phone__edge--2 { background: #252e28; transform: translateZ(-13px); }
.phone__edge--3 { background: #2d3730; transform: translateZ(-10px); }
.phone__edge--4 { background: #343f37; transform: translateZ(-7px); }
.phone__edge--5 { background: #3b463e; transform: translateZ(-4px); }

.phone__body {
  position: relative;
  width: 100%;
  height: 100%;
  padding: 11px;
  border-radius: 54px;
  background: linear-gradient(145deg, #5b675e 0%, #2a332d 38%, #1b221e 62%, #4a564d 100%);
  box-shadow: inset 0 0 0 1.5px rgb(255 255 255 / 0.18), inset 0 0 0 4px #121814, 0 40px 60px -30px rgb(18 26 21 / 0.6);
}
/* Side buttons. */
.phone__bump { position: absolute; width: 4px; border-radius: 2px; background: #39443c; }
.phone__bump--1 { left: -3px; top: 128px; height: 30px; }
.phone__bump--2 { left: -3px; top: 176px; height: 56px; }
.phone__bump--3 { left: -3px; top: 244px; height: 56px; }
.phone__bump--4 { right: -3px; top: 196px; height: 86px; }

.phone__screen {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 44px;
  overflow: hidden;
  background: #f7f7f2;
  display: flex;
  flex-direction: column;
}
.phone__glare {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(118deg, rgb(255 255 255 / 0.34) 0%, rgb(255 255 255 / 0) 28%, rgb(255 255 255 / 0) 70%, rgb(255 255 255 / 0.08) 100%);
}

.phone__statusbar {
  height: 46px;
  flex: none;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 26px 0 30px;
  background: #ffffff;
}
.phone__time { font-size: 14px; font-weight: 600; color: #141613; letter-spacing: 0.01em; }
.phone__island {
  position: absolute;
  left: 50%;
  top: 11px;
  width: 92px;
  height: 27px;
  margin-left: -46px;
  border-radius: 999px;
  background: #0b0d0c;
}
.phone__status-icons { display: flex; align-items: center; gap: 5px; }
.phone__signal { display: flex; align-items: flex-end; gap: 1.5px; height: 10px; }
.phone__signal span { width: 3px; border-radius: 1px; background: #141613; }
.phone__signal span:nth-child(1) { height: 4px; }
.phone__signal span:nth-child(2) { height: 6px; }
.phone__signal span:nth-child(3) { height: 8px; }
.phone__signal span:nth-child(4) { height: 10px; }
.phone__battery {
  width: 22px;
  height: 11px;
  border-radius: 3px;
  border: 1px solid rgb(20 22 19 / 0.45);
  padding: 1.5px;
  display: flex;
}
.phone__battery span { width: 70%; background: #141613; border-radius: 1.5px; }

.phone__chatbar {
  flex: none;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px 10px;
  background: #ffffff;
  border-bottom: 1px solid #e4e4dc;
}
.phone__avatar {
  width: 36px;
  height: 36px;
  flex: none;
  border-radius: 999px;
  background: #203627;
  color: #e0de2c;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.phone__who { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.phone__who-name { font-size: 15px; font-weight: 600; color: #203627; white-space: nowrap; }
.phone__who-status { font-size: 12px; font-weight: 500; color: #4e5d52; }
.phone__who-status[data-typing] { color: #2c4a35; }

.phone__messages {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 7px;
  padding: 10px 12px 12px;
  overflow: hidden;
}
.phone__day {
  align-self: center;
  font-size: 11px;
  font-weight: 600;
  color: #4e5d52;
  background: #ecece5;
  padding: 3px 10px;
  border-radius: 999px;
  margin-bottom: 4px;
}
@keyframes phone-msg-in {
  from { opacity: 0; transform: translateY(10px) scale(0.96); }
  to { opacity: 1; transform: none; }
}
.phone__msg {
  max-width: 80%;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 11px 5px;
  border-radius: 16px 16px 5px 16px;
  animation: phone-msg-in 0.38s cubic-bezier(0.2, 0.8, 0.3, 1) both;
}
.phone__msg--client { align-self: flex-end; background: #9dc4d5; color: #203627; }
.phone__msg--client .phone__msg-time { align-self: flex-end; color: #2c4a35; }
.phone__msg--clinic {
  align-self: flex-start;
  max-width: 84%;
  background: #ffffff;
  color: #203627;
  border: 1px solid #e4e4dc;
  border-radius: 16px 16px 16px 5px;
  gap: 6px;
}
.phone__msg-text { font-size: 13.5px; line-height: 1.38; font-weight: 500; }
.phone__msg--clinic .phone__msg-text { font-weight: 400; }
.phone__msg-time { align-self: flex-end; font-size: 10px; color: #4e5d52; }
.phone__msg-card {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #203627;
  border-radius: 12px;
  padding: 9px 11px;
}
.phone__msg-card-date {
  width: 30px;
  height: 30px;
  flex: none;
  border-radius: 9px;
  background: #e0de2c;
  color: #203627;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.phone__msg-card-date span:first-child { font-size: 8px; font-weight: 700; letter-spacing: 0.06em; }
.phone__msg-card-date span:last-child { font-size: 13px; font-weight: 700; }
.phone__msg-card-text { display: flex; flex-direction: column; gap: 1px; }
.phone__msg-card-title { font-size: 12.5px; font-weight: 600; color: #ffffff; }
.phone__msg-card-sub { font-size: 11.5px; color: rgb(255 255 255 / 0.82); }

.phone__typing {
  align-self: flex-start;
  display: flex;
  align-items: center;
  gap: 4px;
  background: #ffffff;
  border: 1px solid #e4e4dc;
  border-radius: 16px 16px 16px 5px;
  padding: 11px 13px;
  animation: phone-msg-in 0.38s cubic-bezier(0.2, 0.8, 0.3, 1) both;
}
@keyframes phone-typing-dot {
  0%, 60%, 100% { opacity: 0.3; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-3px); }
}
.phone__typing span {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: #203627;
  animation: phone-typing-dot 1.1s infinite;
}
.phone__typing span:nth-child(2) { animation-delay: 0.15s; }
.phone__typing span:nth-child(3) { animation-delay: 0.3s; }
@media (prefers-reduced-motion: reduce) {
  .phone__msg, .phone__typing { animation: none; }
  .phone__typing span { animation: none; opacity: 0.75; }
}

.phone__inputbar {
  flex: none;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px 22px;
  background: #ffffff;
  border-top: 1px solid #e4e4dc;
}
.phone__input {
  flex: 1;
  height: 34px;
  border-radius: 999px;
  border: 1px solid #cdd6ce;
  display: flex;
  align-items: center;
  padding: 0 14px;
  font-size: 13px;
  color: #4e5d52;
}
.phone__send {
  width: 34px;
  height: 34px;
  flex: none;
  border-radius: 999px;
  background: #203627;
  display: flex;
  align-items: center;
  justify-content: center;
}
.phone__home-indicator {
  position: absolute;
  left: 50%;
  bottom: 7px;
  width: 100px;
  height: 4px;
  margin-left: -50px;
  border-radius: 999px;
  background: #141613;
}

/* ---- Lightbox ---- */
.phone-zoom {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background: rgb(24 43 30 / 0.86);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  cursor: zoom-out;
}
.phone-zoom[hidden] { display: none; }
.phone-zoom__close {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 48px;
  height: 48px;
  border-radius: 999px;
  border: 1px solid rgb(255 255 255 / 0.35);
  background: transparent;
  color: var(--color-white);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease;
}
.phone-zoom__close:hover { border-color: var(--color-lime); color: var(--color-lime); }
.phone-zoom__stage {
  position: relative;
  cursor: default;
  perspective: 1500px;
  width: calc(360px * var(--phone-scale, 0.9));
  height: calc(680px * var(--phone-scale, 0.9));
}
.phone-zoom__caption { font-size: 0.875rem; font-weight: var(--fw-medium); color: rgb(255 255 255 / 0.82); }
@media (prefers-reduced-motion: reduce) {
  .phone-zoom { animation: none; }
}

/* ---- Mobile phone thumbnail, beside the headline ---- */
.hero__title-row { display: flex; align-items: center; gap: 14px; }
/* Hosts a live clone of the same animated .phone used in the desktop panel
   (js/hero-phone.js appends it directly here) — the real, running
   conversation at a small scale, not a static decorative stand-in
   (Andrés's feedback, 2026-09-24: it should be "the same animation, just
   smaller"). Sizing follows the same --phone-scale technique as
   .phone-trigger. The background/radius below are just a graceful fallback
   for the brief instant before JS mounts the phone. */
.phone-thumb {
  /* an actual custom-property assignment, not just a calc() fallback below —
     the cloned .phone reads this through inheritance. 0.253 = 0.22 × 1.15,
     the phone itself 15% bigger (Andrés's request, 2026-09-24). The box
     below is sized to 1.1× the phone's own footprint, not 1:1 — needed
     room for the float animation's bounce, which was getting clipped by
     overflow:hidden when the box matched the phone exactly. */
  --phone-scale: 0.253;
  position: relative;
  flex: none;
  width: calc(360px * var(--phone-scale) * 1.1);
  height: calc(680px * var(--phone-scale) * 1.1);
  padding: 0;
  border: none;
  border-radius: 12px;
  background: var(--gradient-panel);
  cursor: zoom-in;
  overflow: hidden;
  perspective: 1500px;
}
.phone-thumb__zoom {
  position: absolute;
  z-index: 1;
  right: 5px;
  bottom: 5px;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: var(--color-forest);
  color: var(--color-lime);
  display: flex;
  align-items: center;
  justify-content: center;
}

@media (min-width: 600px) {
  .hero__actions { flex-direction: row; align-items: center; gap: 14px; }
}

@media (min-width: 900px) {
  .hero { padding-block: 72px 80px; }

  .hero__inner {
    display: grid;
    grid-template-columns: 1.05fr 0.95fr;
    gap: var(--space-16);
    align-items: center;
  }

  .hero__content { gap: 26px; max-width: none; }

  .hero__eyebrow { font-size: var(--text-eyebrow); }
  .hero__eyebrow::before { width: 28px; }
  .hero__eyebrow-extra { display: inline; }
  .hero.theme-light .hero__eyebrow {
    height: 34px;
    padding-inline: 16px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
  }
  .hero.theme-light .hero__eyebrow::before { width: 8px; }

  .hero__title { line-height: 1.08; letter-spacing: -0.02em; text-wrap: balance; }
  .hero__lead { max-width: 52ch; }

  .hero__note { display: none; }
  .hero__panel { display: flex; }
  .phone-thumb { display: none; }
}
