/* ============================================================
   Livro -- fonts
   ============================================================ */

@font-face {
  font-family: "Fraunces Variable";
  src: url("assets/fonts/Fraunces-Variable.woff2") format("woff2-variations"),
       url("assets/fonts/Fraunces-Variable.woff2") format("woff2");
  font-weight: 300 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Fraunces Variable";
  src: url("assets/fonts/Fraunces-Italic-Variable.woff2") format("woff2-variations"),
       url("assets/fonts/Fraunces-Italic-Variable.woff2") format("woff2");
  font-weight: 300 700;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: "Public Sans";
  src: url("assets/fonts/PublicSans-Regular.woff2") format("woff2-variations"),
       url("assets/fonts/PublicSans-Regular.woff2") format("woff2");
  font-weight: 300 800;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Public Sans";
  src: url("assets/fonts/PublicSans-Italic.woff2") format("woff2-variations"),
       url("assets/fonts/PublicSans-Italic.woff2") format("woff2");
  font-weight: 300 800;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: "IBM Plex Mono";
  src: url("assets/fonts/PlexMono-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "IBM Plex Mono";
  src: url("assets/fonts/PlexMono-Medium.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

/* ============================================================
   Tokens
   ============================================================ */

:root {
  --bg: #eff1e8;
  --surface: #ffffff;
  --surface-soft: #e4e7d8;
  --text: #1b1c17;
  --text-muted: #5a5e4d;
  --border: #d7dac6;
  --accent: #1f5c4e;
  --accent-strong: #16463b;
  --on-accent: #f3f5ea;
  --bubble-out: #d9f2d1;
  --bubble-in: #ffffff;
  --shadow: 0 18px 40px -22px rgba(27, 28, 23, 0.35);

  --font-display: "Fraunces Variable", ui-serif, Georgia, serif;
  --font-body: "Public Sans", ui-sans-serif, system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SF Mono", monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14150f;
    --surface: #1d1f16;
    --surface-soft: #262819;
    --text: #edefe2;
    --text-muted: #a3a791;
    --border: #343725;
    --accent: #59a98c;
    --accent-strong: #7bc4a6;
    --on-accent: #0d150f;
    --bubble-out: #234a37;
    --bubble-in: #262819;
    --shadow: 0 18px 44px -22px rgba(0, 0, 0, 0.6);
  }
}

:root[data-theme="dark"] {
  --bg: #14150f;
  --surface: #1d1f16;
  --surface-soft: #262819;
  --text: #edefe2;
  --text-muted: #a3a791;
  --border: #343725;
  --accent: #59a98c;
  --accent-strong: #7bc4a6;
  --on-accent: #0d150f;
  --bubble-out: #234a37;
  --bubble-in: #262819;
  --shadow: 0 18px 44px -22px rgba(0, 0, 0, 0.6);
}

:root[data-theme="light"] {
  --bg: #eff1e8;
  --surface: #ffffff;
  --surface-soft: #e4e7d8;
  --text: #1b1c17;
  --text-muted: #5a5e4d;
  --border: #d7dac6;
  --accent: #1f5c4e;
  --accent-strong: #16463b;
  --on-accent: #f3f5ea;
  --bubble-out: #d9f2d1;
  --bubble-in: #ffffff;
  --shadow: 0 18px 40px -22px rgba(27, 28, 23, 0.35);
}

/* ============================================================
   Reset and base
   ============================================================ */

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
}

body {
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  transition: background 200ms ease, color 200ms ease;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;
}

svg {
  display: block;
}

/* ============================================================
   Page shell -- fixed to the viewport, never scrolls
   ============================================================ */

.page {
  height: 100dvh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: clamp(16px, 3vh, 32px) clamp(18px, 4vw, 56px);
  gap: clamp(10px, 2vh, 24px);
}

/* ============================================================
   Header
   ============================================================ */

.site-header {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-mark {
  color: var(--accent);
  width: clamp(22px, 2.4vw, 28px);
  height: auto;
  flex: none;
}

.brand-name {
  font-family: var(--font-display);
  font-variation-settings: "opsz" 30, "wght" 560;
  font-size: clamp(18px, 2vw, 23px);
  letter-spacing: 0.01em;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: clamp(8px, 1.4vw, 14px);
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-muted);
  transition: color 160ms ease, border-color 160ms ease, background 160ms ease;
}

.icon-btn:hover,
.icon-btn:focus-visible {
  color: var(--text);
  border-color: var(--text-muted);
  background: var(--surface-soft);
}

.icon-btn svg {
  width: 17px;
  height: 17px;
}

.pill-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px 9px 13px;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: clamp(12px, 1vw, 13px);
  letter-spacing: 0.02em;
  color: var(--text);
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.pill-link:hover,
.pill-link:focus-visible {
  border-color: var(--text-muted);
  background: var(--surface-soft);
}

.pill-link svg {
  width: 15px;
  height: 15px;
}

/* ============================================================
   Hero
   ============================================================ */

.hero {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(0, 0.92fr);
  align-items: center;
  gap: clamp(20px, 5vw, 64px);
}

.hero-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: clamp(10px, 1.8vh, 20px);
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: clamp(10.5px, 0.85vw, 12.5px);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
}

.headline {
  font-family: var(--font-display);
  font-variation-settings: "opsz" 40, "wght" 520;
  font-size: clamp(28px, 4.6vw, 58px);
  line-height: 1.05;
  letter-spacing: -0.01em;
  margin: 0;
  text-wrap: balance;
  max-width: 15ch;
}

.headline em {
  font-style: italic;
  font-variation-settings: "opsz" 40, "wght" 480;
  color: var(--accent);
}

.subtext {
  font-size: clamp(14px, 1.15vw, 17.5px);
  line-height: 1.55;
  color: var(--text-muted);
  max-width: 46ch;
}

.cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: clamp(10px, 1.2vw, 14px);
  margin-top: clamp(4px, 1vh, 10px);
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: clamp(11px, 1.3vh, 14px) clamp(16px, 1.6vw, 22px);
  border-radius: 10px;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: clamp(13.5px, 1vw, 15.5px);
  white-space: nowrap;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease, border-color 160ms ease;
}

.btn svg {
  width: 18px;
  height: 18px;
  flex: none;
}

.btn-primary {
  background: var(--accent);
  color: var(--on-accent);
  border: 1px solid var(--accent);
}

.btn-primary:hover,
.btn-primary:focus-visible {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

.btn-secondary {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover,
.btn-secondary:focus-visible {
  border-color: var(--text-muted);
  background: var(--surface-soft);
  transform: translateY(-1px);
}

.docs-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: clamp(12px, 0.95vw, 13.5px);
  color: var(--text-muted);
  width: fit-content;
  padding-bottom: 1px;
  border-bottom: 1px solid transparent;
  transition: color 160ms ease, border-color 160ms ease;
}

.docs-link:hover,
.docs-link:focus-visible {
  color: var(--text);
  border-color: var(--text-muted);
}

.docs-link svg {
  width: 12px;
  height: 12px;
  transition: transform 160ms ease;
}

.docs-link:hover svg {
  transform: translateX(2px);
}

/* ============================================================
   Phone mockup
   ============================================================ */

.hero-visual {
  min-width: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100%;
}

.phone {
  width: min(100%, 300px);
  height: min(92%, 560px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 30px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.phone-chrome {
  flex: none;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.phone-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--on-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
}

.phone-avatar svg {
  width: 16px;
  height: 16px;
}

.phone-id {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.phone-id .name {
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 13.5px;
}

.phone-id .status {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--text-muted);
}

.phone-thread {
  flex: 1 1 auto;
  min-height: 0;
  background: var(--bg);
  padding: clamp(10px, 2vh, 18px) 12px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 8px;
}

.bubble {
  max-width: 84%;
  padding: 8px 11px;
  border-radius: 13px;
  font-size: clamp(11.5px, 1.6vh, 13.5px);
  line-height: 1.42;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.03);
}

.bubble.in {
  align-self: flex-start;
  background: var(--bubble-in);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
}

.bubble.out {
  align-self: flex-end;
  background: var(--bubble-out);
  border-bottom-right-radius: 4px;
}

.bubble .meta {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 3px;
  margin-top: 3px;
  font-family: var(--font-mono);
  font-size: 9.5px;
  color: var(--text-muted);
}

.bubble .meta svg {
  width: 12px;
  height: 12px;
  color: var(--accent);
}

.typing {
  align-self: flex-start;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 9px 12px;
  border-radius: 13px;
  border-bottom-left-radius: 4px;
  background: var(--bubble-in);
  border: 1px solid var(--border);
}

.typing span {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--text-muted);
  opacity: 0.6;
  animation: bounce 1.2s infinite ease-in-out;
}

.typing span:nth-child(2) {
  animation-delay: 0.15s;
}

.typing span:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes bounce {
  0%,
  60%,
  100% {
    transform: translateY(0);
    opacity: 0.5;
  }
  30% {
    transform: translateY(-3px);
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .typing span {
    animation: none;
  }
  .btn,
  .icon-btn,
  .pill-link,
  .docs-link,
  .docs-link svg {
    transition: none;
  }
}

/* ============================================================
   Responsive: width
   ============================================================ */

@media (max-width: 880px) {
  .hero {
    grid-template-columns: 1fr;
  }
  .hero-visual {
    display: none;
  }
  .headline {
    max-width: none;
  }
}

@media (max-width: 460px) {
  .header-actions .pill-link span {
    display: none;
  }
  .header-actions .pill-link {
    padding: 9px;
  }
}

/* ============================================================
   Responsive: height (short viewports, landscape phones)
   ============================================================ */

@media (max-height: 640px) {
  .hero {
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  }
  .phone {
    height: 94%;
  }
}

@media (max-height: 460px) {
  .hero-visual {
    display: none;
  }
  .hero {
    grid-template-columns: 1fr;
  }
  .cta-row {
    margin-top: 2px;
  }
}
