body { margin: 0; }
/* Layout concept: one phone-sized stage centred on a quiet page, with a skip-to-cafes button at the side.
   The phone is the artwork, so its own colours stay fixed in both themes; only the page around it changes. */
:root {
  --page: #E9E1D3;
  --page-fg: #2E1F17;
  --muted: #6B5848;
  --btn-bg: #2E1F17;
  --btn-fg: #F6F0E7;
  --btn-line: #B9A58C;
  --focus: #8A4B22;
  --phone-shadow: 0 30px 60px -24px rgba(46, 31, 23, .4);

  --cream: #F6F0E7;
  --espresso: #2E1F17;
  --roast: #8A4B22;
  --nutty: #B9854F;
  --tint: #EEE6D8;

  --display: 'Fraunces', Georgia, 'Times New Roman', serif;
  --body: 'DM Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --page: #1A1310;
    --page-fg: #F1E8DA;
    --muted: #B9A794;
    --btn-bg: #F6F0E7;
    --btn-fg: #2E1F17;
    --btn-line: #5C4A3C;
    --focus: #E0A878;
    --phone-shadow: 0 30px 60px -24px rgba(0, 0, 0, .7);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --page: #1A1310;
  --page-fg: #F1E8DA;
  --muted: #B9A794;
  --btn-bg: #F6F0E7;
  --btn-fg: #2E1F17;
  --btn-line: #5C4A3C;
  --focus: #E0A878;
  --phone-shadow: 0 30px 60px -24px rgba(0, 0, 0, .7);
  color-scheme: dark;
}

body {
  background: var(--page);
  color: var(--page-fg);
  font-family: var(--body);
  padding-block: 0;
  padding-inline: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  min-height: 100dvh;
}


/* ---------- the phone ---------- */
.phone {
  --s: 1;
  width: min(430px, 100vw);
  height: 100vh; height: 100dvh;
  margin: 0 auto;
  container-type: size;
  position: relative;
  overflow: hidden;
  overflow: clip; /* hidden still lets focus or scrollIntoView shift the whole app sideways */
  border-radius: 0;
  background: var(--cream);
  box-shadow: var(--phone-shadow);
}
.scene {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
}
.scene > * { grid-area: 1 / 1; }

/* the tint the intro plays on; it lifts once the full stop has grown into the cream page */
.tint { position: absolute; inset: 0; background: var(--espresso); opacity: 0; }
/* contour lines on the dark start (drawn and animated by intro.js); stroke opacity and dash come from the script */
.topo { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.topo path { fill: none; stroke: var(--cream); stroke-opacity: .12; stroke-width: 1; stroke-dasharray: 1 1; vector-effect: non-scaling-stroke; }
/* the reveal: the full stop's colour, clipped to a circle on its spot, grown crisp at every size (no scaling) */
.fs-cover { position: absolute; inset: 0; background: var(--cream); clip-path: circle(0 at 50% 50%); pointer-events: none; }

/* ---------- wordmark ---------- */
.wordmark {
  display: flex;
  align-items: flex-end;
  font-family: var(--display);
  font-weight: 400;
  font-size: 18.5cqw;
  line-height: 1;
  letter-spacing: -.02em;
  color: var(--espresso);
}
.l { display: inline-block; opacity: 0; }
/* the full stop: a real circle sitting exactly where Fraunces draws its "." (ink measured from the font: .126em wide,
   centred .097em from the glyph's left and .19em above the bottom of the 1em line box), so it can slide and grow */
.fstop { position: relative; display: inline-block; width: .175em; height: 1em; opacity: 0; }
.phone.play .l { color: var(--cream); }
.fs-dot { position: absolute; left: .034em; bottom: .128em; width: .126em; height: .126em; border-radius: 50%; background: var(--nutty); }

/* ---------- welcome: headline, the three standard sign-in buttons, then email ---------- */
.sso { width: 80cqw; display: flex; flex-direction: column; align-items: center; }
.headline {
  margin: 0 0 12cqw;
  text-align: center;
  font-family: var(--display);
  font-weight: 400;
  font-size: 12cqw;
  line-height: 1.08;
  letter-spacing: -.02em;
  color: var(--espresso);
}
.sso-list { width: 100%; display: grid; gap: 3cqw; }
/* each button in its brand's own standard style (Apple black, Google white with grey outline, Facebook blue) */
.sso-b { display: flex; align-items: center; justify-content: center; gap: 2.6cqw; height: 12.8cqw; min-height: 44px; padding: 0 4cqw; border: 0; border-radius: 3.2cqw; font: 500 4.1cqw var(--body); cursor: pointer; }
.sso-b:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.sso-i { width: 5cqw; height: 5cqw; flex: none; }
.sso-b.ap { background: #000; color: #fff; }
.sso-b.gg { background: #fff; color: #1F1F1F; box-shadow: inset 0 0 0 1px #747775; }
.sso-b.fb { background: #0866FF; color: #fff; } /* Facebook's current brand blue; white on it passes AA */
.sso-note { min-height: 4.6cqw; margin: 3cqw 0 0; text-align: center; font: 400 3.5cqw/1.3 var(--body); color: #6B5848; }

/* ---------- footer ---------- */
.foot {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 7cqw;
  margin: 0;
  text-align: center;
  font: 400 3.1cqw/1.5 var(--display);
  letter-spacing: .01em;
  color: #6B5848;
}

/* ---------- email option below the buttons ---------- */
.email {
  margin: 1cqw 0 0;
  padding: 2cqw 3cqw;
  border: 0;
  background: none;
  white-space: nowrap;
  font: 400 3.9cqw/1 var(--body);
  color: #6B5848;
  text-decoration: underline;
  text-underline-offset: .9cqw;
  text-decoration-color: rgba(107, 88, 72, .4);
  cursor: pointer;
}

/* ---------- the intro sequence (timings in seconds, scaled by --s for slow motion) ---------- */
.phone.play .tint { animation: tint calc(2.7s * var(--s)) both; }
/* dark espresso with cream contours; the full stop rolls in from the left with "notes" rising in its wake, then a
   circle grows out of it, turning from nutty to cream, and the light page is revealed (no contours there) */
.phone.play .fstop { animation: fsIn calc(.8s * var(--s)) calc(.1s * var(--s)) cubic-bezier(.2, .9, .25, 1.08) both; }
.phone.play .fs-cover { animation: fsReveal calc(.95s * var(--s)) calc(1.55s * var(--s)) cubic-bezier(.65, 0, .35, 1) forwards; } /* not backwards: no circle before the full stop arrives */
.phone.play .l {
  animation: letter calc(2.2s * var(--s)) calc((.18s + var(--i) * .08s) * var(--s)) both; /* in the full stop's wake */
}
/* the welcome screen just fades up once the light page is revealed */
.phone.play .sso { animation: ssoIn calc(.6s * var(--s)) calc(2.3s * var(--s)) ease-out both; }
.phone.play .foot {
  animation: fadeIn calc(.6s * var(--s)) calc(2.6s * var(--s)) ease-out both;
}

@keyframes ssoIn { from { opacity: 0; transform: translateY(2cqw); } to { opacity: 1; transform: none; } }
@keyframes tint { 0%, 96% { opacity: 1; } 100% { opacity: 0; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes fsIn {
  0%   { opacity: 0; transform: translateX(-75cqw); }
  60%  { opacity: 1; }
  100% { opacity: 1; transform: none; }
}
@keyframes fsReveal {
  0%   { clip-path: circle(var(--fr0) at var(--fx) var(--fy)); background: var(--nutty); }
  14%  { background: var(--nutty); }
  70%  { background: var(--cream); }
  100% { clip-path: circle(var(--fr1) at var(--fx) var(--fy)); background: var(--cream); }
}
@keyframes letter {
  0%   { opacity: 0; transform: translateY(1.6cqw); filter: blur(4px); }
  14%  { opacity: 1; transform: none; filter: blur(0); }
  78%  { opacity: 1; transform: none; filter: blur(0); }
  100% { opacity: 0; transform: translateY(-1.5cqw); filter: blur(6px); }
}


/* ---------- email flow: screens that slide over the sign-in page ---------- */
.phone { --ease: cubic-bezier(.2, .8, .2, 1); }
#home { transition: opacity calc(.4s * var(--s)) ease, transform calc(.5s * var(--s)) var(--ease), visibility 0s; }
.foot { transition: opacity calc(.4s * var(--s)) ease; }
.phone:not([data-screen="home"]) #home {
  opacity: 0;
  transform: translateX(-8cqw);
  visibility: hidden;
  pointer-events: none;
  transition: opacity calc(.4s * var(--s)) ease, transform calc(.5s * var(--s)) var(--ease), visibility 0s calc(.5s * var(--s));
}
.phone:not([data-screen="home"]) .foot { opacity: 0; }

.panel {
  position: absolute;
  inset: 0;
  z-index: 5;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: 4cqw;
  padding: 15cqw 7.2cqw 8cqw;
  overflow-y: auto;
  background: var(--cream);
  color: var(--espresso);
  font-family: var(--body);
  opacity: 0;
  visibility: hidden;
  transform: translateX(10cqw);
  transition: opacity calc(.35s * var(--s)) ease, transform calc(.5s * var(--s)) var(--ease), visibility 0s calc(.5s * var(--s));
}
.panel.left { transform: translateX(-8cqw); }
.panel.on {
  opacity: 1;
  visibility: visible;
  transform: none;
  transition: opacity calc(.35s * var(--s)) ease, transform calc(.5s * var(--s)) var(--ease), visibility 0s;
}
.panel.on .st {
  animation: stag calc(.55s * var(--s)) calc((.12s + var(--i, 0) * .06s) * var(--s)) ease-out both;
}
@keyframes stag { from { opacity: 0; transform: translateY(2.4cqw); } to { opacity: 1; transform: none; } }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-1.4cqw); }
  75% { transform: translateX(1.4cqw); }
}

.pf { flex: 1; display: flex; flex-direction: column; justify-content: space-between; gap: 4cqw; margin: 0; }
.top { display: flex; flex-direction: column; gap: 4.4cqw; }
.bottom { display: flex; flex-direction: column; gap: .8cqw; }
.back {
  display: flex; align-items: center; justify-content: center;
  width: 11.3cqw; height: 11.3cqw; margin-left: -2.6cqw;
  border: 0; background: none; color: var(--espresso); cursor: pointer; flex: none;
}
.back svg { width: 7cqw; height: 7cqw; }
.h { margin: 0; font: 400 13.3cqw/1.02 var(--display); letter-spacing: -.02em; color: var(--roast); }
.h:focus { outline: none; }
.sub { margin: 0; font-size: 4.4cqw; line-height: 1.45; color: #6B5848; }
.fields { display: flex; flex-direction: column; gap: 3.4cqw; margin-top: 1.5cqw; }
.field { display: flex; flex-direction: column; gap: 1.8cqw; position: relative; }
.lbl { font-size: 3.6cqw; font-weight: 500; color: var(--espresso); }
.lbl span { font-weight: 400; color: #6B5848; }
.inp {
  box-sizing: border-box; width: 100%; height: 14.4cqw; padding: 0 5.1cqw;
  border-radius: 4.1cqw; border: 1px solid #D9C7B0; background: #EDE3D5;
  font: 400 4.4cqw var(--body); color: var(--espresso);
}
.inp::placeholder { color: #7A6757; }
.inp:focus-visible { outline: 2px solid var(--roast); outline-offset: 2px; }
.inp[aria-invalid="true"] { border-color: #9B3A2A; animation: shake calc(.35s * var(--s)) ease; }
.inp.pw { padding-right: 18cqw; }
.eye {
  position: absolute; right: 1.2cqw; bottom: 1.2cqw; height: 12cqw; padding: 0 3.6cqw;
  border: 0; background: none; font: 500 3.85cqw var(--body); color: var(--roast); cursor: pointer;
}
.err { min-height: 4.2cqw; font-size: 3.4cqw; line-height: 1.25; color: #9B3A2A; }
.cta {
  display: flex; align-items: center; justify-content: center; width: 100%; height: max(50px, 12.8cqw);
  border: 0; border-radius: 999px; background: var(--roast); color: var(--cream);
  font: 500 4.6cqw var(--body); cursor: pointer; transition: transform .15s ease;
}
.cta:active { transform: scale(.98); }
.lnk {
  display: flex; align-items: center; justify-content: center; gap: 1.5cqw; min-height: 11.3cqw;
  border: 0; background: none; font: 500 4.1cqw var(--body); color: #6B5848; cursor: pointer;
}
.lnk.strong { color: var(--roast); }
.lnk.inline { justify-content: flex-start; align-self: flex-start; padding: 0; }
.row { display: flex; align-items: center; justify-content: center; gap: 1.5cqw; font-size: 3.85cqw; color: #6B5848; }
.chips { display: flex; flex-wrap: wrap; gap: 2cqw; }
.chip {
  display: flex; align-items: center; gap: 2cqw; height: 11.3cqw; padding: 0 4.1cqw;
  border-radius: 999px; border: 1px solid #D9C7B0; background: #EDE3D5; color: var(--espresso);
  font: 500 3.85cqw var(--body); cursor: pointer;
  transition: background .2s ease, color .2s ease, border-color .2s ease;
}
.chip .dot { width: 2.6cqw; height: 2.6cqw; border-radius: 50%; border: 1px solid var(--cream); }
.chip[aria-pressed="true"] { background: var(--roast); border-color: var(--roast); color: var(--cream); }
.fine { margin: 1cqw 0 0; text-align: center; font-size: 3.3cqw; line-height: 1.45; color: #6B5848; }
.mailcard {
  display: flex; align-items: center; gap: 3.6cqw; margin-top: 2cqw; padding: 4.6cqw 5.1cqw;
  border-radius: 4.1cqw; background: #EDE3D5; border: 1px solid #D9C7B0; font-size: 4.1cqw; line-height: 1.35;
}
.mailcard svg { width: 7.2cqw; height: 7.2cqw; flex: none; }
.panel[data-state="sent"] .mlf, .panel:not([data-state="sent"]) .mls { display: none; }
.pin { width: 5.1cqw; height: 5.1cqw; }

@media (prefers-reduced-motion: reduce) {
  .panel, #home, .foot { transition: none !important; }
  .panel.on .st, .inp[aria-invalid="true"] { animation: none !important; }
}

/* ---------- log in extras ---------- */
.panel.on .back svg { animation: arrowTurn calc(.7s * var(--s)) calc(.8s * var(--s)) cubic-bezier(.3, .7, .3, 1) both; }
@keyframes arrowTurn { from { transform: rotate(90deg); } 60% { transform: rotate(-10deg); } to { transform: rotate(0); } }
@media (prefers-reduced-motion: reduce) { .panel.on .back svg { animation: none !important; } }

/* ---------- log in: line fields ---------- */
#p-login { padding-top: 10cqw; }
#p-login .h { color: var(--espresso); }
.h.sm { font-size: 10.4cqw; letter-spacing: -.015em; }
#p-login .fields { margin-top: 13cqw; gap: 7cqw; }
.fld { display: flex; flex-direction: column; }
.fl { position: relative; height: 17cqw; }
.fl::before, .fl::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 1px;
  background: var(--espresso); transform-origin: left;
}
.fl::after {
  height: 2px; bottom: -.5px; background: var(--roast); transform: scaleX(0);
  transition: transform calc(.55s * var(--s)) var(--ease);
}
.fl:focus-within::after, .pf.sent .fl::after { transform: scaleX(1); }
.fl:has([aria-invalid="true"])::before { background: #9B3A2A; }
.panel.on .fl::before {
  animation: lineDraw calc(.8s * var(--s)) calc((.3s + var(--i, 0) * .14s) * var(--s)) cubic-bezier(.6, .1, .2, 1) both;
}
@keyframes lineDraw { from { transform: scaleX(0); } to { transform: scaleX(1); } }
.fl .inp {
  position: absolute; left: 0; right: 0; bottom: 1.2cqw; height: 10.5cqw; padding: 0;
  border: 0; border-radius: 0; background: transparent; outline: none;
  font: 400 5.6cqw/1 var(--display); color: var(--espresso);
}
.fl .inp.pw { padding-right: 14cqw; }
.fl .inp[aria-invalid="true"] { border: 0; }
.fl label {
  position: absolute; left: 0; bottom: 2.6cqw; pointer-events: none;
  font: 400 5.2cqw/1 var(--display); color: #7A6757; transform-origin: left bottom;
  transition: transform calc(.4s * var(--s)) var(--ease), color .2s ease;
}
.fl .inp:focus + label, .fl .inp:not(:placeholder-shown) + label { transform: translateY(-7.6cqw) scale(.62); color: #6B5848; }
.fl .eye {
  left: auto; right: 0; bottom: 0; height: 11.3cqw; padding: 0 1cqw;
  font: italic 400 4.2cqw var(--display); color: #6B5848;
}
.help { align-self: flex-start; padding: 0; min-height: 11.3cqw; font: 400 4.6cqw var(--display); color: var(--espresso); text-decoration: underline; text-underline-offset: 1.2cqw; text-decoration-thickness: 1px; }
.go {
  align-self: flex-end; display: grid; place-items: center; width: 15.4cqw; height: 15.4cqw;
  border: 0; border-radius: 50%; background: var(--roast); color: var(--cream); cursor: pointer;
  opacity: 0; transform: scale(.4); pointer-events: none;
  transition: opacity .25s ease, transform calc(.55s * var(--s)) cubic-bezier(.34, 1.56, .64, 1);
}
.go svg { width: 6.6cqw; height: 6.6cqw; transition: transform calc(.5s * var(--s)) var(--ease); transform: rotate(180deg); }
.pf:has(#l-email:valid):has(#l-pw:valid) .go { opacity: 1; transform: none; pointer-events: auto; }
.pf.sent .go svg { transform: rotate(180deg) translateX(9cqw); }
.pf.sent .go { pointer-events: none; }
@media (prefers-reduced-motion: reduce) { .panel.on .fl::before { animation: none !important; } .go, .fl label { transition: none !important; } }

.hrow { display: flex; align-items: center; justify-content: space-between; gap: 3cqw; }
.chk { display: flex; align-items: center; gap: 2cqw; min-height: 11.3cqw; font-size: 3.6cqw; color: #6B5848; cursor: pointer; }
.chk input { width: 4.6cqw; height: 4.6cqw; margin: 0; accent-color: var(--roast); cursor: pointer; }
#p-login .bottom { gap: 1.4cqw; }
.pf.sent .cta { opacity: .75; pointer-events: none; }

.sr { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; pointer-events: none; }
.bean { width: 6cqw; height: 6cqw; flex: none; fill: none; stroke: var(--roast); stroke-width: 1.5; stroke-linecap: round; transition: transform calc(.45s * var(--s)) cubic-bezier(.34, 1.56, .64, 1); }
.bean ellipse { fill: transparent; transition: fill .25s ease; }
.sr:checked + .bean ellipse { fill: var(--roast); }
.sr:checked + .bean path { stroke: var(--cream); }
.sr:checked + .bean { transform: scale(1.12); }
.sr:focus-visible + .bean { outline: 2px solid var(--roast); outline-offset: 2px; border-radius: 50%; }
@media (prefers-reduced-motion: reduce) { .bean { transition: none !important; } }

.note { margin: 0; font-size: 3.8cqw; line-height: 1.4; color: #6B5848; }
.code { position: relative; display: flex; gap: 2.8cqw; margin-top: 2cqw; }
.cell {
  position: relative; flex: 1; height: 17cqw; display: grid; place-items: end center; padding-bottom: 2.6cqw;
  font: 400 8.4cqw/1 var(--display); color: var(--espresso);
}
.cell::before, .cell::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 1px; background: var(--espresso); transform-origin: left; }
.cell::after { height: 2px; bottom: -.5px; background: var(--roast); transform: scaleX(0); transition: transform calc(.35s * var(--s)) var(--ease); }
.cell.act::after, .pf.sent .cell::after { transform: scaleX(1); }
.panel.on .cell::before { animation: lineDraw calc(.7s * var(--s)) calc((.25s + var(--i, 0) * .09s) * var(--s)) cubic-bezier(.6, .1, .2, 1) both; }
.codein { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; border: 0; padding: 0; font-size: 16px; cursor: text; }
@media (prefers-reduced-motion: reduce) { .panel.on .cell::before { animation: none !important; } .cell::after { transition: none !important; } }

.cont {
  display: flex; align-items: center; justify-content: space-between; width: 100%; height: 17cqw; padding: 0;
  border: 0; border-top: 1px solid var(--espresso); background: none; color: var(--espresso);
  font: 400 6cqw/1 var(--display); cursor: pointer; transition: color .3s ease, border-color .3s ease;
}
.cont svg { width: 7cqw; height: 7cqw; flex: none; transition: transform calc(.5s * var(--s)) var(--ease), opacity .3s ease; }
.cont:active svg { transform: translateX(2cqw); }
.cont:focus-visible { outline: 2px solid var(--roast); outline-offset: 1cqw; }
.pf:has(:required:invalid) .cont { color: #9B8F82; border-top-color: #CDBBA2; }
.pf:not(:has(:required:invalid)) .cont svg { animation: nudge calc(1.4s * var(--s)) ease-in-out 2; }
@keyframes nudge { 0%, 100% { transform: none; } 50% { transform: translateX(2.2cqw); } }
.pf.sent .cont svg { transform: translateX(10cqw); opacity: 0; animation: none; }
.pf.sent .cont { pointer-events: none; }
@media (prefers-reduced-motion: reduce) { .cont svg { animation: none !important; transition: none !important; } }

/* boxed field (log in email) */
.fl.box {
  height: 16cqw; border: 1px solid #CDBBA2; border-radius: 4cqw; background: #FBF7F0;
  transition: border-color .25s ease, box-shadow .25s ease, background .25s ease;
}
.fl.box::before, .fl.box::after { display: none; }
.fl.box:focus-within { border-color: var(--roast); box-shadow: 0 0 0 1px var(--roast); background: #FFFDF9; }
.fl.box:has([aria-invalid="true"]) { border-color: #9B3A2A; box-shadow: 0 0 0 1px #9B3A2A; }
.pf.sent .fl.box { border-color: var(--roast); }
.fl.box .inp { left: 5cqw; right: auto; width: calc(100% - 10cqw); bottom: 2.2cqw; height: 7.4cqw; }
.fl.box label { left: 5cqw; bottom: 4.8cqw; }
.fl.box .inp:focus + label, .fl.box .inp:not(:placeholder-shown) + label { transform: translateY(-3.7cqw) scale(.6); }

/* ---------- controls ---------- */
.controls[hidden] { display: none; }
.controls {
  position: fixed;
  right: max(12px, env(safe-area-inset-right, 0px));
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
@media (max-width: 600px) { .controls { display: none; } } /* the phone fills a small screen; the side button would cover it */
.btn {
  min-height: 40px;
  padding: 0 16px;
  border-radius: 999px;
  border: 1px solid var(--btn-line);
  background: transparent;
  color: var(--page-fg);
  font: 500 13px/1 var(--body);
  cursor: pointer;
}
.btn.primary { background: var(--btn-bg); color: var(--btn-fg); border-color: var(--btn-bg); }
.btn[aria-pressed="true"] { background: var(--btn-bg); color: var(--btn-fg); border-color: var(--btn-bg); }
.btn:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
/* once the app is open (skipped early, or signed in) the dark intro layer must not show through its fade-in */
.phone[data-screen="app"] .tint { display: none; }
