/* The Learner's Guild — design tokens and base components. Part 5 of
   docs/MASTER_PROMPT.md. One hand-written stylesheet, no build step. */

@font-face {
  font-family: 'Fraunces';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('/fonts/fraunces-600.woff2') format('woff2');
}
@font-face {
  font-family: 'Instrument Sans';
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url('/fonts/instrument-sans-variable.woff2') format('woff2');
}
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/fonts/ibm-plex-mono-400.woff2') format('woff2');
}

:root {
  --guild-navy: #1B5474;
  --parchment: #F5EDDF;
  --parchment-raised: #FBF6EC;
  --ink: #16232B;
  --ink-muted: #5A6B75;
  --rule: #DCD0BC;
  --rule-strong: #8F877A; /* input borders — --rule alone is 1.3:1, fails WCAG 1.4.11 (3:1) for UI boundaries */
  --celeste: #3E8EA6;
  --vert: #4F7A46;
  --gules: #8C3B45;
  --or: #B8912C;
  --ink-surface: #101A20;
  --ink-raised: #1A272F;
  --dark-label: #93A4AD;

  /* Darkened variants of --vert/--or for small text on light backgrounds —
     the base tokens don't clear WCAG AA (4.5:1) as text; see contrast audit. */
  --vert-text: #43683C;
  --or-text: #785E1D;

  --font-display: 'Fraunces', Georgia, serif;
  --font-interface: 'Instrument Sans', system-ui, -apple-system, sans-serif;
  --font-data: 'IBM Plex Mono', 'SFMono-Regular', Consolas, monospace;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--parchment);
  color: var(--ink);
  font-family: var(--font-interface);
  font-size: 16px;
  line-height: 24px;
  -webkit-font-smoothing: antialiased;
  padding-bottom: 72px; /* room for bottom nav */
}
h1, h2, h3, p { margin: 0 0 8px; }
img { max-width: 100%; }

/* Type scale — Part 5. Max one --t-display element per screen. */
.t-display { font-family: var(--font-display); font-size: 32px; line-height: 36px; font-weight: 600; margin: 0; }
.t-title { font-family: var(--font-display); font-size: 22px; line-height: 28px; font-weight: 600; margin: 0; }
.t-heading { font-family: var(--font-interface); font-size: 17px; line-height: 24px; font-weight: 600; margin: 0; }
.t-body { font-family: var(--font-interface); font-size: 16px; line-height: 24px; font-weight: 400; }
.t-label {
  font-family: var(--font-interface); font-size: 13px; line-height: 16px; font-weight: 500;
  letter-spacing: 0.02em; color: var(--ink-muted);
}
.t-data { font-family: var(--font-data); font-size: 15px; line-height: 20px; font-weight: 400; font-variant-numeric: tabular-nums; }

/* Money — always t-data, rupee-prefixed, whole rupees, right-aligned. */
.money {
  font-family: var(--font-data);
  font-variant-numeric: tabular-nums;
  display: inline-block;
  text-align: right;
}
.money::before { content: '\20B9'; margin-right: 1px; }

a { color: var(--guild-navy); }

:focus-visible { outline: 2px solid var(--guild-navy); outline-offset: 2px; }

/* Layout */
.page { max-width: 480px; margin: 0 auto; padding: 16px; }
.stack > * + * { margin-top: 12px; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }

/* Cards — parchment-raised, hairline border, no shadow. */
.card { background: var(--parchment-raised); border: 1px solid var(--rule); border-radius: 8px; padding: 16px; }

/* Buttons — 48px min, 6px radius, sentence case. */
.btn {
  min-height: 48px; min-width: 48px;
  border-radius: 6px; border: none;
  background: var(--guild-navy); color: #fff;
  font-family: var(--font-interface); font-size: 16px; font-weight: 500;
  padding: 0 20px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
.btn:active { opacity: 0.85; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-secondary { background: transparent; color: var(--guild-navy); border: 1px solid var(--rule-strong); }
.btn-danger { background: var(--gules); }
.btn-block { width: 100%; }
.btn-lower { margin-top: 24px; } /* primary actions live in the lower half */

/* Forms */
label { display: block; margin-bottom: 4px; }
input, select, textarea {
  width: 100%; min-height: 48px;
  border: 1px solid var(--rule-strong); border-radius: 6px;
  padding: 0 12px; font-size: 16px; font-family: var(--font-interface);
  background: #fff; color: var(--ink);
}
textarea { min-height: 96px; padding: 12px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--guild-navy); outline-offset: 2px; }
.field { margin-bottom: 16px; }

/* Status pills */
.pill { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 13px; font-weight: 500; }
.pill-paid, .pill-present, .pill-confirmed { background: color-mix(in srgb, var(--vert) 18%, transparent); color: var(--vert-text); }
.pill-overdue, .pill-absent, .pill-rejected { background: color-mix(in srgb, var(--gules) 18%, transparent); color: var(--gules); }
.pill-pending { background: color-mix(in srgb, var(--or) 20%, transparent); color: var(--or-text); }

/* Bottom nav — never a hamburger. */
.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: flex;
  background: var(--parchment-raised);
  border-top: 1px solid var(--rule);
  padding-bottom: env(safe-area-inset-bottom);
}
.bottom-nav a {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: 56px; text-decoration: none; color: var(--ink-muted); font-size: 13px; gap: 2px;
}
.bottom-nav a.active { color: var(--guild-navy); font-weight: 600; }

/* Week strip — the signature component. 7 cells, M..S, program colour fills active days. */
.week-strip { display: inline-flex; gap: 4px; vertical-align: middle; }
.week-strip .cell {
  width: 12px; height: 16px; border-radius: 3px;
  border: 1px solid var(--rule); background: transparent;
}
.week-strip .cell.on { border-color: transparent; }
.week-strip.history .cell { width: 14px; height: 14px; border-radius: 50%; }
.week-strip.history .cell.hollow { background: transparent; border-color: var(--rule); }
.week-strip.history .cell.filled { border-color: transparent; }
.week-strip.history .cell.not-scheduled { background: transparent; border: 1px dashed var(--rule); }
.week-strip.day-header .cell {
  width: 20px; height: 20px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--font-interface); font-size: 11px; font-weight: 600;
  color: var(--dark-label); /* this strip only ever appears on .surface-dark */
}
.week-strip.day-header .cell.on { color: #fff; }

/* Guild mark — shield avatar, divided by enrolment. No gradients, no photo. */
.guild-mark { display: inline-block; vertical-align: middle; }

/* Attendance row — coach screen, 64px, tap toggles present. */
.attendance-row {
  display: flex; align-items: center; justify-content: space-between;
  height: 64px; padding: 0 12px;
  border-bottom: 1px solid var(--ink-raised);
  position: relative;
  transition: background-color 120ms ease-out, box-shadow 120ms ease-out;
}
.attendance-row.present { background: color-mix(in srgb, var(--vert) 12%, transparent); box-shadow: inset 4px 0 0 var(--vert); }
.attendance-row.absent { background: color-mix(in srgb, var(--gules) 12%, transparent); box-shadow: inset 4px 0 0 var(--gules); }
.attendance-row.late, .attendance-row.excused { background: color-mix(in srgb, var(--or) 12%, transparent); box-shadow: inset 4px 0 0 var(--or); }

/* Dark surface — coach attendance screen only. */
.surface-dark { background: var(--ink-surface); color: #E8EEF1; min-height: 100vh; }
.surface-dark .card { background: var(--ink-raised); border-color: #2A3A44; }
.surface-dark .t-label { color: #93A4AD; }
.surface-dark .attendance-row { border-bottom-color: #24333C; }

/* Empty / error states — one line of direction, one action. */
.empty-state, .error-state { padding: 32px 16px; text-align: center; color: var(--ink-muted); }
.error-state { color: var(--gules); }

/* Sheets slide up 200ms ease-out. */
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  background: var(--parchment-raised);
  border-top: 1px solid var(--rule);
  border-radius: 12px 12px 0 0;
  padding: 20px 16px calc(20px + env(safe-area-inset-bottom));
  transform: translateY(100%);
  transition: transform 200ms ease-out;
}
.sheet.open { transform: translateY(0); }
.sheet-backdrop {
  position: fixed; inset: 0; background: rgba(16,26,32,0.4); z-index: 19;
  opacity: 0; pointer-events: none; transition: opacity 200ms ease-out;
}
.sheet-backdrop.open { opacity: 1; pointer-events: auto; }

/* Admin console — denser than the parent/coach screens, per the "wants
   density" persona in Part 5, but the same tokens throughout. */
.admin-page { max-width: 760px; margin: 0 auto; padding: 16px; }
.admin-tabs { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 16px; }
.admin-tabs button { min-height: 40px; padding: 0 14px; }
table.data { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data th { text-align: left; font-family: var(--font-interface); font-size: 13px; font-weight: 500; color: var(--ink-muted); border-bottom: 1px solid var(--rule); padding: 6px 8px; }
table.data td { border-bottom: 1px solid var(--rule); padding: 6px 8px; vertical-align: middle; }
table.data td.num { font-family: var(--font-data); font-variant-numeric: tabular-nums; text-align: right; }
.section { display: none; }
.section.active { display: block; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 480px) { .two-col { grid-template-columns: 1fr; } }

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