/* ============================================================
   BARS CREW PORTAL — barscrew.org

   Deliberately the same design language as the public site at
   driving.brandonrescue.org/lp: identical tokens, serif headings,
   rescue blue, warm off-white, amber reserved for primary actions.
   Someone moving between the two should not feel a seam.

   Tokens below are copied verbatim from the /lp stylesheet. If the
   public site's palette changes, change it here too.
   ============================================================ */

/* ---------- 1. Tokens ---------- */
:root {
  --ink:        #16303C;
  --ink-muted:  #4A6470;

  --blue:       #0B6FB8;
  --blue-strong:#075A97;
  --blue-ink:   #0A3550;

  --amber:      #F5A00A;
  --amber-ink:  #331F00;
  --amber-light:#FFC65C;

  --white:      #FFFFFF;
  --paper:      #FAF7F2;
  --paper-2:    #F1EDE6;
  --line:       #E2DBD1;
  --line-strong:#CFC5B8;

  --footer-text: #D6E3EC;
  --footer-muted:#A9C2D3;

  /* Status marks for the compliance table. Never color alone — every
     status also carries a word and a shape. */
  --ok:      #1F7A4D;
  --ok-bg:   #E8F4EE;
  --warn:    #8A5A00;
  --warn-bg: #FDF2DC;
  --late:    #A32020;
  --late-bg: #FBEAEA;

  --font-serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, "Times New Roman", serif;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  --measure: 62ch;
  --page: 1180px;
  --gutter: clamp(1.25rem, 4vw, 2.5rem);
  --section-y: clamp(2.5rem, 5vw, 4.5rem);
  --radius: 6px;
}

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

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

body {
  margin: 0;
  background: var(--white);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 1.125rem;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  margin: 0;
  font-family: var(--font-serif);
  font-weight: 600;
  line-height: 1.15;
  color: var(--ink);
  text-wrap: balance;
}

h1 { font-size: clamp(2.05rem, 5vw, 3.4rem); letter-spacing: -0.015em; }
h2 { font-size: clamp(1.7rem, 3.4vw, 2.5rem); letter-spacing: -0.01em; }
h3 { font-size: clamp(1.25rem, 2vw, 1.5rem); }
h4 { font-size: 1.0625rem; font-family: var(--font-sans); font-weight: 700; }

p { margin: 0 0 1.15em; max-width: var(--measure); }
p:last-child { margin-bottom: 0; }

a { color: var(--blue-strong); text-underline-offset: 3px; }
a:hover { color: var(--ink); }

img { display: block; max-width: 100%; height: auto; }

:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 3px;
  border-radius: 2px;
}
.band :focus-visible,
.site-footer :focus-visible { outline-color: var(--amber-light); }

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

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

.section { padding-block: var(--section-y); }
.section--paper { background: var(--paper); border-block: 1px solid var(--line); }

.label {
  display: block;
  margin: 0 0 0.75rem;
  font-family: var(--font-sans);
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--blue-strong);
}

.lede {
  font-size: clamp(1.15rem, 1.6vw, 1.3rem);
  line-height: 1.6;
  color: var(--ink-muted);
}

/* ---------- 4. Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 48px;
  padding: 0.75rem 1.5rem;
  border: 2px solid transparent;
  border-radius: var(--radius);
  font-family: var(--font-sans);
  font-size: 1.0625rem;
  font-weight: 700;
  line-height: 1.25;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.btn--primary { background: var(--blue-strong); color: var(--white); }
.btn--primary:hover { background: var(--ink); color: var(--white); }
.btn--amber { background: var(--amber); color: var(--amber-ink); }
.btn--amber:hover { background: #d98a00; color: var(--amber-ink); }
.btn--quiet { background: transparent; color: var(--blue-strong); border-color: var(--line-strong); }
.btn--quiet:hover { background: var(--white); border-color: var(--blue-strong); }
.btn--danger { background: transparent; color: var(--late); border-color: var(--late); }
.btn--danger:hover { background: var(--late); color: var(--white); }
.btn--sm { min-height: 38px; padding: 0.35rem 0.85rem; font-size: 0.95rem; }
.btn--block { width: 100%; }

.actions { display: flex; flex-wrap: wrap; gap: 0.85rem; margin-top: 1.75rem; }
@media (max-width: 26.25em) {
  .actions { flex-direction: column; align-items: stretch; }
  .actions .btn { width: 100%; }
}

/* ---------- 5. Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--white);
  border-bottom: 1px solid var(--line);
}
.site-header__inner {
  display: flex;
  align-items: center;
  gap: 1rem;
  min-height: 68px;
  padding-block: 0.6rem;
}
.brand {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  min-height: 44px;
  margin-right: auto;
  min-width: 0;
  text-decoration: none;
  color: var(--ink);
}
.brand__mark {
  width: 42px;
  height: 42px;
  flex: none;
  /* The five-tap admin reveal lives on this image. Keep it non-draggable so
     repeated taps on a phone do not start an image drag instead. */
  -webkit-user-select: none;
  user-select: none;
  -webkit-user-drag: none;
}
.brand__name {
  font-family: var(--font-serif);
  font-size: 1.15rem;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.brand__name span {
  display: block;
  font-family: var(--font-sans);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-muted);
}
.header__link { font-size: 0.98rem; font-weight: 700; text-decoration: none; }

/* Revealed only after five taps on the logo. */
.admin-reveal { display: none; }
.admin-reveal.is-shown { display: inline-flex; }

/* ---------- 6. Hero band ---------- */
.band {
  background: var(--blue-ink);
  color: var(--white);
  padding-block: clamp(2.25rem, 5vw, 3.75rem);
}
.band h1 { color: var(--white); }
.band p { color: var(--footer-text); }

/* ---------- 7. Tiles ---------- */
.tile-group + .tile-group { margin-top: clamp(2rem, 4vw, 3rem); }
.tile-group__head {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  margin-bottom: 1.1rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--line);
}
.tile-group__head h2 { font-size: clamp(1.35rem, 2.2vw, 1.65rem); }

.tiles {
  display: grid;
  gap: 1rem;
  grid-template-columns: 1fr;
}
@media (min-width: 34em) { .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 60em) { .tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

.tile {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 1.25rem 1.35rem;
  min-height: 118px;
  background: var(--white);
  border: 1px solid var(--line-strong);
  border-left: 5px solid var(--blue);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--ink);
  transition: border-color 0.15s ease, background-color 0.15s ease, transform 0.15s ease;
}
.tile:hover {
  background: var(--paper);
  border-left-color: var(--amber);
  color: var(--ink);
  transform: translateY(-2px);
}
.tile__title {
  font-family: var(--font-serif);
  font-size: 1.3rem;
  font-weight: 600;
  line-height: 1.2;
}
.tile__blurb {
  margin: 0;
  font-size: 0.98rem;
  line-height: 1.5;
  color: var(--ink-muted);
  max-width: none;
}
/* The action the portal actually wants you to take. */
.tile--action { border-left-color: var(--amber); background: var(--paper); }
.tile--action:hover { border-left-color: var(--amber); background: var(--paper-2); }

/* ---------- 8. Passcode gate ---------- */
.gate {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: var(--gutter);
  background: var(--paper);
}
.gate__card {
  width: 100%;
  max-width: 25rem;
  padding: clamp(1.75rem, 4vw, 2.5rem);
  background: var(--white);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  text-align: center;
}
.gate__mark { width: 76px; height: 76px; margin: 0 auto 1.1rem; }
.gate__card h1 { font-size: 1.9rem; margin-bottom: 0.35rem; }
.gate__card p { margin-inline: auto; }

/* ---------- 9. Forms ---------- */
.field { margin-bottom: 1.1rem; text-align: left; }
.field label {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.95rem;
  font-weight: 700;
}
.field input[type="text"],
.field input[type="password"],
.field input[type="email"],
.field input[type="url"],
.field input[type="date"],
.field input[type="number"],
.field select,
.field textarea {
  width: 100%;
  min-height: 48px;
  padding: 0.6rem 0.75rem;
  font-family: inherit;
  font-size: 1.0625rem;
  color: var(--ink);
  background: var(--white);
  border: 2px solid var(--line-strong);
  border-radius: var(--radius);
}
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--blue);
  outline: none;
}
.field__hint { margin: 0.35rem 0 0; font-size: 0.9rem; color: var(--ink-muted); }

.notice {
  margin-bottom: 1.25rem;
  padding: 0.85rem 1rem;
  border-radius: var(--radius);
  font-size: 1rem;
  text-align: left;
}
.notice p { max-width: none; }
.notice--error { background: var(--late-bg); border: 1px solid var(--late); color: var(--late); }
.notice--ok    { background: var(--ok-bg);   border: 1px solid var(--ok);   color: var(--ok); }
.notice--warn  { background: var(--warn-bg); border: 1px solid var(--warn); color: var(--warn); }

/* ---------- 10. Admin tables ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line-strong); border-radius: var(--radius); }
table.data {
  width: 100%;
  min-width: 44rem;
  border-collapse: collapse;
  font-size: 1rem;
  background: var(--white);
}
table.data th, table.data td {
  padding: 0.7rem 0.9rem;
  text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
table.data th {
  background: var(--paper);
  font-size: 0.88rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-muted);
  white-space: nowrap;
}
table.data tr:last-child td { border-bottom: 0; }
table.data tbody tr:hover { background: var(--paper); }

/* Status carries a word, a symbol and a color — not color alone. */
.status {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 700;
  white-space: nowrap;
}
.status--ok   { background: var(--ok-bg);   color: var(--ok); }
.status--warn { background: var(--warn-bg); color: var(--warn); }
.status--late { background: var(--late-bg); color: var(--late); }

.stat-row {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
  margin-bottom: 1.75rem;
}
.stat {
  padding: 1rem 1.15rem;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.stat__num { font-family: var(--font-serif); font-size: 2.1rem; line-height: 1; }
.stat__lbl { font-size: 0.9rem; font-weight: 700; color: var(--ink-muted); }

/* ---------- 11. Footer ---------- */
.site-footer {
  margin-top: auto;
  padding-block: 2.25rem;
  background: var(--blue-ink);
  color: var(--footer-text);
  font-size: 0.95rem;
}
.site-footer a { color: var(--white); }
.site-footer p { max-width: none; }
.site-footer__muted { color: var(--footer-muted); }

body.has-footer { display: flex; flex-direction: column; min-height: 100dvh; }

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