/* App layout and components. All values from us-tokens.css. */

:root {
  /* Purple is the default theme in us-design-system.md §5;
     generated us-tokens.css only defines pink/green/orange. */
  --theme-light: var(--color-secondary-light-titan-white);
  --theme-primary: var(--color-primary-lavender);
  --theme-medium: var(--color-secondary-medium-royal);
  --theme-dark: var(--color-secondary-dark-east-bay);
}

/* Typeface roles follow the Figma text styles exactly:
   H1-H3 and CTA banners  -> Owners Wide, bold, uppercase
   H4-H6, nav, buttons, card titles -> Owners (regular width), sentence case
   Body, labels, table text -> Public Sans Light; bold is Semibold 600
   No other family, width or weight is used anywhere in the app. */

[data-us-theme="purple"] {
  --theme-light: var(--color-secondary-light-titan-white);
  --theme-primary: var(--color-primary-lavender);
  --theme-medium: var(--color-secondary-medium-royal);
  --theme-dark: var(--color-secondary-dark-east-bay);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--page-page-background);
  color: var(--content-body);
  font-family: var(--typography-font-body);
  font-size: var(--typography-font-size-paragraph-default);
  line-height: var(--typography-line-height-body_default);
  font-weight: var(--typography-font-weight-body_default-weight);
  letter-spacing: normal;
}

h1, h2, h3, h4, h5, h6 {
  color: var(--content-heading);
  overflow-wrap: break-word;
  margin: 0 0 var(--spacing-content-h-content-medium);
  letter-spacing: normal;
}

h1 {
  font-family: var(--typography-font-headings-default-h1-wide);
  font-weight: var(--typography-font-weight-headings-default-h1-weight);
  font-size: var(--typography-font-size-h1-default);
  line-height: var(--typography-line-height-h1-default);
  text-transform: uppercase;
}

h2 {
  font-family: var(--typography-font-headings-default-h2-wide);
  font-weight: var(--typography-font-weight-headings-default-h2-weight);
  font-size: var(--typography-font-size-h2);
  line-height: var(--typography-line-height-h2);
  text-transform: uppercase;
}

h3 {
  font-family: var(--typography-font-headings-default-h3);
  font-weight: var(--typography-font-weight-headings-default-h3-weight);
  font-size: var(--typography-font-size-h3);
  line-height: var(--typography-line-height-h3);
  text-transform: uppercase;
}

h4 {
  font-family: var(--typography-font-headings-default-h4);
  font-weight: var(--typography-font-weight-headings-default-h4-weight);
  font-size: var(--typography-font-size-h4);
  line-height: var(--typography-line-height-h4);
  text-transform: none;
}

h5 {
  font-family: var(--typography-font-headings-default-h5);
  font-weight: var(--typography-font-weight-headings-default-h5-weight);
  font-size: var(--typography-font-size-h5);
  line-height: var(--typography-line-height-h5);
  text-transform: none;
}

h6 {
  font-family: var(--typography-font-headings-default-h6);
  font-weight: var(--typography-font-weight-headings-default-h6-weight);
  font-size: var(--typography-font-size-h6);
  line-height: var(--typography-line-height-h6);
  text-transform: none;
}

strong, b {
  font-weight: var(--typography-font-weight-body_bold-weight);
}

a {
  color: var(--content-link-content);
  font-weight: var(--typography-font-weight-link-weight);
}

.icon {
  font-family: var(--typography-font-icons);
  font-size: var(--typography-font-size-icons-24);
  color: var(--icon-icon-10);
  font-style: normal;
  font-weight: normal;
  line-height: 1;
  display: inline-block;
  vertical-align: middle;
  font-variation-settings:
    "FILL" var(--typography-icon-fill),
    "wght" var(--typography-icon-weight),
    "GRAD" var(--typography-icon-grade),
    "opsz" var(--typography-icon-opsz);
}

.icon.is-filled {
  font-variation-settings:
    "FILL" 1,
    "wght" var(--typography-icon-weight),
    "GRAD" var(--typography-icon-grade),
    "opsz" var(--typography-icon-opsz);
}

.icon-16 { font-size: var(--typography-font-size-icons-16); }
.icon-32 { font-size: var(--typography-font-size-icons-32); }

.site-header {
  display: grid;
  gap: var(--spacing-1-rem);
  padding-block: var(--navigation-margin-top_bottom);
  padding-inline: var(--margins-page-margin);
  border-bottom: 1px solid var(--borders-separator);
  background: var(--theme-light);
}

.site-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--spacing-1-5-rem);
}

.brand {
  font-family: var(--typography-font-navigation);
  font-weight: var(--typography-font-weight-nav-weight);
  font-size: var(--typography-font-size-nav);
  line-height: var(--typography-line-height-nav_labels);
  text-decoration: none;
  color: var(--theme-dark);
  flex-shrink: 0;
  text-transform: none;
}

.brand:hover {
  color: var(--navigation-nav_item-hover);
}

.step-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--spacing-0-75-rem) var(--spacing-1-5-rem);
  flex: 1;
  justify-content: center;
}

.step-nav-item {
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-0-5-rem);
  font-family: var(--typography-font-navigation);
  font-weight: var(--typography-font-weight-nav-weight);
  font-size: var(--typography-font-size-nav);
  line-height: var(--typography-line-height-nav_labels);
  text-decoration: none;
  color: var(--content-placeholder);
  letter-spacing: normal;
  text-transform: none;
  white-space: nowrap;
}

.step-nav-item .icon {
  color: var(--content-placeholder);
}

.step-nav-item.is-done,
.step-nav-item.is-done .icon,
.step-nav-item.is-current,
.step-nav-item.is-current .icon {
  color: var(--theme-dark);
}

a.step-nav-item:hover,
a.step-nav-item:hover .icon {
  color: var(--navigation-nav_item-hover);
}

.step-nav-item.is-disabled {
  cursor: default;
}

.header-meta {
  font-family: var(--typography-font-navigation);
  font-size: var(--typography-font-size-nav);
  line-height: var(--typography-line-height-nav_labels);
  font-weight: var(--typography-font-weight-nav-weight);
  color: var(--content-placeholder);
  flex-shrink: 0;
  text-transform: none;
}

.scan-progress {
  display: grid;
  gap: var(--spacing-0-5-rem);
}

.scan-progress-label {
  margin: 0;
  font-family: var(--typography-font-navigation);
  font-weight: var(--typography-font-weight-nav-weight);
  font-size: var(--typography-font-size-nav);
  line-height: var(--typography-line-height-nav_labels);
  color: var(--content-placeholder);
}

.progress-track,
.bar-track {
  position: relative;
  height: var(--spacing-1-rem);
  background: var(--borders-border-01);
  border-radius: var(--radius-radius-round);
  overflow: hidden;
}

.progress-fill,
.bar-fill {
  height: 100%;
  width: 0;
  background: var(--theme-primary);
  border-radius: var(--radius-radius-round);
}

.bar-track {
  overflow: visible;
}

.container {
  width: 100%;
  max-width: var(--page-content-width);
  margin-inline: auto;
  padding-inline: var(--margins-page-margin);
  padding-block: var(--spacing-content-nav-content-default) var(--margins-row_indent-large-default);
}

.eyebrow {
  font-family: var(--typography-font-navigation);
  font-weight: var(--typography-font-weight-nav-weight);
  font-size: var(--typography-font-size-nav);
  line-height: var(--typography-line-height-nav_labels);
  color: var(--content-placeholder);
  margin: 0 0 var(--spacing-content-h-content-small);
  text-transform: none;
}

.hint {
  font-size: var(--typography-font-size-paragraph-small);
  line-height: var(--typography-line-height-body_small);
  color: var(--content-placeholder);
  margin: 0 0 var(--spacing-content-h-content-large);
  max-width: min(100%, calc(var(--page-content-width) * 0.62));
}

.lede {
  max-width: min(100%, calc(var(--page-content-width) * 0.62));
  color: var(--content-body);
  margin: 0 0 var(--spacing-content-content-button-large);
}

.form-sections {
  display: grid;
  gap: var(--margins-row_indent-small);
}

fieldset {
  border: none;
  margin: 0;
  padding: 0;
}

legend {
  font-family: var(--typography-font-headings-default-h5);
  font-weight: var(--typography-font-weight-headings-default-h5-weight);
  font-size: var(--typography-font-size-h5);
  line-height: var(--typography-line-height-h5);
  color: var(--content-heading);
  padding: 0;
  margin: 0 0 var(--spacing-content-h-content-medium);
  text-transform: none;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--grid-grid-gutter) var(--grid-grid-gutter);
}

.form-grid .span-2 {
  grid-column: 1 / -1;
}

label {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-0-5-rem);
  font-family: var(--typography-font-body);
  font-weight: var(--typography-font-weight-body_bold-weight);
  font-size: var(--typography-font-size-paragraph-small);
  line-height: var(--typography-line-height-body_small);
  color: var(--content-heading);
  text-transform: none;
}

input, select {
  font-family: var(--typography-font-body);
  font-size: var(--typography-font-size-paragraph-default);
  line-height: var(--typography-line-height-body_default);
  font-weight: var(--typography-font-weight-body_default-weight);
  padding: var(--spacing-0-75-rem) var(--spacing-1-rem);
  border: 1px solid var(--borders-border-01);
  border-radius: var(--radius-radius-l);
  background: var(--page-page-background);
  color: var(--content-body);
  width: 100%;
  min-width: 0;
}

input:hover, select:hover,
input:focus, select:focus {
  border-color: var(--borders-border-02);
  outline: none;
}

input::placeholder {
  color: var(--content-placeholder);
}

.field-error {
  color: var(--color-system-error);
  font-size: var(--typography-font-size-paragraph-small);
  line-height: var(--typography-line-height-body_small);
}

.actions {
  display: flex;
  gap: var(--spacing-content-2-buttons);
  flex-wrap: wrap;
  margin-top: var(--spacing-content-content-button-large);
}

.actions-sticky {
  position: sticky;
  bottom: 0;
  background: var(--page-page-background);
  padding-top: var(--spacing-1-rem);
  padding-bottom: var(--spacing-1-rem);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-0-5-rem);
  min-height: var(--spacing-3-rem);
  padding: var(--spacing-0-75-rem) var(--spacing-1-5-rem);
  border-radius: var(--radius-radius-round);
  border: none;
  background: var(--button-default-state-button-bg-default);
  color: var(--button-default-state-button-prim_label);
  font-family: var(--typography-font-button);
  font-size: var(--typography-font-size-button);
  line-height: var(--typography-line-height-button);
  font-weight: var(--typography-font-weight-button-label-default);
  text-decoration: none;
  cursor: pointer;
  letter-spacing: normal;
  text-transform: none;
}

.btn:hover {
  background: var(--button-hover-state-button-bg-hover);
  color: var(--button-hover-state-button-prim_label);
}

.btn:disabled,
.btn.is-disabled {
  background: var(--button-disabled-state-button-bg-disabled);
  color: var(--button-disabled-state-button-prim_label);
  cursor: not-allowed;
}

.btn-secondary {
  background: transparent;
  color: var(--button-default-state-button-sec_label);
  border: 1px solid var(--button-default-state-button-stroke);
}

.btn-secondary:hover {
  background: var(--button-hover-state-button-bg-hover);
  color: var(--button-hover-state-button-sec_label);
  border-color: var(--button-hover-state-button-stroke);
}

.assess-layout {
  display: grid;
  grid-template-columns: minmax(0, calc(var(--grid-grid-width) * 5 + var(--grid-grid-gutter) * 4)) minmax(0, 1fr);
  gap: var(--grid-grid-gutter);
  align-items: start;
}

.level-list {
  display: grid;
  gap: var(--spacing-0-5-rem);
}

.level-row {
  position: relative;
  display: grid;
  grid-template-columns: var(--spacing-2-rem) 1fr;
  gap: var(--spacing-0-75-rem);
  align-items: center;
  padding: var(--spacing-1-rem);
  border: 1px solid var(--borders-border-01);
  border-radius: var(--radius-radius-cards-lg);
  cursor: pointer;
  background: var(--page-page-background);
}

.level-row input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}

.level-row:hover {
  border-color: var(--borders-border-02);
  box-shadow: var(--dropshadow-soft);
}

.level-row.is-selected {
  border-color: var(--borders-border-02);
  background: var(--theme-light);
}

.level-row .level-status {
  color: var(--content-placeholder);
}

.level-row.is-selected .level-status {
  color: var(--theme-dark);
}

.level-copy {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-0-25-rem);
  min-width: 0;
}

.level-description {
  display: none;
  margin: 0;
}

.band {
  font-family: var(--typography-font-body);
  font-size: var(--typography-font-size-paragraph-small);
  line-height: var(--typography-line-height-body_small);
  font-weight: var(--typography-font-weight-body_bold-weight);
  color: var(--theme-dark);
  text-transform: none;
}

.card-title {
  font-family: var(--typography-font-card-title);
  font-weight: var(--typography-font-weight-card-title);
  font-size: var(--typography-font-size-card-title-s);
  line-height: var(--typography-line-height-card-title-s);
  color: var(--content-heading);
  margin: 0;
  text-transform: none;
}

.level-detail {
  background: var(--theme-light);
  color: var(--theme-dark);
  border-radius: var(--radius-radius-cards-lg);
  padding: var(--spacing-1-5-rem);
  min-height: var(--spacing-7-rem);
}

.level-detail .band,
.level-detail .card-title,
.level-detail p {
  color: var(--theme-dark);
}

.level-detail .card-title {
  margin-bottom: var(--spacing-content-h-content-medium);
}

.summary-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: var(--spacing-0-5-rem);
}

.summary-row {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1.6fr auto;
  gap: var(--spacing-1-rem);
  align-items: center;
  padding: var(--spacing-1-rem);
  border: 1px solid var(--borders-border-01);
  border-radius: var(--radius-radius-cards-lg);
  text-decoration: none;
  color: var(--content-body);
}

.summary-row:hover {
  border-color: var(--borders-border-02);
  box-shadow: var(--dropshadow-soft);
}

.summary-row[data-us-theme] {
  background: var(--theme-light);
  color: var(--theme-dark);
  border-color: var(--theme-primary);
}

.summary-row[data-us-theme] .summary-name,
.summary-row[data-us-theme] .summary-change {
  color: var(--theme-dark);
}

.summary-name {
  font-family: var(--typography-font-card-title);
  font-weight: var(--typography-font-weight-card-title);
  font-size: var(--typography-font-size-card-title-s);
  line-height: var(--typography-line-height-card-title-s);
  color: var(--content-heading);
  text-transform: none;
}

.summary-change {
  font-family: var(--typography-font-button);
  font-weight: var(--typography-font-weight-button-label-default);
  font-size: var(--typography-font-size-button);
  line-height: var(--typography-line-height-button);
  color: var(--button-default-state-button-sec_label);
  text-decoration: underline;
  text-transform: none;
}

.score-hero {
  background: var(--theme-light);
  color: var(--theme-dark);
  border-radius: var(--radius-radius-cards-lg);
  padding: var(--spacing-2-rem);
  margin-bottom: var(--margins-row_indent-medium);
}

.score-hero .percent {
  font-family: var(--typography-font-headings-default-h1-xwide);
  font-size: var(--typography-font-size-h1-xl);
  line-height: var(--typography-line-height-h1-xl);
  font-weight: var(--typography-font-weight-headings-default-h1-weight);
  color: var(--theme-dark);
}

.score-hero h2 {
  color: var(--theme-dark);
}

.score-hero p,
.score-hero summary {
  color: var(--theme-dark);
}

.score-explain {
  margin-top: var(--spacing-1-5-rem);
}

.score-explain summary {
  font-family: var(--typography-font-button);
  font-weight: var(--typography-font-weight-button-label-default);
  font-size: var(--typography-font-size-nav);
  line-height: var(--typography-line-height-nav_labels);
  cursor: pointer;
  list-style: none;
  text-transform: none;
}

.score-explain summary::-webkit-details-marker {
  display: none;
}

.score-explain summary:hover {
  color: var(--button-hover-state-button-tert_label);
}

.score-explain p {
  margin-top: var(--spacing-content-h-content-medium);
  max-width: min(100%, calc(var(--page-content-width) * 0.62));
}

.benchmark {
  margin-top: var(--spacing-1-rem);
}

.bars { display: grid; gap: var(--spacing-1-25-rem); }

.bar-row { display: grid; gap: var(--spacing-0-5-rem); }

.bar-hover-title {
  display: none;
  margin: 0;
  font-size: var(--typography-font-size-paragraph-small);
  line-height: var(--typography-line-height-body_small);
  color: var(--content-placeholder);
}

.bar-row:hover .bar-hover-title {
  display: block;
}

.bar-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--spacing-1-rem);
  font-size: var(--typography-font-size-paragraph-small);
  line-height: var(--typography-line-height-body_small);
}

.bar-fill-series-2 {
  background: var(--theme-medium);
}

.bar-marker {
  position: absolute;
  top: calc(var(--spacing-0-25-rem) * -1);
  width: var(--spacing-0-25-rem);
  height: var(--spacing-1-5-rem);
  background: var(--content-heading);
  border-radius: var(--radius-radius-round);
}

.benchmark-compare {
  margin-top: var(--spacing-1-5-rem);
}

.feedback {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: var(--spacing-1-rem);
  align-items: start;
  background: var(--page-page-background);
  border: 1px solid var(--borders-border-01);
  border-radius: var(--radius-radius-cards-lg);
  padding: var(--spacing-1-5-rem);
  margin-bottom: var(--spacing-1-rem);
}

.feedback .icon { color: var(--color-system-warning); }

.feedback h4 {
  margin-bottom: var(--spacing-0-5-rem);
}

.table-wrap { overflow-x: auto; }

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

th, td {
  text-align: left;
  padding: var(--spacing-0-75-rem) var(--spacing-0-75-rem) var(--spacing-0-75-rem) 0;
  border-bottom: 1px solid var(--borders-separator);
  font-size: var(--typography-font-size-paragraph-small);
  line-height: var(--typography-line-height-body_small);
}

th {
  font-family: var(--typography-font-body);
  font-weight: var(--typography-font-weight-body_bold-weight);
  text-transform: none;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

/* =========================================================
   MOBILE LAYOUT
   The token model is fluid; this is the system's single
   discrete breakpoint (768px, where the grid drops to 6
   columns). Only layout changes here. Sizes, spacing and
   colours keep coming from the tokens above.
   ========================================================= */

@media (max-width: 768px) {
  .site-header-row {
    flex-wrap: wrap;
  }

  .step-nav {
    order: 3;
    flex-basis: 100%;
    justify-content: flex-start;
    gap: var(--spacing-0-75-rem) var(--spacing-1-rem);
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .assess-layout {
    grid-template-columns: 1fr;
  }

  /* No hover on touch: the selected row shows its description inline. */
  .level-detail {
    display: none;
  }

  .level-row.is-selected .level-description {
    display: block;
    color: var(--theme-dark);
  }

  .summary-row {
    grid-template-columns: 1fr;
    gap: var(--spacing-0-25-rem);
  }

  .actions .btn {
    flex: 1 1 auto;
  }

  .score-hero {
    padding: var(--spacing-1-5-rem);
  }

  th, td {
    white-space: nowrap;
  }
}

@media print {
  .no-print,
  .step-nav,
  .scan-progress,
  .header-meta,
  .actions,
  .actions-sticky {
    display: none;
  }

  .site-header {
    background: var(--page-page-background);
  }

  .bar-hover-title {
    display: block;
  }

  .progress-fill,
  .bar-fill,
  .score-hero,
  .level-detail,
  .summary-row[data-us-theme],
  .site-header {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
}
