/* Colours and fonts are tokens: change them here, nowhere else. They match the database access portal's
   (cayo_db-access, portal/static/portal.css); DESIGN.md says how to keep the two in step. */
:root {
  --font-display: 'Bricolage Grotesque', system-ui, sans-serif;
  --font-text: 'Figtree', system-ui, sans-serif;
  --font-mono: ui-monospace, 'SF Mono', Menlo, monospace;

  --ground: #EEF3F7; --surface: #FFFFFF; --tint: #F5F8FB;
  --ink: #0B1F3A; --muted: #4A5D72; --line: #D3DEE8; --line-soft: #E3EAF1; --field-line: #7A8DA3;
  --accent: #0067B1; --on-accent: #FFFFFF;
  --top: #1D5FA8; --top-from: #1B5AA0; --top-to: #2164AE; --top-ink: #FFFFFF; --top-muted: #D3E3F5; --top-line: #3473B9; --top-button: #A9C8EA; --top-chip: #174E8B;
  --sky: #5FB4F0; --sun: #F2B705;
  --chart-up: #3F8CC4; --chart-down: #C99A16;   /* charts: sky and sun, a shade deeper */
  --chart-death: #B8553E; --chart-death-edge: #7C3423; --chart-move: #2E9486; --chart-move-edge: #1B5F56;
  --chart-up-edge: #1D5684; --chart-down-edge: #7E600C;   /* each bar's outline, a darker shade of its fill */
  --ok-bg: #DDF0E6; --ok-ink: #14532D; --warn-bg: #FFF2CC; --warn-ink: #5C430C;
  --bad-bg: #FBE0DC; --bad-ink: #A1291B; --chip-bg: #E3EAF1; --chip-ink: #3B4F66;
  --code-bg: #0B1F3A; --code-ink: #E4EBF2;
  --hl-keyword: #C9A7FF; --hl-function: #5FB4F0; --hl-argument: #9FB4C9; --hl-string: #F2C744; --hl-number: #FF9F7A;
  --hl-comment: #8A9BB0;
  --shadow: 0 1px 2px rgba(11, 31, 58, .06), 0 6px 16px rgba(11, 31, 58, .06);
  --radius: 12px;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--ground); color: var(--ink); font: 16px/1.5 var(--font-text); }
a { color: var(--accent); }
a:hover { text-decoration-thickness: 2px; }
h1, h2, h3 { font-family: var(--font-display); }
code, pre { font-family: var(--font-mono); }
[hidden] { display: none !important; }
.wrap { max-width: 1200px; margin: 0 auto; padding: 0 32px; }
@media (max-width: 640px) { .wrap { padding: 0 16px; } }

/* Top bar */
.topbar { background: var(--top) linear-gradient(180deg, var(--top-to), var(--top-from));   /* barely there, on purpose */
          color: var(--top-ink); border-bottom: 1px solid var(--top-line); }
.topbar .wrap, .topbar .left { display: flex; align-items: center; justify-content: space-between; gap: 6px 24px; flex-wrap: wrap; }
.topbar .wrap { padding-top: 4px; padding-bottom: 4px; }
.brand { display: flex; flex-direction: column; gap: 4px; padding: 8px 0; color: var(--top-ink); text-decoration: none; line-height: 1.1; }
.brand-logo { display: block; width: 130px; max-width: 100%; height: auto; }
.brand span { font-size: 13px; color: var(--top-muted); }
.topnav { display: flex; gap: 4px 20px; flex-wrap: wrap; }
.topnav a { padding: 12px 0; color: var(--top-muted); text-decoration: none; font-weight: 600; border-bottom: 3px solid transparent; }
.topnav a[aria-current="page"] { color: var(--top-ink); font-weight: 700; border-bottom-color: var(--sun); }
.badge { display: inline-flex; align-items: center; justify-content: center; min-width: 22px; height: 22px; padding: 0 6px;
         margin-left: 4px; border-radius: 11px; background: var(--sun); color: var(--ink); font-size: 13px; font-weight: 800; }

/* Layout */
main { padding: 24px 0 40px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 10px 24px; flex-wrap: wrap; margin-bottom: 16px; }
.page-head h1 { margin: 0; font-size: 32px; line-height: 1.1; }
.lead { margin: 4px 0 0; color: var(--muted); font-size: 15px; }
.crumbs { margin-bottom: 10px; font-size: 14px; }
.cols { display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-start; }
.cols > .main { flex: 999 1 560px; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.cols > .side { flex: 1 1 300px; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
/* .cols is a container so a sidebar can come first exactly when the two columns stack (560 + 20 + 300 px). */
.cols { container-type: inline-size; }
@container (max-width: 879px) { .cols > .side.first-when-stacked { order: -1; } }
.narrow { max-width: 820px; margin: 0 auto; display: flex; flex-direction: column; gap: 16px; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
        padding: 22px 26px; display: flex; flex-direction: column; gap: 14px; }
.card.small { padding: 16px 20px; gap: 10px; }
.card h2 { margin: 0; font-size: 24px; line-height: 1.15; }
.card p { margin: 0; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 8px 16px; flex-wrap: wrap; }
.label, .card .label { margin: 0; font-family: var(--font-text); font-size: 13px; font-weight: 700; color: var(--muted); }
.muted { color: var(--muted); }
.small-text { font-size: 14px; }
.sep { border-top: 1px solid var(--line); padding-top: 14px; }
.big { font-family: var(--font-display); font-weight: 700; font-size: 30px; line-height: 1.1; word-break: break-word; }
.facts { margin: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(190px, 100%), 1fr)); gap: 12px 24px; }
.facts div, .rows div { display: flex; }
.facts div { flex-direction: column; }
.facts dt { font-size: 13px; color: var(--muted); }
.facts dd, .rows dd { margin: 0; }
.rows { margin: 0; display: flex; flex-direction: column; gap: 6px; font-size: 15px; }
.rows div { justify-content: space-between; gap: 12px; }
.rows dt { color: var(--muted); }
.rows dd { text-align: right; overflow-wrap: anywhere; }
/* A bulleted list inside a card, spaced like the card's other lines */
.list { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; }

/* Chips and notes */
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 99px; font-size: 13px;
        font-weight: 700; white-space: nowrap; align-self: flex-start; }
.chip.ok { background: var(--ok-bg); color: var(--ok-ink); }
.chip.warn { background: var(--warn-bg); color: var(--warn-ink); }
.chip.bad { background: var(--bad-bg); color: var(--bad-ink); }
.chip.neutral { background: var(--chip-bg); color: var(--chip-ink); }
.chip.dashed { border: 1.5px dashed var(--field-line); color: var(--chip-ink); padding: 1px 9px; }
.chip.dark { background: var(--ink); color: #FFFFFF; }
.chip.outline { border: 1px solid var(--ink); padding: 1px 9px; }
/* Long labels wrap inside the card instead of running past it; one line still looks like a pill. */
.chip.wrap { white-space: normal; max-width: 100%; border-radius: 12px; }
.note { display: flex; gap: 10px; align-items: flex-start; padding: 10px 14px; border-radius: 8px; font-size: 15px; }
.note.ok { background: var(--ok-bg); color: var(--ok-ink); }
.note.warn { background: var(--warn-bg); color: var(--warn-ink); }
.note.bad { background: var(--bad-bg); color: var(--bad-ink); }
.note.plain { background: var(--tint); border: 1px solid var(--line); }
.note a { color: inherit; }

/* Forms and buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 20px; border-radius: 8px;
       border: 1px solid var(--accent); background: var(--accent); color: var(--on-accent); font: inherit; font-weight: 700;
       text-decoration: none; cursor: pointer; }
.btn.secondary { background: var(--surface); color: var(--accent); }
.btn.plain { background: var(--surface); color: var(--ink); border-color: var(--field-line); }
.btn.danger { background: var(--surface); color: var(--bad-ink); border-color: var(--bad-ink); }
.btn.wide { width: 100%; min-height: 50px; }
.btn.disabled { opacity: .55; cursor: not-allowed; pointer-events: none; }
.actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.actions .end { margin-left: auto; }
.spread { justify-content: space-between; }
form { margin: 0; }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field > label, .field > legend { padding: 0; font-size: 15px; font-weight: 700; }
input[type=text], input[type=email], input[type=search], select, textarea {
  font: inherit; min-height: 44px; padding: 0 12px; border: 1px solid var(--field-line); border-radius: 8px;
  background: var(--surface); color: var(--ink); }
textarea { padding: 10px 12px; min-height: 110px; resize: vertical; }
.hint { font-size: 13px; color: var(--muted); }
.req { color: var(--bad-ink); font-weight: 700; }   /* the asterisk on required fields */
.formgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr)); gap: 14px 18px; }
.formgrid .full { grid-column: 1 / -1; }
fieldset { margin: 0; padding: 0; border: 0; min-width: 0; }
.choice { display: grid; grid-template-columns: repeat(2, minmax(0, 240px)); gap: 8px; }
.choice label, .check { display: flex; gap: 8px; align-items: center; cursor: pointer; }
.choice label { min-height: 44px; padding: 0 12px; border: 1px solid var(--field-line); border-radius: 8px; font-weight: 700; }
.choice label:has(input:checked) { border: 2px solid var(--accent); }
input[type=radio], input[type=checkbox] { width: 18px; height: 18px; margin: 0; accent-color: var(--accent); }
details > summary { cursor: pointer; font-weight: 700; }

/* Code */
pre, .codeline { margin: 0; padding: 14px 16px; border-radius: 8px; background: var(--code-bg); color: var(--code-ink);
                 font-size: 14px; line-height: 1.6; overflow-x: auto; white-space: pre; }
.codeline { flex: 1 1 420px; padding: 10px 14px; }
.hl-k { color: var(--hl-keyword); }
.hl-f { color: var(--hl-function); }
.hl-a { color: var(--hl-argument); }
.hl-s { color: var(--hl-string); }
.hl-n { color: var(--hl-number); }
.hl-o { color: var(--hl-argument); }
.hl-c { color: var(--hl-comment); font-style: italic; }

/* Tabs, filters, tables */
.tabs { display: flex; gap: 4px 24px; flex-wrap: wrap; padding: 0 20px; border-bottom: 1px solid var(--line); background: var(--tint);
        border-radius: var(--radius) var(--radius) 0 0; }
.tabs a { padding: 12px 2px; margin-bottom: -1px; color: var(--muted); text-decoration: none; font-weight: 600; border-bottom: 3px solid transparent; }
.tabs a[aria-current="page"] { color: var(--ink); font-weight: 700; border-bottom-color: var(--accent); }
.card.flush { padding: 0; gap: 0; overflow: hidden; }
.card.flush > .body { padding: 20px 24px 24px; display: flex; flex-direction: column; gap: 14px; }
.toolbar { padding: 14px 18px; display: flex; justify-content: space-between; align-items: center; gap: 10px 20px; flex-wrap: wrap;
           border-bottom: 1px solid var(--line); }
.filters { display: flex; gap: 6px; flex-wrap: wrap; }
.pill { display: inline-flex; align-items: center; min-height: 36px; padding: 0 12px; border-radius: 99px; border: 1px solid var(--field-line);
        color: var(--ink); text-decoration: none; font-size: 14px; }
.pill[aria-current="page"] { background: var(--ink); border-color: var(--ink); color: #FFFFFF; font-weight: 700; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 15px; }
th { text-align: left; color: var(--muted); font-size: 13px; font-weight: 700; background: var(--tint); padding: 10px 12px; }
td { padding: 12px; border-top: 1px solid var(--line-soft); vertical-align: top; }
td .sub { display: block; font-size: 14px; color: var(--muted); }
.nowrap { white-space: nowrap; }
.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; }

/* Home hero: the photo, a heading and two lines. Its height follows the width (the photo is 3:2), and with the
   photo's vertical position that keeps the macaque whole from phones to wide screens. A little shorter than the
   portal's (280px, 30vw, 640px), by Suhail's choice. */
.hero { position: relative; overflow: hidden; background: #0B1F3A; color: #FFFFFF; }
.hero > img { position: absolute; inset: 0; z-index: 0; width: 100%; height: 100%; object-fit: cover; object-position: 62% 36%; }
/* The shade over the photo: z-index puts it above the img, which comes later in the page. */
.hero::before { content: ""; position: absolute; inset: 0; z-index: 1;   /* the photo is brightest on the left (sky and sea) */
                background: linear-gradient(90deg, rgba(10, 30, 56, .92) 0%, rgba(10, 30, 56, .85) 25%,
                                            rgba(10, 30, 56, .6) 45%, rgba(10, 30, 56, .2) 70%, rgba(10, 30, 56, 0) 100%); }
.hero .wrap { position: relative; z-index: 2; min-height: clamp(260px, 25vw, 540px); padding-top: 32px; padding-bottom: 32px;
              display: flex; flex-direction: column; justify-content: center; }
.hero h1 { margin: 0; font-size: 52px; line-height: 1.02; letter-spacing: -.02em; text-shadow: 0 1px 14px rgba(0, 0, 0, .3); }
.hero .hero-lead { margin: 10px 0 0; max-width: 500px; font-size: 17px; color: #D2DCE6; text-shadow: 0 1px 10px rgba(0, 0, 0, .3); }
@media (max-width: 640px) { .hero h1 { font-size: 40px; } }
.tiles { margin: 16px 0 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; max-width: 420px; }
.tiles div { display: flex; flex-direction: column-reverse; padding: 12px 16px; border-radius: 10px; background: rgba(10, 30, 56, .55);
             border: 1px solid rgba(255, 255, 255, .2); backdrop-filter: blur(6px); }
.tiles dt { font-size: 13px; color: #D2DCE6; }
.tiles dd { margin: 0; font-family: var(--font-display); font-weight: 700; font-size: 26px; line-height: 1.1; font-variant-numeric: tabular-nums; }

/* Openings: one row per posting, the summary on the left and its key facts on the right. The list is a container, so
   the two stack whenever the list itself is narrow (beside the sidebar on a laptop, or on a phone). */
.openings { margin: 0; padding: 0; list-style: none; container-type: inline-size; }
.openings > li { display: grid; grid-template-columns: minmax(0, 1fr) minmax(220px, 270px); gap: 12px 32px; padding: 20px 24px;
                 border-top: 1px solid var(--line-soft); }
.openings > li:first-child { border-top: 0; }
.openings .what { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.openings h3 { margin: 0; font-size: 21px; line-height: 1.2; }
.openings h3 a { color: var(--ink); text-decoration: none; }
.openings h3 a:hover { color: var(--accent); text-decoration: underline; }
.openings .where { margin: 0; font-size: 15px; font-weight: 600; color: var(--muted); }
.openings .summary { margin: 0; font-size: 15px; }
.openings .rows { font-size: 14px; }
.openings li.closed h3 a, .openings li.closed .summary { color: var(--muted); }
@container (max-width: 720px) {
  .openings > li { grid-template-columns: minmax(0, 1fr); }
  .openings .rows { display: flex; flex-flow: row wrap; gap: 4px 24px; }   /* the facts become one line under the summary */
  .openings .rows div { gap: 6px; }
}
@media (max-width: 640px) { .openings > li { padding: 18px 16px; } }
.empty { padding: 20px 24px; color: var(--muted); }

/* Style guide: colour swatches */
.swatches { margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.swatches div { display: flex; flex-direction: column; gap: 2px; font-size: 13px; }
.swatches .sample { display: block; height: 52px; margin-bottom: 6px; border-radius: 8px; border: 1px solid var(--line); }
.swatches dd { margin: 0; font-family: var(--font-mono); font-size: 12px; color: var(--muted); }

footer { border-top: 1px solid var(--line); color: var(--muted); font-size: 14px; }
footer .wrap { display: flex; justify-content: space-between; align-items: center; gap: 8px 24px; flex-wrap: wrap; padding-top: 16px; padding-bottom: 16px; }
footer nav { display: flex; gap: 6px 22px; flex-wrap: wrap; }
footer a.quiet { color: var(--muted); }

@media print {
  @page { margin: 16mm; }
  body { background: #FFFFFF; }
  .topbar, .hero, footer, .no-print { display: none !important; }
  main .wrap { max-width: none; padding: 0; }
  .card { box-shadow: none; }
  .card.small, pre, .openings > li { break-inside: avoid; }
  h1, h2, h3, .label { break-after: avoid; }
  pre { background: #F3F6F9 !important; color: var(--ink) !important; border: 1px solid var(--line); }
  pre span { color: inherit !important; }   /* syntax colours are for screens */
  a { color: inherit; text-decoration: none; }
}
