/* ============================================================
   goscapy docs — Warm Light Theme Design System
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

/* ---------- Reset & Base ---------- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: #FAF9F6;
  min-height: 100vh;
  padding: 2.5rem 2rem;
  color: #1a1a1a;
  overflow-x: hidden;
}

a {
  color: #5B8A72;
  text-decoration: none;
  transition: color 0.2s;
}
a:hover {
  color: #D97757;
}

img {
  max-width: 100%;
  height: auto;
}

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: #F5F3F0; }
::-webkit-scrollbar-thumb { background: #D9D5CF; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #B0AAA4; }

/* ---------- Container ---------- */
.container {
  max-width: 1000px;
  margin: 0 auto;
}

/* ---------- Header ---------- */
.header {
  margin-bottom: 2.5rem;
  position: relative;
  z-index: 100;
}

.header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.375rem;
  flex-wrap: wrap;
  position: relative;
  z-index: 1000;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.header-nav a {
  color: #8B8680;
  font-size: 0.8125rem;
  font-weight: 500;
  text-decoration: none;
  transition: color 0.2s;
  position: relative;
}

.header-nav a:hover {
  color: #D97757;
}

.header-nav a::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 1.5px;
  background: #D97757;
  transition: width 0.2s;
}

.header-nav a:hover::after {
  width: 100%;
}

/* Nav dropdown */
.nav-dropdown {
  position: relative;
}
.nav-dropdown-trigger {
  color: #8B8680;
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.25rem;
  background: none;
  border: none;
  padding: 0.25rem 0;
  font-family: inherit;
}
.nav-dropdown-trigger::after {
  content: '\25BE';
  font-size: 0.625rem;
  transition: transform 0.2s;
}
.nav-dropdown:hover .nav-dropdown-trigger::after {
  transform: rotate(180deg);
}
.nav-dropdown-trigger:hover {
  color: #D97757;
}
.nav-dropdown-menu {
  position: absolute;
  top: calc(100% - 4px);
  left: 50%;
  background: #FFFFFF;
  border: 1px solid #E8E4DE;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.08);
  padding: 0.375rem 0;
  min-width: 160px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s, transform 0.15s;
  transform: translateX(-50%) translateY(4px);
  z-index: 9999;
  pointer-events: none;
}
.nav-dropdown:hover .nav-dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}
.nav-dropdown-menu a {
  display: block;
  padding: 0.4rem 0.875rem;
  color: #4A4540;
  font-size: 0.75rem;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
}
.nav-dropdown-menu a:hover {
  background: #F7F6F4;
  color: #D97757;
}
.nav-dropdown-menu a.active {
  color: #D97757;
  font-weight: 600;
}

.pulse-dot {
  width: 10px;
  height: 10px;
  background: #D97757;
  border-radius: 50%;
  animation: pulse 2.5s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.6; transform: scale(0.9); }
}

h1 {
  font-size: 1.375rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #1a1a1a;
}

.subtitle {
  color: #8B8680;
  font-size: 0.8125rem;
  margin-left: 1.625rem;
  letter-spacing: 0.01em;
}

.diagram-desc {
  color: #B0AAA4;
  font-size: 0.6875rem;
  margin-top: 0.5rem;
  margin-left: 1.625rem;
  line-height: 1.5;
  font-style: italic;
}

.lang-switch {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.25rem 0.625rem;
  background: #FDFCFB;
  border: 1px solid #E8E4DE;
  border-radius: 6px;
  font-size: 0.6875rem;
  color: #8B8680;
  cursor: pointer;
  transition: all 0.2s;
  margin-left: auto;
}
.lang-switch:hover {
  border-color: #D97757;
  color: #D97757;
}

/* ---------- Headings ---------- */
h2 {
  font-size: 1.125rem;
  font-weight: 700;
  color: #1a1a1a;
  margin-top: 2.5rem;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid #E8E4DE;
}

h3 {
  font-size: 0.9375rem;
  font-weight: 600;
  color: #1a1a1a;
  margin-top: 1.5rem;
  margin-bottom: 0.75rem;
}

h4 {
  font-size: 0.8125rem;
  font-weight: 600;
  color: #1a1a1a;
}

p {
  color: #4A4540;
  font-size: 0.8125rem;
  line-height: 1.7;
  margin-bottom: 0.75rem;
}

/* ---------- TOC ---------- */
.toc {
  background: #FDFCFB;
  border: 1px solid #E8E4DE;
  border-radius: 10px;
  padding: 1.25rem 1.5rem;
  margin-bottom: 2rem;
  position: relative;
  z-index: 1;
}

.toc h3 {
  font-size: 0.8125rem;
  margin-top: 0;
  margin-bottom: 0.75rem;
  color: #8B8680;
}

.toc ul {
  list-style: none;
  font-size: 0.75rem;
}

.toc li {
  margin-bottom: 0.375rem;
}

.toc a {
  color: #5B8A72;
  text-decoration: none;
  transition: all 0.2s;
  display: inline-block;
}
.toc a:hover {
  color: #D97757;
  transform: translateX(8px);
}
.toc a.active {
  color: #D97757;
  font-weight: 600;
}

/* ---------- Section ---------- */
.section {
  background: #FFFFFF;
  border-radius: 12px;
  border: 1px solid #E8E4DE;
  padding: 1.5rem 1.75rem;
  margin-bottom: 1.25rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04), 0 4px 12px rgba(0,0,0,0.02);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.section:hover {
  box-shadow: 0 2px 6px rgba(0,0,0,0.06), 0 6px 16px rgba(0,0,0,0.04);
  transform: translateY(-2px);
}

.section-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.section-title h3 {
  margin: 0;
  font-size: 0.875rem;
}

/* ---------- Section Dots ---------- */
.section-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  transition: transform 0.3s ease;
}

.section-dot.terracotta { background: #D97757; }
.section-dot.sage       { background: #5B8A72; }
.section-dot.slate       { background: #6B7280; }
.section-dot.plum        { background: #8B6F8A; }
.section-dot.rose        { background: #C96464; }
.section-dot.amber       { background: #D4A843; }
.section-dot.teal        { background: #2D9CDB; }
.section-dot.violet      { background: #7C5CBF; }
.section-dot.coral       { background: #E8624F; }

/* ---------- Cards Grid ---------- */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.card {
  background: #FFFFFF;
  border-radius: 10px;
  border: 1px solid #E8E4DE;
  padding: 1.125rem 1.25rem;
  box-shadow: 0 1px 2px rgba(0,0,0,0.03);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
  transform: scale(1.03);
  box-shadow: 0 4px 16px rgba(0,0,0,0.08);
}

.card-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.625rem;
}

.card-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.card-dot.terracotta { background: #D97757; }
.card-dot.sage       { background: #5B8A72; }
.card-dot.slate       { background: #6B7280; }
.card-dot.plum        { background: #8B6F8A; }
.card-dot.blue        { background: #4A6FA5; }
.card-dot.amber       { background: #D4A843; }
.card-dot.teal        { background: #2D9CDB; }
.card-dot.violet      { background: #7C5CBF; }
.card-dot.coral       { background: #E8624F; }

.card h4 {
  font-size: 0.8125rem;
  font-weight: 600;
  color: #1a1a1a;
}

.card p {
  font-size: 0.75rem;
  color: #6B6560;
  line-height: 1.6;
  margin-bottom: 0.5rem;
}

.card ul {
  list-style: none;
  color: #6B6560;
  font-size: 0.75rem;
  line-height: 1.7;
}

.card li {
  margin-bottom: 0.25rem;
}

/* ---------- Flow Arrow / Steps ---------- */
.flow-arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin: 1.5rem 0;
  flex-wrap: wrap;
}

.flow-step {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: #FFFFFF;
  border: 1px solid #E8E4DE;
  border-radius: 8px;
  padding: 0.5rem 1rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: #1a1a1a;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
  transition: transform 0.3s ease;
}

.flow-step:hover {
  transform: translateY(-2px);
}

.flow-step .step-num {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.625rem;
  font-weight: 700;
  color: white;
  transition: transform 0.3s ease;
}

.flow-step:hover .step-num {
  transform: rotate(360deg);
}

.step-num.n1 { background: #D97757; }
.step-num.n2 { background: #5B8A72; }
.step-num.n3 { background: #8B6F8A; }
.step-num.n4 { background: #4A6FA5; }
.step-num.n5 { background: #D4A843; }
.step-num.n6 { background: #2D9CDB; }
.step-num.n7 { background: #E8624F; }
.step-num.n8 { background: #6B7280; }

.flow-connector {
  color: #C5C0BA;
  font-size: 1.25rem;
}

/* ---------- Code Blocks ---------- */
pre {
  background: #1a1a1a;
  border-radius: 8px;
  padding: 1rem 1.25rem;
  overflow-x: auto;
  margin: 0.75rem 0;
  font-size: 0.75rem;
  line-height: 1.6;
  color: #E8E4DE;
  font-family: 'JetBrains Mono', 'SF Mono', 'Fira Code', monospace;
}

code {
  font-family: 'JetBrains Mono', 'SF Mono', 'Fira Code', monospace;
  color: #E8E4DE;
}

/* Syntax highlighting — inside dark code blocks */
.code-body .comment,
.code-body .cmt     { color: #8B8680; font-style: italic; }
.code-body .flag    { color: #D97757; }
.code-body .value   { color: #7EC8A0; }
.code-body .cmd     { color: #E8E4DE; }
.code-body .kw      { color: #D97757; font-weight: 500; }
.code-body .fn      { color: #82AAFF; }
.code-body .str     { color: #7EC8A0; }
.code-body .type    { color: #FFCB6B; }
.code-body .num     { color: #F78C6C; }
.code-body .pkg     { color: #FFCB6B; }

/* Also target pre > span directly for code blocks without .code-body wrapper */
pre .comment,
pre .cmt     { color: #8B8680; font-style: italic; }
pre .flag    { color: #D97757; }
pre .value   { color: #7EC8A0; }
pre .cmd     { color: #E8E4DE; }
pre .kw      { color: #D97757; font-weight: 500; }
pre .fn      { color: #82AAFF; }
pre .str     { color: #7EC8A0; }
pre .type    { color: #FFCB6B; }
pre .num     { color: #F78C6C; }
pre .pkg     { color: #FFCB6B; }

/* Code block with header */
.code-block {
  position: relative;
  margin: 0.75rem 0;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid #2a2a2a;
}

.code-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.375rem 0.75rem;
  background: #2a2a2a;
  border-bottom: 1px solid #3a3a3a;
}

.code-lang {
  font-size: 0.625rem;
  font-weight: 600;
  color: #8B8680;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.code-copy {
  padding: 2px 8px;
  background: transparent;
  border: 1px solid #4a4a4a;
  border-radius: 4px;
  color: #8B8680;
  font-size: 0.625rem;
  cursor: pointer;
  transition: all 0.2s;
}
.code-copy:hover {
  border-color: #D97757;
  color: #D97757;
}

.code-body {
  background: #1a1a1a;
  padding: 1rem 1.25rem;
  overflow-x: auto;
  color: #E8E4DE;
  font-family: 'JetBrains Mono', 'SF Mono', 'Fira Code', monospace;
}

.code-body pre {
  margin: 0;
  padding: 0;
  background: none;
  border: none;
  font-size: 0.75rem;
  line-height: 1.6;
  color: #E8E4DE;
  font-family: 'JetBrains Mono', 'SF Mono', 'Fira Code', monospace;
}

/* ---------- Inline Code ---------- */
.inline-code {
  background: #F5F3F0;
  border: 1px solid #E8E4DE;
  border-radius: 4px;
  padding: 0.125rem 0.375rem;
  font-family: 'JetBrains Mono', 'SF Mono', monospace;
  font-size: 0.75rem;
  color: #C05536;
  transition: transform 0.2s ease, background 0.2s ease;
  display: inline;
}

.inline-code:hover {
  transform: scale(1.05);
  background: #FFF5F0;
}

/* Also style plain <code> used inline (not inside <pre>) */
:not(pre) > code {
  background: #F5F3F0;
  border: 1px solid #E8E4DE;
  border-radius: 4px;
  padding: 0.125rem 0.375rem;
  font-family: 'JetBrains Mono', 'SF Mono', monospace;
  font-size: 0.75rem;
  color: #C05536;
}

/* ---------- Tables ---------- */
.table-wrapper {
  overflow-x: auto;
  border-radius: 8px;
  border: 1px solid #E8E4DE;
  margin: 0.75rem 0;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.75rem;
  margin: 0;
}

th {
  background: #F7F6F4;
  font-weight: 600;
  text-align: left;
  padding: 0.625rem 0.75rem;
  color: #4A4540;
  border-bottom: 1px solid #E8E4DE;
}

td {
  padding: 0.5rem 0.75rem;
  color: #4A4540;
  border-bottom: 1px solid #F0EDE8;
}

tr:last-child td {
  border-bottom: none;
}

tr:hover td {
  background: #FDFCFB;
}

/* Layer badges */
.layer-badge {
  display: inline-block;
  padding: 0.125rem 0.5rem;
  border-radius: 4px;
  font-size: 0.6875rem;
  font-weight: 500;
}

.layer-link     { background: #FFF5F0; color: #D97757; border: 1px solid #D97757; }
.layer-network  { background: #F5F8F6; color: #5B8A72; border: 1px solid #5B8A72; }
.layer-transport{ background: #F5F3F8; color: #8B6F8A; border: 1px solid #8B6F8A; }
.layer-tunnel   { background: #F5F3F8; color: #7C5CBF; border: 1px solid #7C5CBF; }
.layer-app      { background: #FDF8F0; color: #C96464; border: 1px solid #C96464; }
.layer-payload  { background: #F0F4F8; color: #4A6FA5; border: 1px solid #4A6FA5; }

/* ---------- Badges ---------- */
.badge {
  display: inline-block;
  padding: 0.125rem 0.5rem;
  border-radius: 4px;
  font-size: 0.6875rem;
  font-weight: 500;
}

.badge-primary { background: #FFF5F0; color: #D97757; border: 1px solid #D97757; }
.badge-accent  { background: #F5F8F6; color: #5B8A72; border: 1px solid #5B8A72; }
.badge-warning { background: #FDF8F0; color: #D4A843; border: 1px solid #D4A843; }
.badge-note    { background: #F5F3F0; color: #6B7280; border: 1px solid #6B7280; }

/* ---------- Note / Tip Boxes ---------- */
.note {
  background: #FFF5F0;
  border-left: 3px solid #D97757;
  border-radius: 0 8px 8px 0;
  padding: 0.75rem 1rem;
  font-size: 0.75rem;
  color: #6B6560;
  margin: 0.75rem 0;
}

.note strong, .note .admonition-title {
  color: #D97757;
}

.tip {
  background: #F5F8F6;
  border-left: 3px solid #5B8A72;
  border-radius: 0 8px 8px 0;
  padding: 0.75rem 1rem;
  font-size: 0.75rem;
  color: #6B6560;
  margin: 0.75rem 0;
}

.tip strong, .tip .admonition-title {
  color: #5B8A72;
}

.admonition-title {
  font-weight: 600;
  margin-bottom: 0.25rem;
  display: flex;
  align-items: center;
  gap: 0.375rem;
}

/* ---------- Step List ---------- */
.step-list {
  list-style: none;
  padding-left: 0;
  color: #4A4540;
  font-size: 0.8125rem;
  line-height: 1.8;
}

.step-list li {
  margin-bottom: 0.25rem;
  padding-left: 1.25rem;
  position: relative;
}

.step-list li::before {
  content: ">";
  position: absolute;
  left: 0;
  color: #5B8A72;
  font-weight: 600;
}

/* ---------- Diagram Box ---------- */
.diagram-box {
  background: #FFFFFF;
  border-radius: 12px;
  border: 1px solid #E8E4DE;
  padding: 1.5rem;
  margin: 1rem 0;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
  overflow-x: auto;
}

/* ---------- Ordered/Unordered Lists ---------- */
ol, ul {
  color: #4A4540;
  font-size: 0.8125rem;
  line-height: 1.8;
}

ol {
  padding-left: 1.5rem;
}

/* ---------- Footer ---------- */
.footer {
  text-align: center;
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid #E8E4DE;
}

.footer p {
  color: #B0AAA4;
  font-size: 0.6875rem;
  letter-spacing: 0.02em;
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  margin-bottom: 0.75rem;
}

.footer-links a {
  color: #8B8680;
  font-size: 0.75rem;
  transition: color 0.2s;
}
.footer-links a:hover {
  color: #D97757;
}

/* ---------- Particle Canvas ---------- */
#particleCanvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

.container {
  position: relative;
  background: #FAF9F6;
}

/* ---------- Utility ---------- */
.text-center { text-align: center; }
.text-muted  { color: #8B8680; }

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
  body {
    padding: 1.5rem 1rem;
  }

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

  .flow-arrow {
    flex-direction: column;
    gap: 0.5rem;
  }

  .flow-connector {
    transform: rotate(90deg);
  }

  h1 {
    font-size: 1.125rem;
  }

  .section {
    padding: 1.25rem;
  }

  .header-row {
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .header-left {
    width: 100%;
  }

  .header-nav {
    width: 100%;
    gap: 0.75rem;
    flex-wrap: wrap;
  }

  .header-nav a {
    font-size: 0.75rem;
  }

  .lang-switch {
    margin-left: 0;
  }
}
