/* Ansam Owners' Committee: owner registration.
   Agorium design system, theme Courtyard, palette Brand Board (packages/design-system/src/tokens in
   the Agorium repo): meaning tokens copied as CSS custom properties, light and dark. Fonts are
   self-hosted (SIL OFL 1.1, licences beside them in /fonts). */

@font-face { font-family: 'Figtree'; font-weight: 400; font-style: normal; font-display: swap; src: url('/fonts/Figtree-Regular.woff2') format('woff2'); }
@font-face { font-family: 'Figtree'; font-weight: 600; font-style: normal; font-display: swap; src: url('/fonts/Figtree-SemiBold.woff2') format('woff2'); }
@font-face { font-family: 'Figtree'; font-weight: 700; font-style: normal; font-display: swap; src: url('/fonts/Figtree-Bold.woff2') format('woff2'); }
@font-face { font-family: 'Bricolage Grotesque'; font-weight: 700; font-style: normal; font-display: swap; src: url('/fonts/BricolageGrotesque-Bold.woff2') format('woff2'); }

:root {
  color-scheme: light dark;
  /* colour (Brand Board, light) */
  --canvas: #F7F6F2;
  --surface: #FFFFFF;
  --surface-2: #EFEDE8;
  --ink: #171717;
  --ink-2: #4D4D49;
  --muted: #4D4D49;
  --line: #E8E6E1;
  --line-2: #737373;
  --line-field: #737373;
  --accent: #171717;
  --on-accent: #F7F6F2;
  --accent-soft: #E8E6E1;
  --warn: #7A4F08;
  --warn-soft: #FAEFD8;
  --danger: #9C3A2B;
  --danger-soft: #F8E3DE;
  --success: #2C6227;
  --success-soft: #E2EFDF;
  --info: #2C5E78;
  --info-soft: #DFEBF1;
  --state-hover: rgba(23,23,23,.05);
  --state-pressed: rgba(23,23,23,.09);
  --disabled: #B9B6AE;
  --focus-ring: #171717;
  --shadow-strong: rgba(23,23,23,.18);
  --you: #C27C00;
  --brand-ground: #0F1A21;
  --brand-ink: #EEE8DE;
  --brand-you: #F0B54A;

  /* type */
  --font-display: 'Bricolage Grotesque', ui-sans-serif, system-ui, sans-serif;
  --font-text: 'Figtree', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;

  /* space (4-point), layout, form, radius, control */
  --space-1: 4px; --space-2: 8px; --space-3: 12px; --space-4: 16px; --space-6: 24px; --space-8: 32px; --space-10: 40px; --space-12: 48px;
  --gutter: 16px;
  --section: 32px;
  --top-bar-height: 56px;
  --content-max-width: 760px;
  --form-max-width: 440px;
  --field-gap: 16px;
  --group-gap: 24px;
  --label-gap: 6px;
  --radius-control: 12px;
  --radius-control-small: 10px;
  --radius-card: 20px;
  --radius-pill: 999px;
  --control-form: 52px;
  --control-small: 32px;
  --focus-width: 2px;
  --focus-offset: 2px;
  --press: 150ms;
  --ease-standard: cubic-bezier(.2, .8, .2, 1);
  --chevron: url('/img/chevron-light.svg');
}

/* Theme: 'System' follows the device; 'Light' and 'Dark' (theme.js sets data-theme on <html>)
   override it. The dark meaning tokens are the Brand Board dark palette. */
:root[data-theme="light"] { color-scheme: light; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --canvas: #0F1A21;
    --surface: #16232C;
    --surface-2: #1E2D38;
    --ink: #EEE8DE;
    --ink-2: #CFC8BC;
    --muted: #9AA3AA;
    --line: #243440;
    --line-2: #6E7E8A;
    --line-field: #6E7E8A;
    --accent: #EEE8DE;
    --on-accent: #0F1A21;
    --accent-soft: #243440;
    --warn: #E7B562;
    --warn-soft: #2F2A1C;
    --danger: #F0907E;
    --danger-soft: #3A2224;
    --success: #98C88E;
    --success-soft: #1C2D24;
    --info: #90C2DC;
    --info-soft: #172B36;
    --state-hover: rgba(238,232,222,.06);
    --state-pressed: rgba(238,232,222,.10);
    --disabled: #4A5A66;
    --focus-ring: #EEE8DE;
    --shadow-strong: rgba(0,0,0,.65);
    --you: #F0B54A;
    --chevron: url('/img/chevron-dark.svg');
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --canvas: #0F1A21;
  --surface: #16232C;
  --surface-2: #1E2D38;
  --ink: #EEE8DE;
  --ink-2: #CFC8BC;
  --muted: #9AA3AA;
  --line: #243440;
  --line-2: #6E7E8A;
  --line-field: #6E7E8A;
  --accent: #EEE8DE;
  --on-accent: #0F1A21;
  --accent-soft: #243440;
  --warn: #E7B562;
  --warn-soft: #2F2A1C;
  --danger: #F0907E;
  --danger-soft: #3A2224;
  --success: #98C88E;
  --success-soft: #1C2D24;
  --info: #90C2DC;
  --info-soft: #172B36;
  --state-hover: rgba(238,232,222,.06);
  --state-pressed: rgba(238,232,222,.10);
  --disabled: #4A5A66;
  --focus-ring: #EEE8DE;
  --shadow-strong: rgba(0,0,0,.65);
  --you: #F0B54A;
  --chevron: url('/img/chevron-dark.svg');
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family: var(--font-text);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
::selection { background: var(--accent-soft); }
[hidden] { display: none !important; }
a { color: var(--ink); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: var(--focus-width) solid var(--focus-ring); outline-offset: var(--focus-offset); border-radius: 4px; }

.skip { position: absolute; left: -9999px; }
.skip:focus { left: var(--gutter); top: var(--space-2); background: var(--surface); padding: var(--space-2) var(--space-3); z-index: 10; }

/* top bar */
.top-bar {
  height: var(--top-bar-height);
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-3);
  padding: 0 var(--gutter);
  max-width: var(--content-max-width); margin: 0 auto;
}
.brand { display: flex; align-items: center; gap: var(--space-2); text-decoration: none; min-width: 0; }
.brand-mark { width: 36px; height: 36px; flex: none; border-radius: 50%; }
.brand-name { font-family: var(--font-display); font-weight: 700; font-size: 16px; letter-spacing: -0.015em; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.committee-login {
  font-size: 13.5px; font-weight: 600; color: var(--ink-2); text-decoration: none; white-space: nowrap;
  padding: var(--space-2) var(--space-3); border-radius: var(--radius-pill); min-height: 44px; display: inline-flex; align-items: center;
}
.committee-login:hover { background: var(--state-hover); color: var(--ink); }

/* Theme switcher: three icon buttons in a pill (Light, Dark, Same as device). */
.top-actions { display: flex; align-items: center; gap: var(--space-1); flex: none; }
.theme-switch { display: inline-flex; padding: 2px; border: 1px solid var(--line); border-radius: var(--radius-pill); background: var(--surface); }
.theme-switch button { width: 30px; height: 30px; display: grid; place-items: center; border: 0; padding: 0; border-radius: 50%; background: none; color: var(--muted); cursor: pointer; }
.theme-switch button:hover { color: var(--ink); background: var(--state-hover); }
.theme-switch button[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); }
.theme-switch svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
@media (max-width: 400px) { .committee-login { padding: var(--space-2); } }

main { max-width: var(--content-max-width); margin: 0 auto; padding: var(--space-4) var(--gutter) var(--space-12); }
.column { max-width: var(--form-max-width); margin: 0 auto; }

/* type roles */
.label-role { font-size: 13px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); line-height: 1.25; margin: 0 0 var(--space-2); }
h1, .display { font-family: var(--font-display); font-weight: 700; font-size: 34px; line-height: 1.05; letter-spacing: -0.035em; margin: 0 0 var(--space-3); }
h2, .title { font-family: var(--font-display); font-weight: 700; font-size: 20px; line-height: 1.2; letter-spacing: -0.015em; margin: 0 0 var(--space-2); }
.lead { color: var(--ink-2); margin: 0 0 var(--group-gap); }
.small { font-size: 13.5px; line-height: 1.5; }
.caption { font-size: 12px; line-height: 1.4; }
.muted { color: var(--muted); }

/* notices */
.notice { border-radius: var(--radius-card); padding: var(--space-4); margin: 0 0 var(--group-gap); font-size: 13.5px; line-height: 1.5; }
.notice p { margin: 0 0 var(--space-2); }
.notice p:last-child { margin-bottom: 0; }
.notice-warn { background: var(--warn-soft); color: var(--ink); }
.notice-neutral { background: var(--surface-2); }
.notice-danger { background: var(--danger-soft); }
.notice-success { background: var(--success-soft); }
.tag {
  display: inline-block; font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  padding: 2px var(--space-2); border-radius: var(--radius-pill); background: var(--warn-soft); color: var(--warn);
  border: 1px solid currentColor; margin-bottom: var(--space-2);
}

/* card */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-card); padding: var(--space-6) var(--space-4); }
@media (min-width: 480px) { .card { padding: var(--space-8) var(--space-6); } }

/* fields */
.field { display: flex; flex-direction: column; gap: var(--label-gap); margin-bottom: var(--field-gap); min-width: 0; }
.field > label, .field-label { font-size: 13.5px; font-weight: 600; line-height: 1.3; }
.optional { font-weight: 400; color: var(--muted); }
.row { display: grid; grid-template-columns: 1fr; gap: 0 var(--space-3); }
@media (min-width: 400px) { .row-2 { grid-template-columns: 1fr 1fr; } }

.input, .select {
  font: inherit; font-size: 16px; color: var(--ink);
  width: 100%; min-height: var(--control-form);
  padding: 13px 14px; /* keeps text still when the ring grows from 1 to 2 */
  background: var(--surface); border: 1px solid var(--line-field); border-radius: var(--radius-control);
  outline: none; transition: border-color var(--press) var(--ease-standard);
  -webkit-appearance: none; appearance: none;
}
.input::placeholder { color: var(--muted); opacity: 1; }
.input:focus, .select:focus { border-width: 2px; padding: 12px 13px; border-color: var(--focus-ring); }
.input[aria-invalid="true"], .select[aria-invalid="true"] { border-width: 2px; padding: 12px 13px; border-color: var(--danger); }
.select {
  padding-right: 40px;
  background-image: var(--chevron); background-repeat: no-repeat; background-position: right 14px center; background-size: 16px;
}
.select:focus, .select[aria-invalid="true"] { padding-right: 39px; }
.help { font-size: 12px; line-height: 1.4; color: var(--muted); margin: 0; }
.error { display: flex; gap: 6px; align-items: flex-start; font-size: 12px; line-height: 1.4; font-weight: 600; color: var(--danger); margin: 0; }
.error svg { flex: none; width: 13px; height: 13px; margin-top: 2px; }

/* checkbox */
.check { display: grid; grid-template-columns: 24px 1fr; gap: var(--space-3); align-items: start; margin-bottom: var(--space-2); }
.check input {
  -webkit-appearance: none; appearance: none; margin: 0; width: 24px; height: 24px; flex: none;
  border: 1px solid var(--line-field); border-radius: 6px; background: var(--surface); display: grid; place-content: center; cursor: pointer;
}
.check input::after { content: ''; width: 12px; height: 7px; border: 2px solid var(--on-accent); border-top: 0; border-right: 0; transform: rotate(-45deg) translate(1px, -1px); opacity: 0; }
.check input:checked { background: var(--accent); border-color: var(--accent); }
.check input:checked::after { opacity: 1; }
.check input[aria-invalid="true"] { border: 2px solid var(--danger); }
.check label { font-size: 13.5px; line-height: 1.5; cursor: pointer; }
.check-error { margin: 0 0 var(--space-2) 36px; }
.check-help { margin: 0 0 var(--group-gap) 36px; }
.check + .check-help { margin-top: calc(-1 * var(--space-1)); }

.turnstile-wrap { min-height: 65px; margin: var(--space-4) 0; }
.help strong { color: var(--ink-2); font-weight: 600; }
/* Full width (Turnstile "flexible"), inset 1px each side so a fractional width can never clip its border. */
#turnstile { width: 100%; padding: 0 1px; }

/* buttons */
.button {
  font: inherit; font-size: 16px; font-weight: 600; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  min-height: var(--control-form); padding: 0 var(--space-4); width: 100%;
  border-radius: var(--radius-control); border: 1px solid transparent; cursor: pointer;
  background: var(--accent); color: var(--on-accent);
  transition: transform var(--press) var(--ease-standard), opacity var(--press) var(--ease-standard);
}
.button:active { transform: scale(.98); }
.button[disabled] { background: var(--surface-2); color: var(--muted); cursor: progress; }
.button-secondary { background: var(--surface); color: var(--ink); border-color: var(--line-field); }
.button-small { min-height: var(--control-small); font-size: 13.5px; padding: 0 var(--space-3); border-radius: var(--radius-control-small); width: auto; }
.button-danger { background: var(--danger); color: var(--surface); }
.form-error { margin-bottom: var(--space-4); }

/* privacy card: collapsed by default, opens on tap */
.privacy-card { padding: 0; }
.privacy-card > summary { list-style: none; cursor: pointer; padding: var(--space-4); padding-right: 44px; position: relative; display: flex; flex-direction: column; gap: 2px; border-radius: var(--radius-card); }
.privacy-card > summary::-webkit-details-marker { display: none; }
.privacy-card > summary::after { content: ''; position: absolute; right: var(--space-4); top: 50%; width: 16px; height: 16px; margin-top: -8px; background: var(--chevron) center / 16px no-repeat; transition: transform var(--press) var(--ease-standard); }
.privacy-card[open] > summary::after { transform: rotate(180deg); }
.privacy-title { font-weight: 600; font-size: 13.5px; }
.privacy-sub { color: var(--ink-2); }
.privacy-card > p { padding: 0 var(--space-4); }
.privacy-card > p:last-child { padding-bottom: var(--space-4); }

/* success: the ring draws, fills, the tick draws, a small burst, then the text rises in. */
#success-view { text-align: center; }
.success-anim { position: relative; width: 88px; height: 88px; margin: var(--space-2) auto var(--space-6); }
.success-check { width: 88px; height: 88px; display: block; overflow: visible; }
.success-check .ring { fill: var(--success-soft); fill-opacity: 0; stroke: var(--success); stroke-width: 2.5; stroke-dasharray: 151; stroke-dashoffset: 151; transform: rotate(-90deg); transform-origin: 50% 50%;
  animation: ring-draw 600ms var(--ease-standard) forwards, ring-fill 300ms ease-out 550ms forwards; }
.success-check .tick { fill: none; stroke: var(--success); stroke-width: 3.5; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 34; stroke-dashoffset: 34;
  animation: tick-draw 380ms var(--ease-standard) 700ms forwards; }
.success-anim::after { content: ''; position: absolute; inset: 0; border-radius: 50%; border: 2px solid var(--success); opacity: 0; animation: ring-pulse 900ms ease-out 700ms; }
.burst { position: absolute; inset: 0; pointer-events: none; }
.burst i { position: absolute; left: 50%; top: 50%; width: 7px; height: 7px; margin: -3.5px 0 0 -3.5px; border-radius: 50%; background: var(--brand-you); opacity: 0; animation: burst 700ms cubic-bezier(.2, .8, .2, 1) 760ms forwards; }
.burst i:nth-child(2n) { background: var(--success); width: 5px; height: 5px; margin: -2.5px 0 0 -2.5px; }
.burst i:nth-child(1) { --a: 0deg; } .burst i:nth-child(2) { --a: 45deg; } .burst i:nth-child(3) { --a: 90deg; } .burst i:nth-child(4) { --a: 135deg; }
.burst i:nth-child(5) { --a: 180deg; } .burst i:nth-child(6) { --a: 225deg; } .burst i:nth-child(7) { --a: 270deg; } .burst i:nth-child(8) { --a: 315deg; }
.success-line { opacity: 0; transform: translateY(8px); animation: rise 450ms var(--ease-standard) forwards; }
.success-line:nth-of-type(1) { animation-delay: 900ms; } #success-text { animation-delay: 1000ms; } .success-line.small { animation-delay: 1100ms; }
@keyframes ring-draw { to { stroke-dashoffset: 0; } }
@keyframes ring-fill { to { fill-opacity: 1; } }
@keyframes tick-draw { to { stroke-dashoffset: 0; } }
@keyframes ring-pulse { 0% { opacity: .5; transform: scale(1); } 100% { opacity: 0; transform: scale(1.45); } }
@keyframes burst { 0% { opacity: 0; transform: rotate(var(--a)) translateY(0) scale(.4); } 25% { opacity: 1; } 100% { opacity: 0; transform: rotate(var(--a)) translateY(-62px) scale(1); } }
@keyframes rise { to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  .success-check .ring { stroke-dashoffset: 0; fill-opacity: 1; animation: none; }
  .success-check .tick { stroke-dashoffset: 0; animation: none; }
  .success-anim::after, .burst { display: none; }
  .success-line { opacity: 1; transform: none; animation: none; }
}

footer.site-footer { max-width: var(--content-max-width); margin: 0 auto; padding: 0 var(--gutter) var(--space-10); color: var(--muted); font-size: 13.5px; text-align: center; }
footer.site-footer a { color: var(--ink-2); }

/* privacy notice page */
.prose h2 { margin-top: var(--section); }
.prose p, .prose li { color: var(--ink-2); }
.prose ul { padding-left: 1.25em; }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }

/* Committee login steps */
.steps { margin: 0 0 var(--space-4); padding-left: 1.4em; display: flex; flex-direction: column; gap: var(--space-3); }
.steps li { color: var(--ink-2); padding-left: 4px; }
.steps strong { color: var(--ink); }
a.button, a.button:hover { text-decoration: none; color: var(--on-accent); margin-top: var(--space-2); }
.restricted { margin-bottom: var(--space-4); }
.login-foot { margin: var(--space-3) 0 0; text-align: center; }

/* Narrow screens: the name wraps onto two lines rather than being cut off beside the switcher. */
@media (max-width: 480px) {
  .brand-name { white-space: normal; font-size: 14.5px; line-height: 1.15; overflow: visible; }
  .top-bar { gap: var(--space-2); }
  /* Phones: the switcher is one round button showing the current theme; a tap moves to the next. */
  .theme-switch { padding: 0; border: 0; background: none; }
  .theme-switch button:not([aria-pressed="true"]) { display: none; }
  .theme-switch button[aria-pressed="true"] { background: var(--surface-2); color: var(--ink); width: 34px; height: 34px; }
  .committee-login { padding: var(--space-2); font-size: 13px; }
}

/* Owner or tenant: two large choices; the chosen one fills with the accent colour. */
.role-field { border: 0; margin: 0 0 var(--field-gap); padding: 0; min-width: 0; }
.role-field legend { padding: 0; margin-bottom: var(--label-gap); font-size: 13.5px; font-weight: 600; line-height: 1.3; }
.role-options { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-2); }
.role-option { position: relative; display: block; cursor: pointer; }
.role-option input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.role-option span {
  display: flex; align-items: center; justify-content: center; min-height: var(--control-form);
  border: 1px solid var(--line-field); border-radius: var(--radius-control); background: var(--surface);
  font-weight: 600; transition: background-color var(--press) var(--ease-standard), color var(--press) var(--ease-standard);
}
.role-option:hover span { background: var(--state-hover); }
.role-option input:checked + span { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.role-option input:focus-visible + span { outline: var(--focus-width) solid var(--focus-ring); outline-offset: var(--focus-offset); }
.role-field[aria-invalid="true"] .role-option span { border: 2px solid var(--danger); }
.role-warning { margin: var(--space-2) 0 0; font-size: 12px; line-height: 1.4; font-weight: 600; color: var(--danger); }
.role-field .error { margin-top: var(--space-2); }

/* Contact: the link under the intro on the registration form, and the contact form's textarea. */
.contact-cta {
  display: flex; align-items: center; justify-content: center; gap: .35em; flex-wrap: wrap;
  margin: calc(var(--group-gap) * -0.5) 0 var(--group-gap); padding: var(--space-3) var(--space-4); min-height: 44px;
  border: 1px solid var(--line-field); border-radius: var(--radius-pill); background: var(--surface);
  color: var(--ink-2); font-size: 14.5px; text-decoration: none; text-align: center;
}
.contact-cta strong { color: var(--ink); }
.contact-cta:hover { background: var(--state-hover); color: var(--ink); }
.textarea { min-height: 9.5em; resize: vertical; line-height: 1.5; display: block; }
.counter { text-align: right; }
.counter.near { color: var(--danger); }
.contact-note { margin-bottom: var(--space-4); }
