/* Server Rules */

.rules-page {
  --rules-blue: #4aa3ff;
  --rules-blue-soft: #89bdff;
  --rules-text: #f3f7ff;
  --rules-muted: #9eb1cd;
  --rules-dim: #7f95b4;
  --rules-line: rgba(125, 175, 255, 0.15);
  --severity-low: #74aee9;
  --severity-medium: #e1b95b;
  --severity-high: #ef7b7b;
  min-height: calc(100vh - 200px);
  padding: 42px 14px 72px;
}

.rules-shell {
  width: min(1480px, 100%);
  margin: 0 auto;
  display: grid;
  gap: 18px;
}

.rules-hero,
.rules-principles,
.rules-index-panel,
.severity-panel,
.rules-controls,
.enforcement-notice,
.rules-section {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--rules-line);
  border-radius: 20px;
  background:
    radial-gradient(
      ellipse at 12% 0%,
      rgba(74, 163, 255, 0.105),
      transparent 44%
    ),
    linear-gradient(180deg, rgba(8, 17, 30, 0.9), rgba(5, 13, 25, 0.88));
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.24);
  backdrop-filter: blur(18px) saturate(125%);
}

.rules-hero::before,
.rules-principles::before,
.rules-index-panel::before,
.severity-panel::before,
.rules-controls::before,
.rules-section::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(132, 196, 255, 0.48),
    transparent
  );
}

.rules-hero {
  min-height: 360px;
  padding: 42px;
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(330px, 0.65fr);
  align-items: center;
  gap: 46px;
}

.rules-hero::after {
  content: "";
  position: absolute;
  width: 460px;
  height: 460px;
  right: -150px;
  top: -180px;
  border-radius: 50%;
  background: radial-gradient(
    circle,
    rgba(53, 212, 154, 0.085),
    transparent 66%
  );
  pointer-events: none;
}

.rules-hero-copy,
.rules-hero-summary {
  position: relative;
  z-index: 1;
}

.rules-eyebrow,
.section-kicker {
  color: #78b7ff;
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.rules-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  padding: 7px 11px;
  border: 1px solid rgba(74, 163, 255, 0.18);
  border-radius: 999px;
  background: rgba(74, 163, 255, 0.07);
}

.rules-hero h1 {
  margin: 0;
  color: var(--rules-text);
  font-size: clamp(2.35rem, 5vw, 4.25rem);
  font-weight: 950;
  letter-spacing: -0.045em;
  line-height: 0.98;
}

.rules-hero h1 span {
  color: #78b7ff;
}

.rules-hero-copy > p {
  max-width: 720px;
  margin: 19px 0 0;
  color: #b7c8df;
  font-size: 1.05rem;
  line-height: 1.7;
}

.rules-hero-actions {
  margin-top: 26px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.rules-button {
  min-height: 46px;
  padding: 11px 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border: 1px solid transparent;
  border-radius: 12px;
  color: #fff;
  font-size: 0.88rem;
  font-weight: 900;
  text-decoration: none;
  transition:
    transform 0.18s ease,
    border-color 0.18s ease,
    background 0.18s ease,
    box-shadow 0.18s ease;
}

.rules-button:hover {
  color: #fff;
  transform: translateY(-1px);
}

.rules-button.primary {
  border-color: rgba(119, 190, 255, 0.38);
  background: linear-gradient(135deg, #2995ff, #2563eb);
  box-shadow:
    0 8px 24px rgba(37, 99, 235, 0.25),
    inset 0 1px rgba(255, 255, 255, 0.2);
}

.rules-button.secondary {
  border-color: rgba(125, 175, 255, 0.18);
  background: rgba(255, 255, 255, 0.05);
  color: #dceaff;
}

.rules-button.secondary:hover {
  border-color: rgba(125, 175, 255, 0.35);
  background: rgba(74, 163, 255, 0.1);
}

.rules-hero-summary {
  padding: 20px;
  border: 1px solid rgba(255, 255, 255, 0.085);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.042);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.035);
}

.hero-summary-lead {
  padding-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.075);
}

.hero-summary-icon {
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(53, 212, 154, 0.22);
  border-radius: 13px;
  color: #5be0ae;
  background: rgba(53, 212, 154, 0.09);
  font-size: 1.2rem;
  line-height: 1;
}

.hero-summary-icon > i {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.hero-summary-icon > i::before {
  display: block;
  line-height: 1;
  vertical-align: 0;
}

.hero-summary-lead strong,
.hero-summary-lead span {
  display: block;
}

.hero-summary-lead strong {
  color: var(--rules-text);
  font-size: 0.98rem;
}

.hero-summary-lead div span {
  margin-top: 3px;
  color: var(--rules-muted);
  font-size: 0.76rem;
}

.rules-hero-summary dl {
  margin: 16px 0 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.rules-hero-summary dl div {
  min-width: 0;
  padding: 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.035);
}

.rules-hero-summary dl .wide {
  grid-column: 1 / -1;
}

.rules-hero-summary dt {
  color: var(--rules-dim);
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.rules-hero-summary dd {
  margin: 5px 0 0;
  overflow: hidden;
  color: var(--rules-text);
  font-size: 1.02rem;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rules-principles {
  padding: 26px;
}

.section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.section-heading h2,
.sidebar-heading h2 {
  margin: 4px 0 0;
  color: var(--rules-text);
  font-size: 1.3rem;
  font-weight: 900;
  letter-spacing: -0.02em;
}

.principles-note {
  padding: 6px 9px;
  border: 1px solid rgba(53, 212, 154, 0.18);
  border-radius: 999px;
  background: rgba(53, 212, 154, 0.06);
  color: #58d6a7;
  font-size: 0.65rem;
  font-weight: 900;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.principles-grid {
  margin-top: 18px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.principle-card {
  min-width: 0;
  padding: 15px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 11px;
  border: 1px solid rgba(255, 255, 255, 0.075);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.032);
}

.principle-number {
  grid-column: 1 / -1;
  color: #6583a6;
  font-size: 0.61rem;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.principle-icon {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(125, 175, 255, 0.16);
  border-radius: 11px;
  background: rgba(74, 163, 255, 0.07);
  color: #74b4fb;
}

.principle-card h3 {
  margin: 0;
  color: #eaf3ff;
  font-size: 0.82rem;
  font-weight: 900;
}

.principle-card p {
  margin: 4px 0 0;
  color: #91a5bf;
  font-size: 0.68rem;
  line-height: 1.5;
}

.rules-layout {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
  scroll-margin-top: 108px;
}

.rules-sidebar {
  position: static;
  display: grid;
  gap: 14px;
  align-self: start;
}

.rules-index-panel,
.severity-panel {
  padding: 20px;
}

.sidebar-heading h2 {
  font-size: 1.06rem;
}

.rules-index {
  margin: 16px 0 0;
  padding: 0;
  display: grid;
  gap: 4px;
  list-style: none;
}

.rules-index a {
  min-width: 0;
  min-height: 43px;
  padding: 8px 9px;
  display: grid;
  grid-template-columns: 25px 30px minmax(0, 1fr) auto;
  align-items: center;
  gap: 7px;
  border: 1px solid transparent;
  border-radius: 10px;
  color: #95a9c4;
  text-decoration: none;
  transition:
    border-color 0.18s ease,
    background 0.18s ease,
    color 0.18s ease;
}

.rules-index a:hover {
  border-color: rgba(125, 175, 255, 0.13);
  background: rgba(74, 163, 255, 0.05);
  color: #dceaff;
}

.rules-index a.active {
  border-color: rgba(125, 175, 255, 0.2);
  background: rgba(74, 163, 255, 0.1);
  color: #f0f6ff;
}

.index-number {
  color: #5f7898;
  font-size: 0.58rem;
  font-weight: 900;
}

.rules-index a.active .index-number {
  color: #75b5fb;
}

.index-icon {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  color: #6ca8e9;
  font-size: 0.76rem;
}

.index-label {
  min-width: 0;
  overflow: hidden;
  font-size: 0.7rem;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.index-count {
  min-width: 21px;
  padding: 2px 5px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  color: #7186a2;
  font-size: 0.57rem;
  font-weight: 850;
  text-align: center;
}

.severity-list {
  margin-top: 14px;
  display: grid;
  gap: 7px;
}

.severity-row {
  --severity: var(--severity-low);
  min-width: 0;
  padding: 10px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: start;
  gap: 9px;
  border: 1px solid rgba(255, 255, 255, 0.065);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.028);
}

.severity-row.severity-medium {
  --severity: var(--severity-medium);
}

.severity-row.severity-high {
  --severity: var(--severity-high);
}

.severity-marker {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid color-mix(in srgb, var(--severity) 28%, transparent);
  border-radius: 8px;
  background: color-mix(in srgb, var(--severity) 8%, transparent);
  color: var(--severity);
  font-size: 0.72rem;
}

.severity-row strong {
  color: #dce8f7;
  font-size: 0.68rem;
}

.severity-row p {
  margin: 3px 0 0;
  color: #7f93ae;
  font-size: 0.59rem;
  line-height: 1.4;
}

.severity-count {
  color: var(--severity);
  font-size: 0.61rem;
  font-weight: 900;
}

.rules-content {
  min-width: 0;
  display: grid;
  gap: 14px;
}

.rules-controls {
  padding: 18px;
  display: grid;
  gap: 12px;
}

.rules-search-wrap {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 9px;
}

.rules-search {
  min-height: 46px;
  padding: 0 13px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  border: 1px solid rgba(125, 175, 255, 0.14);
  border-radius: 11px;
  background: rgba(0, 0, 0, 0.18);
}

.rules-search > i {
  color: #70adf1;
}

.rules-search input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: #eaf3ff;
  font-size: 0.78rem;
}

.rules-search input::placeholder {
  color: #6f829e;
}

.rules-search kbd {
  padding: 2px 6px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.04);
  color: #677c98;
  font-size: 0.58rem;
  box-shadow: none;
}

.rules-clear {
  padding: 0 13px;
  border: 1px solid rgba(125, 175, 255, 0.14);
  border-radius: 11px;
  background: rgba(74, 163, 255, 0.06);
  color: #8ebcf0;
  font-size: 0.67rem;
  font-weight: 850;
  cursor: pointer;
}

.severity-filters {
  padding: 5px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 4px;
  border: 1px solid rgba(255, 255, 255, 0.065);
  border-radius: 11px;
  background: rgba(0, 0, 0, 0.14);
}

.severity-filters button {
  --severity: #7baee8;
  min-height: 35px;
  padding: 7px 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: #8499b5;
  font-size: 0.66rem;
  font-weight: 850;
  cursor: pointer;
}

.severity-filters button[data-severity-filter="medium"] {
  --severity: var(--severity-medium);
}

.severity-filters button[data-severity-filter="high"] {
  --severity: var(--severity-high);
}

.severity-filters button:hover {
  background: rgba(255, 255, 255, 0.035);
  color: #d6e4f7;
}

.severity-filters button.active {
  border-color: rgba(125, 175, 255, 0.17);
  background: rgba(74, 163, 255, 0.09);
  color: #edf5ff;
}

.severity-filters button > i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--severity);
}

.severity-filters button > span {
  min-width: 19px;
  padding: 2px 5px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.055);
  color: #7890ae;
  font-size: 0.56rem;
}

.rules-results-meta {
  color: #7186a2;
  font-size: 0.63rem;
  font-weight: 850;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.enforcement-notice {
  padding: 16px 18px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  border-radius: 16px;
  border-color: rgba(225, 185, 91, 0.15);
  background: linear-gradient(
    180deg,
    rgba(25, 24, 24, 0.82),
    rgba(16, 18, 23, 0.82)
  );
}

.enforcement-notice > span {
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: rgba(225, 185, 91, 0.08);
  color: #ddbb68;
}

.enforcement-notice strong {
  color: #ede5d0;
  font-size: 0.76rem;
}

.enforcement-notice p {
  margin: 4px 0 0;
  color: #aaa28f;
  font-size: 0.68rem;
  line-height: 1.5;
}

.rules-sections {
  display: grid;
  gap: 14px;
}

.rules-section {
  padding: 22px;
  scroll-margin-top: 105px;
}

.rules-section[hidden],
.rule-card[hidden] {
  display: none;
}

.rule-section-header {
  padding-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.075);
}

.section-identity {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 11px;
}

.section-number {
  color: #607b9d;
  font-size: 0.65rem;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.section-icon {
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(125, 175, 255, 0.16);
  border-radius: 12px;
  background: rgba(74, 163, 255, 0.07);
  color: #72b1f7;
}

.section-identity h2 {
  margin: 3px 0 0;
  color: #eef5ff;
  font-size: 1.08rem;
  font-weight: 900;
}

.section-identity .section-kicker {
  font-size: 0.57rem;
}

.section-meta {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 5px;
  color: #7186a2;
  font-size: 0.62rem;
  font-weight: 800;
}

.section-meta > span {
  color: #9bb3cf;
}

.section-meta a {
  width: 29px;
  height: 29px;
  margin-left: 5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(125, 175, 255, 0.12);
  border-radius: 8px;
  color: #6c9ed4;
  text-decoration: none;
}

.rule-grid {
  margin-top: 14px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
}

.rule-card {
  min-width: 0;
  min-height: 150px;
  padding: 15px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.03);
  transition:
    border-color 0.18s ease,
    background 0.18s ease,
    transform 0.18s ease;
}

.rule-card:hover {
  border-color: rgba(125, 175, 255, 0.18);
  background: rgba(74, 163, 255, 0.045);
  transform: translateY(-1px);
}

.rule-card-top {
  display: flex;
  align-items: center;
  gap: 8px;
}

.rule-icon {
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 9px;
  background: rgba(74, 163, 255, 0.065);
  color: #6ba8eb;
  font-size: 0.75rem;
}

.rule-reference {
  color: #607590;
  font-size: 0.57rem;
  font-weight: 900;
  letter-spacing: 0.06em;
}

.rule-severity {
  --severity: var(--severity-low);
  margin-left: auto;
  padding: 4px 7px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 1px solid rgba(255, 255, 255, 0.075);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.025);
  color: #98aac0;
  font-size: 0.55rem;
  font-weight: 900;
  letter-spacing: 0.045em;
  text-transform: uppercase;
}

.rule-severity.severity-medium {
  --severity: var(--severity-medium);
}

.rule-severity.severity-high {
  --severity: var(--severity-high);
}

.rule-severity i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--severity);
}

.rule-card h3 {
  margin: 13px 0 0;
  color: #e5eefb;
  font-size: 0.83rem;
  font-weight: 900;
}

.rule-card p {
  margin: 6px 0 0;
  color: #8fa3bd;
  font-size: 0.7rem;
  line-height: 1.58;
}

.rules-empty {
  min-height: 260px;
  padding: 42px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 1px dashed rgba(125, 175, 255, 0.15);
  border-radius: 17px;
  text-align: center;
}

.rules-empty[hidden] {
  display: none;
}

.rules-empty > span {
  width: 48px;
  height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  background: rgba(74, 163, 255, 0.07);
  color: #70acef;
  font-size: 1.15rem;
}

.rules-empty h2 {
  margin: 13px 0 0;
  color: #e6f0fc;
  font-size: 1rem;
}

.rules-empty p {
  margin: 5px 0 0;
  color: #8499b4;
  font-size: 0.72rem;
}

.rules-empty button {
  margin-top: 13px;
  padding: 8px 12px;
  border: 1px solid rgba(125, 175, 255, 0.17);
  border-radius: 9px;
  background: rgba(74, 163, 255, 0.08);
  color: #8fc3ff;
  font-size: 0.67rem;
  font-weight: 850;
  cursor: pointer;
}

.rules-page :is(a, button, input):focus-visible {
  outline: 2px solid #78b7ff;
  outline-offset: 3px;
}

@media (max-width: 1180px) {
  .rules-layout {
    grid-template-columns: 260px minmax(0, 1fr);
  }

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

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

@media (max-width: 960px) {
  .rules-hero {
    grid-template-columns: 1fr 310px;
    gap: 28px;
    padding: 34px;
  }

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

  .rules-sidebar {
    grid-template-columns: 1fr 1fr;
  }

  .rules-index {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 720px) {
  .rules-page {
    padding: 24px 14px 52px;
  }

  .rules-hero {
    min-height: 0;
    padding: 27px;
    grid-template-columns: 1fr;
  }

  .rules-hero h1 {
    font-size: clamp(2.25rem, 10vw, 3.3rem);
  }

  .rules-hero-summary {
    width: 100%;
  }

  .rules-principles,
  .rules-index-panel,
  .severity-panel,
  .rules-controls,
  .rules-section {
    padding: 20px;
  }

  .rules-sidebar,
  .principles-grid {
    grid-template-columns: 1fr;
  }

  .severity-filters {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 520px) {
  .rules-hero {
    padding: 23px 20px;
  }

  .rules-hero-actions {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr;
  }

  .rules-hero-summary dl {
    grid-template-columns: 1fr;
  }

  .rules-hero-summary dl .wide {
    grid-column: auto;
  }

  .principles-note,
  .rules-search kbd,
  .section-number {
    display: none;
  }

  .rules-index {
    grid-template-columns: 1fr;
  }

  .rules-search-wrap {
    grid-template-columns: 1fr;
  }

  .rules-clear {
    min-height: 38px;
  }

  .severity-filters {
    grid-template-columns: 1fr;
  }

  .rule-section-header {
    align-items: flex-start;
  }

  .section-meta {
    flex-direction: column;
    align-items: flex-end;
  }

  .rule-card-top {
    flex-wrap: wrap;
  }

  .rule-severity {
    margin-left: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .rules-page *,
  .rules-page *::before,
  .rules-page *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.001ms !important;
  }
}
