/* ==========================================================================
   1000forONE: the one hand-written stylesheet (tech spec §2).
   Mobile-first at 390px, fluid to desktop. No build step: edit and reload.

   Sections:
     1. Tokens        5. Cards            9. Notices
     2. Base          6. Buttons         10. Site header and footer
     3. Layout        7. Forms           11. Wordmark (logo A)
     4. Type          8. Sign-in code    12. Dark surfaces (.theme-dark)
   ========================================================================== */


/* 1. Tokens ---------------------------------------------------------------
   Brand colours from docs/mockups/README.md. Other templates depend on these
   exact names, so add new ones rather than renaming. */
:root {
  /* Brand */
  --ridge: #1D2B36;          /* headers, main text */
  --snowfield: #F5F1E8;      /* page background */
  --lift-gold: #D99A2B;      /* main buttons (Ridge text), "you" */
  --deep-gold: #8A5A0F;      /* gold text on light backgrounds */
  --fir: #3B6652;            /* links, numbers */
  --granite: #5B6670;        /* secondary text */
  --alpenglow: #E8A98C;      /* tints only */
  --board-captain: #1E6B3C;  /* captain squares */
  --board-joined: #A5DDB8;   /* joined squares */
  --white: #FFFFFF;
  --line: #E6DFD0;           /* card borders and dividers */

  /* Supporting shades used in the mockups */
  --ridge-raised: #26384A;   /* panels on a Ridge background */
  --mist: #DCE2E7;           /* body text on Ridge */
  --fog: #B9C3CC;            /* secondary text on Ridge */
  --input-border: #CFC6B4;   /* form control borders */
  --sand: #E8E1D1;           /* step bubbles, quiet fills */
  --alpenglow-tint: #F6E1D6;
  --error: #A3341F;          /* 6.6:1 on white */
  --error-tint: #FBE9E4;
  --success-tint: #E3EFE8;

  /* Type */
  --font-display: 'Bricolage Grotesque', system-ui, sans-serif;
  --font-body: 'Source Sans 3', system-ui, sans-serif;
  --text-small: 15px;        /* never smaller than this */
  --text-body: 17px;
  --text-lead: 18px;

  /* Spacing scale */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-7: 32px;
  --space-8: 48px;

  --radius: 16px;
  --radius-sm: 12px;
  --tap: 48px;               /* minimum tap target */
  --gutter: 16px;
}

@media (min-width: 400px) {
  :root { --gutter: 20px; }
}


/* 2. Base ---------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

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

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--snowfield);
  color: var(--ridge);
  font-family: var(--font-body);
  font-size: var(--text-body);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

main { flex: 1 0 auto; }

h1, h2, h3, h4 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.01em;
}
h1 { font-size: 32px; letter-spacing: -0.02em; }
h2 { font-size: 24px; }
h3 { font-size: 20px; }

p { margin: 0; }

a { color: var(--fir); }
a:hover { color: var(--ridge); }

img, svg { max-width: 100%; }

button, input, select, textarea { font: inherit; color: inherit; }

:focus-visible {
  outline: 3px solid var(--fir);
  outline-offset: 2px;
}

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

@media (min-width: 768px) {
  h1 { font-size: 44px; }
  h2 { font-size: 28px; }
}


/* 3. Layout -------------------------------------------------------------- */
.page {
  width: 100%;
  max-width: 560px;
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.page--wide { max-width: 1100px; }

.stack {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
}


/* 4. Type ---------------------------------------------------------------- */
.display {
  font-family: var(--font-display);
  font-weight: 800;
  line-height: 1.08;
  letter-spacing: -0.02em;
}

.eyebrow {
  font-size: var(--text-small);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--deep-gold);
}

.muted { color: var(--granite); }
.small { font-size: var(--text-small); line-height: 1.4; }


/* 5. Cards --------------------------------------------------------------- */
.card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

@media (min-width: 768px) {
  .card { padding: var(--space-5); }
}


/* 6. Buttons ------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 52px;
  padding: 0 var(--space-5);
  border: 1.5px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--ridge);
  font-family: var(--font-body);
  font-size: 17px;
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.btn:hover { color: var(--ridge); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.55; cursor: not-allowed; }

/* Lift Gold with Ridge text: 7.4:1 */
.btn--primary {
  background: var(--lift-gold);
  border-color: var(--lift-gold);
  color: var(--ridge);
}
.btn--primary:hover { background: #E3A93F; border-color: #E3A93F; }

.btn--secondary {
  background: transparent;
  border-color: var(--ridge);
  color: var(--ridge);
}
.btn--secondary:hover { background: rgba(29, 43, 54, 0.06); }

.btn--block { display: flex; width: 100%; }


/* 7. Forms --------------------------------------------------------------- */
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.field > label,
label.field {
  font-size: 16px;
  font-weight: 600;
  color: var(--ridge);
}
.field input:not([type="checkbox"]):not([type="radio"]),
.field textarea,
.field select {
  width: 100%;
  min-height: 52px;
  padding: 0 14px;
  border: 1.5px solid var(--input-border);
  border-radius: var(--radius-sm);
  background: var(--white);
  color: var(--ridge);
  font-size: 17px;
}
.field textarea {
  padding: 12px 14px;
  line-height: 1.45;
  resize: vertical;
}
.field select {
  appearance: none;
  padding-right: 40px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%231D2B36' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
}
.field input::placeholder,
.field textarea::placeholder { color: #7A848C; }
.field input:focus-visible,
.field textarea:focus-visible,
.field select:focus-visible {
  border-color: var(--fir);
  outline: 3px solid rgba(59, 102, 82, 0.35);
  outline-offset: 0;
}

.field__help {
  font-size: var(--text-small);
  font-weight: 400;
  line-height: 1.4;
  color: var(--granite);
}
.field__error {
  font-size: var(--text-small);
  line-height: 1.4;
  font-weight: 600;
  color: var(--error);
}
.field:has(.field__error) input:not([type="checkbox"]),
.field:has(.field__error) textarea,
.field:has(.field__error) select,
.field input[aria-invalid="true"],
.field textarea[aria-invalid="true"],
.field select[aria-invalid="true"] {
  border-color: var(--error);
}

/* <label class="checkbox"><input type="checkbox"> Text</label> */
.checkbox {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  min-height: var(--tap);
  padding-block: 2px;
  font-size: 16px;
  line-height: 1.4;
  cursor: pointer;
}
.checkbox input {
  flex: none;
  width: 24px;
  height: 24px;
  margin: 0;
  accent-color: var(--fir);
  cursor: pointer;
}


/* 8. Sign-in code: six single-digit inputs in a row ---------------------- */
.code-input {
  display: flex;
  gap: var(--space-2);
  justify-content: space-between;
  max-width: 360px;
}
.code-input input {
  flex: 1 1 0;
  width: 0;          /* lets the six boxes share narrow screens */
  min-width: 0;
  max-width: 56px;
  height: 58px;
  padding: 0;
  border: 1.5px solid var(--input-border);
  border-radius: 10px;
  background: var(--white);
  color: var(--ridge);
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 800;
  text-align: center;
}
.code-input input:focus-visible {
  border-color: var(--fir);
  outline: 3px solid rgba(59, 102, 82, 0.35);
  outline-offset: 0;
}


/* 9. Notices ------------------------------------------------------------- */
.notice {
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--line);
  border-left: 4px solid var(--granite);
  border-radius: var(--radius-sm);
  background: var(--white);
  color: var(--ridge);
  font-size: 16px;
  line-height: 1.45;
}
.notice--error {
  border-color: #EBC2B6;
  border-left-color: var(--error);
  background: var(--error-tint);
}
.notice--success {
  border-color: #BFD8C9;
  border-left-color: var(--fir);
  background: var(--success-tint);
}


/* 10. Site header and footer ---------------------------------------------- */
.site-header {
  background: var(--ridge);
  color: var(--snowfield);
}
.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding-block: var(--space-3);
}
.site-header__home {
  display: flex;
  align-items: center;
  min-height: var(--tap);
  color: var(--snowfield);
  text-decoration: none;
}
.site-header__home:hover { color: var(--snowfield); }
.site-header__link {
  display: flex;
  align-items: center;
  min-height: var(--tap);
  color: var(--mist);
  font-size: 16px;
  text-decoration: none;
}
.site-header__link:hover { color: var(--snowfield); text-decoration: underline; }

.site-footer {
  background: var(--ridge);
  color: var(--mist);
  font-size: 16px;
}
.site-footer__inner {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-top: 22px;
  padding-bottom: 30px;
}
.site-footer__brand {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 8px;
}
.site-footer__tagline { font-size: var(--text-small); color: var(--fog); }
.site-footer__links {
  margin: 0;
  padding: 0;
  list-style: none;
}
.site-footer__links a {
  display: flex;
  align-items: center;
  min-height: var(--tap);
  color: var(--mist);
}
.site-footer__links a:hover { color: var(--snowfield); }
.site-footer__note {
  font-size: var(--text-small);
  line-height: 1.4;
  color: var(--fog);
}

.site-header :focus-visible,
.site-footer :focus-visible { outline-color: var(--lift-gold); }

@media (min-width: 768px) {
  .site-header__inner { padding-block: var(--space-4); }
  .site-footer__links { display: flex; flex-wrap: wrap; column-gap: var(--space-6); }
}


/* 11. Wordmark (logo A) ----------------------------------------------------
   Markup lives in templates/partials/wordmark.html. Size it by setting
   font-size on .wordmark (the mark scales with it). */
.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 0.45em;
  font-size: 20px;
  line-height: 1;
}
.wordmark__mark {
  width: 1.9em;
  height: auto;
  flex: none;
}
.wordmark__text {
  font-family: var(--font-display);
  font-weight: 800;
  letter-spacing: -0.02em;
  white-space: nowrap;
}
.wordmark__for {
  font-weight: 400;
  font-size: 0.6em;
  margin: 0 0.03em;
}
.wordmark--dark .wordmark__text { color: var(--snowfield); }
.wordmark--dark .wordmark__for { color: var(--lift-gold); }
.wordmark--light .wordmark__text { color: var(--ridge); }
.wordmark--light .wordmark__for { color: var(--deep-gold); }


/* 12. Dark surfaces --------------------------------------------------------
   Put .theme-dark on <body> (via {% block body_class %}) for full-Ridge
   screens like sign in, or on any section that sits on Ridge. */
.theme-dark {
  background: var(--ridge);
  color: var(--snowfield);
}
.theme-dark a { color: var(--board-joined); }
.theme-dark a:hover { color: var(--snowfield); }
.theme-dark .btn--primary { color: var(--ridge); }
.theme-dark .btn--secondary { border-color: var(--fog); color: var(--snowfield); }
.theme-dark .btn--secondary:hover { background: rgba(245, 241, 232, 0.08); }
.theme-dark .muted,
.theme-dark .field__help { color: var(--fog); }
.theme-dark .eyebrow { color: var(--lift-gold); }
.theme-dark .field > label,
.theme-dark label.field { color: var(--mist); }
.theme-dark .field input:not([type="checkbox"]):not([type="radio"]),
.theme-dark .field textarea,
.theme-dark .field select,
.theme-dark .code-input input {
  border-color: var(--snowfield);
  background: var(--snowfield);
}
.theme-dark .field__error { color: #F4B7A6; }
.theme-dark .card { background: var(--ridge-raised); border-color: #34495A; }
.theme-dark .notice { color: var(--ridge); }
.theme-dark .notice a { color: var(--fir); }
.theme-dark :focus-visible { outline-color: var(--lift-gold); }

/* Sign-in code: one real input, so phone autofill and paste just work. */
.code-field {
  box-sizing: border-box;
  width: 100%;
  max-width: 320px;
  min-height: 60px;
  padding: 0 16px;
  border: 2px solid transparent;
  border-radius: var(--radius-sm);
  background: var(--snowfield);
  color: var(--ridge);
  font: 700 28px/1 var(--font-body);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.4em;
  text-align: center;
  text-indent: 0.4em; /* balances the trailing letter-spacing so digits sit centred */
}
.code-field::placeholder { color: var(--granite); letter-spacing: 0.4em; }
.code-field:focus-visible { outline: 3px solid var(--lift-gold); outline-offset: 3px; }
.code-field[aria-invalid="true"] { border-color: var(--error); }
