/* merrie.co: the house of Merrie, and Kindred's pages. See brand/MERRIE.md and brand/BRAND.md.
   House pages use moss as their accent; an app's pages (body.kindred) use the app's own. */

@font-face {
  font-family: "Castoro";
  src: url("/assets/fonts/Castoro-normal.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Castoro";
  src: url("/assets/fonts/Castoro-italic.woff2") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "Hanken Grotesk";
  src: url("/assets/fonts/HankenGrotesk-normal.woff2") format("woff2");
  font-weight: 300 700;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light dark;
  --bg: #f3ece3;
  --paper: #fbf8f3;
  --raised: #ede4d8;
  --ink: #2a1f19;
  --bark: #76665b;
  --line: #e1d6c8;
  --brass: #9c7840;
  --moss: #2e4a3d;
  --accent: var(--moss);
  --btn: #2e4a3d;
  --btn-ink: #f6f0e8;
  --btn-2: rgba(42, 31, 25, 0.06);
  --shadow: 0 1px 1px rgba(42, 31, 25, 0.04), 0 18px 40px -22px rgba(42, 31, 25, 0.35);
  --grain-opacity: 0.07;
  --tint-a: #ead2c0;
  --tint-b: #cddbe3;
  --tint-c: #ddd2e6;
  --tint-d: #d6e2d0;
  --tint-ink: #2a1f19;

  --serif: "Castoro", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: "Hanken Grotesk", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --ease: cubic-bezier(0.22, 0.8, 0.24, 1);
  --gutter: clamp(20px, 5vw, 56px);
  --measure: 34rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #16100d;
    --paper: #211814;
    --raised: #2b211b;
    --ink: #f2e9dd;
    --bark: #a6968a;
    --line: #3a2e27;
    --brass: #d2ae72;
    --moss: #9dbba9;
    --btn: #f2e9dd;
    --btn-ink: #1b1410;
    --btn-2: rgba(242, 233, 221, 0.08);
    --shadow: 0 1px 1px rgba(0, 0, 0, 0.3), 0 24px 48px -24px rgba(0, 0, 0, 0.8);
    --grain-opacity: 0.09;
    --tint-a: #6a4a3a;
    --tint-b: #34505f;
    --tint-c: #4b4062;
    --tint-d: #3d5a44;
    --tint-ink: #f6eee3;
  }
}

/* Kindred's pages: brass in place of moss. Buttons stay moss, as in the app. */
.kindred {
  --accent: var(--brass);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* A faint film grain, so flat color reads like paper instead of a screen. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 50;
  opacity: var(--grain-opacity);
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.5  0 0 0 0 0.42  0 0 0 0 0.36  0 0 0 0.9 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  mix-blend-mode: multiply;
}
@media (prefers-color-scheme: dark) {
  body::before {
    mix-blend-mode: screen;
  }
}

a {
  color: inherit;
  text-decoration-color: color-mix(in srgb, currentColor 35%, transparent);
  text-underline-offset: 0.2em;
  transition: text-decoration-color 0.3s var(--ease), color 0.3s var(--ease);
}
a:hover {
  text-decoration-color: currentColor;
}
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
  border-radius: 6px;
}

h1,
h2,
h3 {
  font-family: var(--serif);
  font-weight: 400;
  margin: 0;
  text-wrap: balance;
}
h1 em,
h2 em {
  font-style: italic;
  color: var(--accent);
}
p {
  margin: 0;
  text-wrap: pretty;
}

.wrap {
  width: 100%;
  max-width: 1160px;
  margin: 0 auto;
  padding-inline: var(--gutter);
}

/* ---------- Header ---------- */

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding-block: 22px;
}
.wordmark {
  font-family: var(--serif);
  font-size: 1.5rem;
  line-height: 1;
  letter-spacing: 0.005em;
  text-decoration: none;
}
.top nav {
  display: flex;
  gap: 26px;
  font-size: 0.9375rem;
  color: var(--bark);
}
.top nav a {
  text-decoration: none;
}
.top nav a:hover,
.top nav a[aria-current="page"] {
  color: var(--ink);
}

/* Kindred's own lockup: the mark and its name. */
.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  font-family: var(--serif);
  font-size: 1.375rem;
  letter-spacing: 0.01em;
}
.brand svg {
  width: 34px;
  height: 22px;
}

/* ---------- Kindred's mark ---------- */

.mark .ring {
  fill: none;
  stroke: currentColor;
}
.mark .lens {
  fill: var(--brass);
}

/* ---------- Buttons ---------- */

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px 22px;
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 54px;
  padding: 0 26px;
  border-radius: 999px;
  border: 0;
  font: 600 1rem/1 var(--sans);
  letter-spacing: 0.005em;
  text-decoration: none;
  cursor: pointer;
  background: var(--btn);
  color: var(--btn-ink);
  box-shadow: var(--shadow);
  transition: transform 0.5s var(--ease), box-shadow 0.5s var(--ease), background-color 0.3s var(--ease);
}
.btn:hover {
  transform: translateY(-1px);
}
.btn:active {
  transform: scale(0.98);
  transition-duration: 0.12s;
}
.btn.quiet {
  background: var(--btn-2);
  color: var(--ink);
  box-shadow: none;
}
.soon {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9375rem;
  color: var(--bark);
}
.soon::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--brass);
}
.more {
  font-weight: 600;
  color: var(--moss);
  text-decoration: none;
}
.more:hover {
  text-decoration: underline;
}
.fine {
  font-size: 0.875rem;
  color: var(--bark);
}

/* ---------- Sections ---------- */

section {
  padding-block: clamp(72px, 10vw, 140px);
  border-top: 1px solid var(--line);
}
.eyebrow {
  font: 600 0.8125rem/1 var(--sans);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--bark);
  margin-bottom: 22px;
}
section h2 {
  font-size: clamp(2.25rem, 3.6vw + 0.75rem, 4rem);
  line-height: 1.04;
  letter-spacing: -0.015em;
  max-width: 15ch;
}
section .lead {
  margin-top: 24px;
  max-width: var(--measure);
  font-size: clamp(1.0625rem, 0.3vw + 1rem, 1.1875rem);
  color: var(--bark);
}

/* ---------- The house: home page ---------- */

.house-hero {
  padding-block: clamp(48px, 10vw, 150px) clamp(72px, 11vw, 160px);
}
.house-hero h1 {
  font-size: clamp(3.25rem, 7.2vw + 0.5rem, 7.75rem);
  line-height: 0.96;
  letter-spacing: -0.025em;
  max-width: none;
}
.house-hero .lede {
  margin-top: clamp(28px, 3vw, 40px);
  max-width: 33rem;
  font-size: clamp(1.125rem, 0.5vw + 1rem, 1.3125rem);
  line-height: 1.55;
  color: var(--bark);
}

/* An app, presented by the house: its own panel on the left, the words on the right. */
.app {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: center;
  gap: clamp(36px, 6vw, 96px);
}
.app-art {
  display: grid;
  place-items: center;
  aspect-ratio: 5 / 4;
  border-radius: 28px;
  color: #f2e9dd;
  text-decoration: none;
  /* Kindred's room: always walnut, in either theme, like its icon. */
  background: radial-gradient(120% 100% at 50% 35%, #34271f, #16100d 72%);
  box-shadow: var(--shadow), inset 0 0 0 1px rgba(210, 174, 114, 0.14);
  view-timeline: --art block;
}
.app-art .mark {
  width: 58%;
  height: auto;
  overflow: visible;
}
.app-art .lens {
  fill: #d2ae72;
}
.app h2 {
  max-width: none;
}
.app .tagline {
  margin-top: 10px;
  font: italic 400 clamp(1.375rem, 1vw + 1rem, 1.75rem) / 1.25 var(--serif);
  color: var(--brass);
}
.app .lead {
  margin-top: 22px;
}
.app .actions {
  margin-top: 34px;
}
.app .more {
  display: inline-block;
  margin-top: 26px;
}

/* As Kindred's panel scrolls in, its two circles drift together and the overlap warms. */
@supports (animation-timeline: view()) {
  .app-art .ring-a {
    animation: drift-a linear both;
    animation-timeline: --art;
    animation-range: entry 20% cover 45%;
  }
  .app-art .ring-b {
    animation: drift-b linear both;
    animation-timeline: --art;
    animation-range: entry 20% cover 45%;
  }
  .app-art .lens {
    animation: warm linear both;
    animation-timeline: --art;
    animation-range: cover 35% cover 50%;
  }
}

/* "We'd rather not know": the headline on one side, the reasoning on the other. */
.statement {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: clamp(28px, 6vw, 96px);
  align-items: start;
}
.statement p {
  font-size: clamp(1.125rem, 0.5vw + 1rem, 1.3125rem);
  line-height: 1.6;
  color: var(--bark);
  max-width: 34rem;
}
.statement p + p {
  margin-top: 18px;
}
.statement p strong {
  font-weight: 500;
  color: var(--ink);
}

/* House rules: six short promises with hairlines above. */
.rules {
  list-style: none;
  margin: clamp(44px, 6vw, 80px) 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(36px, 4vw, 56px) clamp(28px, 4vw, 56px);
}
.rules li {
  border-top: 1px solid var(--line);
  padding-top: 24px;
}
.rules h3 {
  font-size: clamp(1.5rem, 1vw + 1.05rem, 1.875rem);
  line-height: 1.15;
}
.rules p {
  margin-top: 12px;
  color: var(--bark);
  max-width: 22rem;
}

/* ---------- Closing ---------- */

.closing {
  text-align: center;
}
.closing h2 {
  margin-inline: auto;
}
.closing .lead {
  margin-inline: auto;
}
.closing .actions {
  justify-content: center;
  margin-top: 36px;
}

/* ---------- Footer ---------- */

footer {
  border-top: 1px solid var(--line);
  padding-block: 40px 52px;
  color: var(--bark);
  font-size: 0.9375rem;
}
footer .wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 16px 28px;
  align-items: baseline;
  justify-content: space-between;
}
footer .wordmark {
  color: var(--ink);
  font-size: 1.25rem;
}
footer nav {
  display: flex;
  gap: 24px;
}
footer a {
  text-decoration: none;
}
footer a:hover {
  color: var(--ink);
}
footer .fine {
  flex-basis: 100%;
}

/* ---------- Kindred's page ---------- */

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  align-items: center;
  gap: clamp(40px, 6vw, 96px);
  padding-block: clamp(36px, 7vw, 110px) clamp(64px, 10vw, 140px);
}
.hero .brand {
  margin-bottom: clamp(26px, 3vw, 38px);
  font-size: 1.625rem;
  gap: 14px;
}
.hero .brand svg {
  width: 46px;
  height: 30px;
}
.hero h1 {
  font-size: clamp(3rem, 6.4vw + 0.5rem, 6.25rem);
  line-height: 0.98;
  letter-spacing: -0.02em;
}
.hero .lede {
  margin-top: 28px;
  max-width: 31rem;
  font-size: clamp(1.0625rem, 0.4vw + 1rem, 1.25rem);
  line-height: 1.6;
  color: var(--bark);
}
.hero .actions {
  margin-top: 38px;
}

/* The string: two faces, one line, a pulse running along it. */
.string {
  justify-self: center;
  width: min(440px, 88vw);
  margin: 0;
}
.string svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}
.string-face.a {
  fill: var(--tint-a);
}
.string-face.b {
  fill: var(--tint-c);
}
.string-initial {
  font: 400 38px var(--serif);
  fill: var(--tint-ink);
}
.string-line {
  fill: none;
  stroke: var(--bark);
  stroke-opacity: 0.55;
  stroke-width: 1.4;
  stroke-linecap: round;
}
.string-pulse {
  fill: none;
  stroke: var(--brass);
  stroke-width: 2.6;
  stroke-linecap: round;
  stroke-dasharray: 9 91;
  stroke-dashoffset: 9;
  animation: along 3.6s var(--ease) infinite;
}
@keyframes along {
  0% { stroke-dashoffset: 9; opacity: 0; }
  12% { opacity: 1; }
  70% { stroke-dashoffset: -91; opacity: 1; }
  82%, 100% { stroke-dashoffset: -91; opacity: 0; }
}

/* How it feels: three lines, nothing more. */
.feel {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: clamp(18px, 2.4vw, 28px);
  counter-reset: feel;
}
.feel li {
  counter-increment: feel;
  font: 400 clamp(1.75rem, 2.4vw + 0.8rem, 3rem) / 1.12 var(--serif);
  letter-spacing: -0.01em;
  display: grid;
  grid-template-columns: 2.4ch 1fr;
  align-items: baseline;
}
.feel li::before {
  content: counter(feel);
  font: 600 0.875rem/1 var(--sans);
  color: var(--accent);
}
.feel li:last-child {
  font-style: italic;
  color: var(--accent);
}

/* Two short points side by side. */
.pair {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(48px, 6vw, 96px);
}
.pair h2 {
  font-size: clamp(2rem, 2.4vw + 0.9rem, 3rem);
}
.pair .lead {
  margin-top: 18px;
}
.pair .more {
  display: inline-block;
  margin-top: 20px;
}

/* ---------- Prose pages (privacy) ---------- */

.prose {
  max-width: 44rem;
  padding-block: clamp(32px, 6vw, 80px) clamp(64px, 10vw, 120px);
}
.prose h1 {
  font-size: clamp(2.75rem, 4vw + 1rem, 4.5rem);
  line-height: 1;
  letter-spacing: -0.015em;
}
.prose .lead {
  margin-top: 22px;
  font-size: 1.1875rem;
  color: var(--bark);
}
.prose h2 {
  font-size: clamp(2rem, 1.6vw + 1.2rem, 2.625rem);
  margin-top: 72px;
  padding-top: 32px;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 14px;
}
.prose h2 svg {
  width: 40px;
  height: 27px;
  flex: none;
}
.prose h3 {
  font-size: 1.5rem;
  margin-top: 36px;
}
.prose h2 + p,
.prose h2 + h3 {
  margin-top: 18px;
}
.prose ul {
  margin: 14px 0 0;
  padding-left: 1.1em;
  display: grid;
  gap: 10px;
}
.prose li::marker {
  color: var(--accent);
}
.prose p + p,
.prose ul + p {
  margin-top: 14px;
}
.prose h3 + p {
  margin-top: 12px;
}

/* ---------- Invite and 404 pages ---------- */

.invite-page {
  min-height: 100svh;
  display: flex;
  flex-direction: column;
}
.invite-card {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px var(--gutter) 56px;
  max-width: 40rem;
  margin: 0 auto;
}
.invite-card > [data-state] {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.invite-face {
  width: 128px;
  height: 128px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font: 400 3.25rem/1 var(--serif);
  color: var(--tint-ink);
  background: var(--tint-a);
  position: relative;
  margin-bottom: 34px;
}
.invite-face[data-tint="1"] {
  background: var(--tint-b);
}
.invite-face[data-tint="2"] {
  background: var(--tint-c);
}
.invite-face[data-tint="3"] {
  background: var(--tint-d);
}
.invite-face::after {
  content: "";
  position: absolute;
  inset: -9px;
  border-radius: 50%;
  border: 1px solid color-mix(in srgb, var(--brass) 55%, transparent);
}
.invite-card h1 {
  font-size: clamp(2.25rem, 4vw + 1rem, 3.5rem);
  line-height: 1.04;
  letter-spacing: -0.015em;
}
.invite-card .lead {
  margin-top: 18px;
  color: var(--bark);
  font-size: 1.125rem;
  max-width: 28rem;
}
.invite-card .actions {
  margin-top: 36px;
  flex-direction: column;
  width: min(100%, 22rem);
}
.invite-card .btn {
  width: 100%;
}
.invite-card .fine {
  margin-top: 22px;
  max-width: 24rem;
}
.steps {
  margin: 28px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 10px;
  text-align: left;
  width: min(100%, 22rem);
  counter-reset: step;
}
.steps li {
  counter-increment: step;
  display: flex;
  gap: 12px;
  color: var(--bark);
  font-size: 0.9375rem;
}
.steps li::before {
  content: counter(step);
  flex: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  font: 400 0.8rem/1 var(--serif);
  color: var(--brass);
  margin-top: 2px;
}
.invite-by {
  padding: 0 var(--gutter) 28px;
  text-align: center;
}
.invite-by a {
  text-decoration: none;
}
.invite-by a:hover {
  color: var(--ink);
}
[hidden] {
  display: none !important;
}
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ---------- Motion ---------- */

/* The invite page's opening: two circles drift together and the overlap warms to brass. */
.mark-hero .ring-a {
  animation: drift-a 1.6s var(--ease) 0.15s both;
}
.mark-hero .ring-b {
  animation: drift-b 1.6s var(--ease) 0.15s both;
}
.mark-hero .lens {
  animation: warm 1.2s var(--ease) 1.3s both, breathe 6s ease-in-out 2.6s infinite;
}
@keyframes drift-a {
  from {
    transform: translateX(-26px);
    opacity: 0;
  }
  to {
    transform: none;
    opacity: 1;
  }
}
@keyframes drift-b {
  from {
    transform: translateX(26px);
    opacity: 0;
  }
  to {
    transform: none;
    opacity: 1;
  }
}
@keyframes warm {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
@keyframes breathe {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.78;
  }
}

.rise {
  animation: rise 1.1s var(--ease) both;
}
.rise.d1 {
  animation-delay: 0.25s;
}
.rise.d2 {
  animation-delay: 0.45s;
}
.rise.d3 {
  animation-delay: 0.65s;
}
.rise.d4 {
  animation-delay: 0.85s;
}
@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(18px);
    filter: blur(6px);
  }
  to {
    opacity: 1;
    transform: none;
    filter: none;
  }
}

/* Sections settle in as they scroll into view, where the browser supports it. */
@supports (animation-timeline: view()) {
  .settle {
    animation: settle linear both;
    animation-timeline: view();
    animation-range: entry 0% entry 55%;
  }
  @keyframes settle {
    from {
      opacity: 0.25;
      transform: translateY(42px);
    }
    to {
      opacity: 1;
      transform: none;
    }
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    animation-delay: 0s !important;
    transition-duration: 0.01ms !important;
  }
  .settle,
  .app-art .ring-a,
  .app-art .ring-b,
  .app-art .lens {
    animation: none !important;
  }
  .string-pulse {
    animation: none;
    stroke-dasharray: none;
    opacity: 0;
  }
}

/* ---------- Small screens ---------- */

@media (max-width: 860px) {
  .hero,
  .app,
  .statement,
  .pair {
    grid-template-columns: minmax(0, 1fr);
  }
  .rules {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 600px) {
  .rules {
    grid-template-columns: minmax(0, 1fr);
  }
  .hero .actions .btn,
  .app .actions .btn {
    width: 100%;
  }
  .top nav {
    gap: 20px;
  }
}
