/* === Reset & base === */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg: #f2ebe0;
  --bg-warm: #ede5d8;
  --text: #2a2520;
  --text-secondary: #78705f;
  --accent: #B8460B; /* links, buttons, arrows, focus: the brand orange (4.5:1+ on paper) */
  --imsg-blue: #0A84FF; /* iMessage sent bubbles in the demos only */
  --brand: #B8460B; /* wordmark bubble */
  --stamp: #b03030;
  --seal: #B8460B; /* stamped rule numbers, check marks: brand orange (was navy) */
  --border: #d4c9b5;
  --paper: #faf6ee;
  --radius: 4px;
  --serif: "Instrument Serif", "Iowan Old Style", Georgia, serif;
  --sans: "Inter", system-ui, -apple-system, sans-serif;
  --hand: "Caveat", cursive;
  --mono: "Courier New", "Courier", monospace;
  --max-w: 1120px;
}

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.7' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.035'/%3E%3C/svg%3E");
  -webkit-font-smoothing: antialiased;
}
img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }

/* === Typography === */
h1 {
  font-family: var(--serif);
  font-weight: 400;
  font-style: italic;
  font-size: clamp(2.6rem, 6vw, 4.5rem);
  line-height: 1.08;
  letter-spacing: -0.02em;
}
h2 {
  font-family: var(--serif);
  font-weight: 400;
  font-style: italic;
  font-size: clamp(2rem, 4.5vw, 3.2rem);
  line-height: 1.12;
  letter-spacing: -0.015em;
}
h3 {
  font-family: var(--sans);
  font-weight: 600;
  font-size: 1.05rem;
  line-height: 1.35;
}
.eyebrow {
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--text-secondary);
  margin-bottom: 0.75rem;
}
.lede {
  font-size: 1.15rem;
  line-height: 1.55;
  color: var(--text-secondary);
  max-width: 480px;
}
.section-head { max-width: 560px; margin-bottom: 3rem; }

/* === Handwritten annotations === */
.note {
  font-family: var(--hand);
  color: var(--stamp);
  font-size: 1.3rem;
  line-height: 1.3;
  display: inline-block;
}

/* === Rubber stamp === */
.rubber-stamp {
  display: inline-block;
  font-family: var(--mono);
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--stamp);
  border: 2.5px solid var(--stamp);
  border-radius: 3px;
  padding: 0.3em 0.75em;
  transform: rotate(-3deg);
  opacity: 0.75;
  position: relative;
}
.rubber-stamp::after {
  content: '';
  position: absolute;
  inset: -1px;
  border: 1px solid var(--stamp);
  border-radius: 4px;
  opacity: 0.3;
}

/* === Section dividers === */
.section-rule {
  display: block;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 clamp(1.25rem, 4vw, 3rem);
}
.section-rule hr {
  border: none;
  height: 0;
  border-top: 1px dashed var(--border);
  position: relative;
}

/* === Button === */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.85rem 1.8rem;
  background: var(--text);
  color: var(--bg);
  font-family: var(--sans);
  font-size: 0.95rem;
  font-weight: 500;
  border-radius: 3px;
  border: 1px solid var(--text);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.btn:hover { transform: translateY(-1px); box-shadow: 3px 4px 0 rgba(0,0,0,0.12); }
.btn:active { transform: translateY(0); box-shadow: 1px 2px 0 rgba(0,0,0,0.08); }

/* === Wordmark (inline SVG bubble) === */
.wordmark, .footer-mark {
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.35rem;
  letter-spacing: -0.01em;
}
.wm-bubble {
  width: 0.47em;
  height: 0.5em;
  vertical-align: -0.07em;
  margin-inline: 0em;
  overflow: visible;
}
.wm-bubble path {
  fill: none;
  stroke: var(--brand);
  stroke-width: 6;
  stroke-linejoin: round;
}

/* === Nav === */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 clamp(1.25rem, 4vw, 3rem);
  height: 60px;
  background: rgba(242, 235, 224, 0.88);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}
.nav-mark { opacity: 0; transition: opacity 0.3s; }
.nav nav { display: flex; align-items: center; gap: 1.75rem; }
.nav nav a {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-secondary);
  transition: color 0.15s;
}
.nav nav a:hover { color: var(--text); }
.nav-cta {
  padding: 0.5rem 1.1rem !important;
  background: var(--text);
  color: var(--bg) !important;
  border-radius: 3px;
  font-size: 0.82rem !important;
}

/* === Hero === */
.hero {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: clamp(4rem, 10vh, 8rem) clamp(1.25rem, 4vw, 3rem) clamp(3rem, 8vh, 6rem);
}
.hero-text { max-width: 580px; }
.hero-text .eyebrow { margin-bottom: 1rem; }
.hero-text h1 { margin-bottom: 1.25rem; }
.hero-text .lede { margin-bottom: 1.25rem; }
.hero-note {
  font-family: var(--hand);
  color: var(--brand);
  font-size: 1.5rem;
  line-height: 1.2;
  margin-bottom: 2rem;
  transform: rotate(-1.5deg);
  transform-origin: left;
}
.hero-note svg {
  width: 24px;
  height: 14px;
  vertical-align: middle;
  margin-right: 0.25em;
  stroke: var(--brand);
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
}

/* === Phone mockup (the product — stays modern) === */
.phone {
  height: min(640px, calc(100vh - 130px));
  display: flex;
  flex-direction: column;
  border-radius: 44px;
  background: #fff;
  border: 9px solid var(--text);
  box-shadow: 0 50px 90px -40px rgba(42, 37, 32, 0.5);
  overflow: hidden;
}
.phone-top {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 16px 16px 13px;
  border-bottom: 1px solid var(--border);
}
.phone-top .avatar {
  width: 38px; height: 38px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
}
.phone-top .avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.phone-top strong { display: block; font-size: 0.9rem; font-weight: 600; }
.phone-top span { font-size: 0.75rem; color: var(--text-secondary); }
.thread {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 6px;
  overflow: hidden;
  padding: 14px;
  font-size: 0.9rem;
  line-height: 1.35;
}

/* === Bubble styles (the product — stays modern) === */
.bub {
  max-width: 82%;
  padding: 0.55rem 0.8rem;
  border-radius: 18px;
  font-size: 0.85rem;
  line-height: 1.4;
  opacity: 0;
  transform: translateY(6px);
  animation: bub-in 0.3s ease forwards;
}
.bub.no-anim { animation: none; opacity: 1; transform: none; }
.bub.them { align-self: flex-start; background: #E9E9EB; color: #1A1A1A; border-bottom-left-radius: 6px; }
.bub.me { align-self: flex-end; background: var(--imsg-blue); color: #fff; border-bottom-right-radius: 6px; }
.bub.link-bub { align-self: flex-start; background: #fff; border: 1px solid #E5E2DB; color: var(--imsg-blue); font-weight: 500; font-size: 0.82rem; border-bottom-left-radius: 6px; }
.bub.audio-bub.them { align-self: flex-start; background: #E9E9EB; border-bottom-left-radius: 6px; }
.bub.audio-bub.me { align-self: flex-end; background: var(--imsg-blue); color: #fff; border-bottom-right-radius: 6px; }
.bub.photo-bub { font-size: 1.4rem; align-self: flex-end; background: var(--imsg-blue); border-bottom-right-radius: 6px; }
.thread .stamp { text-align: center; font-size: 0.7rem; color: var(--text-secondary); padding: 0.35rem 0; opacity: 0; animation: bub-in 0.25s ease forwards; }
.thread .stamp.no-anim { animation: none; opacity: 1; }
.tap { font-size: 0.72rem; color: var(--text-secondary); font-style: italic; padding: 0.1rem 0; opacity: 0; animation: bub-in 0.25s ease forwards; }
.tap.no-anim { animation: none; opacity: 1; }

@keyframes bub-in {
  to { opacity: 1; transform: translateY(0); }
}

/* === Day section === */
.day {
  max-width: 1200px;
  margin: 0 auto;
  padding: 5rem clamp(1.25rem, 5vw, 4rem) 3rem;
}
.day-head { margin-bottom: 2rem; }
.day-head h2 { margin-bottom: 0.5rem; }
.day-now {
  font-family: var(--hand);
  font-size: 1.3rem;
  color: var(--stamp);
  transform: rotate(-1deg);
  transform-origin: left;
  display: inline-block;
  margin-top: 0.75rem;
}
.day-body {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: clamp(2rem, 7vw, 6rem);
  align-items: start;
}
.steps { list-style: none; }
.steps li {
  min-height: 62vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  opacity: 0.2;
  transition: opacity 0.4s;
}
.steps li.is-active { opacity: 1; }
.steps .time {
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  color: var(--stamp);
  margin-bottom: 0.6rem;
}
.steps h3 {
  font-family: var(--serif);
  font-weight: 400;
  font-style: italic;
  font-size: clamp(1.6rem, 3.5vw, 2.6rem);
  line-height: 1.08;
  margin-bottom: 0.6rem;
}
.steps p { font-size: 1.05rem; color: var(--text-secondary); line-height: 1.5; max-width: 26em; }
.phone-wrap { position: sticky; top: 96px; }

/* Timestamp stamps inside threads */
.bub-stamp { text-align: center; font-size: 0.7rem; color: var(--text-secondary); padding: 0.35rem 0; }

/* Day thread: messages pre-exist hidden, no animation */
.day .thread .bub,
.day .thread .bub-stamp { animation: none; opacity: 1; transform: none; }
.day .thread [hidden] { display: none; }

/* === Use-case player === */
.things {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 4rem clamp(1.25rem, 4vw, 3rem) 5rem;
}
.filter-bar { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 2rem; }
.filter-chip {
  padding: 0.4rem 0.9rem;
  border-radius: 2px;
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 400;
  letter-spacing: 0.04em;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s;
  text-transform: uppercase;
}
.filter-chip:hover { border-color: var(--text); color: var(--text); }
.filter-chip.is-active { background: var(--text); color: var(--bg); border-color: var(--text); }

.case-player { position: relative; }
.case-stage {
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2.5rem 2rem;
  min-height: 360px;
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 2rem;
  align-items: start;
  transition: opacity 0.2s;
  box-shadow: 3px 4px 0 rgba(0,0,0,0.06);
  position: relative;
}
.case-stage::before {
  content: '';
  position: absolute;
  top: 8px; right: 12px;
  width: 20px; height: 20px;
  border-radius: 50%;
  border: 2px solid var(--border);
  opacity: 0.4;
}
.case-info { max-width: 400px; }
.case-info .case-tag {
  display: inline-block;
  font-family: var(--mono);
  font-size: 0.65rem;
  font-weight: 400;
  padding: 0.2rem 0.6rem;
  border-radius: 2px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-secondary);
  margin-bottom: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.case-info h3 { font-size: 1.3rem; margin-bottom: 0.5rem; }
.case-info .case-hook { font-size: 1rem; color: var(--text-secondary); line-height: 1.55; }

.case-phone .phone { max-width: 300px; height: 400px; }
.case-phone .thread { min-height: 0; }

.case-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.25rem;
  margin-top: 1.25rem;
}
.case-nav button {
  width: 40px; height: 40px;
  border-radius: 2px;
  border: 1px solid var(--border);
  background: var(--paper);
  font-size: 1rem;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  font-family: var(--sans);
  display: flex;
  align-items: center;
  justify-content: center;
}
.case-nav button:hover { border-color: var(--text); background: var(--bg); }
.case-count { font-family: var(--mono); font-size: 0.78rem; color: var(--text-secondary); min-width: 60px; text-align: center; letter-spacing: 0.04em; }

/* === Rules === */
.rules {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 4rem clamp(1.25rem, 4vw, 3rem) 5rem;
}
.rules > .eyebrow { margin-bottom: 0.75rem; }
.rules > h2 { margin-bottom: 2.5rem; }
.rule-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.25rem;
}
.rule-grid article {
  padding: 2rem 2rem 2rem 2.25rem;
  background: var(--paper);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: 2px 3px 0 rgba(0,0,0,0.05);
  position: relative;
}
.rule-grid article:nth-child(odd) { transform: rotate(-0.3deg); }
.rule-grid article:nth-child(even) { transform: rotate(0.3deg); }
.rule-grid article::before {
  content: '';
  position: absolute;
  top: -2px; left: 16px;
  width: 24px; height: 6px;
  background: var(--border);
  border-radius: 0 0 3px 3px;
  opacity: 0.7;
}
.rule-grid .rule-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px; height: 44px;
  border-radius: 50%;
  border: 2.5px solid var(--seal);
  font-family: var(--mono);
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--seal);
  margin-bottom: 0.75rem;
  transform: rotate(-4deg);
  letter-spacing: 0.04em;
}
.rule-grid h3 { margin-bottom: 0.5rem; }
.rule-grid p { font-size: 0.9rem; color: var(--text-secondary); line-height: 1.55; }

/* === CTA === */
.cta {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 5rem clamp(1.25rem, 4vw, 3rem) 7rem;
  text-align: center;
  position: relative;
}
.cta h2 { margin-bottom: 1rem; }
.cta .lede { margin: 0 auto 1.25rem; }
.cta-note {
  font-family: var(--hand);
  font-size: 1.4rem;
  color: var(--stamp);
  margin-bottom: 2rem;
  transform: rotate(-1deg);
  display: inline-block;
}
.cta .rubber-stamp {
  position: absolute;
  top: 3rem;
  right: clamp(2rem, 8vw, 6rem);
  font-size: 0.55rem;
  transform: rotate(12deg);
}

/* === Footer === */
footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.5rem clamp(1.25rem, 4vw, 3rem);
  border-top: 1px dashed var(--border);
  font-size: 0.82rem;
  color: var(--text-secondary);
}
.footer-mark { color: var(--text); }
.legal a { color: var(--text-secondary); }
.legal a:hover { color: var(--text); }

/* === Responsive === */
@media (max-width: 800px) {
  .phone { height: 52vh; border-width: 6px; border-radius: 30px; }
  .phone .thread { padding: 10px; font-size: 0.82rem; }
  .day-body { display: flex; flex-direction: column-reverse; }
  .phone-wrap { position: sticky; top: 56px; z-index: 5; margin-bottom: 1rem; display: flex; justify-content: center; }
  .steps { padding-bottom: 16vh; }
  .steps li { min-height: 46vh; justify-content: flex-start; padding-top: 3vh; opacity: 0.3; }
  .steps h3 { font-size: clamp(1.4rem, 5vw, 2rem); }
  .case-stage { grid-template-columns: 1fr; }
  .case-phone { display: flex; justify-content: center; }
  .rule-grid { grid-template-columns: 1fr; }
  .nav nav a:not(.nav-cta) { display: none; }
  .cta .rubber-stamp { display: none; }
  .hero-note { font-size: 1.3rem; }
}

/* === Reveal on scroll === */
.reveal { opacity: 0; transform: translateY(20px); transition: opacity 0.7s, transform 0.7s cubic-bezier(0.2, 0.8, 0.2, 1); }
.reveal.in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  .bub, .thread .stamp, .tap { animation: none !important; opacity: 1 !important; transform: none !important; }
  .reveal { opacity: 1 !important; transform: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
}
