/* ============================================================
   THE CLUB — Careers
   Loaded only by the generated pages under careers/.
   Everything here builds on css/styles.css: same variables, same
   buttons, same form fields, same page hero. No new colours, no
   new typefaces.
   ============================================================ */

/* ---------- Shared column ----------
   One readable measure for the whole section, matching .legal on the
   privacy page. Job postings are read, not scanned across. */
.careers-wrap { max-width: 780px; margin-inline: auto; }

/* A standalone section heading with the house red underline. The site's
   .section-head gives this to an h2 inside a wrapper; here the headings
   stand on their own, so the rule is repeated for them directly. */
.careers-h2 {
  position: relative;
  font-size: clamp(1.45rem, 2.6vw, 1.85rem);
  padding-bottom: 0.85rem;
  margin-bottom: 1.4rem;
}
.careers-h2::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 52px;
  height: 4px;
  border-radius: 2px;
  background: var(--red);
}

.careers-aside p,
.careers-cta p { color: var(--body); max-width: 62ch; }
.careers-cta .btn-row { margin-top: 1.5rem; }

/* ---------- The openings list ----------
   A plain divided list rather than a row of cards: at one or two openings
   a card grid looks like a placeholder, and a list stays honest at any
   number. A hairline rule separates them; only the title and the button
   are interactive. */
.job-list { border-top: 1px solid var(--line); }

.job-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 2rem;
  padding: 1.7rem 0;
  border-bottom: 1px solid var(--line);
}
.job-row-main { min-width: 0; }
/* js/careers.js hides a row, and the whole list, once a deadline passes.
   Any [display] rule beats the browser's own [hidden], so it has to be said
   here. (tasks/lessons.md, 2026-10-27) */
.job-row[hidden],
.job-list[hidden] { display: none; }

.job-row-title { font-size: 1.3rem; margin-bottom: 0.5rem; }
.job-row-title a { color: var(--ink); }
.job-row-title a:hover { color: var(--red); text-decoration: none; }

/* Location · type · pay, separated by a red dot drawn in CSS so the markup
   stays a plain list of spans. The dot belongs to the item before it, not the
   one after, so that a line which wraps on a phone begins with a word rather
   than with what looks like a stray bullet. */
.job-row-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.85rem;
  font-size: 0.84rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--muted);
  margin-bottom: 0.35rem;
}
/* The pay summary sits on its own line rather than in the dotted meta row:
   it is a sentence, not a label, and wrapping it inside the row left the
   separator dot stranded at the end of a line. */
.job-row-pay {
  margin: 0 0 0.7rem;
  font-size: 0.84rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--body);
}
.job-row-meta span {
  display: inline-flex;
  align-items: center;
  gap: 0.85rem;
}
.job-row-meta span:not(:last-child)::after {
  content: "";
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--red);
  flex: 0 0 auto;
}

.job-row-desc { color: var(--body); max-width: 56ch; }
.job-row-deadline {
  margin-top: 0.7rem;
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--muted);
}
.job-row-action { flex: 0 0 auto; padding-top: 0.2rem; }
.job-row-arrow { display: inline-flex; width: 16px; height: 16px; }
.job-row-arrow svg { width: 100%; height: 100%; }

/* ---------- Nothing open ---------- */
.careers-empty {
  display: block;
  padding: 2rem 1.9rem;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-left: 4px solid var(--red);
  border-radius: var(--radius);
}
.section--soft .careers-empty { background: var(--white); }
.careers-empty h2,
.careers-empty h3 { margin-bottom: 0.5rem; }
.careers-empty .careers-h2 { margin-bottom: 1rem; }
.careers-empty p { color: var(--body); }
.careers-empty .btn-row { margin-top: 1.4rem; }
/* JS toggles this one. Any [display] rule beats the browser's own
   [hidden], so it has to be said here. (tasks/lessons.md, 2026-10-27) */
.careers-empty[hidden] { display: none; }

/* ---------- At a glance ---------- */
.job-facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.job-fact { background: var(--white); padding: 1.05rem 1.2rem; }
.job-fact dt {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.3rem;
}
.job-fact dd { font-size: 1rem; font-weight: 700; color: var(--ink); line-height: 1.35; }

/* ---------- The posting itself ----------
   Same measure and rhythm as the privacy policy, which is the site's
   existing long-read page. */
.job-body-section { padding-top: clamp(1.75rem, 4vw, 2.5rem); }
.job-body h2 { font-size: 1.3rem; margin: 2.6rem 0 0.9rem; }
.job-body h2:first-child { margin-top: 0; }
.job-body h3 {
  font-size: 1rem;
  letter-spacing: 0.02em;
  margin: 1.8rem 0 0.6rem;
  color: var(--ink);
}
.job-body p { margin-bottom: 1rem; }
.job-body ul { margin: 0 0 1.4rem; padding-left: 1.2rem; list-style: disc; }
.job-body li { margin-bottom: 0.6rem; padding-left: 0.2rem; }
.job-body li::marker { color: var(--red); }

/* Starting pay / hours / floor hours — the figures pulled out of the
   Schedule & Compensation prose so they are not buried in a paragraph. */
.job-pay {
  margin: 0 0 1.5rem;
  border-top: 1px solid var(--line);
}
.job-pay-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--line);
}
.job-pay dt { font-weight: 600; color: var(--body); font-size: 0.95rem; }
.job-pay dd { font-weight: 800; color: var(--ink); text-align: right; }

/* ---------- Closed / draft notice ---------- */
.job-notice {
  padding: 1.1rem 1.3rem;
  margin-bottom: 1.75rem;
  border: 1px solid var(--line);
  border-left: 4px solid var(--red);
  border-radius: var(--radius-sm);
  background: var(--red-tint);
  color: var(--body);
  font-size: 0.95rem;
  line-height: 1.6;
}
.job-notice strong { color: var(--ink); }
.job-notice a { color: var(--red-dark); text-decoration: underline; }
/* Deliberately loud: a draft page must never be mistaken for a live one. */
.job-notice--draft {
  background: #fff8e1;
  border-color: #e8d9a0;
  border-left-color: #c79a12;
}
.job-notice--draft code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.88em;
  background: rgba(0, 0, 0, 0.055);
  padding: 0.1em 0.35em;
  border-radius: 4px;
}

/* ---------- The application form ---------- */
.apply-intro { color: var(--muted); font-size: 0.95rem; margin-bottom: 1.75rem; }

.apply-group { border: 0; padding: 0; margin: 0 0 1.9rem; }
.apply-group:last-of-type { margin-bottom: 0; }
.apply-group > legend {
  font-family: var(--font-sans);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--red);
  padding: 0 0 0.8rem;
  margin-bottom: 0.3rem;
  width: 100%;
  border-bottom: 1px solid var(--line);
}

.req { color: var(--red); font-weight: 700; }

.field-hint {
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.5;
  margin: -0.1rem 0 0.1rem;
}
.field-error {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--red-dark);
}
/* Both are shown and hidden from js/careers.js. */
.field-hint[hidden],
.field-error[hidden] { display: none; }

.form-field input[aria-invalid="true"],
.form-field select[aria-invalid="true"],
.form-field textarea[aria-invalid="true"] {
  border-color: var(--red);
  background: #fffafa;
}

/* ---------- Availability grid ----------
   Time ranges down the side, days across the top. One real table, so the
   headings are announced with each box; the whole cell is the label, so the
   tap target is the cell and not the 18px checkbox inside it. */
.grid-field { gap: 0; }
.grid-fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.grid-legend {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink);
  padding: 0;
  margin-bottom: 0.4rem;
}
.grid-field .field-hint { margin: 0 0 0.75rem; }

/* min-width: 0 above and this wrapper keep a wide grid from stretching the
   card on a very narrow phone — it scrolls sideways instead of overflowing. */
.grid-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

.grid-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}
.grid-table th,
.grid-table td { padding: 0; text-align: center; }

/* The corner carries the same rule as the day headings, so the line under the
   head runs the full width of the table rather than starting at "Mon". */
.grid-corner { width: 7.5rem; border-bottom: 1px solid var(--line); }

.grid-table thead th {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--muted);
  padding-bottom: 0.45rem;
  border-bottom: 1px solid var(--line);
}
.grid-day-short { display: none; }

.grid-table tbody th {
  text-align: left;
  font-weight: 600;
  padding: 0.3rem 0.75rem 0.3rem 0;
  border-bottom: 1px solid var(--line);
}
.grid-table tbody tr:last-child th,
.grid-table tbody tr:last-child td { border-bottom: 0; }
.grid-table tbody td { border-bottom: 1px solid var(--line); }
.grid-slot-name { display: block; font-size: 0.88rem; color: var(--ink); line-height: 1.3; }
.grid-slot-note { display: block; font-size: 0.74rem; font-weight: 600; color: var(--muted); }

/* The cell itself is the label. The real checkbox sits under the tick so the
   keyboard and screen reader get a genuine checkbox, not a div pretending. */
.grid-cell {
  display: grid;
  place-items: center;
  min-height: 44px;
  cursor: pointer;
  position: relative;
}
.grid-cell input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}
.grid-tick {
  width: 20px;
  height: 20px;
  border: 1.5px solid var(--line);
  border-radius: 5px;
  background: var(--white);
  transition: background 0.15s ease, border-color 0.15s ease;
  position: relative;
}
.grid-tick::after {
  content: "";
  position: absolute;
  left: 6px;
  top: 2px;
  width: 5px;
  height: 10px;
  border: solid var(--white);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg) scale(0.6);
  opacity: 0;
  transition: opacity 0.15s ease, transform 0.15s ease;
}
.grid-cell:hover .grid-tick { border-color: var(--red); }
.grid-cell input:checked + .grid-tick { background: var(--red); border-color: var(--red); }
.grid-cell input:checked + .grid-tick::after { opacity: 1; transform: rotate(45deg) scale(1); }
.grid-cell input:focus-visible + .grid-tick {
  outline: 3px solid rgba(217, 22, 28, 0.4);
  outline-offset: 2px;
}
.grid-fieldset[aria-invalid="true"] .grid-tick { border-color: var(--red); }

/* The spam trap. Off-screen rather than display:none, because some bots
   skip anything that is not rendered. Never reachable by keyboard or by a
   screen reader: the wrapper is aria-hidden and the input tabindex="-1". */
.apply-trap {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* The confirmation that replaces the form in place. */
.apply-done { text-align: left; }
.apply-done .btn-row { margin-top: 1.5rem; }

/* ---------- Application received page ---------- */
.careers-received { text-align: center; max-width: 620px; }
.careers-received h1 { font-size: clamp(1.9rem, 4vw, 2.6rem); margin-bottom: 1rem; }
.careers-received p { color: var(--body); font-size: 1.05rem; }
.careers-received .btn-row { margin-top: 2rem; }
.received-tick {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  margin: 0 auto 1.6rem;
  border-radius: 50%;
  background: var(--red-tint);
  color: var(--red);
}
.received-tick svg { width: 30px; height: 30px; }

/* ---------- Narrow screens ---------- */
@media (max-width: 640px) {
  /* The button belongs under the role on a phone, full width, where a
     thumb already is. */
  .job-row {
    flex-direction: column;
    align-items: stretch;
    gap: 1.1rem;
    padding: 1.5rem 0;
  }
  .job-row-action { padding-top: 0; }
  .job-row-action .btn { width: 100%; }
  .job-row-desc { max-width: none; }

  .job-facts { grid-template-columns: 1fr; }
  .careers-empty { padding: 1.6rem 1.3rem; }
  .careers-received .btn-row .btn { width: 100%; }
}

/* The grid is the one thing on the form that needs the whole screen. Below
   this width the day headings drop to single letters, the time ranges stack
   name over hours, and the table is pulled out to the edges of the card so
   seven columns still get a usable tap target. */
@media (max-width: 560px) {
  .apply-card { padding-inline: 1.15rem; }
  .grid-scroll {
    margin-inline: -1.15rem;
    padding-inline: 1.15rem;
    width: calc(100% + 2.3rem);
  }
  .grid-table { min-width: 300px; }
  .grid-corner { width: 4.9rem; }
  .grid-day-full { display: none; }
  .grid-day-short { display: inline; }
  .grid-table tbody th { padding-right: 0.5rem; }
  .grid-slot-name { font-size: 0.8rem; }
  .grid-slot-note { font-size: 0.68rem; }
  .grid-tick { width: 18px; height: 18px; }
  .grid-tick::after { left: 5px; top: 2px; width: 5px; height: 9px; }
}
