/* Page foundation and theme tokens */
.http-status-page,
.http-status-page * {
  box-sizing: border-box;
}

body.http-status-page {
  --http-page: #f4f6f8;
  --http-surface: #ffffff;
  --http-surface-muted: #f6f8fa;
  --http-border: #d0d7de;
  --http-border-strong: #afb8c1;
  --http-text: #1f2328;
  --http-muted: #59636e;
  --http-primary: #0969da;
  --http-primary-hover: #0550ae;
  --http-primary-contrast: #ffffff;
  --http-focus: #0969da;
  --http-selected: #ddf4ff;
  --http-row-hover: #f6f8fa;
  --http-success: #1a7f37;
  --http-error: #cf222e;
  --http-warning: #9a6700;
  --http-content-max: 1440px;
  --http-font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans JP", sans-serif;
  --http-font-mono: "Cascadia Code", Consolas, monospace;
  --http-radius-inline: 5px;
  --http-radius-control: 8px;
  --http-radius-frame: 9px;
  --http-radius-code: 10px;
  --http-radius-panel: 12px;
  --http-radius-pill: 999px;
  --http-button-min-height: 38px;
  --http-control-min-height: 40px;
  --http-panel-spacing: 16px;
  --http-panel-padding: 18px;
  --http-panel-shadow: 0 1px 2px rgb(31 35 40 / 4%);
  --http-space-xs: 4px;
  --http-space-sm: 8px;
  --http-space-md: 12px;
  --http-space-lg: 16px;
  --http-space-xl: 20px;
  --http-space-2xl: 24px;
  min-block-size: 100vh;
  margin: 0;
  color: var(--http-text);
  background: var(--http-page);
  font-family: var(--http-font-sans);
  line-height: 1.65;
}

body.http-status-page[data-theme="dark"] {
  --http-page: #0d1117;
  --http-surface: #161b22;
  --http-surface-muted: #21262d;
  --http-border: #3d444d;
  --http-border-strong: #656c76;
  --http-text: #f0f6fc;
  --http-muted: #9da7b1;
  --http-primary: #58a6ff;
  --http-primary-hover: #79c0ff;
  --http-primary-contrast: #0d1117;
  --http-focus: #58a6ff;
  --http-selected: #1c3657;
  --http-row-hover: #21262d;
  --http-success: #3fb950;
  --http-error: #ff7b72;
  --http-warning: #d29922;
}

.http-status-main {
  inline-size: min(var(--http-content-max), calc(100% - 32px));
  margin-inline: auto;
  padding-block: 38px;
}

/* Page header and reusable panels */
.http-status-page .breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--http-space-sm);
  margin-block-end: var(--http-space-sm);
  color: var(--http-muted);
  font-size: 13px;
}

.http-status-page .breadcrumb a,
.http-status-about a,
.http-status-detail-item a {
  color: var(--http-primary);
}

.http-status-page-header h1,
.http-status-panel h2,
.http-status-panel h3,
.http-status-page-header p,
.http-status-panel p,
.http-status-panel ul,
.http-status-panel ol,
.http-status-panel dl {
  margin-block-start: 0;
}

.http-status-page-header h1 {
  margin-block-end: var(--http-space-xs);
  font-size: clamp(25px, 3vw, 34px);
  line-height: 1.3;
}

.http-status-page-header p {
  margin-block-end: 0;
  color: var(--http-muted);
}

.http-status-split-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--http-space-xl);
}

.http-status-notice {
  margin-block: var(--http-space-xl) var(--http-space-lg);
  padding: var(--http-space-md) var(--http-space-lg);
  border: 1px solid color-mix(in srgb, var(--http-primary) 35%, var(--http-border));
  border-radius: var(--http-radius-frame);
  color: color-mix(in srgb, var(--http-primary) 78%, var(--http-text));
  background: color-mix(in srgb, var(--http-primary) 8%, var(--http-surface));
  font-size: 14px;
}

.http-status-panel {
  margin-block: var(--http-panel-spacing);
  padding: var(--http-panel-padding);
  border: 1px solid var(--http-border);
  border-radius: var(--http-radius-panel);
  background: var(--http-surface);
  box-shadow: var(--http-panel-shadow);
}

.http-status-panel-heading {
  margin-block-end: 14px;
}

.http-status-section-title {
  margin-block-end: 3px;
  font-size: 19px;
}

.http-status-supporting-text {
  margin-block-end: 0;
  color: var(--http-muted);
  font-size: 14px;
}

.http-status-panel-heading--list {
  align-items: end;
}

.http-status-button,
.http-status-related-button,
.http-status-code-button {
  min-block-size: var(--http-button-min-height);
  border: 1px solid var(--http-border);
  border-radius: var(--http-radius-control);
  color: var(--http-text);
  background: var(--http-surface-muted);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.http-status-button {
  padding: 7px 14px;
  white-space: nowrap;
}

.http-status-button:hover,
.http-status-related-button:hover,
.http-status-code-button:hover {
  border-color: var(--http-border-strong);
  background: color-mix(in srgb, var(--http-primary) 8%, var(--http-surface));
}

.http-status-button--primary {
  border-color: var(--http-primary);
  color: var(--http-primary-contrast);
  background: var(--http-primary);
}

.http-status-button--primary:hover {
  border-color: var(--http-primary-hover);
  background: var(--http-primary-hover);
}

.http-status-button:disabled {
  cursor: wait;
  opacity: .55;
}

.http-status-button:focus-visible,
.http-status-related-button:focus-visible,
.http-status-code-button:focus-visible,
.http-status-control:focus-visible,
.http-status-scroll-region:focus-visible,
.http-status-detail-item a:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--http-focus) 45%, transparent);
  outline-offset: 2px;
}

/* Search and form controls */
.http-status-form-grid {
  display: grid;
  gap: var(--http-space-md);
}

.http-status-filter-grid {
  grid-template-columns: minmax(280px, 2fr) minmax(180px, 1fr) minmax(210px, 1fr);
}

.http-status-field {
  display: grid;
  gap: 5px;
  color: var(--http-muted);
  font-size: 13px;
  font-weight: 600;
}

.http-status-control {
  inline-size: 100%;
  min-block-size: var(--http-control-min-height);
  padding: 7px 11px;
  border: 1px solid var(--http-border);
  border-radius: var(--http-radius-control);
  color: var(--http-text);
  background: var(--http-surface);
  font: inherit;
  font-size: 14px;
}

.http-status-message {
  min-block-size: 24px;
  margin-block: 10px 0;
  color: var(--http-muted);
  font-size: 13px;
}

.http-status-message[data-type="success"] {
  color: var(--http-success);
}

.http-status-message[data-type="error"] {
  color: var(--http-error);
}

.http-status-result-count {
  margin-block-end: 0;
  color: var(--http-muted);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}

/* Desktop table and mobile card representations */
.http-status-scroll-region {
  overflow: auto;
  border: 1px solid var(--http-border);
  border-radius: var(--http-radius-frame);
}

.http-status-data-table {
  inline-size: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.http-status-table {
  min-inline-size: 1080px;
}

.http-status-data-table th,
.http-status-data-table td {
  padding: 10px 12px;
  border-block-end: 1px solid var(--http-border);
  text-align: start;
  vertical-align: top;
}

.http-status-data-table thead th {
  position: sticky;
  inset-block-start: 0;
  z-index: 1;
  color: var(--http-text);
  background: var(--http-surface-muted);
  font-size: 13px;
}

.http-status-table tbody tr:last-child td,
.http-status-comparison-table tbody tr:last-child th,
.http-status-comparison-table tbody tr:last-child td {
  border-block-end: 0;
}

.http-status-table tbody tr:hover {
  background: var(--http-row-hover);
}

.http-status-table tbody tr.is-selected,
.http-status-card.is-selected {
  background: var(--http-selected);
}

.http-status-code-button {
  min-inline-size: 58px;
  padding: 5px 10px;
  color: var(--http-primary);
  background: transparent;
  font-family: var(--http-font-mono);
  font-size: 15px;
}

.http-status-table-ja {
  display: block;
  margin-block-start: 2px;
  color: var(--http-muted);
  font-size: 12px;
}

/* Status categories and registration states */
.http-status-badge,
.http-status-state {
  display: inline-flex;
  align-items: center;
  min-block-size: 25px;
  padding: 2px 8px;
  border: 1px solid transparent;
  border-radius: var(--http-radius-pill);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.http-status-badge {
  color: var(--http-badge-text);
  border-color: var(--http-badge-border);
  background: var(--http-badge-background);
}

.http-status-badge--1 {
  --http-badge-text: #0550ae;
  --http-badge-background: #ddf4ff;
  --http-badge-border: #54aeff;
}

.http-status-badge--2 {
  --http-badge-text: #116329;
  --http-badge-background: #dafbe1;
  --http-badge-border: #4ac26b;
}

.http-status-badge--3 {
  --http-badge-text: #633c01;
  --http-badge-background: #fff8c5;
  --http-badge-border: #d4a72c;
}

.http-status-badge--4 {
  --http-badge-text: #9a6700;
  --http-badge-background: #fff1e5;
  --http-badge-border: #fb8f44;
}

.http-status-badge--5 {
  --http-badge-text: #a40e26;
  --http-badge-background: #ffebe9;
  --http-badge-border: #ff8182;
}

body.http-status-page[data-theme="dark"] .http-status-badge--1 {
  --http-badge-text: #79c0ff;
  --http-badge-background: #1c3657;
  --http-badge-border: #388bfd;
}

body.http-status-page[data-theme="dark"] .http-status-badge--2 {
  --http-badge-text: #56d364;
  --http-badge-background: #1b4721;
  --http-badge-border: #238636;
}

body.http-status-page[data-theme="dark"] .http-status-badge--3 {
  --http-badge-text: #e3b341;
  --http-badge-background: #463a14;
  --http-badge-border: #9e6a03;
}

body.http-status-page[data-theme="dark"] .http-status-badge--4 {
  --http-badge-text: #ffa657;
  --http-badge-background: #4b2b17;
  --http-badge-border: #bd561d;
}

body.http-status-page[data-theme="dark"] .http-status-badge--5 {
  --http-badge-text: #ff7b72;
  --http-badge-background: #4c1f24;
  --http-badge-border: #da3633;
}

.http-status-state--registered {
  color: var(--http-success);
  border-color: color-mix(in srgb, var(--http-success) 35%, var(--http-border));
  background: color-mix(in srgb, var(--http-success) 9%, var(--http-surface));
}

.http-status-state--temporary {
  color: var(--http-warning);
  border-color: color-mix(in srgb, var(--http-warning) 40%, var(--http-border));
  background: color-mix(in srgb, var(--http-warning) 10%, var(--http-surface));
}

.http-status-state--deprecated,
.http-status-state--unused,
.http-status-state--obsolete {
  color: var(--http-error);
  border-color: color-mix(in srgb, var(--http-error) 35%, var(--http-border));
  background: color-mix(in srgb, var(--http-error) 8%, var(--http-surface));
}

.http-status-card-list {
  display: none;
}

.http-status-empty {
  margin-block: 18px 0;
  color: var(--http-muted);
  text-align: center;
}

.http-status-detail {
  scroll-margin-block-start: var(--http-space-lg);
}

/* Detail and comparison panels */
.http-status-detail-heading {
  align-items: center;
}

.http-status-detail-code-wrap {
  display: flex;
  align-items: center;
  gap: 14px;
}

.http-status-detail-code {
  display: grid;
  place-items: center;
  min-inline-size: 88px;
  min-block-size: 72px;
  border: 1px solid var(--http-border);
  border-radius: var(--http-radius-code);
  color: var(--http-primary);
  background: var(--http-surface-muted);
  font-family: var(--http-font-mono);
  font-size: 30px;
  font-weight: 800;
}

.http-status-detail-heading h2 small {
  display: block;
  margin-block-start: 3px;
  color: var(--http-muted);
  font-size: 14px;
  font-weight: 600;
}

.http-status-copy-controls {
  display: flex;
  align-items: end;
  gap: var(--http-space-sm);
}

.http-status-field--inline {
  min-inline-size: 210px;
}

.http-status-detail-summary {
  margin-block: var(--http-space-lg);
  padding: 12px 14px;
  border-inline-start: 4px solid var(--http-primary);
  background: var(--http-surface-muted);
  font-size: 15px;
}

.http-status-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-block-end: var(--http-space-lg);
}

.http-status-detail-item {
  min-inline-size: 0;
  padding: var(--http-space-md);
  border: 1px solid var(--http-border);
  border-radius: var(--http-radius-control);
  background: var(--http-surface-muted);
}

.http-status-detail-item--wide {
  grid-column: 1 / -1;
}

.http-status-detail-item dt {
  margin-block-end: 3px;
  color: var(--http-muted);
  font-size: 12px;
  font-weight: 700;
}

.http-status-detail-item dd {
  margin: 0;
}

.http-status-related h3 {
  margin-block-end: 8px;
  font-size: 15px;
}

.http-status-related-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--http-space-sm);
}

.http-status-related-button {
  min-block-size: 34px;
  padding: 5px 10px;
  color: var(--http-primary);
  font-size: 13px;
}

.http-status-compare-selects {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-block-end: 14px;
}

.http-status-comparison-table {
  min-inline-size: 820px;
  table-layout: fixed;
}

.http-status-comparison-table th:first-child {
  inline-size: 160px;
}

.http-status-comparison-table tbody th {
  color: var(--http-muted);
  background: var(--http-surface-muted);
}

/* About and source information */
.http-status-about-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--http-space-2xl);
}

.http-status-about h3 {
  margin-block: 18px 5px;
  font-size: 15px;
}

.http-status-about li + li {
  margin-block-start: var(--http-space-xs);
}

.http-status-source {
  margin-block: 18px 0;
  padding-block-start: 14px;
  border-block-start: 1px solid var(--http-border);
  color: var(--http-muted);
  font-size: 13px;
}

.http-status-page kbd,
.http-status-page code {
  padding: 1px 5px;
  border: 1px solid var(--http-border);
  border-radius: var(--http-radius-inline);
  color: var(--http-text);
  background: var(--http-surface-muted);
  font-family: var(--http-font-mono);
}

/* Responsive adaptations */
@media (max-width: 900px) {
  .http-status-filter-grid {
    grid-template-columns: 1fr 1fr;
  }

  .http-status-filter-grid .http-status-field:first-child {
    grid-column: 1 / -1;
  }

  .http-status-detail-heading {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 760px) {
  body.http-status-page {
    --http-panel-padding: 14px;
  }

  .http-status-main {
    inline-size: min(100% - 20px, var(--http-content-max));
    padding-block: 22px;
  }

  .http-status-mobile-stack {
    align-items: stretch;
    flex-direction: column;
    gap: 10px;
  }

  .http-status-single-column-mobile {
    grid-template-columns: 1fr;
  }

  .http-status-filter-grid .http-status-field:first-child,
  .http-status-detail-item--wide {
    grid-column: auto;
  }

  .http-status-table-scroll {
    display: none;
  }

  .http-status-card-list {
    display: grid;
    gap: 10px;
  }

  .http-status-card {
    padding: 13px;
    border: 1px solid var(--http-border);
    border-radius: var(--http-radius-frame);
    background: var(--http-surface);
  }

  .http-status-card-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
  }

  .http-status-card-heading > div {
    display: flex;
    align-items: baseline;
    gap: var(--http-space-sm);
  }

  .http-status-card-code {
    color: var(--http-primary);
    font-family: var(--http-font-mono);
    font-size: 18px;
  }

  .http-status-card-ja,
  .http-status-card p {
    margin-block: 7px;
  }

  .http-status-card-ja {
    color: var(--http-muted);
    font-size: 13px;
  }

  .http-status-detail-code-wrap {
    align-items: flex-start;
  }

  .http-status-copy-controls {
    align-items: stretch;
    flex-direction: column;
    inline-size: 100%;
  }

  .http-status-field--inline {
    min-inline-size: 0;
  }

  .http-status-card .http-status-button,
  .http-status-copy-controls .http-status-button {
    inline-size: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .http-status-page *,
  .http-status-page *::before,
  .http-status-page *::after {
    scroll-behavior: auto !important;
  }
}
