@font-face {
  font-family: "HK Grotesk";
  src:
    url("WEB/HKGrotesk-Regular.woff2") format("woff2"),
    url("WEB/HKGrotesk-Regular.woff") format("woff");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "HK Grotesk";
  src:
    url("WEB/HKGrotesk-Medium.woff2") format("woff2"),
    url("WEB/HKGrotesk-Medium.woff") format("woff");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "HK Grotesk";
  src:
    url("WEB/HKGrotesk-SemiBold.woff2") format("woff2"),
    url("WEB/HKGrotesk-SemiBold.woff") format("woff");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "HK Grotesk";
  src:
    url("WEB/HKGrotesk-Bold.woff2") format("woff2"),
    url("WEB/HKGrotesk-Bold.woff") format("woff");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Roboto Mono";
  src:
    url("static/RobotoMono-Regular.ttf") format("truetype"),
    url("RobotoMono-VariableFont_wght.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Roboto Mono";
  src: url("static/RobotoMono-Medium.ttf") format("truetype");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

:root {
  --ruby: #ff4069;
  --ruby-light: #ff9fb4;
  --peacock: #c27fec;
  --peacock-light: #e0bff5;
  --jade: #55c7b4;
  --jade-light: #aae3d9;
  --sandstone: #f99963;
  --sandstone-light: #fcccb1;
  --lemon: #ffce2e;
  --lemon-light: #ffe696;
  --ocean: #50b2fc;
  --ocean-light: #a7d8fd;
  --cyberspace: #1f2a36;
  --granit: #8e9297;
  --concrete: #d8d8d8;
  --black: #000000;
  --bg: #f5f7f8;
  --bg-strong: #edf1f4;
  --surface: #ffffff;
  --surface-strong: #ffffff;
  --ink: var(--cyberspace);
  --muted: #576474;
  --accent: var(--ruby);
  --accent-soft: rgba(255, 64, 105, 0.12);
  --must: var(--ruby);
  --should: var(--ocean);
  --may: var(--peacock);
  --tag: var(--sandstone);
  --attr: var(--jade);
  --value: var(--lemon);
  --line-highlight: rgba(80, 178, 252, 0.14);
  --shadow: 0 18px 40px rgba(31, 42, 54, 0.08);
  --radius: 18px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "HK Grotesk", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(255, 64, 105, 0.1), transparent 26%),
    radial-gradient(circle at top right, rgba(80, 178, 252, 0.1), transparent 24%),
    linear-gradient(180deg, #ffffff 0%, var(--bg) 100%);
}

code,
pre,
.xml-viewer {
  font-family: "Roboto Mono", monospace;
}

.page-shell {
  width: min(1680px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0 40px;
}

.hero {
  margin-bottom: 24px;
}

.hero-copy,
.federation-panel,
.viewer-panel,
.details-panel {
  background: var(--surface);
  border: 1px solid rgba(31, 42, 54, 0.08);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.hero-copy {
  position: relative;
  padding: 28px 28px 30px;
  overflow: hidden;
}

.hero-copy::before {
  content: "";
  position: absolute;
  inset: 0 auto auto 0;
  width: 100%;
  height: 6px;
  background: linear-gradient(90deg, var(--ruby), var(--jade), var(--ocean), var(--peacock));
}

.hero-brandbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 18px;
}

.hero-controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 12px;
}

.mode-switcher-wide {
  flex-wrap: wrap;
  justify-content: flex-start;
}

.brand-logo {
  display: block;
  width: min(360px, 42vw);
  height: auto;
}

.hero-copy h1 {
  margin: 0 0 12px;
  font-size: clamp(2rem, 3vw, 3.5rem);
  line-height: 0.98;
  letter-spacing: -0.04em;
}

.hero-topbar {
  display: block;
}

.eyebrow,
.panel-label,
.stat-label,
.detail-heading {
  margin: 0;
  font-size: 0.83rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
}

.lead {
  margin: 0;
  max-width: 84ch;
  font-size: 1.02rem;
  line-height: 1.65;
  color: var(--muted);
}

.hero-link-row {
  margin: 18px 0 0;
}

.profile-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 12px 18px;
  border-radius: 999px;
  border: 1px solid rgba(255, 64, 105, 0.2);
  background: rgba(255, 64, 105, 0.08);
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
  transition: transform 180ms ease, background 180ms ease;
}

.profile-link:hover,
.profile-link:focus-visible {
  background: rgba(255, 64, 105, 0.16);
  transform: translateY(-1px);
  outline: none;
}

.federation-panel {
  padding: 22px;
  margin-bottom: 24px;
}

.federation-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.federation-panel-header h2 {
  margin: 6px 0 0;
  font-size: 1.45rem;
}

.federation-panel-lead {
  max-width: none;
  margin-top: 10px;
}

.federation-switcher {
  margin-top: 18px;
}

.federation-summary {
  margin: 18px 0 0;
  color: var(--muted);
  line-height: 1.65;
}

.federation-summary a {
  color: var(--cyberspace);
  font-weight: 600;
  text-decoration: none;
  border-bottom: 1px solid rgba(31, 42, 54, 0.18);
}

.federation-summary a:hover,
.federation-summary a:focus-visible {
  border-bottom-color: rgba(31, 42, 54, 0.44);
  outline: none;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.9fr) minmax(340px, 420px);
  gap: 24px;
}

.viewer-panel,
.details-panel {
  padding: 22px;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 18px;
}

.panel-header h2 {
  margin: 6px 0 0;
  font-size: 1.45rem;
}

.mode-switcher {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px;
  border-radius: 999px;
  background: rgba(31, 42, 54, 0.04);
  border: 1px solid rgba(31, 42, 54, 0.1);
}

.mode-button {
  border: 0;
  border-radius: 999px;
  min-width: 56px;
  padding: 10px 14px;
  font: inherit;
  font-weight: 600;
  color: var(--cyberspace);
  background: transparent;
  cursor: pointer;
  transition: background 160ms ease, color 160ms ease, transform 160ms ease;
}

.mode-button:hover,
.mode-button:focus-visible {
  background: rgba(31, 42, 54, 0.07);
  outline: none;
}

.mode-button.is-active {
  color: #ffffff;
  background: var(--cyberspace);
  box-shadow: 0 10px 22px rgba(31, 42, 54, 0.18);
}

.legend,
.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.legend {
  margin-bottom: 18px;
}

.legend-note {
  margin: 0;
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(31, 42, 54, 0.04);
  border: 1px solid rgba(31, 42, 54, 0.08);
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.5;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 0.92rem;
  background: #ffffff;
  border: 1px solid rgba(31, 42, 54, 0.1);
}

.chip::before {
  content: "";
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: currentColor;
}

.chip.must {
  color: var(--must);
}

.chip.should {
  color: var(--should);
}

.chip.may {
  color: var(--may);
}

.chip.neutral::before {
  background: var(--jade);
}

.xml-viewer {
  position: relative;
  overflow: auto;
  padding: 20px 24px;
  border-radius: 20px;
  background:
    linear-gradient(180deg, rgba(31, 42, 54, 0.99), rgba(31, 42, 54, 0.96)),
    linear-gradient(135deg, rgba(255,255,255,0.03), transparent);
  color: #f7f1e9;
  min-height: 72vh;
  max-height: 78vh;
  font-size: 0.94rem;
  line-height: 1.7;
  white-space: normal;
}

.xml-block {
  display: block;
}

.xml-children {
  display: block;
}

.xml-children[hidden],
.xml-line[hidden],
.collapsed-tail[hidden] {
  display: none !important;
}

.xml-line {
  display: block;
  padding: 1px 0;
  border-radius: 10px;
  transition: background 120ms ease;
  white-space: pre-wrap;
}

.xml-line.is-highlighted {
  background: var(--line-highlight);
}

.xml-line.is-continuation {
  opacity: 0.96;
}

.xml-line.is-empty {
  min-height: 1.7em;
}

.indent {
  display: inline-block;
  width: calc(var(--depth) * 18px);
}

.collapse-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  margin-right: 6px;
  border: 0;
  border-radius: 5px;
  font: inherit;
  font-weight: 700;
  line-height: 1;
  color: #ffffff;
  background: rgba(255, 255, 255, 0.08);
  cursor: pointer;
}

.collapse-spacer {
  display: inline-block;
  width: 24px;
  margin-right: 6px;
}

.collapse-toggle:hover,
.collapse-toggle:focus-visible {
  background: rgba(255, 255, 255, 0.18);
  outline: none;
}

.collapse-toggle.is-placeholder {
  visibility: hidden;
  cursor: default;
}

.collapsed-tail {
  color: rgba(255, 248, 238, 0.78);
}

.token {
  border-radius: 7px;
  transition: background 120ms ease, color 120ms ease, box-shadow 120ms ease;
}

.token:hover,
.token:focus-visible,
.token.is-active {
  background: rgba(255, 255, 255, 0.12);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.1);
  outline: none;
}

.token.tag {
  color: var(--sandstone-light);
}

.token.attr-name {
  color: var(--jade-light);
}

.token.attr-value,
.token.text-value {
  color: var(--lemon-light);
}

.token.punctuation {
  color: rgba(255, 248, 238, 0.7);
}

.details-panel {
  position: sticky;
  top: 18px;
  align-self: start;
}

.details-panel.is-pinned {
  box-shadow: 0 18px 40px rgba(31, 42, 54, 0.14);
}

.detail-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border: 1px solid rgba(31, 42, 54, 0.12);
  border-radius: 999px;
  background: rgba(31, 42, 54, 0.04);
  color: var(--cyberspace);
  font: inherit;
  font-size: 1.2rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  transition: background 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.detail-close:hover,
.detail-close:focus-visible {
  background: rgba(31, 42, 54, 0.08);
  border-color: rgba(31, 42, 54, 0.18);
  transform: translateY(-1px);
  outline: none;
}

.detail-close[hidden] {
  display: none !important;
}

.detail-path,
.detail-why {
  color: var(--muted);
  line-height: 1.55;
}

.detail-path {
  margin: 0 0 6px;
  font-family: "Roboto Mono", monospace;
  font-size: 0.92rem;
  overflow-wrap: anywhere;
  word-break: break-word;
  white-space: normal;
}

.detail-why {
  margin: 0 0 20px;
  padding: 14px 16px;
  border-left: 4px solid var(--ruby);
  border-radius: 12px;
  background: linear-gradient(90deg, rgba(255, 64, 105, 0.08), rgba(255, 64, 105, 0.02));
  color: var(--cyberspace);
  font-weight: 500;
}

.detail-source-type {
  margin: 0;
  color: var(--ink);
  font-weight: 600;
}

.detail-source-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.detail-source-link {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid rgba(31, 42, 54, 0.12);
  background: rgba(31, 42, 54, 0.04);
  color: var(--cyberspace);
  font-weight: 600;
  text-decoration: none;
  transition: transform 180ms ease, background 180ms ease, border-color 180ms ease;
}

.detail-source-link:hover,
.detail-source-link:focus-visible {
  background: rgba(31, 42, 54, 0.08);
  border-color: rgba(31, 42, 54, 0.18);
  transform: translateY(-1px);
  outline: none;
}

.detail-block + .detail-block {
  margin-top: 20px;
}

.detail-list {
  margin: 10px 0 0;
  padding-left: 18px;
  color: var(--ink);
}

.detail-list li + li {
  margin-top: 8px;
}

.empty-state {
  padding: 18px;
  border-radius: 16px;
  background: rgba(255, 250, 242, 0.08);
  color: rgba(255, 250, 242, 0.84);
}

@media (max-width: 1080px) {
  .workspace {
    grid-template-columns: 1fr;
  }

  .details-panel {
    position: static;
  }
}

@media (max-width: 640px) {
  .page-shell {
    width: min(100% - 20px, 1400px);
    padding-top: 20px;
  }

  .hero-copy,
  .federation-panel,
  .viewer-panel,
  .details-panel {
    padding: 18px;
    border-radius: 18px;
  }

  .panel-header {
    flex-direction: column;
    align-items: stretch;
  }

  .hero-topbar {
    display: block;
  }

  .mode-switcher {
    width: fit-content;
  }

  .hero-brandbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .hero-controls {
    justify-content: flex-start;
  }

  .brand-logo {
    width: min(300px, 70vw);
  }

  .xml-viewer {
    min-height: 50vh;
    padding: 14px;
    max-height: none;
  }
}
