/* ============================================================
   emma.build — cream + terracotta, exe.dev-inspired restraint
   ============================================================ */

:root {
  --bg: hsl(50, 33%, 97%);
  --fg: hsl(30, 10%, 15%);
  --card: hsl(45, 30%, 95%);
  --primary: hsl(19, 52%, 52%);
  --primary-fg: hsl(0, 0%, 100%);
  --primary-soft: hsl(19, 52%, 62%);
  --secondary: hsl(40, 20%, 90%);
  --muted-fg: hsl(30, 8%, 45%);
  --border: hsl(35, 15%, 85%);

  --dark-bg: hsl(24, 12%, 9%);
  --dark-card: hsl(26, 14%, 13%);
  --dark-fg: hsl(40, 25%, 92%);
  --dark-muted: hsl(32, 12%, 62%);
  --dark-border: hsl(26, 12%, 22%);

  --sans: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto,
    Helvetica, Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas,
    "Liberation Mono", monospace;

  --prose: 720px;
  --wide: 1080px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--fg);
  line-height: 1.6;
  font-size: 17px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.mono { font-family: var(--mono); }

.container {
  max-width: var(--prose);
  margin: 0 auto;
  padding: 0 24px;
}
.container.wide { max-width: var(--wide); }

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3 { line-height: 1.15; letter-spacing: -0.02em; }
h2 { font-size: clamp(1.7rem, 4vw, 2.4rem); margin-bottom: 0.75rem; }
h3 { font-size: 1.15rem; margin-bottom: 0.5rem; }

/* ---------- header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: hsla(50, 33%, 97%, 0.85);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
}
.wordmark {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  color: var(--fg);
  letter-spacing: -0.01em;
}
.wordmark:hover { text-decoration: none; }
.wordmark-dot { color: var(--muted-fg); font-weight: 500; }

/* ---------- EmmaMark ("Glyph") ----------
   Geometry from the Emma PWA brand mark. Personality per the PWA spec:
   occasional right-eye wink on an irregular ~7-10s idle cycle with one
   paired antenna twinkle; hover/tap winks; reduced motion = fully static. */

.emma-mark { color: var(--primary); overflow: visible; flex-shrink: 0; }
.emma-mark .eye-l,
.emma-mark .eye-r,
.emma-mark .antenna {
  transform-box: fill-box;
  transform-origin: center;
}
.emma-mark-nav { width: 26px; height: 26px; }
.emma-mark-hero {
  width: 68px;
  height: 68px;
  display: block;
  margin-bottom: 20px;
}
.emma-mark-footer { width: 30px; height: 30px; }
.footer-id { display: flex; align-items: center; gap: 12px; }

@keyframes emma-wink {
  0%, 100% { transform: scaleY(1); }
  30%, 62% { transform: scaleY(0.12); }
}
@keyframes emma-twinkle {
  0%, 100% { transform: scale(1); opacity: 1; }
  38% { transform: scale(1.5); opacity: 0.55; }
}
@keyframes emma-bounce {
  0%, 100% { transform: translateY(0) scale(1, 1); }
  30% { transform: translateY(-7px) scale(0.97, 1.04); }
  62% { transform: translateY(0) scale(1.03, 0.96); }
}
@keyframes emma-enter {
  from { opacity: 0; transform: scale(0.85) translateY(6px); }
  to { opacity: 1; transform: none; }
}

/* JS-driven wink (idle cycle, greeting, tap) — antenna twinkle is paired. */
.emma-mark.wink .eye-r { animation: emma-wink 0.55s ease both; }
.emma-mark.wink .antenna { animation: emma-twinkle 0.9s ease both; }
.emma-mark.bounce { animation: emma-bounce 0.55s cubic-bezier(0.34, 1.4, 0.5, 1); }

/* Hover winks (nav wordmark, hero, footer). */
.wordmark:hover .emma-mark .eye-r,
.emma-mark-hero:hover .eye-r,
.emma-mark-footer:hover .eye-r { animation: emma-wink 0.55s ease both; }
.wordmark:hover .emma-mark .antenna,
.emma-mark-hero:hover .antenna,
.emma-mark-footer:hover .antenna { animation: emma-twinkle 0.9s ease both; }

/* Gentle entrance on the hero mark once JS confirms motion is ok.
   The .bounce rule below outranks it so the tap bounce can replay. */
.js .emma-mark-hero { animation: emma-enter 0.7s ease both; }
.js .emma-mark-hero.bounce {
  animation: emma-bounce 0.55s cubic-bezier(0.34, 1.4, 0.5, 1);
}
.site-nav { display: flex; gap: 18px; }
.site-nav a {
  font-family: var(--mono);
  font-size: 0.82rem;
  color: var(--muted-fg);
}
.site-nav a:hover { color: var(--primary); text-decoration: none; }

/* ---------- hero ---------- */

.hero { padding: 88px 0 40px; }
.kicker {
  font-family: var(--mono);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted-fg);
  margin-bottom: 20px;
}
.hero h1 {
  font-size: clamp(2.6rem, 8vw, 4.6rem);
  font-weight: 800;
  margin-bottom: 22px;
}
.accent { color: var(--primary); }
.lede {
  font-size: clamp(1.05rem, 2.4vw, 1.25rem);
  color: var(--muted-fg);
  max-width: 46ch;
  margin-bottom: 30px;
}
.cta-row { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 18px; }
.hero-footnote {
  font-size: 0.78rem;
  color: var(--muted-fg);
  letter-spacing: 0.06em;
  margin-bottom: 52px;
}

.btn {
  display: inline-block;
  padding: 12px 22px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.95rem;
  border: 1px solid transparent;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.btn:hover { text-decoration: none; transform: translateY(-2px); }
.btn-primary {
  background: var(--primary);
  color: var(--primary-fg);
  box-shadow: 0 1px 2px hsla(19, 52%, 30%, 0.25);
}
.btn-primary:hover { box-shadow: 0 6px 18px hsla(19, 52%, 40%, 0.3); }
.btn-ghost {
  background: transparent;
  color: var(--fg);
  border-color: var(--border);
}
.btn-ghost:hover { border-color: var(--primary); color: var(--primary); }
.btn-light {
  background: var(--dark-fg);
  color: var(--dark-bg);
}
.btn-light:hover { box-shadow: 0 6px 18px hsla(0, 0%, 0%, 0.35); }

/* ---------- terminal ---------- */

.terminal {
  background: hsl(24, 12%, 10%);
  border: 1px solid hsl(26, 12%, 20%);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 24px 60px -20px hsla(24, 30%, 20%, 0.35);
}
.terminal-bar {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 11px 14px;
  background: hsl(25, 12%, 13%);
  border-bottom: 1px solid hsl(26, 12%, 20%);
}
.tdot {
  width: 11px; height: 11px; border-radius: 50%;
  background: hsl(26, 12%, 26%);
}
.terminal-title {
  margin-left: 8px;
  font-size: 0.75rem;
  color: hsl(32, 12%, 55%);
}
.terminal-body {
  padding: 20px 22px 26px;
  min-height: 230px;
  font-size: 0.86rem;
  line-height: 1.75;
  color: hsl(40, 22%, 88%);
  white-space: pre-wrap;
  word-break: break-word;
}
.t-you { color: hsl(40, 25%, 92%); font-weight: 600; }
.t-tag { color: hsl(32, 12%, 55%); }
.t-emma { color: hsl(19, 65%, 66%); }
.t-dim { color: hsl(32, 12%, 62%); }
.t-ok { color: hsl(140, 35%, 60%); }
.cursor {
  display: inline-block;
  width: 8px; height: 1.05em;
  vertical-align: text-bottom;
  background: hsl(19, 65%, 66%);
  animation: blink 1s step-end infinite;
}
@keyframes blink { 50% { opacity: 0; } }

/* ---------- sections ---------- */

.section { padding: 84px 0; }
.section-alt { background: var(--card); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.section-label {
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  color: var(--primary);
  margin-bottom: 14px;
}
.section-intro {
  color: var(--muted-fg);
  max-width: 54ch;
  margin-bottom: 12px;
}

/* ---------- cards / trio ---------- */

.trio {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-top: 40px;
}
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 26px 24px;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}
.section-alt .card { background: var(--bg); }
.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 14px 34px -14px hsla(30, 20%, 30%, 0.18);
  border-color: hsl(19, 40%, 75%);
}
.card-label {
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  color: var(--primary);
  margin-bottom: 12px;
}
.card p:not(.card-label):not(.price) { color: var(--muted-fg); font-size: 0.95rem; }

/* ---------- feature grid ---------- */

.feature-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-top: 40px;
}
.feature {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px 18px;
  transition: transform 0.18s ease, border-color 0.18s ease;
}
.feature:hover { transform: translateY(-3px); border-color: hsl(19, 40%, 75%); }
.feature-label {
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  color: var(--primary);
  margin-bottom: 8px;
}
.feature p:not(.feature-label) { font-size: 0.88rem; color: var(--muted-fg); }

/* ---------- dark band ---------- */

.dark-band {
  background: var(--dark-bg);
  color: var(--dark-fg);
}
.dark-band .section-intro { color: var(--dark-muted); }
.dark-band .section-label { color: hsl(19, 65%, 66%); }

.arch-diagram {
  margin: 44px 0 36px;
  background: var(--dark-card);
  border: 1px solid var(--dark-border);
  border-radius: 14px;
  padding: 18px;
  overflow-x: auto;
}
.arch-diagram svg { width: 100%; height: auto; min-width: 640px; display: block; }
.svg-title {
  font-family: var(--sans);
  font-size: 17px;
  font-weight: 700;
  fill: hsl(40, 25%, 92%);
}
.svg-title.small { font-size: 15px; }
.svg-title.dim, .svg-sub.dim { fill: hsl(32, 12%, 48%); }
.svg-sub {
  font-family: var(--mono);
  font-size: 11px;
  fill: hsl(32, 12%, 62%);
}
.svg-wire {
  font-family: var(--mono);
  font-size: 11px;
  fill: hsl(19, 65%, 66%);
}
.flow {
  stroke-dasharray: 6 5;
  animation: flowmove 1.6s linear infinite;
}
.flow.dashed { animation-duration: 2.6s; opacity: 0.7; }
@keyframes flowmove { to { stroke-dashoffset: -11; } }

.arch-points {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}
.arch-point {
  background: var(--dark-card);
  border: 1px solid var(--dark-border);
  border-radius: 12px;
  padding: 20px 18px;
}
.arch-point .feature-label { color: hsl(19, 65%, 66%); }
.arch-point p:not(.feature-label) { font-size: 0.9rem; color: var(--dark-muted); }

.vision {
  margin-top: 40px;
  border: 1px dashed hsl(19, 40%, 40%);
  border-radius: 14px;
  padding: 30px 28px;
  background: linear-gradient(180deg, hsla(19, 52%, 52%, 0.07), transparent);
}
.vision-label {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid hsl(19, 45%, 45%);
  color: hsl(19, 65%, 70%);
  margin-bottom: 14px;
}
.vision h3 { font-size: 1.4rem; margin-bottom: 12px; }
.vision p { color: var(--dark-muted); max-width: 72ch; }

/* ---------- creator ---------- */

.creator p { margin-top: 18px; color: var(--muted-fg); max-width: 62ch; }
.creator strong { color: var(--fg); }

/* ---------- pricing ---------- */

.pricing-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  margin-top: 40px;
  max-width: 820px;
}
.price-card { display: flex; flex-direction: column; gap: 6px; }
.price {
  font-size: 2.6rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin: 6px 0 10px;
}
.price-period { font-size: 1rem; font-weight: 500; color: var(--muted-fg); }
.price-call { font-size: 2rem; }
.price-list {
  list-style: none;
  margin-bottom: 22px;
  flex: 1;
}
.price-list li {
  padding: 7px 0 7px 24px;
  position: relative;
  font-size: 0.93rem;
  color: var(--muted-fg);
}
.price-list li::before {
  content: "▸";
  position: absolute;
  left: 4px;
  color: var(--primary);
  font-size: 0.8rem;
}
.price-card .btn { text-align: center; }
.price-card-dark {
  background: var(--dark-bg);
  border-color: var(--dark-border);
  color: var(--dark-fg);
}
.price-card-dark .price-list li,
.price-card-dark p:not(.card-label):not(.price) { color: var(--dark-muted); }
.price-card-dark .card-label { color: hsl(19, 65%, 66%); }
.price-card-dark:hover { border-color: hsl(19, 45%, 45%); }

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

.site-footer {
  border-top: 1px solid var(--border);
  padding: 36px 0;
}
.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.footer-brand { font-size: 0.85rem; color: var(--fg); font-weight: 600; }
.footer-copy { font-size: 0.82rem; color: var(--muted-fg); }
.footer-links { display: flex; gap: 18px; }
.footer-links a { font-size: 0.82rem; color: var(--muted-fg); }
.footer-links a:hover { color: var(--primary); text-decoration: none; }

/* ---------- reveal animations ---------- */

/* Reveal styles only apply once JS has confirmed it's running (html.js),
   so content is never hidden if scripts fail to load. */
.js .reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.55s ease, transform 0.55s ease;
}
.js .reveal.in {
  opacity: 1;
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
  .flow { animation: none; }
  .cursor { animation: none; }
  .btn, .card, .feature { transition: none; }
  .emma-mark, .emma-mark * { animation: none !important; }
}

/* ---------- responsive ---------- */

@media (max-width: 900px) {
  .feature-grid { grid-template-columns: repeat(2, 1fr); }
  .trio { grid-template-columns: 1fr; }
  .arch-points { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
  body { font-size: 16px; }
  .section { padding: 64px 0; }
  .hero { padding: 60px 0 32px; }
  .feature-grid { grid-template-columns: 1fr; }
  .pricing-grid { grid-template-columns: 1fr; }
  .site-nav { display: none; }
  .terminal-body { font-size: 0.78rem; padding: 16px 14px 22px; }
}
