/* Shared tool styles for every StudyTravelPlus tool (contract section 2).
   Load it with res.render(..., { toolStylesheets: ['/css/tools-base.css', '/css/tools/<id>.css'] }).
   Tool files may add layout only, using these variables. They must not
   define new colours, fonts or component styles. */

.stp-tool {
  --stp-deep: #0F2926;
  --stp-juniper: #173B37;
  --stp-rust: #A84326;
  --stp-aloe: #DCE9DF;
  --stp-paper: #F5F1E8;
  --stp-coral: #EF8354; /* decorative only */
  --stp-ink: #0F2926;
  --stp-muted: #3D5753;
  --stp-line: #B9CBBE;
  --stp-radius: 10px;
  --stp-gap: 1rem;
  --stp-display: 'Sora', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color: var(--stp-ink);
  max-width: 46rem;
  margin: 0 auto;
}
.stp-tool h1, .stp-tool h2 { font-family: var(--stp-display); color: var(--stp-deep); line-height: 1.25; }
.stp-tool p, .stp-tool li { line-height: 1.6; }

/* Progress: one primary task per screen, visible progress */
.stp-progress { list-style: none; display: flex; flex-wrap: wrap; gap: 0.5rem; padding: 0; margin: 0 0 1.5rem; }
.stp-progress li { border: 1px solid var(--stp-line); border-radius: 999px; padding: 0.25rem 0.75rem; font-size: 0.9rem; }
.stp-progress li[aria-current="step"] { border: 3px solid var(--stp-juniper); font-weight: 600; }

/* Panels and meta */
.stp-panel { background: #fff; border: 1px solid var(--stp-line); border-radius: var(--stp-radius); padding: 1.25rem; margin: 0 0 var(--stp-gap); }
.stp-meta { color: var(--stp-muted); font-size: 0.9rem; }
.stp-notice { background: var(--stp-aloe); border-radius: var(--stp-radius); padding: 1rem; margin: 0 0 var(--stp-gap); }

/* Forms */
.stp-field { margin: 0 0 1.25rem; }
.stp-field label, .stp-field legend { display: block; font-weight: 600; margin: 0 0 0.35rem; }
.stp-hint { color: var(--stp-muted); font-size: 0.9rem; margin: 0 0 0.35rem; }
.stp-field input[type="text"], .stp-field input[type="date"], .stp-field input[type="url"],
.stp-field input[type="number"], .stp-field select, .stp-field textarea {
  width: 100%; max-width: 32rem; min-height: 44px; padding: 0.5rem 0.75rem; font: inherit;
  border: 2px solid var(--stp-juniper); border-radius: 6px; background: #fff; box-sizing: border-box;
}
.stp-field textarea { min-height: 6rem; }
.stp-choice { display: flex; align-items: center; gap: 0.5rem; min-height: 44px; }
.stp-choice input { width: 1.25rem; height: 1.25rem; }
.stp-field-error { color: var(--stp-rust); font-weight: 600; margin: 0 0 0.35rem; }
[aria-invalid="true"] { border-color: var(--stp-rust) !important; }

/* Error summary */
.stp-error-summary { border: 3px solid var(--stp-rust); border-radius: var(--stp-radius); padding: 1rem; margin: 0 0 1.5rem; background: #fff; }
.stp-error-summary h2 { margin-top: 0; font-size: 1.1rem; }

/* Buttons and actions */
.stp-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: center; margin: 1.5rem 0 0; }
.stp-tool .stp-btn {
  display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 0.5rem 1.25rem;
  border: 2px solid var(--stp-juniper); border-radius: 6px; background: var(--stp-juniper); color: #fff;
  font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
}
.stp-tool .stp-btn:hover { background: var(--stp-deep); border-color: var(--stp-deep); }
.stp-tool .stp-btn.stp-btn-secondary { background: transparent; color: var(--stp-juniper); }
.stp-tool .stp-btn.stp-btn-secondary:hover { background: var(--stp-aloe); }
.stp-tool .stp-btn.stp-btn-danger { background: var(--stp-rust); border-color: var(--stp-rust); }
.stp-actions a:not(.stp-btn), .stp-link-control { display: inline-flex; align-items: center; min-height: 44px; padding: 0 0.25rem; color: var(--stp-juniper); }

/* Focus and motion */
.stp-tool a:focus-visible, .stp-tool button:focus-visible, .stp-tool input:focus-visible,
.stp-tool select:focus-visible, .stp-tool textarea:focus-visible { outline: 3px solid var(--stp-rust); outline-offset: 2px; }
/* Chrome moves focus into the parts of a date field, so :focus-visible does not
   match the input itself; show the ring whenever a date field has focus. */
.stp-tool input[type="date"]:focus { outline: 3px solid var(--stp-rust); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { .stp-tool * { transition: none !important; animation: none !important; } }
@media (forced-colors: active) { .stp-progress li[aria-current="step"] { border: 4px double CanvasText; } }

/* Tables (comparisons, budgets) */
.stp-table-wrap { overflow-x: auto; }
.stp-table { border-collapse: collapse; width: 100%; }
.stp-table th, .stp-table td { border-bottom: 1px solid var(--stp-line); padding: 0.5rem; text-align: left; vertical-align: top; }

/* Visually hidden text for screen readers */
.stp-visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Tools index (/tools/) and shared breadcrumb */
.stp-crumbs { list-style: none; display: flex; flex-wrap: wrap; gap: 0.5rem; padding: 0; margin: 0 0 1rem; }
.stp-crumbs li { display: inline-flex; align-items: center; min-height: 44px; }
.stp-crumbs li + li::before { content: "/"; margin-right: 0.5rem; color: var(--stp-muted); }
.stp-crumbs a { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; min-width: 44px; color: var(--stp-juniper); }
.stp-tool-intro { margin: 0 0 1.5rem; max-width: 42rem; }
.stp-tool-list { list-style: none; padding: 0; margin: 0 0 var(--stp-gap); display: grid; gap: var(--stp-gap); grid-template-columns: repeat(auto-fill, minmax(min(100%, 18rem), 1fr)); }
.stp-tool-list .stp-panel { margin: 0; }
.stp-tool-list h2 { font-size: 1.15rem; margin: 0 0 0.5rem; }
.stp-tool-list h2 a { display: inline-flex; align-items: center; min-height: 44px; }
.stp-tool-list p { margin: 0; }
.stp-tool nav[aria-label="Breadcrumb"] ol > li { display: inline-flex; align-items: center; min-height: 44px; }
.stp-tool nav[aria-label="Breadcrumb"] a { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; min-width: 44px; }
