/*
 * The NorthPoint account.
 *
 * Neither app's look: the Cafe is cream and the Courts are dark, and this is
 * where both send people, so it is NorthPoint's own -- cream and charcoal by
 * day, the Courts' night greys when the phone is in dark mode, the brand teal
 * for the one thing to press. Inter for everything, Libre Caslon Text for
 * headings, as in both apps.
 *
 * Contrast, checked: text on its ground is 4.5:1 or more in both themes.
 * Light, the teal fill is darkened to #007A74 for white type (5.2:1); dark,
 * the brand teal #00968F takes dark type (4.8:1), as Courts does. Orange
 * marks a problem with a border and the words, never as text colour.
 * np_account/tests.py holds np_account/mail.py's colours to the light ones.
 */

:root {
  color-scheme: light dark;
  --ground: #FFF9EF;
  --card: #FFFFFF;
  --raised: #F6EFE4;
  --rule: #E6DED3;
  --edge: #8C8279;
  --text: #2D2926;
  --muted: #6B625B;
  --accent-fill: #007A74;
  --on-accent: #FFFFFF;
  --link: #007A74;
  --warn: #F68D2E;
  --focus: #007A74;

  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-display: 'Libre Caslon Text', Georgia, 'Times New Roman', serif;
  --radius-card: 14px;
  --radius-control: 10px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ground: #1C1917;
    --card: #2D2926;
    --raised: #3B3631;
    --rule: #4A443E;
    --edge: #8A817A;
    --text: #FFF9EF;
    --muted: #BEB6AC;
    --accent-fill: #00968F;
    --on-accent: #1C1917;
    --link: #9CDBD9;
    --focus: #9CDBD9;
  }
}

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

html, body {
  margin: 0;
  padding: 0;
  background: var(--ground);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}

p { margin: 0; }
img { display: block; max-width: 100%; }
[hidden] { display: none !important; }
a { color: var(--link); text-underline-offset: 2px; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 10;
  background: var(--accent-fill); color: var(--on-accent); padding: 12px 16px;
}
.skip-link:focus { left: 0; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap;
}

/* --- The column ------------------------------------------------------------ */

.shell {
  max-width: 460px;
  margin: 0 auto;
  padding: max(24px, env(safe-area-inset-top)) 20px max(32px, env(safe-area-inset-bottom));
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.brand { display: flex; justify-content: center; padding: 8px 0 4px; }
.brand img { width: 200px; height: auto; }
.brand .on-dark { display: none; }
@media (prefers-color-scheme: dark) {
  .brand .on-light { display: none; }
  .brand .on-dark { display: block; }
}

main { display: flex; flex-direction: column; gap: 20px; }

.card {
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: var(--radius-card);
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.footer {
  margin-top: auto;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px 18px;
  font-size: 13px;
  color: var(--muted);
}
.footer a { color: var(--muted); }

/* --- Type -------------------------------------------------------------------- */

h1, .display {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 28px;
  line-height: 1.15;
  margin: 0;
}
h2 {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0;
}
.lede { color: var(--muted); }
.fine { font-size: 13px; color: var(--muted); }
.center { text-align: center; }
.for-app {
  display: flex; align-items: center; gap: 10px;
  font-size: 14px; color: var(--muted);
}
.for-app strong { color: var(--text); font-weight: 600; }

/* --- Messages and problems ------------------------------------------------- */

.messages { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.messages li, .problem {
  border: 1px solid var(--rule);
  border-left: 4px solid var(--accent-fill);
  border-radius: var(--radius-control);
  background: var(--card);
  padding: 12px 14px;
  font-size: 15px;
}
.messages li.error, .messages li.warning, .problem { border-left-color: var(--warn); }
.problem strong { display: block; margin-bottom: 2px; }

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

form { display: flex; flex-direction: column; gap: 16px; margin: 0; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label, .field .label { font-size: 14px; font-weight: 600; }
.field .help { font-size: 13px; color: var(--muted); }
fieldset.bare { border: 0; margin: 0; padding: 0; min-width: 0; }
fieldset.bare legend { padding: 0; margin-bottom: 6px; }
.label { font-size: 14px; font-weight: 600; }
.field .error { font-size: 14px; color: var(--text); padding-left: 10px; border-left: 3px solid var(--warn); }

input[type=text], input[type=email], input[type=password], input[type=number],
input[type=search], input[inputmode], select {
  width: 100%;
  font: inherit;
  font-size: 16px; /* under 16px, iOS zooms the page when a field is tapped */
  color: var(--text);
  background: var(--raised);
  border: 1px solid var(--edge);
  border-radius: var(--radius-control);
  padding: 12px 14px;
  min-height: 48px;
  -webkit-appearance: none;
  appearance: none;
}
select {
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
                    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) 21px, calc(100% - 13px) 21px;
  background-size: 5px 5px;
  background-repeat: no-repeat;
  padding-right: 34px;
}
input:focus, select:focus { border-color: var(--focus); outline: 2px solid var(--focus); outline-offset: 0; }

.birth { display: grid; grid-template-columns: 1.6fr 1fr 1.2fr; gap: 8px; }
.birth label { font-size: 12px; font-weight: 500; color: var(--muted); }
.birth .part { display: flex; flex-direction: column; gap: 4px; }

.password-wrap { position: relative; }
.password-wrap input { padding-right: 72px; }
.password-toggle {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  border: 0; background: none; color: var(--link); font: inherit; font-size: 14px;
  font-weight: 600; padding: 8px 10px; cursor: pointer; border-radius: 8px;
}

.code-input {
  font-size: 28px !important;
  letter-spacing: 0.35em;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 48px;
  padding: 12px 16px;
  border-radius: var(--radius-control);
  border: 1px solid transparent;
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}
.btn-primary { background: var(--accent-fill); color: var(--on-accent); }
.btn-secondary { background: transparent; color: var(--text); border-color: var(--edge); }
.btn-plain { background: none; color: var(--link); min-height: 44px; width: auto; padding: 8px; }
.btn-warn { background: transparent; color: var(--text); border-color: var(--warn); }
.btn[disabled] { opacity: 0.55; cursor: progress; }
.btn svg { width: 20px; height: 20px; flex: none; }

.or {
  display: flex; align-items: center; gap: 12px;
  color: var(--muted); font-size: 13px;
}
.or::before, .or::after { content: ''; flex: 1; border-top: 1px solid var(--rule); }

.actions { display: flex; flex-direction: column; gap: 10px; }
.links { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 16px; font-size: 15px; }

/* --- The account page ------------------------------------------------------ */

.who { display: flex; align-items: center; gap: 14px; }
.avatar {
  flex: none;
  width: 52px; height: 52px; border-radius: 50%;
  background: var(--accent-fill); color: var(--on-accent);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 19px; letter-spacing: 0.02em;
}
.who .name { font-family: var(--font-display); font-weight: 700; font-size: 22px; line-height: 1.2; }
.who .email { color: var(--muted); font-size: 15px; overflow-wrap: anywhere; }

.section { display: flex; flex-direction: column; gap: 8px; }
.rows {
  list-style: none; margin: 0; padding: 0;
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: var(--radius-card);
  overflow: hidden;
}
.rows > li + li { border-top: 1px solid var(--rule); }
.row {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px; min-height: 56px;
  color: var(--text); text-decoration: none;
}
a.row:hover { background: var(--raised); }
.row .what { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.row .what .value { color: var(--muted); font-size: 14px; overflow-wrap: anywhere; }
.row .chevron { color: var(--muted); flex: none; }
.row form { margin: 0; }
.row .btn-plain { padding: 6px 4px; }

.tag {
  font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 6px;
  border: 1px solid var(--rule); color: var(--muted); white-space: nowrap;
}

.events { list-style: none; margin: 0; padding: 0; }
.events li { padding: 12px 0; border-top: 1px solid var(--rule); display: flex; flex-direction: column; }
.events li:first-child { border-top: 0; }
.events .when { font-size: 13px; color: var(--muted); }

.prose { display: flex; flex-direction: column; gap: 12px; }
.prose h2 { margin-top: 8px; }
.prose ul { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; }
