/*
 * Iderwell frontend foundation
 * Copy with assets/fonts/ and adapt asset paths to the target build.
 * This file defines the shared visual contract, not route-specific layout.
 */

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("/assets/fonts/inter-latin-ext-400-700.woff2") format("woff2");
  unicode-range: U+0100-02FF, U+0304, U+0308, U+0329, U+1E00-1E9F,
    U+1EF2-1EFF, U+20A0-20C0, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("/assets/fonts/inter-latin-400-700.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC,
    U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215,
    U+FEFF, U+FFFD;
}

:root {
  color-scheme: light;
  --brand-navy-950: #05243f;
  --brand-navy-700: #003b7a;
  --brand-blue-600: #0078d4;
  --brand-sky-400: #50a8e8;
  --brand-sky-200: #a8d5ff;

  --ink-950: #10212f;
  --ink-800: #263b4a;
  --ink-650: #4b6272;
  --ink-500: #6b7f8d;
  --line-300: #c9d5de;
  --line-200: #dce4ea;
  --line-100: #eaf0f4;
  --canvas: #f4f7fa;
  --surface: #ffffff;
  --surface-subtle: #f8fafc;

  --success: #17633a;
  --success-bg: #eaf7ef;
  --success-line: #a8d8b9;
  --warning: #7a4c00;
  --warning-bg: #fff7e2;
  --warning-line: #e8c778;
  --danger: #a32a2a;
  --danger-bg: #fff0f0;
  --danger-line: #e7aaaa;
  --info: #075a96;
  --info-bg: #edf7ff;
  --info-line: #a9d4f2;

  --font-sans: "Inter", ui-sans-serif, system-ui, -apple-system,
    BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;
  --space-16: 64px;

  --radius-control: 6px;
  --radius-panel: 8px;
  --radius-overlay: 12px;
  --radius-large: 16px;
  --shadow-popover: 0 12px 32px rgb(16 33 47 / 16%),
    0 2px 8px rgb(16 33 47 / 8%);
  --shadow-modal: 0 24px 64px rgb(16 33 47 / 20%),
    0 4px 14px rgb(16 33 47 / 10%);

  --page-focused: 900px;
  --page-standard: 1180px;
  --page-dashboard: 1480px;
  --page-data-wide: 1600px;
  --page-public: 1200px;
}

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

html {
  font-family: var(--font-sans);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink-950);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.4667;
}

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

img,
svg {
  display: block;
  max-width: 100%;
}

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

:is(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: 3px solid var(--brand-blue-600);
  outline-offset: 3px;
}

.skip-link {
  position: fixed;
  z-index: 1000;
  top: 8px;
  left: 8px;
  translate: 0 -160%;
  padding: 10px 14px;
  border-radius: var(--radius-control);
  background: var(--brand-navy-700);
  color: #fff;
}

.skip-link:focus {
  translate: 0;
}

.page {
  width: min(100%, var(--page-standard));
  margin-inline: auto;
  padding: 32px 36px 48px;
}

.page--focused { max-width: var(--page-focused); }
.page--standard { max-width: var(--page-standard); }
.page--dashboard { max-width: var(--page-dashboard); }
.page--data-wide { max-width: var(--page-data-wide); }
.page--public { max-width: var(--page-public); }
.page--immersive { max-width: none; }

.route-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-6);
  margin-bottom: var(--space-8);
}

.route-heading h1 {
  margin: 0;
  font-size: clamp(28px, 2.5vw, 32px);
  font-weight: 700;
  line-height: 1.1875;
  letter-spacing: -0.025em;
}

.route-heading p {
  max-width: 68ch;
  margin: 8px 0 0;
  color: var(--ink-650);
}

.section + .section {
  margin-top: var(--space-10);
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: var(--space-4);
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--line-200);
}

.section-heading h2 {
  margin: 0;
  font-size: 24px;
  line-height: 1.25;
}

.panel,
.data-surface,
.callout {
  border: 1px solid var(--line-200);
  border-radius: var(--radius-panel);
  background: var(--surface);
}

.panel {
  padding: var(--space-6);
}

.button {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: var(--radius-control);
  background: transparent;
  color: inherit;
  font-size: 14px;
  font-weight: 600;
  line-height: 20px;
  text-decoration: none;
  cursor: pointer;
}

.button--primary {
  border-color: var(--brand-blue-600);
  background: var(--brand-blue-600);
  color: #fff;
}

.button--primary:hover {
  border-color: var(--brand-navy-700);
  background: var(--brand-navy-700);
}

.button--secondary {
  border-color: var(--line-300);
  background: var(--surface);
  color: var(--ink-800);
}

.button--quiet:hover {
  background: var(--info-bg);
  color: var(--brand-navy-700);
}

.button--danger {
  border-color: var(--danger-line);
  background: var(--danger-bg);
  color: var(--danger);
}

.button:disabled,
.button[aria-disabled="true"] {
  cursor: not-allowed;
  opacity: 0.52;
}

.field {
  display: grid;
  max-width: 64ch;
  gap: 6px;
}

.field > label,
.field-label {
  color: var(--ink-800);
  font-size: 13px;
  font-weight: 600;
  line-height: 18px;
}

.field :is(input:not([type="checkbox"]):not([type="radio"]), select, textarea) {
  width: 100%;
  min-height: 44px;
  padding: 11px 14px;
  border: 1px solid var(--line-300);
  border-radius: var(--radius-control);
  background: var(--surface);
  color: var(--ink-950);
  font-size: 14px;
  line-height: 20px;
}

.field textarea {
  min-height: 104px;
  resize: vertical;
}

.field :is(input, select, textarea):focus {
  border-color: var(--brand-blue-600);
  box-shadow: 0 0 0 3px rgb(0 120 212 / 14%);
}

.field-help,
.field-error {
  margin: 0;
  color: var(--ink-650);
  font-size: 12px;
  line-height: 16px;
}

.field-error {
  color: var(--danger);
}

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

.status-chip {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  border: 1px solid var(--line-300);
  border-radius: 999px; /* iderwell-audit-allow-pill: true compact status */
  background: var(--surface-subtle);
  color: var(--ink-650);
  font-size: 12px;
  font-weight: 600;
  line-height: 16px;
}

.callout {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: var(--space-3);
  padding: var(--space-4);
}

.callout--info {
  border-color: var(--info-line);
  background: var(--info-bg);
  color: var(--info);
}

.callout--warning {
  border-color: var(--warning-line);
  background: var(--warning-bg);
  color: var(--warning);
}

.callout--danger {
  border-color: var(--danger-line);
  background: var(--danger-bg);
  color: var(--danger);
}

.data-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-4);
  border-bottom: 1px solid var(--line-200);
}

.table-scroll {
  overflow-x: auto;
  scrollbar-gutter: stable;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  min-height: 48px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--line-100);
  text-align: left;
  vertical-align: middle;
}

th {
  color: var(--ink-650);
  font-size: 12px;
  font-weight: 650;
  line-height: 18px;
}

td {
  font-size: 14px;
  line-height: 20px;
}

.numeric {
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.state-region {
  display: grid;
  min-height: 240px;
  place-items: center;
  padding: var(--space-8);
  text-align: center;
}

.state-region > div {
  max-width: 52ch;
}

.state-region h2 {
  margin: 0 0 8px;
  font-size: 18px;
  line-height: 24px;
}

.state-region p {
  margin: 0;
  color: var(--ink-650);
}

.modal-backdrop {
  position: fixed;
  z-index: 900;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgb(5 36 63 / 58%);
}

.modal {
  display: grid;
  width: min(640px, calc(100vw - 48px));
  max-height: calc(100dvh - 48px);
  grid-template-rows: auto minmax(0, 1fr) auto;
  border: 1px solid var(--line-200);
  border-radius: var(--radius-overlay);
  background: var(--surface);
  box-shadow: var(--shadow-modal);
}

.modal__header,
.modal__footer {
  padding: 20px 24px;
}

.modal__header {
  border-bottom: 1px solid var(--line-200);
}

.modal__body {
  overflow: auto;
  padding: 24px;
}

.modal__footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  border-top: 1px solid var(--line-200);
}

.popover {
  width: min(352px, calc(100vw - 32px));
  border: 1px solid var(--line-200);
  border-radius: var(--radius-overlay);
  background: var(--surface);
  box-shadow: var(--shadow-popover);
}

@media (max-width: 1279px) {
  .page {
    padding-inline: 28px;
  }

  .route-heading {
    flex-wrap: wrap;
  }
}

@media (max-width: 820px) {
  .page {
    padding: 20px 20px 32px;
  }

  .route-heading,
  .section-heading,
  .data-toolbar {
    align-items: stretch;
    flex-direction: column;
  }
}

@media (max-width: 520px) {
  .page {
    padding-inline: 16px;
  }

  .modal-backdrop {
    padding: 12px;
  }

  .modal {
    width: calc(100vw - 24px);
    max-height: calc(100dvh - 24px);
  }

  .modal__footer {
    flex-direction: column-reverse;
  }

  .modal__footer .button {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto;
    transition-duration: 0.01ms;
    animation-duration: 0.01ms;
    animation-iteration-count: 1;
  }
}

@media print {
  body {
    background: #fff;
  }

  .skip-link,
  .button,
  .popover,
  .modal-backdrop {
    display: none;
  }
}
