/* OPEN x CMS public portal: the workspace's dark tokens, laid out like a web
   search engine. Home centers the court's name and the search box; results
   and records move the search box to the top. */
:root {
  --chrome: #151517; --bg: #19191b; --card: #232327; --card-hover: #2b2b31; --border: #34343a; --field: #202024;
  --text: #ececf1; --muted: #a9a9b4; --accent: #6aa8ff; --accent-text: #0d1b2e; --focus: #9ec5ff; --danger: #ff9aa3;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; display: flex; flex-direction: column; background: var(--bg); color: var(--text); font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--accent); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
[tabindex="-1"]:focus { outline: none; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
[hidden] { display: none !important; }

/* ------------------------------------------------------------ head */
.portal-head { display: flex; align-items: flex-start; gap: 28px; padding: 18px 28px 14px; background: var(--chrome); border-bottom: 1px solid var(--border); }
.portal-name { display: flex; flex-direction: column; color: var(--text); text-decoration: none; line-height: 1.2; padding-top: 6px; min-width: 190px; }
.portal-name .state { font-weight: 700; font-size: 18px; }
.portal-name .title { color: var(--muted); font-size: 13px; }
.portal-name:hover .state { color: var(--accent); }

.search { flex: 1; max-width: 720px; }
.search-row { display: flex; gap: 10px; }
.combo { position: relative; flex: 1; }
.combo input { width: 100%; height: 44px; padding: 0 20px; border-radius: 22px; border: 1px solid var(--border); background: var(--field); color: var(--text); font: inherit; }
.combo input:hover { border-color: #4a4a54; }
.combo input:focus { outline: none; border-color: var(--focus); box-shadow: 0 0 0 1px var(--focus); }
.combo input::placeholder { color: #8d8d99; }
.advanced-link { display: inline-block; margin: 8px 0 0 20px; font-size: 14px; }

.btn { display: inline-flex; align-items: center; justify-content: center; height: 44px; padding: 0 22px; border-radius: 22px; border: 1px solid var(--border); background: var(--card); color: var(--text); font: inherit; cursor: pointer; }
.btn:hover { background: var(--card-hover); }
.btn.primary { background: var(--accent); color: var(--accent-text); border-color: var(--accent); font-weight: 600; }
.btn.primary:hover { background: #86b9ff; }

/* Suggestions, below the box. */
.suggest { position: absolute; z-index: 10; left: 0; right: 0; top: 48px; margin: 0; padding: 6px 0; list-style: none; background: var(--card); border: 1px solid var(--border); border-radius: 14px; box-shadow: 0 8px 24px rgba(0, 0, 0, .5); }
.suggestion { display: flex; align-items: flex-start; gap: 12px; padding: 8px 18px; cursor: pointer; }
.suggestion[aria-selected="true"] { background: #30303a; }
.s-text { display: flex; flex-direction: column; min-width: 0; }
.s-title { font-weight: 600; }
.s-sub { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kind { flex: none; display: inline-block; min-width: 72px; margin-top: 2px; padding: 1px 8px; border-radius: 10px; font-size: 12px; text-align: center; color: var(--text); background: #33333b; }
.kind-case { background: #22344f; }
.kind-party { background: #2c3d2c; }
.kind-hearing { background: #45361f; }
.kind-po { background: #462631; }

/* Home: the name and the box in the middle of the page. */
body.home .portal-head { flex: 1; flex-direction: column; align-items: center; justify-content: center; gap: 28px; padding: 0 20px 12vh; background: none; border: 0; }
body.home .portal-name { align-items: center; text-align: center; padding: 0; }
body.home .portal-name .state { font-size: 48px; letter-spacing: -.5px; }
body.home .portal-name .title { font-size: 22px; margin-top: 6px; }
body.home .search { flex: none; width: 100%; max-width: 640px; }
body.home .combo input { height: 50px; border-radius: 25px; font-size: 16px; }
body.home .btn { height: 50px; border-radius: 25px; }
body.home .suggest { top: 54px; }
body.home main { display: none; }
body:not(.home):not(.top) .portal-head { visibility: hidden; } /* until the page knows its layout */

/* ------------------------------------------------------- results */
main { flex: 1; max-width: 1080px; padding: 20px 28px 48px; margin-left: 218px; }
main h1 { font-size: 26px; margin: 4px 0 8px; line-height: 1.25; }
main h2 { font-size: 18px; margin: 28px 0 10px; }
.count { margin: 0 0 16px; }
.result-list { list-style: none; margin: 0; padding: 0; }
.result { display: grid; grid-template-columns: auto 1fr; column-gap: 12px; padding: 12px 0; border-bottom: 1px solid #26262b; }
.result .kind { grid-row: span 2; align-self: start; }
.r-title { font-size: 18px; text-decoration: none; }
.r-title:hover { text-decoration: underline; }
.r-sub { margin: 2px 0 0; color: var(--muted); font-size: 14px; }
.notice { background: #232a36; border: 1px solid #36445a; border-radius: 8px; padding: 10px 14px; }

/* -------------------------------------------------------- record */
.record-head .kind { margin-bottom: 6px; }
.record-head p { margin: 0 0 12px; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 24px; margin: 16px 0 0; padding: 16px 18px; background: var(--card); border: 1px solid var(--border); border-radius: 10px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; color: var(--muted); font-weight: 600; padding: 8px 12px 8px 0; border-bottom: 1px solid var(--border); white-space: nowrap; }
.nowrap { white-space: nowrap; }
td { padding: 8px 12px 8px 0; border-bottom: 1px solid #26262b; vertical-align: top; }

/* ------------------------------------------------------ advanced */
.advanced { flex: 1; display: flex; flex-wrap: wrap; align-items: flex-end; gap: 6px 10px; }
.page-advanced .portal-head { padding: 8px 28px 10px; align-items: flex-end; }
.page-advanced .portal-name { padding: 0 0 4px; }
.advanced .field { display: flex; flex-direction: column; gap: 2px; }
.advanced .field.grow { flex: 1; min-width: 140px; }
.advanced label { font-size: 12px; color: var(--muted); }
.advanced input, .advanced select { height: 36px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--border); background: var(--field); color: var(--text); font: inherit; }
.advanced input:focus, .advanced select:focus { outline: none; border-color: var(--focus); box-shadow: 0 0 0 1px var(--focus); }
.advanced .btn { height: 36px; border-radius: 8px; }
.form-error { flex-basis: 100%; margin: 0; color: var(--danger); }
.page-advanced main { margin-left: 218px; }

/* -------------------------------------------------------- footer */
.portal-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding: 12px 28px; border-top: 1px solid var(--border); background: var(--chrome); color: var(--muted); font-size: 12px; }
.foot-brand { display: inline-flex; align-items: center; gap: 5px; color: var(--text); font-weight: 600; text-decoration: none; }
.foot-brand svg { width: 16px; height: 16px; }
.foot-note { margin-left: auto; }

@media (max-width: 820px) {
  .portal-head { flex-direction: column; gap: 12px; padding: 14px 16px; }
  main, .page-advanced main { margin-left: 0; padding: 16px; }
  body.home .portal-name .state { font-size: 36px; }
  .foot-note { margin-left: 0; }
}
