:root {
  color-scheme: light;

  /* A printed sibling of the lab page: same type and hairlines, on paper. */
  --ground: #eeebe3;
  --ink: #161514;
  --ink-2: #4f4c47;
  --ink-3: #6b675f; /* 4.6:1 on ground, the floor for small text */
  --rule: rgba(22, 21, 20, 0.14);
  --line: rgba(22, 21, 20, 0.45);
  --wash: rgba(22, 21, 20, 0.05);
  --error: #8c2f22;

  --sans: "Mona Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --gutter: clamp(20px, 4vw, 56px);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
}

html { scroll-padding-top: 24px; }

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

body {
  font-family: var(--sans);
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection { background: var(--ink); color: var(--ground); }

a { color: inherit; }

/* ---- Bar and figure -------------------------------------------------- */

.bar {
  display: flex;
  align-items: baseline;
  gap: 14px;
  padding: 26px var(--gutter);
  font-size: 14px;
  line-height: 1;
}

.mark {
  font-weight: 600;
  letter-spacing: -0.01em;
  text-decoration: none;
}

.crumb { color: var(--ink-3); }
.crumb::before { content: "/"; margin-right: 14px; }

/* A still of the lab page's operating theatre, pixelated and printed light. */
.figure {
  height: clamp(160px, 22vh, 240px);
  margin: 0 var(--gutter);
  background: url(media/still-strip-light.png) center / cover no-repeat;
  image-rendering: pixelated;
}

/* ---- Document: title column and the card ----------------------------- */

.doc {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: 48px;
  padding: 48px var(--gutter) 0;
}

.side {
  position: sticky;
  top: 32px;
  align-self: start;
}

h1 {
  margin: 0;
  font-weight: 340;
  font-size: clamp(2.6rem, 1.5rem + 3.2vw, 4.6rem);
  line-height: 1.02;
  letter-spacing: -0.035em;
}

/* The introduction: a one-line definition, then how the system works. */
.overview {
  margin: 24px 0 0;
  max-width: 34rem;
  font-size: 19px;
  line-height: 1.45;
  letter-spacing: -0.005em;
  color: var(--ink);
  text-wrap: balance;
}

.overview-more {
  margin: 16px 0 0;
  max-width: 34rem;
  font-size: 15px;
  line-height: 1.65;
  color: var(--ink-2);
  text-wrap: pretty;
}

.side .button { margin-top: 32px; }

/* ---- Record: one AI-generated encounter, set out like a clinical printout -- */

.record {
  margin: 0 0 48px;
  border: 1px solid var(--line);
  background: #f8f7f3;
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--ink);
}

/* Patient banner: who, and the identifiers every screen of the record carries. */
.rec-banner {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 12px 32px;
  padding: 18px 22px 16px;
  border-bottom: 1px solid var(--line);
}

.rec-who { display: grid; gap: 2px; }

.rec-name {
  font-size: 18px;
  font-weight: 500;
  letter-spacing: -0.01em;
}

.rec-demo { color: var(--ink-2); }

.rec-ids {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 24px;
  margin: 0;
}

.rec-ids div { display: grid; gap: 1px; }
.rec-ids dt { font-size: 12px; font-weight: 400; line-height: 1.4; color: var(--ink-3); }
.rec-ids dd { margin: 0; max-width: none; font-size: 13.5px; color: var(--ink); }

.rec-encounter {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 20px;
  padding: 10px 22px;
  border-bottom: 1px solid var(--rule);
  background: rgba(22, 21, 20, 0.025);
  color: var(--ink-2);
}

.rec-section { padding: 14px 22px 4px; }
.rec-section + .rec-section { border-top: 1px solid var(--rule); }

.rec-section h3 {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin: 0 0 6px;
  font-size: 13.5px;
  font-weight: 600;
}

/* Who recorded the section, and when. */
.rec-section h3 span {
  font-weight: 400;
  color: var(--ink-3);
}

.rec-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 8px;
}

.rec-table th {
  padding: 4px 12px 4px 0;
  border-bottom: 1px solid var(--rule);
  font-size: 12px;
  font-weight: 400;
  text-align: left;
  color: var(--ink-3);
}

.rec-table td {
  padding: 6px 12px 6px 0;
  border-bottom: 1px solid rgba(22, 21, 20, 0.07);
  vertical-align: top;
}

.rec-table tr:last-child td { border-bottom: 0; }
.rec-table td:last-child,
.rec-table th:last-child { padding-right: 0; }
.rec-table td:first-child { width: 34%; }
.rec-table td.code { width: 4.5rem; font-weight: 500; }

.rec-table small {
  display: block;
  font-size: 12px;
  color: var(--ink-3);
}

/* An out-of-range value, as clinical systems mark it. */
.flag {
  margin-left: 6px;
  font-style: normal;
  font-size: 12px;
  font-weight: 600;
  color: var(--error);
}

.rec-notes { margin: 0 0 10px; }

.rec-notes div {
  display: grid;
  grid-template-columns: 6.5rem minmax(0, 1fr);
  gap: 12px;
  padding: 4px 0;
}

.rec-notes dt { font-size: 12px; font-weight: 400; line-height: 1.6; color: var(--ink-3); }
.rec-notes dd { margin: 0; max-width: none; font-size: 13.5px; color: var(--ink); }

.rec-foot {
  padding: 12px 22px 14px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  color: var(--ink-2);
}

.rec-foot p { margin: 0; }
.rec-disclaimer { margin-top: 6px !important; color: var(--ink-3); }

.card { margin: 0; }

.row {
  display: grid;
  grid-template-columns: 11rem minmax(0, 1fr);
  gap: 8px 32px;
  padding: 20px 0 22px;
  border-top: 1px solid var(--rule);
}

.row:last-child { border-bottom: 1px solid var(--rule); }

dt {
  font-size: 14px;
  font-weight: 500;
  line-height: 1.6;
}

dd {
  margin: 0;
  max-width: 40rem;
  font-size: 15px;
  line-height: 1.6;
  color: var(--ink-2);
}

dd p { margin: 0; }

/* Scope, architecture and standards, set as compact two- or three-column tables. */
.spec-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  line-height: 1.55;
}

.spec-table th,
.spec-table td {
  padding: 7px 16px 7px 0;
  border-bottom: 1px solid rgba(22, 21, 20, 0.08);
  text-align: left;
  vertical-align: top;
}

.spec-table tr:last-child th,
.spec-table tr:last-child td { border-bottom: 0; }
.spec-table td:last-child { padding-right: 0; }
.spec-table tbody tr:first-child th,
.spec-table tbody tr:first-child td { padding-top: 0; }
.spec-table thead + tbody tr:first-child th,
.spec-table thead + tbody tr:first-child td { padding-top: 7px; }

.spec-table thead th {
  padding-top: 0;
  border-bottom: 1px solid var(--rule);
  font-size: 12px;
  font-weight: 400;
  color: var(--ink-3);
}

.spec-table tbody th {
  width: 34%;
  font-weight: 500;
  color: var(--ink);
}

.spec-table td { color: var(--ink-2); }

/* Keeps a word or code whole, so no line ends on "pre-" or splits an ID. */
.nowrap { white-space: nowrap; }

.button {
  display: inline-block;
  padding: 12px 18px;
  border: 1px solid var(--line);
  background: none;
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  line-height: 1;
  color: var(--ink);
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.3s ease, border-color 0.3s ease;
}

.button:hover { background: var(--wash); border-color: var(--ink-2); }
.button:focus-visible { outline: 1px solid var(--ink-2); outline-offset: 3px; }
.button:disabled { cursor: progress; opacity: 0.6; }

/* ---- Access form ----------------------------------------------------- */

.form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px 20px;
  margin-top: 20px;
}

.field {
  display: grid;
  gap: 6px;
  font-size: 13px;
  color: var(--ink-2);
}

.field em { font-style: normal; color: var(--ink-3); }
.wide { grid-column: 1 / -1; }

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  font: inherit;
  font-size: 15px;
  color: var(--ink);
}

.field textarea { resize: vertical; line-height: 1.5; }

.field input:focus-visible,
.field select:focus-visible,
.field textarea:focus-visible {
  outline: 1px solid var(--ink);
  outline-offset: -1px;
}

.field [aria-invalid="true"] { border-color: var(--error); }

/* Off-screen, not display:none, so bots still find it. */
.trap {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.form-end {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px 20px;
  margin-top: 4px;
}

.form-status {
  margin: 0;
  font-size: 13px;
  color: var(--ink-2);
}

.form-status.error { color: var(--error); }

.form-note {
  margin: 0;
  font-size: 13px;
  color: var(--ink-3);
}

/* Shown in place of the form once a request is saved. */
.done {
  margin-top: 20px;
  padding: 18px 20px;
  border: 1px solid var(--line);
  color: var(--ink);
}

.done p + p { margin-top: 8px; color: var(--ink-2); }
.done .button { margin-top: 16px; }

/* ---- Foot ------------------------------------------------------------ */

/* The name across the full width, set like the lab page's sign-off. "Shushrut
   EHR" at this weight and tracking is about 5.97 times as wide as its font size;
   dividing by 6.15 leaves room for a scrollbar, so it never runs past the gutter. */
.signoff {
  padding: clamp(64px, 12vh, 140px) var(--gutter) 0;
  font-size: calc((100vw - 2 * var(--gutter)) / 6.15);
  font-weight: 340;
  line-height: 0.8;
  letter-spacing: -0.05em;
  white-space: nowrap;
  color: var(--ink);
}

.foot {
  display: flex;
  justify-content: flex-end;
  gap: 16px;
  padding: 28px var(--gutter) var(--gutter);
  font-size: 13px;
  color: var(--ink-3);
}

.foot a {
  color: var(--ink-2);
  text-decoration: none;
}

@media (max-width: 960px) {
  .doc { grid-template-columns: 1fr; }
  .side { position: static; }
}

@media (max-width: 760px) {
  .row { grid-template-columns: 1fr; }
  .form { grid-template-columns: 1fr; }
  .rec-banner, .rec-encounter, .rec-section, .rec-foot { padding-left: 14px; padding-right: 14px; }
  .rec-notes div { grid-template-columns: 1fr; gap: 0; }
  .rec-table td:first-child { width: auto; }
  .spec-table tbody th { width: 40%; }
}

@media (prefers-reduced-motion: reduce) {
  .button { transition: none; }
}
