/* Base styles shared by the pages: tokens, reset, buttons and dialogs. */

:root {
  --bg: #f3f4f6;
  --surface: #ffffff;
  --surface-2: #f7f8fa; /* hover fills */
  --line: #e4e6ea; /* hairlines inside things */
  --border: #d5d8de; /* edges of controls and boxes */
  --line-strong: #1c1d21; /* primary buttons, active states */
  --text: #1c1d21;
  --muted: #565a62;
  --link: #0b57d0;
  --accent: #0b57d0;
  --danger: #b3261e;
  --excluded: #9a9a94; /* borders and fills of excluded things */
  --excluded-text: #6e6e68; /* the same grey as text, >= 4.5:1 */
  --flight: #0b57d0;
  --train: #c2410c;
  --bus: #be185d;
  --boat: #0e7490;
  --car: #7c3aed;
  --stay: #1e7d32;
  --activity: #d97706;
  --other: #6b6b66;
  --yes-bg: #e6f4e7;
  --yes-line: #4caf50;
  --yes-text: #14501a;
  --yes-icon: #2e7d32;
  --no-bg: #fdecea;
  --no-line: #e57373;
  --no-text: #8a1c15;
  --no-icon: #c62828;
  --radius: 8px; /* controls, cards */
  --radius-lg: 12px; /* trip options, plan columns */
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.05), 0 1px 3px rgba(16, 24, 40, 0.07);
  --shadow-md: 0 2px 4px rgba(16, 24, 40, 0.06), 0 6px 16px rgba(16, 24, 40, 0.1);
  /* Layered shadow for dialogs: soft and deep, like it is lifted off the page. */
  --shadow-lift: 0 1px 1px rgba(0, 0, 0, 0.11), 0 2px 2px rgba(0, 0, 0, 0.11),
    0 4px 4px rgba(0, 0, 0, 0.11), 0 8px 8px rgba(0, 0, 0, 0.11),
    0 16px 16px rgba(0, 0, 0, 0.11), 0 32px 32px rgba(0, 0, 0, 0.11);
  --focus-ring: 0 0 0 3px rgba(11, 87, 208, 0.28);
  --focus: #0b57d0; /* focus outline, >= 3:1 on every surface */
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.4;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

* { box-sizing: border-box; }
/* iOS Safari enlarges text in narrow boxes on its own; keep the sizes set here. */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  min-height: 100vh;
}

button, input, select, textarea { font: inherit; color: inherit; }
/* One visible focus ring for keyboard users, everywhere. */
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
input[type="checkbox"] { accent-color: var(--line-strong); }

a { color: var(--link); text-decoration: underline; text-underline-offset: 2px; word-break: break-all; }
a:hover { text-decoration-thickness: 2px; }

/* ---------- buttons ---------- */
.btn {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius);
  padding: 5px 12px;
  font-weight: 500;
  cursor: pointer;
  box-shadow: 0 1px 1px rgba(16, 24, 40, 0.04);
  transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}
.btn:hover { background: var(--surface-2); border-color: #c4c8cf; }
.btn.primary { background: var(--line-strong); border-color: var(--line-strong); color: #fff; }
.btn.primary:hover { background: #3a3c42; border-color: #3a3c42; }
.btn.danger { border-color: var(--danger); color: var(--danger); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--muted); padding: 2px 6px; box-shadow: none; }
.btn.ghost:hover { color: var(--text); background: #eceef1; border-color: transparent; }

/* ---------- dialog ---------- */
dialog {
  border: 0;
  border-radius: 16px;
  padding: 0;
  width: min(520px, calc(100vw - 32px));
  box-shadow: var(--shadow-lift);
}
dialog::backdrop { background: rgba(17, 20, 28, 0.42); backdrop-filter: blur(2px); }
dialog form { padding: 20px; display: flex; flex-direction: column; gap: 12px; }
.dialog-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
dialog h2 { margin: 0; font-size: 19px; font-weight: 700; letter-spacing: -0.01em; }
dialog label, .field-label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
.field-label { margin-bottom: 6px; }
.field-label small { font-size: 12px; color: var(--excluded-text); }
dialog label.check { flex-direction: row; align-items: center; gap: 8px; color: var(--text); }
dialog input[type="text"], dialog input[type="number"], dialog input[type="date"], dialog textarea, dialog select {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 7px 9px;
  background: var(--surface);
  font-size: 15px;
  color: var(--text);
  min-width: 0;
}
dialog input:focus, dialog textarea:focus, dialog select:focus { border-color: var(--accent); }
dialog textarea { resize: vertical; }

/* Small controls still get a 24 x 24 px target (WCAG 2.2 target size). */
.btn.ghost, .person-remove, .handle { min-width: 24px; min-height: 24px; }

/* Touch: primary actions are at least 44 x 44 px (NFR-COMPAT-02.AC3). */
@media (pointer: coarse) {
  .btn, .btn.ghost, .board-title, .section-title, .toggle button, dialog select, dialog input[type="text"], dialog input[type="number"], dialog input[type="date"], dialog input[type="time"],
  .form-field input, .person-remove, .who-picker button, .feature-state button { min-height: 44px; min-width: 44px; }
  .btn.ghost { padding: 8px 12px; }
  input[type="checkbox"] { width: 24px; height: 24px; }
  label.check, .card-actions label { min-height: 44px; display: inline-flex; align-items: center; }
}

/* Motion: nothing animates for people who ask for less (NFR-A11Y-05.AC2). */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0s !important; animation-duration: 0s !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; }
}
