/* The pages Django renders, in the app's Postcard look: allauth's sign-in and account
   pages, the consent page, /privacy and the 404, all on one layout
   (ledger/templates/allauth/layouts/base.html). Colours, type and sizes come from
   tokens.css, which frontend/scripts/tokens.mjs writes from the design's tokens.json;
   the sea header's sky from sky.css, which frontend/scripts/pagesSky.mjs writes from the
   app's scene. Everything is here: the CSP refuses inline styles. */

/* The self-hosted fonts (D-32), in the weights these pages use. Relative URLs, so they
   load from wherever the static files are (R2's public bucket on the box). */
@font-face {
  font-family: "Young Serif";
  font-weight: 400;
  font-display: swap;
  src: url("fonts/young-serif-latin-400-normal.de140f3124a8.woff2") format("woff2");
}
@font-face {
  font-family: "Figtree";
  font-weight: 400;
  font-display: swap;
  src: url("fonts/figtree-latin-400-normal.7bfd10a3def3.woff2") format("woff2");
}
@font-face {
  font-family: "Figtree";
  font-weight: 600;
  font-display: swap;
  src: url("fonts/figtree-latin-600-normal.4376f5953b85.woff2") format("woff2");
}
@font-face {
  font-family: "Figtree";
  font-weight: 700;
  font-display: swap;
  src: url("fonts/figtree-latin-700-normal.70aaa6879de5.woff2") format("woff2");
}
@font-face {
  font-family: "DM Mono";
  font-weight: 500;
  font-display: swap;
  src: url("fonts/dm-mono-latin-500-normal.c4598219c4b8.woff2") format("woff2");
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
/* The bar above the page in a browser takes the sea header's sky (sky.css's --sky-fill,
   by the phase on <html>; sea-deep, the midday sky's, without it): Safari (from iOS 26,
   which ignores theme-color) paints it from a fixed element at the page's top edge, at
   least 90% wide and more than 10 px tall, as in the app (frontend/src/theme/web.css). */
.status-bar-sea {
  position: fixed; top: 0; right: 0; left: 0; z-index: 1000;
  height: env(safe-area-inset-top); background-color: var(--sky-fill, var(--color-sea-deep));
}
@media (max-width: 480px) {
  .status-bar-sea { height: max(env(safe-area-inset-top), 12px); }
}
body {
  margin: 0; background: var(--color-sand); color: var(--color-ink);
  font-family: var(--font-body); font-size: var(--text-body);
  line-height: var(--text-body--line-height);
}
a { color: var(--color-ink); font-weight: 600; text-underline-offset: 3px; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--color-ink); outline-offset: 2px; }
.sea-head :focus-visible { outline-color: var(--color-on-sea); }
/* allauth's email change page hides this form with an inline style, which the CSP blocks. */
form#pending-email { display: none; }

/* ---- The frame: a centred phone column, the sea header, the ticket ------------- */

/* The design's 20 px gutter and 24 px top; the footer sits at the bottom. */
.page {
  position: relative; isolation: isolate; display: flex; flex-direction: column;
  width: 100%; max-width: var(--container-phone); min-height: 100vh; min-height: 100dvh;
  margin: 0 auto; padding: var(--space-6) var(--space-5) var(--space-5);
}

/* The SeaHeader, as the app lays it out (frontend/src/components/SeaHeader): the
   time-of-day sky (sky.css) behind the header's text, from the column's edges and the
   page's top. Nothing is measured: s is the column's width over the design's 390, and
   --sky-column that width (the window's, up to the phone container's 480 px; the band
   bleeds past the gutters to it). The far wave's crest sits 6 px under the text,
   wherever a title that wraps ends, but never higher than the scene's HORIZON (sky.css's
   --sky-horizon, its share of the column's width), so that much sky shows above the sea
   on every page (the words reach that far, less the band's top); the band reaches the
   design's sea (132·s) under that and gives it back. The ticket starts 28·s and the
   scene's WATER_GAP (sky.css's --sky-water-gap) under the crest: the near wave's troughs
   reach 28·s under it as it bobs (the design's 144 + 2, against 118), so both waves and
   a little water show above the ticket, which overlaps the rest of the sea. */
.sea-head {
  --sky-column: min(100vw, var(--container-phone));
  position: relative; margin: calc(-1 * var(--space-6)) calc(-1 * var(--space-5)) 0;
  padding-bottom: calc(var(--sky-column) * 28 / 390 + var(--sky-water-gap));
}
.sea-band {
  position: relative; padding: var(--space-6) var(--space-5) var(--sky-sea-share);
  margin-bottom: calc(-1 * var(--sky-sea-share));
}
.sea-words { min-height: calc(var(--sky-column) * var(--sky-horizon) - var(--space-6)); padding-bottom: 6px; }
.sea-art { position: absolute; z-index: -1; top: 0; right: 0; bottom: 0; left: 0; }
.sea-top {
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-3);
  min-height: var(--spacing-touch-target);
}
.sea-top form { margin: 0 0 0 auto; }
/* An invite's "Step 1 of 2", at the right (InviteSignup's), in the phase's secondary
   text colour (sky.css's --sky-caption: foam, on-sea at golden hour), as the eyebrow. */
.step {
  font-family: var(--font-mono); font-weight: 500; font-size: var(--text-eyebrow);
  letter-spacing: 0.06em; color: var(--sky-caption, var(--color-foam)); margin-left: auto;
}
/* Text keeps out of the sun's column (the right 104 px). */
.sea-title {
  margin: 4px 0 0; padding-right: 104px; overflow-wrap: anywhere;
  font-family: var(--font-display); font-weight: 400; font-size: var(--text-title-page);
  line-height: var(--text-title-page--line-height); color: var(--color-on-sea);
}
/* The round back button on the sea, and the light pill (Log out). */
.back {
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  width: var(--spacing-touch-target); height: var(--spacing-touch-target);
  border: var(--border-width-1\.5) solid var(--color-on-sea); border-radius: var(--radius-round);
  color: var(--color-on-sea);
}
.pill {
  display: inline-flex; align-items: center; height: var(--spacing-touch-target);
  padding: 0 18px; border: 0; border-radius: var(--radius-pill);
  background: var(--color-on-sea); color: var(--color-ink); cursor: pointer;
  font-weight: 700; font-size: var(--text-body);
}

/* A cream ticket lifted off the sand, overlapping the waves. */
.ticket {
  position: relative; padding: 18px; border-radius: var(--radius-lg);
  background: var(--color-cream); box-shadow: var(--shadow-ticket); overflow-wrap: anywhere;
}
.ticket > :first-child { margin-top: 0; }
.ticket > :last-child { margin-bottom: 0; }
.ticket h1 {
  margin: 0; font-family: var(--font-display); font-weight: 400;
  font-size: var(--text-24); line-height: var(--text-24--line-height);
}
.ticket h2 {
  margin: 20px 0 8px; font-family: var(--font-display); font-weight: 400;
  font-size: var(--text-20); line-height: var(--text-20--line-height);
}
.ticket p { margin: 12px 0 0; }
/* The line under a title says what happens next. */
.ticket h1 + p, .lede {
  margin-top: 4px; font-size: var(--text-14); line-height: var(--text-14--line-height);
  color: var(--color-ink-muted);
}
.ticket h1 + p a { color: var(--color-ink-muted); }
.ticket ul { margin: 12px 0 0; padding-left: 20px; }
.ticket li + li { margin-top: 6px; }
/* The dashed rule under a card's title (and allauth's hr). */
.rule, .ticket hr {
  height: 0; margin: 14px 0 16px; border: 0; border-top: 2px dashed var(--color-divider-dashed);
}
.muted { color: var(--color-ink-muted); }
.small { font-size: var(--text-13); line-height: var(--text-13--line-height); }

/* Under the card, pinned to the bottom of the screen. */
.site-foot {
  margin-top: auto; padding-top: var(--space-6); text-align: center;
  font-size: var(--text-status); line-height: 1.45; color: var(--color-ink-muted);
}
.site-foot a { color: var(--color-ink-muted); font-weight: 400; }
.site-foot .made-by { margin: 6px 0 0; }

/* ---- Messages ------------------------------------------------------------------ */

.ticket .messages { list-style: none; margin: 0 0 var(--space-4); padding: 0; display: grid; gap: 8px; }
.alert {
  margin: 0 0 12px; padding: 8px 12px; border-radius: var(--radius-18);
  background: var(--color-sand-deep); font-weight: 600;
  font-size: var(--text-13); line-height: var(--text-13--line-height);
}
.ticket .messages .alert { margin: 0; }
.alert.error {
  border: var(--border-width-1\.5) solid var(--color-owes); background: var(--color-cream);
  color: var(--color-owes);
}

/* ---- Forms --------------------------------------------------------------------- */

.ticket form { display: grid; gap: var(--space-4); margin: 0; }
.ticket h1 + form, .ticket p + form, .ticket form + p { margin-top: var(--space-4); }
.field { display: grid; gap: 6px; }
/* A field's label is the mono eyebrow, in ink-muted (the app's TextField). */
.field > label {
  font-family: var(--font-mono); font-weight: var(--text-eyebrow--font-weight);
  font-size: var(--text-eyebrow); line-height: var(--text-eyebrow--line-height);
  letter-spacing: var(--text-eyebrow--letter-spacing); text-transform: uppercase;
  color: var(--color-ink-muted);
}
input[type=text], input[type=email], input[type=password], input[type=number],
input[type=tel], select, textarea {
  width: 100%; min-height: 52px; padding: 0 14px; border-radius: var(--radius-14);
  border: var(--border-width-1\.5) solid var(--color-divider-dashed);
  background: var(--color-cream); color: var(--color-ink);
  font-weight: 600; font-size: var(--text-button); outline: none;
}
input::placeholder { color: var(--color-ink-muted); font-weight: 400; opacity: 1; }
/* 2 px ink while typing, owes when the value was refused. */
input:focus, select:focus, textarea:focus { border: 2px solid var(--color-ink); padding: 0 13.5px; }
input[aria-invalid=true] { border: 2px solid var(--color-owes); padding: 0 13.5px; }
input:disabled { color: var(--color-ink-muted); cursor: not-allowed; }
/* A check box and its label on one row ("Remember me"). */
.field.check { display: flex; align-items: center; gap: 10px; min-height: var(--spacing-touch-target); }
.field.check > label {
  font-family: var(--font-body); font-size: var(--text-14); letter-spacing: 0;
  text-transform: none; color: var(--color-ink);
}
input[type=checkbox], input[type=radio] {
  width: 22px; height: 22px; margin: 0; accent-color: var(--color-ink);
}
.helptext { font-size: var(--text-meta); line-height: var(--text-meta--line-height); color: var(--color-ink-muted); }
.helptext ul { margin: 4px 0 0; padding-left: 18px; }
.helptext a { font-size: var(--text-14); }
.errorlist {
  list-style: none; margin: 0; padding: 0; color: var(--color-owes); font-weight: 600;
  font-size: var(--text-meta); line-height: var(--text-meta--line-height);
}
.errorlist.nonfield {
  padding: 8px 12px; border: var(--border-width-1\.5) solid var(--color-owes);
  border-radius: var(--radius-18);
}

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

/* The primary sun button with its hard lower edge; the ink outline pill for the
   other choices (InviteSignup's). A form's buttons stack at full width. */
.btn-group { display: grid; gap: 10px; }
.btn {
  display: flex; align-items: center; justify-content: center; width: 100%;
  min-height: var(--spacing-button-height); padding: 0 var(--space-5);
  border: 0; border-radius: var(--radius-pill); background: var(--color-sun);
  box-shadow: var(--shadow-button); color: var(--color-ink); cursor: pointer;
  text-align: center; text-decoration: none; font-weight: var(--text-button--font-weight);
  font-size: var(--text-button); line-height: var(--text-button--line-height);
}
.btn-group .btn + .btn { margin-top: 4px; }
.btn.secondary {
  min-height: 54px; border: 2px solid var(--color-ink); background: transparent;
  box-shadow: none; font-size: var(--text-row-title);
}
.btn.danger { border-color: var(--color-owes); color: var(--color-owes); }

/* "Already have an account? Log in": a question and its answer, centred. */
.prompt {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center;
  column-gap: 6px; min-height: 48px; font-size: var(--text-14); color: var(--color-ink-muted);
}
.ticket .prompt { margin: 6px 0 0; }
.prompt a { display: inline-flex; align-items: center; min-height: var(--spacing-touch-target); font-weight: 700; }

/* ---- Sign-in (the social-login design) ------------------------------------------------ */

/* "Welcome back" over the name, on the sea. */
.sea-eyebrow {
  margin: 4px 0 0; font-family: var(--font-mono); font-weight: var(--text-eyebrow--font-weight);
  font-size: var(--text-eyebrow); line-height: var(--text-eyebrow--line-height);
  letter-spacing: var(--text-eyebrow--letter-spacing); text-transform: uppercase;
  color: var(--sky-caption, var(--color-foam));
}
/* Continue with Google: the ink outline pill at the sun button's height, on cream, with
   Google's G. */
.btn.provider-google {
  gap: var(--space-3); border: 2px solid var(--color-ink); background: var(--color-cream);
  box-shadow: none;
}
.provider-logo { flex-shrink: 0; }
.ticket .provider-note {
  margin: var(--space-2) 0 0; text-align: center; color: var(--color-ink-muted);
  font-size: var(--text-13); line-height: var(--text-13--line-height);
}
/* "or use your email" between dashed lines: the login page's fold, a plain divider on
   sign-up. */
.divider {
  display: flex; align-items: center; gap: var(--space-3); min-height: var(--spacing-touch-target);
  font-size: var(--text-14); line-height: var(--text-14--line-height); color: var(--color-ink-muted);
}
.divider::before, .divider::after {
  content: ""; flex-grow: 1; border-top: 1px dashed var(--color-divider-dashed);
}
.divider > span { display: flex; align-items: center; gap: 6px; font-weight: 600; }
.ticket .divider { margin: var(--space-4) 0 0; }
details.email-login { margin-top: 0; }
details.email-login > summary { list-style: none; font-weight: 400; }
details.email-login > summary::-webkit-details-marker { display: none; }
.chevron {
  fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round;
  stroke-linejoin: round;
}
details[open] > summary .chevron { transform: rotate(180deg); }
/* The folded form: labels in the body face above sand fields, the fields 12 px apart,
   "Log in with email" 16 px below them. */
.ticket .email-login form { gap: var(--space-3); margin-top: var(--space-4); }
.email-login .btn-group { margin-top: var(--space-1); }
.email-login .field { gap: 4px; }
.email-login .field > label {
  font-family: var(--font-body); font-weight: 400; letter-spacing: 0; text-transform: none;
  font-size: var(--text-meta); line-height: var(--text-meta--line-height);
}
.email-login input[type=email], .email-login input[type=password] {
  min-height: 48px; padding: 0 16px; border-color: var(--color-placeholder-border);
  border-radius: var(--radius-md); background: var(--color-sand);
  font-weight: 400; font-size: var(--text-body);
}
.email-login input[type=email]:focus, .email-login input[type=password]:focus,
.email-login input[aria-invalid=true] { padding: 0 15.5px; }
.email-login .helptext a { display: flex; align-items: center; min-height: var(--spacing-touch-target); }
/* "No account yet? Sign up" at the foot of the login page, over the privacy link. */
.site-foot .prompt { margin: 0; }
.site-foot .prompt a { color: var(--color-ink); font-weight: 700; }

/* allauth's other pieces: badges, collapsible sections, tables. */
.tag {
  display: inline-block; margin-left: 6px; padding: 2px 8px; border-radius: var(--radius-pill);
  background: var(--color-sand-deep); font-weight: var(--text-tag--font-weight);
  font-size: var(--text-tag); line-height: var(--text-tag--line-height); vertical-align: middle;
}
details { margin-top: var(--space-4); }
details summary {
  display: flex; align-items: center; min-height: var(--spacing-touch-target);
  cursor: pointer; font-weight: 600;
}
table { width: 100%; border-collapse: collapse; }
th, td { padding: 8px 0; border-top: 1px solid var(--color-hairline); text-align: left; }
tr:first-child > th, tr:first-child > td { border-top: 0; }

/* ---- The consent page ------------------------------------------------------------ */

.consent .scopes { margin: 8px 0 0; }
/* Under the headline: the "Known assistant" mark, or the name the client gave itself. */
.consent .identity {
  margin-top: 6px; font-size: var(--text-13); line-height: var(--text-13--line-height);
}
.consent .identity + .lede { margin-top: 6px; }
.consent .tag.known { margin-left: 0; background: var(--color-mint); }
/* Where the code goes, boxed off from the rest. */
.consent .destination {
  margin-top: 12px; padding: 10px 14px; border: var(--border-width-1\.5) solid var(--color-divider-dashed);
  border-radius: var(--radius-14); background: var(--color-sand);
}
.consent .destination p { margin: 0; }
.consent .redirect-host { overflow-wrap: anywhere; }
.consent form { margin-top: var(--space-4); }

/* Below 20rem (a phone at 125% text size or more, whose browser zooms the page) there
   isn't room beside the sun: it sets (sky.css) and the title takes the width, and the
   gutters narrow to 12 px, as the app's screens do. */
@media (max-width: 20rem) {
  .page { padding-left: var(--space-3); padding-right: var(--space-3); }
  .sea-head { margin-right: calc(-1 * var(--space-3)); margin-left: calc(-1 * var(--space-3)); }
  .sea-band { padding-right: var(--space-3); padding-left: var(--space-3); }
  .sea-title {
    padding-right: 0; font-size: var(--text-28); line-height: var(--text-28--line-height);
  }
  .ticket { padding: var(--space-3); }
  /* Continue with Google wraps between its words, never inside one. */
  .btn.provider-google {
    gap: var(--space-2); padding: 0 var(--space-3); overflow-wrap: normal;
  }
}
