/* Reef Engine - Pure Raw CSS */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:ital,wght@0,300;0,400;0,500;0,600;0,700;0,800;1,400&family=JetBrains+Mono:ital,wght@0,400;0,500;0,600;0,700;1,400&display=swap');

:root {
  --bg-dark: #0A0A0A;
  --bg-card: #080808;
  --bg-input: #050505;
  --text-main: #F0F0F0;
  --text-muted: rgba(255, 255, 255, 0.6);
  --text-dim: rgba(255, 255, 255, 0.4);
  --border-color: rgba(255, 255, 255, 0.1);
  --border-color-subtle: rgba(255, 255, 255, 0.05);
  --accent-white: #FFFFFF;
  --font-sans: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  background-color: var(--bg-dark);
  color: var(--text-main);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
}

::selection {
  background-color: #FFFFFF;
  color: #000000;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: var(--bg-card);
}
::-webkit-scrollbar-thumb {
  background: #262626;
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: #404040;
}

.no-scrollbar::-webkit-scrollbar {
  display: none;
}
.no-scrollbar {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

/* App Layout */
.app-container {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: 1;
}

/* Header */
.header-sticky {
  position: sticky;
  top: 0;
  z-index: 30;
  background-color: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
}

.header-inner {
  max-width: 80rem;
  margin: 0 auto;
  padding: 0 1rem;
}

.header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 4rem;
  gap: 1rem;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  /* No painted fill: a fill can expose the overlay's rectangular bounds in
     browsers that do not clip backdrop-filter to a CSS mask. */
  background: transparent;
  border: none;
  color: inherit;
  cursor: pointer;
  text-align: left;
}

.brand-icon {
  width: 1.75rem;
  height: 1.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.brand-icon-img {
  width: 1.75rem;
  height: 1.75rem;
  object-fit: contain;
  display: block;
}

.brand-title {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.875rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.brand-title-dim {
  color: var(--text-dim);
}

.badge-version {
  display: inline-flex;
  align-items: center;
  padding: 0.125rem 0.5rem;
  font-size: 0.625rem;
  font-family: var(--font-mono);
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  background-color: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
  border: 1px solid var(--border-color);
}

.search-trigger-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.375rem 0.75rem;
  font-size: 0.75rem;
  font-family: var(--font-mono);
  letter-spacing: 0.05em;
  font-weight: 500;
  background-color: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
  border: 1px solid var(--border-color);
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.search-trigger-btn:hover {
  background-color: rgba(255, 255, 255, 0.1);
  color: var(--accent-white);
}

.kbd-badge {
  display: inline-block;
  padding: 0.125rem 0.375rem;
  font-size: 0.625rem;
  font-family: var(--font-mono);
  font-weight: 700;
  background-color: #000000;
  color: var(--text-dim);
  border: 1px solid var(--border-color);
}

.github-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.375rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  background-color: var(--accent-white);
  color: #000000;
  text-decoration: none;
  transition: background-color 0.15s ease;
}
.github-btn:hover {
  background-color: #E0E0E0;
}

/* Nav Tabs */
.nav-row {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  overflow-x: auto;
  border-top: 1px solid var(--border-color-subtle);
  padding: 0.5rem 0;
  margin-bottom: -1px;
}

.tab-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.375rem 0.75rem;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-family: var(--font-sans);
  background: rgba(255,255,255,0.02);
  color: var(--text-dim);
  border: 1px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}
.tab-btn:hover {
  color: var(--accent-white);
  background-color: rgba(255, 255, 255, 0.05);
}
.tab-btn.active {
  background-color: var(--accent-white);
  color: #000000;
  font-weight: 700;
}

/* Main Content */
.main-content {
  flex: 1;
  max-width: 80rem;
  width: 100%;
  margin: 0 auto;
  padding: 1.5rem 1rem;
}

/* Card Containers */
.card-panel {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  padding: 1.5rem;
  position: relative;
  overflow: hidden;
}

.card-title-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.25rem 0.625rem;
  background-color: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  font-size: 0.625rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-family: var(--font-mono);
  font-weight: 600;
}

.card-heading {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--text-main);
  margin-top: 0.75rem;
}

.card-desc {
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.6;
  margin-top: 0.5rem;
}

/* Grid Layouts */
.grid-2 {
  display: grid;
  grid-template-columns: repeat(1, minmax(0, 1fr));
  gap: 1rem;
}
@media (min-width: 640px) {
  .grid-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.grid-4 {
  display: grid;
  grid-template-columns: repeat(1, minmax(0, 1fr));
  gap: 1rem;
}
@media (min-width: 640px) {
  .grid-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (min-width: 1024px) {
  .grid-4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

/* Buttons */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background-color: var(--accent-white);
  color: #000000;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 0.75rem;
  border: none;
  cursor: pointer;
  transition: background-color 0.15s ease;
  text-decoration: none;
}
.btn-primary:hover {
  background-color: #E0E0E0;
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background-color: rgba(255, 255, 255, 0.05);
  color: var(--accent-white);
  border: 1px solid var(--border-color);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 0.75rem;
  cursor: pointer;
  transition: background-color 0.15s ease;
  text-decoration: none;
}
.btn-secondary:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

/* Code Blocks */
.code-block {
  background-color: var(--bg-input);
  border: 1px solid var(--border-color);
  padding: 0.875rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.8);
  overflow-x: auto;
  line-height: 1.6;
  white-space: pre-wrap;
  user-select: all;
}

/* Table styling */
.custom-table {
  width: 100%;
  text-align: left;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  border-collapse: collapse;
}
.custom-table th {
  border-bottom: 1px solid var(--border-color);
  background-color: var(--bg-input);
  padding: 0.875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #FFFFFF;
}
.custom-table td {
  border-bottom: 1px solid var(--border-color-subtle);
  padding: 0.875rem;
  color: rgba(255, 255, 255, 0.8);
}
.custom-table tr:hover td {
  background-color: rgba(255, 255, 255, 0.03);
}

/* Accordion */
.accordion-item {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  overflow: hidden;
  margin-bottom: 0.75rem;
}
.accordion-header {
  width: 100%;
  padding: 1rem;
  text-align: left;
  background: transparent;
  border: none;
  color: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.accordion-header:hover {
  background-color: rgba(255, 255, 255, 0.03);
}
.accordion-body {
  padding: 1rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border-color);
  background-color: var(--bg-input);
  font-size: 0.875rem;
  color: rgba(255, 255, 255, 0.7);
  line-height: 1.6;
}

/* Modal Palette */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  background-color: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 3rem 1rem 1rem 1rem;
}
.modal-box {
  width: 100%;
  max-width: 42rem;
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7);
  overflow: hidden;
}

/* Footer */
.footer-bar {
  background-color: var(--bg-card);
  border-top: 1px solid var(--border-color);
  color: var(--text-dim);
  font-size: 0.625rem;
  text-transform: uppercase;
  font-family: var(--font-mono);
  letter-spacing: 0.1em;
  padding: 1rem;
  margin-top: auto;
}
.footer-inner {
  max-width: 80rem;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}
@media (min-width: 640px) {
  .footer-inner {
    flex-direction: row;
  }
}

.status-dot {
  position: relative;
  display: flex;
  height: 0.5rem;
  width: 0.5rem;
}
.status-dot-ping {
  animation: ping 1s cubic-bezier(0, 0, 0.2, 1) infinite;
  position: absolute;
  display: inline-flex;
  height: 100%;
  width: 100%;
  border-radius: 9999px;
  background-color: #FFFFFF;
  opacity: 0.75;
}
.status-dot-core {
  position: relative;
  display: inline-flex;
  border-radius: 9999px;
  height: 0.5rem;
  width: 0.5rem;
  background-color: #FFFFFF;
}

@keyframes ping {
  75%, 100% {
    transform: scale(2);
    opacity: 0;
  }
}

/* ── Comparison Table Badges ─────────────────────────────────────── */
.badge-success,
.badge-warning,
.badge-error {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.625rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 0.2rem 0.45rem;
  border-radius: 2px;
  white-space: nowrap;
  line-height: 1.4;
}

.badge-success {
  background-color: rgba(34, 197, 94, 0.12);
  color: #4ade80;
  border: 1px solid rgba(34, 197, 94, 0.25);
}

.badge-warning {
  background-color: rgba(234, 179, 8, 0.12);
  color: #facc15;
  border: 1px solid rgba(234, 179, 8, 0.25);
}

.badge-error {
  background-color: rgba(239, 68, 68, 0.1);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.2);
}

#comparisonTable td {
  vertical-align: middle;
}

#comparisonTable tbody tr:first-child td {
  padding-top: 0.625rem;
  padding-bottom: 0.625rem;
}

/* ── Motion System ──────────────────────────────────────────────── */
:root {
  --motion-ease: cubic-bezier(0.22, 1, 0.36, 1);
  --motion-fast: 160ms;
  --motion-base: 420ms;
}

html {
  scroll-behavior: smooth;
}

body {
  position: relative;
  overflow-x: hidden;
}

.install-mode-note { margin-top: 0.625rem; padding: 0.625rem; border-left: 2px solid #8df3e5; color: var(--text-dim); font-size: 0.6875rem; line-height: 1.5; }

.header-sticky {
  background-color: var(--bg-card);
}

.brand-icon-img {
  transition: transform 500ms var(--motion-ease), filter 500ms ease;
}
.brand-logo:hover .brand-icon-img {
  transform: rotate(-8deg) scale(1.08);
  filter: drop-shadow(0 0 0.75rem rgba(255,255,255,0.22));
}

.badge-version,
.github-btn,
.btn-primary,
.btn-secondary,
.tab-btn,
.card-panel,
.arch-phase-btn,
.accordion-header,
.modal-item,
.custom-table tr {
  transition: background-color var(--motion-fast) ease, border-color var(--motion-fast) ease, color var(--motion-fast) ease, transform var(--motion-fast) var(--motion-ease), box-shadow var(--motion-fast) ease;
}

.github-btn:hover,
.btn-primary:hover,
.btn-secondary:hover {
  transform: translateY(-2px);
  box-shadow: 0 0.55rem 1.25rem rgba(0,0,0,0.28);
}

.github-btn:active,
.btn-primary:active,
.btn-secondary:active,
.tab-btn:active {
  transform: translateY(0) scale(0.98);
}

.tab-pane.active {
  animation: pane-enter 520ms var(--motion-ease) both;
}

.tab-pane.active > .card-panel,
.tab-pane.active > .grid-4 > .card-panel,
.tab-pane.active > .grid-2 > .card-panel {
  animation: card-enter 560ms var(--motion-ease) both;
}

.tab-pane.active > *:nth-child(2) { animation-delay: 70ms; }
.tab-pane.active > *:nth-child(3) { animation-delay: 130ms; }
.tab-pane.active > *:nth-child(4) { animation-delay: 190ms; }

.card-panel:hover {
  border-color: rgba(255,255,255,0.2);
}

.grid-4 > .card-panel:hover,
.grid-2 > .card-panel:hover,
.arch-phase-btn:hover {
  transform: translateY(-4px);
  box-shadow: 0 1rem 2rem rgba(0,0,0,0.22);
}

.code-block {
  transition: border-color var(--motion-fast) ease, background-color var(--motion-fast) ease;
}
.code-block:hover {
  border-color: rgba(255,255,255,0.22);
  background-color: #080808;
}

.modal-overlay {
  animation: overlay-in 220ms ease both;
}
.modal-box {
  animation: modal-in 420ms var(--motion-ease) both;
}
.modal-overlay.is-closing {
  animation: overlay-out 180ms ease both;
}
.modal-overlay.is-closing .modal-box {
  animation: modal-out 180ms ease both;
}

.accordion-body {
  animation: accordion-in 300ms var(--motion-ease) both;
  transform-origin: top;
}

.status-dot-ping {
  animation-duration: 2.4s;
}

@keyframes header-settle {
  from { opacity: 0; transform: translateY(-0.75rem); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes content-rise {
  from { opacity: 0; transform: translateY(0.75rem); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes pane-enter {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes card-enter {
  from { opacity: 0; transform: translateY(0.75rem); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes overlay-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes overlay-out {
  from { opacity: 1; }
  to { opacity: 0; }
}
@keyframes modal-in {
  from { opacity: 0; transform: translateY(-1rem) scale(0.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes modal-out {
  from { opacity: 1; transform: translateY(0) scale(1); }
  to { opacity: 0; transform: translateY(-0.5rem) scale(0.985); }
}
@keyframes accordion-in {
  from { opacity: 0; transform: scaleY(0.92); }
  to { opacity: 1; transform: scaleY(1); }
}

/* Extension Launch Notification Button */
.ext-launch-wrapper {
  position: relative;
}

.ext-launch-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.375rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 700;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  background-color: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
  border: 1px solid var(--border-color);
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
  position: relative;
}
.ext-launch-btn:hover {
  background-color: rgba(255, 255, 255, 0.1);
  color: var(--accent-white);
  border-color: rgba(255, 255, 255, 0.2);
}
.ext-launch-btn[aria-expanded="true"] {
  background-color: rgba(255, 255, 255, 0.1);
  color: var(--accent-white);
  border-color: rgba(255, 255, 255, 0.2);
}

.ext-launch-link {
  text-decoration: none;
  color: var(--text-muted);
}
.ext-launch-link:hover {
  color: var(--accent-white);
}

.ext-launch-dot {
  position: absolute;
  top: -3px;
  right: -3px;
  width: 8px;
  height: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ext-launch-dot-ping {
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: #3b82f6;
  opacity: 0.75;
  animation: ext-ping 1.5s cubic-bezier(0, 0, 0.2, 1) infinite;
}
.ext-launch-dot-core {
  position: relative;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: #3b82f6;
  border: 1px solid #0A0A0A;
}

@keyframes ext-ping {
  75%, 100% {
    transform: scale(2.2);
    opacity: 0;
  }
}

.ext-dropdown {
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  width: 320px;
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.04);
  z-index: 50;
  display: flex;
  flex-direction: column;
  animation: ext-dropdown-in 0.15s ease-out;
}
.ext-dropdown[hidden] {
  display: none;
}

@keyframes ext-dropdown-in {
  from { opacity: 0; transform: translateY(-0.375rem) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.ext-dropdown-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.875rem 1rem;
  border-bottom: 1px solid var(--border-color);
}

.ext-dropdown-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.125rem 0.375rem;
  font-size: 0.5625rem;
  font-family: var(--font-mono);
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  background-color: #3b82f6;
  color: #FFFFFF;
  border-radius: 2px;
}

.ext-dropdown-desc {
  padding: 0.75rem 1rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.55;
  border-bottom: 1px solid var(--border-color-subtle);
}

.ext-dropdown-features {
  display: flex;
  flex-direction: column;
  padding: 0.5rem 0;
  max-height: 280px;
  overflow-y: auto;
}

.ext-feature-item {
  display: flex;
  align-items: flex-start;
  gap: 0.625rem;
  padding: 0.5rem 1rem;
  transition: background-color 0.1s ease;
}
.ext-feature-item:hover {
  background-color: rgba(255, 255, 255, 0.03);
}
.ext-feature-item svg {
  flex-shrink: 0;
  margin-top: 2px;
  color: var(--text-dim);
}

.ext-feature-title {
  font-size: 0.75rem;
  font-weight: 700;
  color: #FFFFFF;
  font-family: var(--font-mono);
  margin-bottom: 0.125rem;
}

.ext-feature-desc {
  font-size: 0.6875rem;
  color: var(--text-dim);
  line-height: 1.5;
}
.ext-feature-desc code {
  font-family: var(--font-mono);
  font-size: 0.625rem;
  padding: 0.0625rem 0.25rem;
  background-color: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
}

.ext-dropdown-actions {
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--border-color);
}

.ext-dropdown-install-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.5rem;
  font-size: 0.75rem;
  font-weight: 700;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  background-color: var(--accent-white);
  color: #000000;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: background-color 0.15s ease;
}
.ext-dropdown-install-btn:hover {
  background-color: #E0E0E0;
}

@media (max-width: 480px) {
  .ext-dropdown {
    position: fixed;
    top: auto;
    right: 0.5rem;
    left: 0.5rem;
    width: auto;
  }
}

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