/* Notion-inspired Design System for Docker Mirror Service */

:root {
  /* Brand Colors */
  --primary: #5645d4;
  --primary-pressed: #4534b3;
  --primary-deep: #3a2a99;
  --on-primary: #ffffff;

  /* Brand Accents */
  --brand-orange: #dd5b00;
  --brand-pink: #ff64c8;
  --brand-purple: #7b3ff2;
  --brand-teal: #2a9d99;
  --brand-green: #1aae39;
  --brand-yellow: #f5d75e;

  /* Card Tints */
  --card-peach: #ffe8d4;
  --card-rose: #fde0ec;
  --card-mint: #d9f3e1;
  --card-lavender: #e6e0f5;
  --card-sky: #dcecfa;
  --card-yellow: #fef7d6;
  --card-cream: #f8f5e8;
  --card-gray: #f0eeec;

  /* Surface & Background */
  --canvas: #ffffff;
  --surface: #f6f5f4;
  --surface-soft: #fafaf9;

  /* Borders */
  --hairline: #e5e3df;
  --hairline-soft: #ede9e4;
  --hairline-strong: #c8c4be;

  /* Text Colors */
  --ink-deep: #000000;
  --ink: #1a1a1a;
  --charcoal: #37352f;
  --slate: #5d5b54;
  --steel: #787671;
  --stone: #a4a097;
  --muted: #bbb8b1;

  /* Semantic Colors */
  --success: #1aae39;
  --warning: #dd5b00;
  --error: #e03131;
  --link: #0075de;
  --link-hover: #005bab;

  /* Component Tokens */
  --code-bg: #1a1a1a;
  --code-text: #e5e5e5;
  --container-bg: var(--canvas);
  --body-bg: var(--surface);
  --text: var(--ink);
  --text-secondary: var(--charcoal);
  --border: var(--hairline);
  --notice-bg: var(--card-yellow);
  --notice-border: var(--warning);
  --table-hover: var(--surface-soft);
  --table-header: var(--surface);
  --transition: 0.2s ease;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04), 0 1px 4px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 8px rgba(0, 0, 0, 0.04), 0 2px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 8px 16px rgba(0, 0, 0, 0.06), 0 4px 24px rgba(0, 0, 0, 0.1);

  /* Border Radius */
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-pill: 9999px;

  /* Spacing */
  --space-xxs: 4px;
  --space-xs: 8px;
  --space-sm: 12px;
  --space-md: 16px;
  --space-lg: 20px;
  --space-xl: 24px;
  --space-2xl: 32px;
  --space-3xl: 40px;
  --space-4xl: 48px;

  /* Typography */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --font-mono: 'SF Mono', 'Fira Code', 'Consolas', monospace;
}

[data-theme="dark"] {
  --primary: #7b6ce6;
  --primary-pressed: #6a5bd4;
  --primary-deep: #5645d4;
  --on-primary: #ffffff;

  --canvas: #191919;
  --surface: #202020;
  --surface-soft: #252525;

  --hairline: #333333;
  --hairline-soft: #2a2a2a;
  --hairline-strong: #444444;

  --ink-deep: #ffffff;
  --ink: #f0f0f0;
  --charcoal: #e0e0e0;
  --slate: #b0b0b0;
  --steel: #909090;
  --stone: #707070;
  --muted: #505050;

  --link: #4da6ff;
  --link-hover: #80bfff;

  --code-bg: #0d0d0d;
  --code-text: #e5e5e5;
  --container-bg: var(--canvas);
  --body-bg: var(--surface);
  --text: var(--ink);
  --text-secondary: var(--charcoal);
  --border: var(--hairline);
  --table-header: var(--surface-soft);
  --table-hover: var(--surface-soft);

  --card-peach: #3d2a1a;
  --card-rose: #3d1a2a;
  --card-mint: #1a3d2a;
  --card-lavender: #2a1a3d;
  --card-sky: #1a2a3d;
  --card-yellow: #3d3a1a;
  --card-cream: #3d3a2a;
  --card-gray: #2a2a2a;
  --notice-bg: var(--card-yellow);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.2), 0 1px 4px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 8px rgba(0, 0, 0, 0.2), 0 2px 12px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 8px 16px rgba(0, 0, 0, 0.25), 0 4px 24px rgba(0, 0, 0, 0.35);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --primary: #7b6ce6;
    --primary-pressed: #6a5bd4;
    --primary-deep: #5645d4;
    --on-primary: #ffffff;

    --canvas: #191919;
    --surface: #202020;
    --surface-soft: #252525;

    --hairline: #333333;
    --hairline-soft: #2a2a2a;
    --hairline-strong: #444444;

    --ink-deep: #ffffff;
    --ink: #f0f0f0;
    --charcoal: #e0e0e0;
    --slate: #b0b0b0;
    --steel: #909090;
    --stone: #707070;
    --muted: #505050;

    --link: #4da6ff;
    --link-hover: #80bfff;

    --code-bg: #0d0d0d;
    --code-text: #e5e5e5;
    --container-bg: var(--canvas);
    --body-bg: var(--surface);
    --text: var(--ink);
    --text-secondary: var(--charcoal);
    --border: var(--hairline);
    --table-header: var(--surface-soft);
    --table-hover: var(--surface-soft);

    --card-peach: #3d2a1a;
    --card-rose: #3d1a2a;
    --card-mint: #1a3d2a;
    --card-lavender: #2a1a3d;
    --card-sky: #1a2a3d;
    --card-yellow: #3d3a1a;
    --card-cream: #3d3a2a;
    --card-gray: #2a2a2a;
    --notice-bg: var(--card-yellow);

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.2), 0 1px 4px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 8px rgba(0, 0, 0, 0.2), 0 2px 12px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 8px 16px rgba(0, 0, 0, 0.25), 0 4px 24px rgba(0, 0, 0, 0.35);
  }
}

* { box-sizing: border-box; }

body {
  font-family: var(--font-sans);
  line-height: 1.6;
  color: var(--text);
  margin: 0;
  padding: var(--space-xl);
  background: var(--body-bg);
  transition: background var(--transition), color var(--transition);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.container {
  max-width: 860px;
  margin: 0 auto;
  padding: var(--space-2xl);
  background: var(--container-bg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border);
}

h1, h2, h3 {
  color: var(--text);
  margin-bottom: var(--space-md);
  line-height: 1.3;
}

h1 {
  font-size: 2.5rem;
  font-weight: 600;
  text-align: center;
  letter-spacing: -0.5px;
}

h2 {
  font-size: 1.5rem;
  font-weight: 600;
  border-bottom: 1px solid var(--border);
  padding-bottom: var(--space-xs);
}

h3 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-top: var(--space-lg);
}

a {
  color: var(--link);
  text-decoration: none;
  transition: color var(--transition);
}

a:hover {
  text-decoration: underline;
  color: var(--link-hover);
}

/* Theme toggle */
.theme-toggle {
  position: fixed;
  top: var(--space-md);
  right: var(--space-md);
  z-index: 1000;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--container-bg);
  color: var(--text);
  font-size: 1.2em;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition);
}

.theme-toggle:hover {
  transform: scale(1.05);
  box-shadow: var(--shadow-md);
  background: var(--primary);
  color: var(--on-primary);
}

/* Notice box */
.notice-box {
  background: var(--notice-bg);
  border-left: 3px solid var(--notice-border);
  padding: var(--space-md);
  margin: var(--space-lg) 0;
  border-radius: var(--radius-sm);
  position: relative;
}

.notice-close {
  position: absolute;
  top: var(--space-xs);
  right: var(--space-sm);
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.2em;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: var(--radius-xs);
  transition: color var(--transition);
}

.notice-close:hover {
  color: var(--text);
}

/* Code blocks */
pre {
  position: relative;
  background: var(--code-bg);
  color: var(--code-text);
  padding: 40px var(--space-lg) var(--space-lg);
  border-radius: var(--radius-md);
  overflow-x: auto;
  margin: var(--space-md) 0;
  font-size: 0.875em;
  font-family: var(--font-mono);
  line-height: 1.7;
}

pre::before {
  content: "";
  position: absolute;
  top: 14px;
  left: 15px;
  width: 12px;
  height: 12px;
  background: #ff5f56;
  border-radius: 50%;
  box-shadow: 20px 0 0 #ffbd2e, 40px 0 0 #27c93f;
}

code {
  font-family: var(--font-mono);
  font-size: 0.875em;
}

.copy-btn {
  position: absolute;
  top: 10px;
  right: 12px;
  background: var(--primary);
  color: var(--on-primary);
  border: none;
  padding: var(--space-xxs) var(--space-sm);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.85em;
  font-weight: 500;
  opacity: 0;
  transition: all var(--transition);
  white-space: nowrap;
}

pre:hover .copy-btn,
pre:focus-within .copy-btn {
  opacity: 1;
}

.copy-btn:hover {
  background: var(--primary-pressed);
}

.copy-btn.copied {
  background: var(--success);
}

/* Table */
.table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: var(--space-lg) 0;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--container-bg);
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border);
}

th, td {
  padding: var(--space-sm) var(--space-md);
  text-align: left;
  border-bottom: 1px solid var(--border);
}

th {
  background-color: var(--table-header);
  font-weight: 600;
  font-size: 0.875em;
  white-space: nowrap;
  color: var(--text-secondary);
}

tr:hover td {
  background-color: var(--table-hover);
}

td code {
  background: var(--card-lavender);
  color: var(--primary-deep);
  padding: 2px 6px;
  border-radius: var(--radius-xs);
  font-size: 0.85em;
  white-space: nowrap;
}

[data-theme="dark"] td code {
  background: var(--card-lavender);
  color: var(--primary);
}

/* Search */
.search-box {
  margin: var(--space-sm) 0;
}

.search-box input {
  width: 100%;
  max-width: 360px;
  padding: var(--space-xs) var(--space-md);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 0.875em;
  background: var(--canvas);
  color: var(--text);
  transition: all var(--transition);
  height: 40px;
}

.search-box input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(86, 69, 212, 0.15);
}

.search-box input::placeholder {
  color: var(--stone);
}

/* Domain cards */
.domain-list {
  list-style: none;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: var(--space-sm);
}

.domain-list li {
  background: var(--canvas);
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 0.875em;
  transition: all var(--transition);
}

.domain-list li:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.domain-list li .node-label {
  display: block;
  font-size: 0.75em;
  color: var(--steel);
  margin-top: 2px;
  font-family: var(--font-sans);
}

.domain-list li .latency {
  float: right;
  font-size: 0.8em;
  font-weight: 500;
  padding: 2px 10px;
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
}

.domain-list li .latency.checking {
  color: var(--stone);
  background: transparent;
}

.domain-list li .latency.fast {
  color: var(--success);
  background: var(--card-mint);
}

.domain-list li .latency.medium {
  color: var(--warning);
  background: var(--card-peach);
}

.domain-list li .latency.slow {
  color: var(--error);
  background: var(--card-rose);
}

.domain-list li .latency.fail {
  color: var(--muted);
  background: var(--card-gray);
}

/* Badges */
.badge-group {
  display: inline-flex;
  gap: var(--space-xxs);
  flex-wrap: wrap;
  align-items: center;
}

.github-badge {
  display: inline-flex;
  align-items: center;
  border-radius: var(--radius-sm);
  font-size: 13px;
  overflow: hidden;
  line-height: 1.5;
  text-decoration: none;
}

.github-badge .badge-subject {
  background-color: var(--slate);
  color: var(--canvas);
  padding: 3px 10px;
  font-weight: 500;
}

.github-badge .badge-value {
  color: var(--canvas);
  padding: 3px 10px;
  font-weight: 500;
}

.bg-blue { background-color: var(--link); }
.bg-green { background-color: var(--success); }
.bg-orange { background-color: var(--warning); }

a.github-badge:hover {
  text-decoration: none;
  opacity: 0.9;
  transform: translateY(-1px);
}

/* Stats */
.stats {
  text-align: center;
  margin: var(--space-lg) 0;
}

/* Back to top */
.back-to-top {
  position: fixed;
  bottom: var(--space-lg);
  right: var(--space-lg);
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--container-bg);
  color: var(--text);
  font-size: 1.2em;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-sm);
  opacity: 0;
  pointer-events: none;
  transition: all var(--transition);
  z-index: 999;
}

.back-to-top.visible {
  opacity: 1;
  pointer-events: auto;
}

.back-to-top:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  background: var(--primary);
  color: var(--on-primary);
}

/* Links section */
.links {
  margin: var(--space-lg) 0;
}

.links img {
  max-width: 100%;
  margin-top: var(--space-md);
  border-radius: var(--radius-sm);
}

/* Footer */
.footer {
  margin-top: var(--space-3xl);
  text-align: center;
  padding-top: var(--space-lg);
  border-top: 1px solid var(--border);
}

.footer .badge-group {
  margin-bottom: var(--space-xs);
}

.cf-info {
  margin: var(--space-sm) 0 0;
  font-size: 0.85em;
  color: var(--steel);
  min-height: 1.3em;
}

/* No results */
.no-results {
  text-align: center;
  color: var(--steel);
  padding: var(--space-lg);
  display: none;
}

/* Responsive */
@media (max-width: 768px) {
  body { padding: var(--space-sm); }

  .container {
    padding: var(--space-lg);
    margin: 0;
    border-radius: var(--radius-md);
  }

  h1 { font-size: 1.75rem; }
  h2 { font-size: 1.25rem; }

  pre {
    font-size: 0.8em;
    padding: 32px var(--space-sm) var(--space-sm);
  }

  pre::before {
    top: 10px;
    left: 10px;
    width: 10px;
    height: 10px;
    box-shadow: 16px 0 0 #ffbd2e, 32px 0 0 #27c93f;
  }

  .copy-btn {
    opacity: 1;
    font-size: 0.75em;
    padding: 3px 8px;
    top: 8px;
    right: 8px;
  }

  .domain-list {
    grid-template-columns: 1fr;
  }

  th, td { padding: var(--space-xs) var(--space-sm); font-size: 0.85em; }

  .theme-toggle {
    top: var(--space-xs);
    right: var(--space-xs);
    width: 36px;
    height: 36px;
    font-size: 1em;
  }

  .back-to-top {
    bottom: var(--space-md);
    right: var(--space-md);
    width: 36px;
    height: 36px;
  }
}

@media (max-width: 480px) {
  .badge-group { gap: 2px; }
  .github-badge { font-size: 11px; }
  .github-badge .badge-subject,
  .github-badge .badge-value { padding: 2px 6px; }
}

/* Print */
@media print {
  .theme-toggle,
  .back-to-top,
  .copy-btn,
  .notice-close { display: none !important; }
}
