/* Piecemates site, Oct 28 redesign: the Web variable collection from Figma
   (Light/Dark by the system setting, no toggle), a plain table (no grain since
   Oct 29), and the web/* text styles. Fonts are served from this site: no
   third-party requests, no cookies, no analytics. All spacing on the 8pt grid. */

@font-face { font-family: "Parkinsans"; src: url("fonts/Parkinsans-Medium.ttf") format("truetype"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Plus Jakarta Sans"; src: url("fonts/PlusJakartaSans-Regular.ttf") format("truetype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Plus Jakarta Sans"; src: url("fonts/PlusJakartaSans-Medium.ttf") format("truetype"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Plus Jakarta Sans"; src: url("fonts/PlusJakartaSans-SemiBold.ttf") format("truetype"); font-weight: 600; font-display: swap; }

/* Colors: Figma's Web collection. Light = Mist table on paper. */
:root {
  color-scheme: light dark;
  --page: #fffbf6;
  --table: #b5d2d8;
  --sheet: #fffbf6;
  --sheet-text: #12384a;
  --text: #12384a;
  --meta: #4c6772;
  --rule: #12384a1f;
  --link: #14707f;
  --marker: #cfbca8;
  --nav-fill: #ffffff99;
  --nav-stroke: #12384a14;
  --nav-fill-solid: #ffffffd9;   /* web/nav/fillSolid: once content slides under the nav */
  --nav-link-hover: color-mix(in srgb, var(--text) 8%, transparent);   /* web/nav/linkHover */
  --button-bg: #135b73;
  --button-label: #ffffff;
  --button-hover: #14707f;   /* web/button/hover (color/accent, the site's link teal) */
  --piece-blush: #f3bfb0;
  --piece-apricot: #f9cba4;
  --piece-sand: #eed6ae;
  --piece-honey: #f0d9a8;
  --piece-melon: #f6b08c;
  --piece-roseClay: #eba898;
  --piece-lavender: #e2dcf6;
  --piece-sage: #d2eac8;
  --bezel: #12384a;
  --gutter: 16px;
  --table-radius: 32px;
}

/* Dark = Marine table on deep marine. */
@media (prefers-color-scheme: dark) {
  :root {
    --page: #0b2531;
    --table: #135b73;
    --sheet: #0b2531;
    --sheet-text: #fbf3ea;
    --text: #fbf3ea;
    --meta: #a9bcc2;
    --rule: #ffffff1f;
    --link: #b5d2d8;
    --nav-fill: #0b25318c;
    --nav-stroke: #ffffff1f;
    --nav-fill-solid: #0b2531e6;
    --button-bg: #b5d2d8;
    --button-label: #12384a;
    --button-hover: #d6e7ea;   /* web/button/hover: Mist mixed with white (design, Oct 29) */
    --piece-blush: #72473a;
    --piece-apricot: #78512d;
    --piece-sand: #705b36;
    --piece-honey: #725d30;
    --piece-melon: #854826;
    --piece-roseClay: #8a4f41;
    --piece-lavender: #666077;
    --piece-sage: #576c4f;
  }
}

@media (max-width: 767px) {
  :root { --gutter: 8px; --table-radius: 24px; }
}

* { box-sizing: border-box; }

html { background: var(--page); -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  color: var(--text);
  background: var(--page);
  font: 400 17px/28px "Plus Jakarta Sans", system-ui, sans-serif;
}

h1, h2, h3, .hero-title, .section-title { text-wrap: balance; }
p, li { text-wrap: pretty; }

a { color: var(--link); text-underline-offset: 3px; }

/* The table: one rounded Mist (or Marine) surface that holds the whole page. */
.table {
  position: relative;
  margin: var(--gutter) var(--gutter) 0;
  border-radius: var(--table-radius);
  /* Plain table color. The paper grain is gone (Zoë, Oct 29): browsers drew
     faint lines through the repeating grain at some screen scales. */
  background: var(--table);
  overflow: hidden;
  isolation: isolate;
  padding-bottom: 96px;
}

/* Nav (Web/Nav): a glass pill that hugs its content, centered, 32 from the top.
   It stays there while the page scrolls (Zoë, Oct 28). */
.nav {
  position: fixed;
  top: 32px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 32px;
  padding: 8px 8px 8px 16px;
  border: 1px solid var(--nav-stroke);
  border-radius: 999px;
  background: var(--nav-fill);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  white-space: nowrap;
  transition: background-color 200ms ease-out, box-shadow 200ms ease-out;
}
/* Once page content slides under it, the glass turns more solid with a soft
   shadow so the links stay easy to read (Zoë, Oct 29). */
.nav.solid { background: var(--nav-fill-solid); box-shadow: 0 4px 16px rgb(18 56 74 / 0.1); }

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  text-decoration: none;
  font: 500 20px/28px "Parkinsans", system-ui, sans-serif;
  letter-spacing: -0.2px;
}
.brand img { display: block; height: 32px; width: auto; }

.nav-links { display: flex; gap: 24px; }
.nav-links a {
  color: var(--text);
  text-decoration: none;
  font: 600 14px/20px "Plus Jakarta Sans", system-ui, sans-serif;
}
/* Hover (Zoë, Oct 29): a soft pill in the text color at 8% fades in behind
   the link. The padding and negative margin make the pill without moving the
   links. Pointer devices only; phones have no hover. */
.nav-links a {
  margin: -6px -12px;
  padding: 6px 12px;
  border-radius: 999px;
  transition: background-color 150ms ease-out;
}
@media (hover: hover) {
  .nav-links a:hover { background: var(--nav-link-hover); }
}
/* Keyboard focus gets the same pill, plus the focus ring. */
.nav-links a:focus-visible { background: var(--nav-link-hover); }

/* Phone nav menu (design, Oct 30, option B). Hidden on desktop. */
.menu-button {
  display: none;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: none;
  color: var(--text);
  cursor: pointer;
}
.menu-button svg { display: block; }
.menu-button .icon-x, .nav.open .menu-button .icon-list { display: none; }
.nav.open .menu-button .icon-x { display: block; }
.menu-button:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }
/* The panel drops 8 below the pill, same width; fades in and drops 8 (200 ms). */
.nav-menu {
  display: none;
  position: absolute;
  top: calc(100% + 9px);   /* 8 below the pill's outer edge (its border is 1) */
  left: -1px;
  right: -1px;
  padding: 16px;
  border: 1px solid var(--nav-stroke);
  border-radius: 24px;
  background: var(--nav-fill-solid);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  box-shadow: 0 4px 16px rgb(18 56 74 / 0.1);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: opacity 200ms ease-out, transform 200ms ease-out, visibility 0s 200ms;
}
.nav-menu:focus { outline: none; }
.nav.open .nav-menu { opacity: 1; visibility: visible; transform: none; transition: opacity 200ms ease-out, transform 200ms ease-out; }
/* Rows: Web/NavLink, 48 tall; labels line up with the logo. */
.nav-menu a:not(.button) {
  display: flex;
  align-items: center;
  height: 48px;
  padding: 0 7px;   /* label lines up with the logo, 24 from the outer edge */
  border-radius: 999px;
  color: var(--text);
  text-decoration: none;
  font: 600 14px/20px "Plus Jakarta Sans", system-ui, sans-serif;
}
.nav-menu a:not(.button):hover, .nav-menu a:not(.button):focus-visible { background: var(--nav-link-hover); }
.nav-menu a:not(.button):focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }
.nav .nav-menu .button { display: flex; width: 100%; margin-top: 8px; padding: 16px 24px; font-size: 16px; line-height: 24px; }   /* full size, 56 tall */

/* The app's primary button, in web/button colors. */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 16px 24px;
  border-radius: 999px;
  background: var(--button-bg);
  color: var(--button-label);
  text-decoration: none;
  font: 500 16px/24px "Plus Jakarta Sans", system-ui, sans-serif;
}
/* Hover (Zoë, Oct 29): a lighter blue fills the button from left to right,
   straight edge, no click. It eases in and out rather than moving at one
   speed: it starts slowly, picks up through the middle and settles gently
   (520 ms); moving off drains it back faster (320 ms, speeding up as it goes).
   The fill sits under the label (z-index -1 inside the isolated button).
   Keyboard focus fills too; pointer hover only on devices that have it. */
.button { position: relative; overflow: hidden; isolation: isolate; }
.button::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--button-hover);
  transform: translateX(-101%);
  transition: transform 320ms cubic-bezier(0.5, 0, 0.75, 0);
  pointer-events: none;
}
@media (hover: hover) {
  .button:hover::before { transform: translateX(0); transition: transform 520ms cubic-bezier(0.76, 0, 0.24, 1); }
}
.button:focus-visible::before { transform: translateX(0); transition: transform 520ms cubic-bezier(0.76, 0, 0.24, 1); }
.button:active { transform: scale(0.98); }
.button:focus-visible, .nav a:focus-visible, .footer a:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }
.nav .button { padding: 12px 16px; font-size: 14px; line-height: 20px; }

.meta-line { margin: 0; font-size: 14px; line-height: 22px; color: var(--text); }

/* Footer: on the page color under the table. */
.footer {
  margin: 0;
  padding: 24px var(--gutter) 32px;
  text-align: center;
  color: var(--meta);
  font-size: 14px;
  line-height: 22px;
}
.footer p { margin: 0; }
.footer a { color: var(--meta); text-decoration: none; }
.footer a:hover, .footer a:focus-visible { text-decoration: underline; }   /* underline only on hover (Zoë, Oct 29) */
.footer .group { white-space: nowrap; }
/* Instagram (design, Oct 29, B1): 20 pt icon in web/meta, 16 after Terms of
   Service on the same line; phones: centered 8 below the two text lines.
   44 × 44 tap area without moving the layout. Never underlined; hover and
   focus turn it web/text. */
.footer a.instagram {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  margin: -11px -12px -11px 4px;   /* 44 box centered on the 22 text line */
  vertical-align: top;
  color: var(--meta);
  text-decoration: none;
  transition: color 150ms ease-out;
}
.footer a.instagram:hover, .footer a.instagram:focus-visible { color: var(--text); text-decoration: none; }
.footer a.instagram svg { display: block; }

@media (max-width: 767px) {
  .table { padding-bottom: 56px; }
  .nav {
    top: 16px;
    left: 16px;
    right: 16px;
    transform: none;
    justify-content: space-between;
    padding: 8px 5px 8px 23px;   /* logo 24 and the menu icon 16 from the pill's outer edge */
  }
  .nav-links, .nav > .button { display: none; }
  .menu-button { display: flex; }
  .nav-menu { display: block; }
  .footer { padding: 16px var(--gutter) 24px; }
  .footer a.instagram { display: flex; margin: -4px auto -12px; }
}

/* ---------- Text pages (Support, Privacy, Terms) ---------- */

/* The words sit on a sheet: 720 wide, 56 padding (phones: full width, 24). */
.table.text-page { padding: 136px 16px 96px; }
.sheet {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 720px;
  margin: 0 auto;
  padding: 56px;
  border-radius: 16px;
  background: var(--sheet);
  color: var(--sheet-text);
}
.sheet h1 { margin: 0; font: 500 40px/48px "Parkinsans", system-ui, sans-serif; }
.sheet h2 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding-top: 24px;
  font: 500 24px/32px "Parkinsans", system-ui, sans-serif;
}
/* The app's engraved diamond marker. */
.sheet h2::before {
  content: "";
  flex: none;
  width: 8px;
  height: 8px;
  margin: 0 4px;
  border-radius: 1px;
  background: var(--marker);
  box-shadow: 0 1px 0 rgb(255 255 255 / 0.9);
  transform: rotate(45deg);
}
.sheet p { margin: 0; }
/* Links to a spot on the page (#faq) land below the fixed nav. */
.sheet [id] { scroll-margin-top: 112px; }
@media (max-width: 767px) { .sheet [id] { scroll-margin-top: 96px; } }
.sheet .lead { max-width: none; font-size: 20px; line-height: 32px; }
.sheet .meta, .sheet .label { font-size: 14px; line-height: 22px; color: var(--meta); }
.sheet h3 { margin: 0; font-size: 17px; line-height: 28px; font-weight: 600; }
.sheet strong { font-weight: 600; }
.sheet a { color: var(--link); }

/* Lists: a small meta-colored dot, 8 before the text, on the first line. */
.sheet ul { display: flex; flex-direction: column; gap: 16px; margin: 0; padding: 0; list-style: none; }
.sheet li { position: relative; padding-left: 20px; }
.sheet li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 8px;   /* centered on the first line: half the 28 line height, minus 6 (design, Oct 30) */
  width: 12px;
  height: 12px;
  background: radial-gradient(circle, var(--meta) 3px, transparent 3.5px);
}

/* Table rows from the Privacy Policy, stacked: name, then each labeled value. */
.sheet .row { display: flex; flex-direction: column; gap: 16px; padding: 16px 0; }

@media (max-width: 767px) {
  .table.text-page { padding: 96px 8px 56px; }   /* 56 like Home, so the bottom row of pieces has room (Oct 30) */
  .sheet { padding: 32px; }   /* phones: 32 (design, Oct 30) */
  .sheet h1 { font-size: 24px; line-height: 32px; }   /* as in the Privacy phone frame */
}

/* ---------- Home ---------- */

.hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  max-width: 960px;
  margin: 0 auto;
  padding: 256px 24px 0;
  text-align: center;
}
.hero-title {
  margin: 0;
  font: 500 56px/64px "Parkinsans", system-ui, sans-serif;
}
.phone-br { display: none; }
.lead { margin: 0; max-width: 600px; font-size: 20px; line-height: 32px; }

/* App screens: Home in front at 115%, the other two tucked 48 behind it.
   Sized in container units so the group scales down on narrow tables. */
.screens {
  container-type: inline-size;
  width: min(920px, 100% - 48px);
  margin: 88px auto 112px;
}
.screens-row {
  --u: calc(100cqw / 920);
  display: flex;
  justify-content: center;
  align-items: center;
}
.phone {
  flex: none;
  background: var(--bezel);
  padding: calc(8 * var(--u));
  border-radius: calc(40 * var(--u));
  width: calc(264 * var(--u));
  box-shadow: 0 calc(16 * var(--u)) calc(32 * var(--u)) rgb(18 56 74 / 0.18);
}
.phone picture { display: block; }
.phone img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 248 / 538;
  border-radius: calc(32 * var(--u));
}
.phone.side-left { margin-right: calc(-48 * var(--u)); }
.phone.side-right { margin-left: calc(-48 * var(--u)); }
.phone.front {
  position: relative;
  z-index: 1;
  width: calc(340.4 * var(--u));
  padding: calc(9.2 * var(--u));
  border-radius: calc(50.6 * var(--u));
  box-shadow: 0 calc(18.4 * var(--u)) calc(36.8 * var(--u)) rgb(18 56 74 / 0.18);
}
.phone.front img { aspect-ratio: 322 / 698; border-radius: calc(41.4 * var(--u)); }

/* Two sections, 64 apart: a centered title with a dotted line on each side,
   24 below it a sheet with three features. */
.sections {
  display: flex;
  flex-direction: column;
  gap: 64px;
  width: min(1072px, 100% - 96px);
  margin: 0 auto;
}
.section { display: flex; flex-direction: column; gap: 24px; }
.section-head {
  --dash: color-mix(in srgb, var(--text) 40%, transparent);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
}
.section-title {
  margin: 0;
  flex: none;
  font: 500 28px/36px "Parkinsans", system-ui, sans-serif;
  color: var(--text);
}
/* 1pt dots, 3 on / 3 off. home.js trims each line to 6n - 3 so both ends are
   whole dashes; without it the lines just fill the space. */
.dots {
  flex: 1 1 0;
  height: 1px;
  background: linear-gradient(to right, var(--dash) 3px, transparent 3px) 0 0 / 6px 1px repeat-x;
}
.dots.left { background-position: right 0 top 0; }
.dots.sized { flex: none; width: var(--w); }

.sheet-card {
  background: var(--sheet);
  color: var(--sheet-text);
  border-radius: 16px;
  padding: 48px;
}
.features {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px;
}
.feature { display: flex; flex-direction: column; gap: 16px; }
.icon-circle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 20px;
  color: var(--sheet-text);
}
.icon-circle svg { width: 24px; height: 24px; }
.feature h3 { margin: 0; font-size: 17px; line-height: 28px; font-weight: 600; }
.feature p { margin: 0; }

.closing {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  margin: 96px auto 0;
  padding: 0 48px;
  text-align: center;
}
.closing h2 { margin: 0; font: 500 40px/48px "Parkinsans", system-ui, sans-serif; }

@media (max-width: 767px) {
  .hero { padding: 200px 24px 0; }
  /* web/heroPhone 32/40 (Oct 28 17:30), with design's phone line breaks. */
  .hero-title, .closing h2 { font-size: 32px; line-height: 40px; }
  .desktop-br { display: none; }
  .phone-br { display: inline; }
  .screens { width: auto; margin: 56px auto; }
  .screens-row { --u: 1px; }
  .phone.side-left, .phone.side-right { display: none; }
  .phone.front {
    width: 256px;
    padding: 8px;
    border-radius: 38px;
    box-shadow: 0 16px 32px rgb(18 56 74 / 0.18);
  }
  .phone.front img { border-radius: 30px; }
  .sections { gap: 48px; width: calc(100% - 16px); }
  .section-head { gap: 16px; }
  .sheet-card { padding: 32px; }   /* phones: 32 (design, Oct 30) */
  .features { grid-template-columns: 1fr; }
  .closing { margin-top: 64px; padding: 0 8px; }
}

/* Pieces (Web/PuzzlePiece): flat fills, no outline, shadow or grain. They sit
   under the page content, so on phones the lower ones peek out from behind
   the cards and sheets at the table edge. */
.pieces { position: absolute; inset: 0; z-index: 0; pointer-events: none; }
.piece { position: absolute; left: 0; top: 0; display: block; }
main { position: relative; z-index: 1; }

/* Opening (Home, first visit in a browser session): only the table and pieces
   show. The nav fades in as the last piece lands, then the hero lines rise in
   one after another, and the rest of the page appears with them. */
.intro .nav, .intro .hero > *, .intro .sections, .intro .closing, .intro .footer { opacity: 0; pointer-events: none; }
.intro .hero > * { transform: translateY(8px); }
.intro.show-nav .nav { opacity: 1; pointer-events: auto; transition: opacity 300ms ease-out; }
.intro.show-page .hero > *, .intro.show-page .sections, .intro.show-page .closing, .intro.show-page .footer { opacity: 1; transform: none; pointer-events: auto; }
.intro.show-page .hero > * { transition: opacity 400ms ease-out, transform 400ms ease-out; }
.intro.show-page .hero .lead { transition-delay: 80ms; }
.intro.show-page .hero .button { transition-delay: 160ms; }
.intro.show-page .hero .meta-line { transition-delay: 240ms; }

/* The app screens wait for the first scroll, then fade in and rise 16: the
   middle phone first, the side phones once it has risen (Zoë, Oct 29). */
.phone { transition: opacity 500ms ease-out, transform 500ms ease-out; }
.phone.side-left, .phone.side-right { transition-delay: 500ms; }
.screens-wait .phone { opacity: 0; transform: translateY(16px); }
.no-anim .phone { transition: none; }

/* Support, Privacy and Terms: the sheet arrives gently on every load. */
.arrive .sheet { animation: arrive 250ms ease-out both; }
@keyframes arrive { from { opacity: 0; transform: translateY(8px); } }

/* Scroll reveal, once per visit. The page is complete without it: these
   start states only apply after web.js adds .reveal. */
.reveal .dots.sized.left { clip-path: inset(0 0 0 calc(var(--w) + 3px)); }
.reveal .dots.sized.right { clip-path: inset(0 calc(var(--w) + 3px) 0 0); }
.reveal .section-title, .reveal .sheet-card { opacity: 0; transform: translateY(8px); }
.reveal .feature { opacity: 0; transform: translateY(16px); }

/* web.js draws the lines a whole dash at a time (it sets the clip per frame).
   The title rises as they draw; the card follows once the lines are done
   (Zoë, Oct 29), and its three features rise in as it settles. */
.revealed .section-title { animation: rise 400ms ease-out forwards; }
.lines-done .sheet-card { animation: rise 400ms ease-out forwards; }
.lines-done .feature { animation: rise 400ms ease-out forwards; animation-delay: calc(200ms + var(--i) * 80ms); }

/* Each feature's round icon snaps in as the feature rises, like a piece
   clicking into place (Zoë, Oct 29). */
.lines-done .icon-circle { animation: snap 420ms cubic-bezier(0.34, 1.56, 0.64, 1) both; animation-delay: calc(200ms + var(--i) * 80ms); }
@keyframes snap { from { transform: scale(0.6); } to { transform: none; } }

/* Pieces near the pointer get a small nudge, like bumping the table. */
.piece.nudge { transition: transform 250ms ease-out; }

/* The closing call to action steps in after the features: headline, then
   the App Store button, then the meta line (Zoë, Oct 29). */
/* Transitions rather than an animation, so a hover effect on the button can't
   cancel the step-in. */
.closing.reveal > * { opacity: 0; transform: translateY(8px); }
.closing.revealed > * { opacity: 1; transform: none; transition: opacity 400ms ease-out, transform 400ms ease-out; }
.closing.revealed > .button { transition-delay: 80ms; }
.closing.revealed > .meta-line { transition-delay: 160ms; }

@keyframes rise { to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
  .intro .nav, .intro .hero > *, .intro .sections, .intro .closing, .intro .footer { opacity: 1; transform: none; pointer-events: auto; }
  .screens-wait .phone { opacity: 1; transform: none; }
  .arrive .sheet { animation: none; }
  .button::before, .button:hover::before, .button:focus-visible::before { transition: none; }   /* the color still changes, without the sweep */
  .footer a.instagram { transition: none; }
  .lines-done .icon-circle { animation: none; }
  .nav-menu { transform: none; }   /* fade only */
  .nav { transition: none; }
  .reveal .dots.sized, .reveal .section-title, .reveal .sheet-card, .reveal .feature, .closing.reveal > * { clip-path: none; opacity: 1; transform: none; animation: none; }
}
