/* Enuclea Secure Intake: shared tokens, fonts, banner and controls.
   Used by the client page (/) and the admin console (/admin/). */

/* ---------- fonts (self-hosted, OFL: see /assets/fonts/OFL-*.txt) ---------- */

@font-face {
  font-family: "Plex Sans";
  src: url("../fonts/ibm-plex-sans-var-latin.woff2") format("woff2");
  font-weight: 100 700;
  font-stretch: 75% 100%;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Plex Mono";
  src: url("../fonts/ibm-plex-mono-400-latin.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Plex Mono";
  src: url("../fonts/ibm-plex-mono-500-latin.woff2") format("woff2");
  font-weight: 500 700;
  font-style: normal;
  font-display: swap;
}

/* ---------- tokens ---------- */

:root {
  --navy-950: #060a13;
  --navy-900: #080d18;
  --navy-800: #0e1626;

  --blue: #0277bd;
  --blue-press: #01579b;
  --blue-deep: #014a84;
  --blue-sky: #8ccff5;
  --blue-50: #eef6fb;
  --blue-100: #d6e9f5;

  --silver-50: #f7f8fa;
  --silver-100: #eff1f4;
  --silver-200: #e6e9ee;
  --silver-300: #c0c7d1;
  --silver-500: #8a94a3;

  --ink: #111111;
  --ink-2: #555555;
  --ink-3: #5e6878; /* labels on white, 5.6:1 */
  --placeholder: #6b7584; /* 4.7:1 */

  --ok: #1e6b3e;
  --ok-bg: #e9f5ee;
  --ok-line: #b9dfc8;
  --ok-dot: #2e9d5b;
  --warn: #7a4a00;
  --warn-bg: #fff5e3;
  --warn-line: #efd29b;
  --warn-dot: #e09b2d;
  --err: #b3261e;
  --err-ink: #8c1d17;
  --err-bg: #fcecea;
  --err-line: #f0c4c0;

  --font-sans: "Plex Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --font-mono: "Plex Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --radius: 4px;
  --radius-lg: 6px;
  --gutter: clamp(16px, 4vw, 40px);
  --ease-out: cubic-bezier(0.2, 0.7, 0.2, 1);
  --shadow-panel: 0 1px 2px rgba(6, 10, 19, 0.05), 0 18px 40px -22px rgba(6, 10, 19, 0.38), 0 40px 80px -48px rgba(2, 87, 155, 0.28);

  --banner-h: 340px;
  color-scheme: light;
}

/* ---------- reset ---------- */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  background: #ffffff;
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

h1,
h2,
h3,
p,
ul,
ol,
dl,
dd,
figure {
  margin: 0;
}

ul[class],
ol[class] {
  padding: 0;
  list-style: none;
}

img,
svg,
canvas {
  display: block;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

[hidden] {
  display: none !important;
}

a {
  color: var(--blue-press);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

a:hover {
  color: var(--blue-deep);
  text-decoration-thickness: 2px;
}

:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 3px;
}

/* Headings and regions that only receive focus programmatically (to move screen readers along). */
[tabindex="-1"]:focus {
  outline: none;
}

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

.vh {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.wrap {
  width: 100%;
  max-width: 1200px;
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.skip-link {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 10;
  padding: 10px 14px;
  background: #ffffff;
  color: var(--blue-press);
  border-radius: var(--radius);
  font-weight: 600;
  transform: translateY(-160%);
  transition: transform 0.2s var(--ease-out);
}

.skip-link:focus {
  transform: none;
}

/* ---------- banner ---------- */

.banner {
  position: relative;
  height: var(--banner-h);
  color: #ffffff;
  isolation: isolate;
  overflow: hidden;
  /* navy, then an eased fade through blue-silver into pure white */
  background: linear-gradient(
    180deg,
    var(--navy-950) 0%,
    var(--navy-900) 44%,
    #0c1526 51%,
    #16233a 57%,
    #2a3b57 63%,
    #4a5e7c 69%,
    #788ba5 75%,
    #a6b4c7 81%,
    #ccd5e1 87%,
    #e9edf2 92.5%,
    #f8f9fb 96.5%,
    #ffffff 100%
  );
}

/* faint substrate grid behind the field */
.banner::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background-image: radial-gradient(rgba(192, 199, 209, 0.14) 1px, transparent 1.3px);
  background-size: 22px 22px;
  background-position: 11px 6px;
  -webkit-mask-image: linear-gradient(180deg, #000 0%, rgba(0, 0, 0, 0.7) 30%, transparent 62%);
  mask-image: linear-gradient(180deg, #000 0%, rgba(0, 0, 0, 0.7) 30%, transparent 62%);
}

.banner__field {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  -webkit-mask-image: linear-gradient(180deg, #000 0%, #000 46%, rgba(0, 0, 0, 0.55) 66%, rgba(0, 0, 0, 0.15) 82%, transparent 94%);
  mask-image: linear-gradient(180deg, #000 0%, #000 46%, rgba(0, 0, 0, 0.55) 66%, rgba(0, 0, 0, 0.15) 82%, transparent 94%);
}

.banner__field.is-fade {
  animation: field-fade 0.7s ease-out both;
}

@keyframes field-fade {
  from {
    opacity: 0.25;
  }
}

.banner__bar {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 20px;
  padding-top: 28px;
}

.banner :focus-visible {
  outline-color: #ffffff;
}

/* logo lockup: ENUCLEA | SECURE INTAKE */
.lockup {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
}

.lockup__logo {
  /* 760x170 artwork, cropped tight (the old 251x66 file had 6px padding) */
  width: 145px;
  height: auto;
  flex: none;
}

.lockup__rule {
  width: 1px;
  height: 24px;
  background: rgba(192, 199, 209, 0.38);
  flex: none;
}

.lockup__product {
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 12px;
  line-height: 1;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: #e6e9ee;
  white-space: nowrap;
}

.lockup__product .sep {
  color: var(--silver-500);
  padding-inline: 0.35em;
}

/* right side of the banner bar: nav links and the status chip, kept together as one group */
.banner__aside {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

/* site navigation in the banner: framed like the chip, so it reads as a control */
.site-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.banner__aside .site-nav {
  margin-left: 0;
}

.site-nav a {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 30px;
  padding: 0 12px;
  border: 1px solid rgba(192, 199, 209, 0.26);
  border-radius: 3px;
  background: rgba(6, 10, 19, 0.6);
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 11.5px;
  line-height: 1;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #e6e9ee;
  text-decoration: none;
  white-space: nowrap;
  transition: color 0.15s, border-color 0.15s, background-color 0.15s;
}

/* a 44px touch target around the 30px frame */
.site-nav a::after {
  content: "";
  position: absolute;
  inset: -8px -4px;
}

.site-nav a:hover {
  color: #ffffff;
  border-color: rgba(192, 199, 209, 0.55);
  background: rgba(14, 22, 38, 0.8);
}

.site-nav a[aria-current] {
  color: #ffffff;
  border-color: rgba(192, 199, 209, 0.5);
}

/* status chip on the banner */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 30px;
  padding: 0 12px 0 10px;
  border: 1px solid rgba(192, 199, 209, 0.26);
  border-radius: 3px;
  background: rgba(6, 10, 19, 0.6);
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 11.5px;
  line-height: 1;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #dde3ea;
  white-space: nowrap;
}

.chip__dot {
  position: relative;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #5bd08a;
  box-shadow: 0 0 0 2px rgba(91, 208, 138, 0.16);
  flex: none;
}

.chip__dot::after {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: 50%;
  border: 1px solid #5bd08a;
  opacity: 0;
  animation: live-ping 2.6s var(--ease-out) infinite;
}

@keyframes live-ping {
  0% {
    transform: scale(1);
    opacity: 0.7;
  }
  70%,
  100% {
    transform: scale(3.2);
    opacity: 0;
  }
}

.chip--warn {
  border-color: rgba(224, 155, 45, 0.55);
  color: #f6dcae;
}

.chip--warn .chip__dot {
  background: var(--warn-dot);
  box-shadow: 0 0 0 2px rgba(224, 155, 45, 0.2);
}

.chip--warn .chip__dot::after {
  border-color: var(--warn-dot);
}

.chip--blue .chip__dot {
  background: #4fb3ef;
  box-shadow: 0 0 0 2px rgba(79, 179, 239, 0.2);
}

.chip--blue .chip__dot::after {
  border-color: #4fb3ef;
}

.chip--muted .chip__dot {
  background: var(--silver-500);
  box-shadow: none;
}

.chip--muted .chip__dot::after,
.chip--error .chip__dot::after {
  display: none;
}

.chip--error {
  border-color: rgba(240, 120, 110, 0.6);
  color: #ffd2cd;
}

.chip--error .chip__dot {
  background: #f0786e;
  box-shadow: none;
}

/* ---------- panels ---------- */

.panel {
  position: relative;
  background: #ffffff;
  border: 1px solid var(--silver-200);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-panel);
}

/* hairline header row with mono read-outs */
.panel__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  min-height: 52px;
  padding: 12px 24px;
  border-bottom: 1px solid var(--silver-200);
}

.readout {
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 12px;
  line-height: 1.3;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.readout strong {
  font-weight: 500;
  color: var(--ink);
}

.readout--blue {
  color: var(--blue-press);
}

.title {
  font-family: var(--font-sans);
  font-weight: 600;
  font-stretch: 85%;
  font-size: clamp(26px, 2.6vw + 14px, 34px);
  line-height: 1.12;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.title:focus {
  outline: none;
}

.lead {
  font-size: 16.5px;
  line-height: 1.55;
  color: var(--ink-2);
  max-width: 46ch;
}

/* ---------- form controls ---------- */

.field {
  display: grid;
  gap: 7px;
  align-content: start;
  min-width: 0;
}

.label {
  font-size: 14.5px;
  font-weight: 500;
  line-height: 1.3;
  color: var(--ink);
}

.label .opt {
  font-weight: 400;
  color: var(--ink-3);
}

.label .req {
  color: var(--err);
  font-weight: 600;
}

.help {
  font-size: 13.5px;
  line-height: 1.45;
  color: var(--ink-3);
}

.input {
  display: block;
  width: 100%;
  min-height: 48px;
  padding: 11px 14px;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.45;
  color: var(--ink);
  background: #ffffff;
  border: 1px solid var(--silver-500);
  border-radius: var(--radius);
  transition: border-color 0.15s, box-shadow 0.15s, background-color 0.15s;
  -webkit-appearance: none;
  appearance: none;
}

.input::placeholder {
  color: var(--placeholder);
  opacity: 1;
}

.input:hover {
  border-color: var(--ink-3);
}

.input:focus,
.input:focus-visible {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(2, 119, 189, 0.2);
}

.input[aria-invalid="true"] {
  border-color: var(--err);
  background: #fffafa;
}

.input[aria-invalid="true"]:focus {
  box-shadow: 0 0 0 3px rgba(179, 38, 30, 0.16);
}

.input:disabled,
.input[readonly] {
  background: var(--silver-50);
  color: var(--ink-2);
}

textarea.input {
  min-height: 92px;
  resize: vertical;
}

select.input {
  padding-right: 40px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%235E6878' stroke-width='1.6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  cursor: pointer;
}

.mono {
  font-family: var(--font-mono);
}

.field-error {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  font-size: 13.5px;
  line-height: 1.4;
  color: var(--err);
  font-weight: 500;
}

.field-error:empty {
  display: none;
}

.field-error::before {
  content: "";
  flex: none;
  width: 14px;
  height: 14px;
  margin-top: 2px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 14 14'%3E%3Ccircle cx='7' cy='7' r='6.25' fill='none' stroke='%23B3261E' stroke-width='1.5'/%3E%3Cpath d='M7 3.6v4.2' stroke='%23B3261E' stroke-width='1.6'/%3E%3Ccircle cx='7' cy='10.1' r='.95' fill='%23B3261E'/%3E%3C/svg%3E") no-repeat;
}

/* ---------- buttons ---------- */

.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 48px;
  padding: 0 22px;
  font-family: var(--font-sans);
  font-size: 15.5px;
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: 0.01em;
  text-decoration: none;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: none;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.15s, transform 0.08s;
  -webkit-tap-highlight-color: transparent;
}

.btn svg {
  flex: none;
}

.btn:active:not(:disabled) {
  transform: translateY(1px);
}

.btn:disabled {
  cursor: not-allowed;
}

.btn--primary {
  color: #ffffff;
  background: var(--blue);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14), 0 1px 2px rgba(1, 74, 132, 0.25);
}

.btn--primary:hover:not(:disabled) {
  background: var(--blue-press);
}

.btn--primary:active:not(:disabled) {
  background: var(--blue-deep);
}

.btn--primary:disabled {
  color: var(--ink-3);
  background: var(--silver-100);
  border-color: var(--silver-200);
  box-shadow: none;
}

.btn--primary.is-busy:disabled {
  color: #ffffff;
  background: var(--blue-press);
  border-color: transparent;
  cursor: progress;
}

.btn--primary .arrow {
  transition: transform 0.2s var(--ease-out);
}

.btn--primary:hover:not(:disabled) .arrow {
  transform: translateX(3px);
}

.btn--secondary {
  color: var(--blue-press);
  background: #ffffff;
  border-color: var(--silver-300);
}

.btn--secondary:hover:not(:disabled) {
  border-color: var(--blue);
  background: var(--blue-50);
}

.btn--secondary:disabled {
  color: var(--ink-3);
  background: var(--silver-50);
}

.btn--quiet {
  min-height: 44px;
  padding: 0 12px;
  color: var(--blue-press);
  font-size: 14.5px;
}

.btn--quiet:hover:not(:disabled) {
  background: var(--blue-50);
}

.btn--danger {
  color: #ffffff;
  background: var(--err);
}

.btn--danger:hover:not(:disabled) {
  background: var(--err-ink);
}

.btn--block {
  width: 100%;
}

.spinner {
  display: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #ffffff;
  animation: spin 0.8s linear infinite;
}

.is-busy .spinner {
  display: block;
}

.is-busy .arrow,
.is-busy .icon-lock {
  display: none;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ---------- notices ---------- */

.notice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--silver-200);
  border-radius: var(--radius);
  background: var(--silver-50);
  font-size: 14.5px;
  line-height: 1.45;
  color: var(--ink);
}

.notice:empty {
  display: none;
}

.notice:focus {
  outline: none;
}

.notice::before {
  content: "";
  flex: none;
  width: 8px;
  height: 8px;
  margin-top: 6px;
  border-radius: 50%;
  background: var(--silver-500);
}

.notice--error {
  border-color: var(--err-line);
  background: var(--err-bg);
  color: var(--err-ink);
}

.notice--error::before {
  background: var(--err);
}

.notice--warn {
  border-color: var(--warn-line);
  background: var(--warn-bg);
  color: var(--warn);
}

.notice--warn::before {
  background: var(--warn-dot);
}

.notice--ok {
  border-color: var(--ok-line);
  background: var(--ok-bg);
  color: var(--ok);
}

.notice--ok::before {
  background: var(--ok-dot);
}

.notice--info {
  border-color: #cfe4f2;
  background: var(--blue-50);
  color: #0b4f7c;
}

.notice--info::before {
  background: var(--blue);
}

/* ---------- footer ---------- */

.foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 24px;
  padding-top: 20px;
  padding-bottom: 28px;
  border-top: 1px solid var(--silver-200);
}

.foot__nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 20px;
}

.foot__nav a,
.foot__tel {
  font-size: 13.5px;
  color: var(--ink-3);
  text-decoration: none;
}

.foot__nav a:hover {
  color: var(--blue-press);
  text-decoration: underline;
}

.foot__tel {
  font-family: var(--font-mono);
  letter-spacing: 0.06em;
}

.foot__tel:hover {
  color: var(--blue-press);
}

/* ---------- entrance ---------- */

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
}

@keyframes appear {
  from {
    opacity: 0;
  }
}

/* ---------- reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-delay: 0s !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }

  .chip__dot::after {
    display: none;
  }

  /* the one allowed effect: a simple fade of the still banner frame on seal() */
  .banner__field.is-fade {
    animation-duration: 0.7s !important;
  }

  /* keep progress spinners legible: slow, not frozen mid-turn */
  .spinner {
    animation-duration: 1.6s !important;
    animation-iteration-count: infinite !important;
  }
}

/* ---------- small screens ---------- */

@media (max-width: 560px) {
  :root {
    --banner-h: 248px;
  }

  .banner__bar {
    padding-top: 18px;
    gap: 10px 12px;
  }

  .lockup {
    gap: 10px;
  }

  .lockup__logo {
    width: 107px;
  }

  .lockup__rule {
    height: 18px;
  }

  .lockup__product {
    font-size: 10px;
    letter-spacing: 0.16em;
  }

  .chip {
    min-height: 28px;
    padding: 0 9px 0 8px;
    gap: 7px;
    font-size: 10.5px;
    letter-spacing: 0.08em;
  }

  .panel__meta {
    padding: 10px 18px;
    min-height: 46px;
  }

  /* on phones the nav and chip move together onto their own row, under the logo */
  .banner__aside {
    flex-basis: 100%;
    justify-content: flex-end;
    gap: 8px;
  }

  .site-nav a {
    min-height: 28px;
    padding: 0 10px;
    font-size: 10.5px;
    letter-spacing: 0.08em;
  }

  .foot {
    flex-direction: column;
    gap: 2px;
  }

  .foot__nav {
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
  }

  .foot__nav a,
  .foot__tel {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
  }
}
