/* Amplitude Dev Guide — layout & components (see maxonomy-theme.css) */
/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0 1.5rem;
  background: var(--header-bg);
  border-bottom: 1px solid var(--header-border);
}

.site-header-start {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
  flex: 1;
}

.header-guide-back {
  flex-shrink: 0;
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--accent);
  text-decoration: none;
  white-space: nowrap;
  padding: 0.5rem 0.85rem;
  border-radius: 8px;
  border: 1.5px solid var(--accent);
  background: var(--accent-soft);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.header-guide-back:hover {
  color: #ffffff;
  border-color: var(--accent-hover);
  background: var(--accent);
  box-shadow: var(--shadow);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text);
  text-decoration: none;
}

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

.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: contain;
  flex-shrink: 0;
  display: block;
}

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

.header-nav a {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.header-nav a:hover {
  color: var(--text);
}


.platform-nav {
  display: flex;
  gap: 0.35rem;
  padding: 0.2rem;
  border-radius: 999px;
  background: var(--bg-card);
  border: 1px solid var(--border);
}

.platform-nav a {
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  color: var(--text-muted);
}

.platform-nav a:hover {
  color: var(--text);
  background: var(--accent-soft);
}

.platform-nav a.is-active {
  color: #ffffff;
  background: var(--emph-yellow);
}

.platform-nav-disabled {
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  color: var(--text-muted);
  opacity: 0.55;
  cursor: not-allowed;
}

.header-nav a.header-support-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.45rem 0.95rem;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 600;
  color: #ffffff;
  background: var(--accent);
  border: 1px solid var(--accent);
  text-decoration: none;
  white-space: nowrap;
  box-shadow: 0 2px 10px rgba(0, 99, 249, 0.25);
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.header-nav a.header-support-btn:hover {
  color: #ffffff;
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(0, 99, 249, 0.3);
}

.menu-toggle {
  display: none;
  background: none;
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.4rem 0.65rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1.1rem;
}

/* Layout */
.layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: calc(100vh - var(--header-h));
}

/* Sidebar */
.sidebar {
  position: sticky;
  top: var(--header-h);
  height: calc(100vh - var(--header-h));
  overflow-y: auto;
  padding: 1.5rem 1rem 2rem;
  border-right: 1px solid var(--border);
  background: var(--bg-elevated);
}

.sidebar-label {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 1.25rem 0 0.5rem 0.75rem;
}

.sidebar-label:first-child {
  margin-top: 0;
}

.sidebar nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.sidebar nav a {
  display: block;
  padding: 0.45rem 0.75rem;
  border-radius: 8px;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.sidebar nav a:hover,
.sidebar nav a.active {
  background: var(--accent-soft);
  color: var(--text);
}

.sidebar nav a.active {
  font-weight: 600;
  color: var(--emph-yellow);
}

.sidebar nav a.nav-important {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.sidebar nav a.nav-important .nav-mark {
  flex-shrink: 0;
  font-size: 0.7rem;
  line-height: 1;
  color: var(--emph-yellow);
}

.sidebar nav a.nav-important.active .nav-mark {
  color: var(--emph-yellow);
}

/* Main — use full width beside sidebar (no narrow 820px column) */
.main {
  padding: 2rem clamp(1.25rem, 2.5vw, 2.75rem) 3.5rem;
  min-width: 0;
}

.content-wrap {
  width: 100%;
  max-width: var(--max-content);
}

.hero {
  margin-bottom: 2.5rem;
  padding: 2rem 2.25rem;
  border-radius: var(--radius-lg);
  background: linear-gradient(145deg, #ffffff 0%, var(--emph-yellow-dim) 100%);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.hero h1 {
  margin: 0 0 0.75rem;
  font-size: clamp(1.75rem, 4vw, 2.25rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.25;
}

.hero p {
  margin: 0;
  color: var(--text-muted);
  font-size: 1.05rem;
  max-width: 52ch;
}

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.25rem;
}

.meta-chip {
  font-size: 0.8rem;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  background: #ffffff;
  border: 1px solid var(--border);
  color: var(--text-muted);
}

/* Sections */
.doc-section {
  margin-bottom: 3rem;
  scroll-margin-top: calc(var(--header-h) + 1rem);
}

.has-portal-topbar .doc-section {
  scroll-margin-top: calc(var(--header-h) + var(--portal-topbar-h) + 1.25rem);
}

.guide-scope-note {
  margin-bottom: 2rem;
}

.doc-section h2 {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0 0 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--emph-yellow);
  color: var(--text);
}

.doc-section h3 {
  font-size: 1.15rem;
  margin: 1.75rem 0 0.75rem;
}

.doc-section h4 {
  font-size: 1rem;
  font-weight: 600;
  margin: 1.5rem 0 0.6rem;
  color: var(--emph-yellow);
}

.doc-section strong,
.doc-section b {
  color: var(--emph-yellow);
  font-weight: 700;
}

.emph-red {
  color: var(--emph-red) !important;
  font-weight: 700;
}

.note-important {
  margin: 1rem 0 1.25rem;
  padding: 0.85rem 1.1rem;
  border-radius: var(--radius);
  background: var(--emph-yellow-dim);
  border: 1px solid rgba(0, 99, 249, 0.25);
  border-left: 4px solid var(--emph-yellow);
  color: var(--text);
  font-size: 0.95rem;
  line-height: 1.6;
}

.note-important strong {
  color: var(--emph-red);
}

.figure {
  margin: 1.25rem auto 1.5rem;
  max-width: 30rem;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--bg-card);
}

.figure.figure-diagram {
  max-width: 36rem;
}

.figure.figure-ecommerce-flow {
  max-width: 48rem;
}

.figure.figure-dashboard {
  max-width: 26rem;
}

.figure img {
  display: block;
  width: 100%;
  height: auto;
}

.figure.figure-zoomable img {
  cursor: zoom-in;
  transition: opacity 0.15s ease;
}

.figure.figure-zoomable img:hover {
  opacity: 0.92;
}

.figure figcaption {
  padding: 0.65rem 1rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
}

.figure.figure-zoomable figcaption::after {
  content: " · 클릭하여 확대";
  color: var(--accent);
  font-weight: 600;
}

/* Image lightbox */
.figure-lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: rgba(15, 23, 42, 0.82);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

.figure-lightbox.is-open {
  opacity: 1;
  visibility: visible;
}

.figure-lightbox-dialog {
  position: relative;
  max-width: min(96vw, 72rem);
  max-height: 92vh;
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
}

.figure-lightbox-dialog img {
  display: block;
  max-width: min(96vw, 72rem);
  max-height: 88vh;
  width: auto;
  height: auto;
  margin: 0 auto;
  border-radius: var(--radius);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
  background: #fff;
}

.figure-lightbox-caption {
  margin: 0.65rem 0 0;
  text-align: center;
  font-size: 0.85rem;
  color: #e2e8f0;
}

.figure-lightbox-close {
  position: absolute;
  top: -0.25rem;
  right: 0;
  transform: translateY(-100%);
  padding: 0.35rem 0.65rem;
  border: none;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
}

.figure-lightbox-close:hover {
  background: rgba(255, 255, 255, 0.25);
}

/* UTM attribution decision table (Amplitude WEB guide) */
.attribution-flow {
  margin: 1.5rem 0;
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.06);
}

.attribution-flow-header {
  padding: 1rem 1.35rem;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(99, 102, 241, 0.08) 0%, rgba(99, 102, 241, 0.02) 100%);
}

.attribution-flow-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
}

.attribution-flow-sub {
  margin: 0.35rem 0 0;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.attribution-flow-body {
  padding: 1.25rem 1.35rem 1.35rem;
}

.attribution-flow-start {
  margin: 0 0 1rem;
  padding: 0.7rem 1rem;
  text-align: center;
  font-weight: 700;
  font-size: 0.92rem;
  border-radius: var(--radius);
  background: linear-gradient(180deg, #fffbeb 0%, #fef3c7 100%);
  border: 1px solid #f0d78c;
  color: #92400e;
  position: relative;
}

.attribution-flow-start::after {
  content: "↓";
  display: block;
  margin-top: 0.55rem;
  font-size: 0.9rem;
  color: var(--text-muted);
  font-weight: 600;
}

.attribution-table-wrap {
  margin: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: #fff;
}

.attribution-table {
  font-size: 0.88rem;
}

.attribution-table thead th {
  padding: 0.8rem 1rem;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  border-bottom: 2px solid var(--border);
  background: #f8fafc;
}

.attribution-table thead th.attribution-col-yes {
  background: #fff5f5;
  color: #9b1c1c;
}

.attribution-table thead th.attribution-col-no {
  background: #f0fdf4;
  color: #166534;
}

.attribution-table tbody td {
  padding: 0.9rem 1rem;
  vertical-align: middle;
  line-height: 1.55;
  border-bottom: 1px solid var(--border);
}

.attribution-table tbody tr:last-child td {
  border-bottom: none;
}

.attribution-table tbody tr:hover td {
  background: rgba(99, 102, 241, 0.03);
}

.attribution-table tbody tr:hover td.attribution-skip,
.attribution-table tbody tr:hover td.attribution-track {
  filter: brightness(0.98);
}

.attribution-table td:first-child,
.attribution-table th:first-child {
  width: 4rem;
  text-align: center;
  white-space: nowrap;
}

.attribution-table td:nth-child(2) {
  min-width: 14rem;
}

.attribution-table td:nth-child(3),
.attribution-table td:nth-child(4) {
  width: 11.5rem;
  text-align: center;
}

.attribution-step {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.85rem;
  height: 1.85rem;
  border-radius: 50%;
  background: var(--accent, #6366f1);
  color: #fff;
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1;
}

.attribution-table td.attribution-skip {
  background: #fef2f2;
  color: #9b1c1c;
  font-weight: 600;
}

.attribution-table td.attribution-track {
  background: #ecfdf3;
  color: #166534;
  font-weight: 700;
}

.attribution-table td.attribution-next {
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.86rem;
  background: #f8fafc;
}

.attribution-legend {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: 0.65rem;
  margin-top: 1rem;
}

.attribution-legend-item {
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius);
  font-size: 0.82rem;
  font-weight: 600;
  text-align: center;
  border: 1px solid var(--border);
}

.attribution-legend-item.attribution-skip {
  background: #fef2f2;
  border-color: #fecaca;
  color: #9b1c1c;
}

.attribution-legend-item.attribution-track {
  background: #ecfdf3;
  border-color: #86efac;
  color: #166534;
}

.ecommerce-appendix {
  margin: 1.25rem 0 1.5rem;
  padding: 1rem 1.15rem;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  background: rgba(99, 102, 241, 0.03);
}

.ecommerce-appendix h4 {
  margin: 0 0 0.75rem;
  font-size: 0.95rem;
}

.ecommerce-appendix > p {
  margin: 0 0 0.75rem;
}

.ecommerce-appendix .table-wrap {
  margin: 0 0 1rem;
}

@media (max-width: 720px) {
  .attribution-flow-body {
    padding: 1rem;
  }

  .attribution-table td:nth-child(3),
  .attribution-table td:nth-child(4) {
    width: auto;
    min-width: 7.5rem;
  }
}

.config-category {
  margin: 2rem 0 1rem;
  padding-top: 0.25rem;
  border-top: 1px dashed var(--border);
}

.config-category:first-of-type {
  border-top: none;
  margin-top: 1rem;
}

.note-ref {
  margin: 0.75rem 0 1.25rem;
  padding: 0.65rem 0.85rem;
  font-size: 0.9rem;
  color: var(--text-muted);
  border-left: 3px solid var(--accent);
  background: var(--accent-soft);
  border-radius: 0 8px 8px 0;
}

.note-ref-mark {
  color: var(--accent);
  font-weight: 700;
  margin-right: 0.15rem;
}

.doc-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 1rem 0;
}

.doc-links a {
  font-size: 0.85rem;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-muted);
}

.doc-links a:hover {
  border-color: var(--accent);
  color: var(--accent-hover);
}

.checklist {
  list-style: none;
  padding: 0;
  margin: 1rem 0;
}

.checklist li {
  position: relative;
  padding: 0.5rem 0 0.5rem 1.75rem;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}

.checklist li::before {
  content: "✓";
  position: absolute;
  left: 0;
  color: var(--emph-yellow);
  font-weight: 700;
}

.api-endpoint {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  padding: 0.75rem 1rem;
  background: var(--emph-yellow-dim);
  border: 1px solid rgba(0, 99, 249, 0.2);
  border-radius: var(--radius);
  margin: 1rem 0;
  color: var(--emph-yellow);
}

.doc-section p {
  color: var(--text);
  margin: 0 0 1rem;
}

.doc-section ul,
.doc-section ol {
  color: var(--text);
  padding-left: 1.35rem;
  margin: 0 0 1rem;
}

.doc-section li {
  margin-bottom: 0.35rem;
}

/* Callouts */
.callout {
  display: flex;
  gap: 1rem;
  padding: 1rem 1.25rem;
  border-radius: var(--radius);
  margin: 1.25rem 0;
  border: 1px solid var(--border);
}

.callout-icon {
  flex-shrink: 0;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 0.75rem;
  font-weight: 700;
}

.callout-info {
  background: var(--emph-yellow-dim);
  border-color: rgba(0, 99, 249, 0.25);
}

.callout-info .callout-icon {
  background: rgba(0, 99, 249, 0.15);
  color: var(--emph-yellow);
}

.callout-warn {
  background: var(--emph-red-dim);
  border-color: rgba(239, 20, 29, 0.25);
}

.callout-warn .callout-icon {
  background: rgba(239, 20, 29, 0.12);
  color: var(--emph-red);
}

.callout-body > strong {
  display: block;
  color: var(--emph-red);
  margin-bottom: 0.25rem;
}

.callout-body p {
  color: var(--text);
}

.callout-body p {
  margin: 0;
  font-size: 0.9rem;
}

/* Code */
pre {
  margin: 1rem 0 1.25rem;
  padding: 1.25rem 1.35rem;
  border-radius: var(--radius);
  background: var(--code-bg);
  border: 1px solid var(--border);
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  line-height: 1.6;
  color: #1a1a1a;
}

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

:not(pre) > code {
  padding: 0.15em 0.45em;
  border-radius: 5px;
  background: var(--code-bg);
  border: 1px solid var(--border);
  color: var(--accent-deep);
}

pre .code-line-important {
  display: inline-block;
  width: 100%;
  color: var(--emph-red);
  font-weight: 700;
  background: var(--emph-yellow-dim);
  box-shadow: inset 3px 0 0 var(--emph-yellow);
  padding: 0.15rem 0.5rem;
  margin: 0.15rem 0;
}

/* Steps */
.steps {
  counter-reset: step;
  list-style: none;
  padding: 0;
  margin: 1.25rem 0;
}

.steps li {
  position: relative;
  padding-left: 3rem;
  margin-bottom: 1.25rem;
  color: var(--text-muted);
}

.steps li::before {
  counter-increment: step;
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0.1rem;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: var(--accent-soft);
  border: 1px solid rgba(0, 99, 249, 0.25);
  color: var(--emph-yellow);
  font-weight: 700;
  font-size: 0.85rem;
  display: grid;
  place-items: center;
}

.steps li strong {
  color: var(--emph-yellow);
}

/* Table */
.table-wrap {
  overflow-x: auto;
  margin: 1.25rem 0;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

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

th {
  background: var(--bg-card);
  color: var(--text);
  font-weight: 600;
}

td {
  color: var(--text);
}

td strong {
  color: var(--emph-yellow);
}

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

/* Cards grid */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
  margin: 1.5rem 0;
}

.card {
  padding: 1.25rem;
  border-radius: var(--radius);
  background: var(--bg-card);
  border: 1px solid var(--border);
  transition: border-color 0.2s, transform 0.2s;
}

.card:hover {
  border-color: rgba(0, 99, 249, 0.35);
  transform: translateY(-2px);
}

.card h4 {
  margin: 0 0 0.5rem;
  font-size: 1rem;
  color: var(--text);
}

.card p {
  margin: 0;
  font-size: 0.85rem;
}

/* Responsive */
@media (max-width: 900px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    left: 0;
    top: var(--header-h);
    width: min(100%, 300px);
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    z-index: 90;
    box-shadow: var(--shadow);
  }

  .sidebar.is-open {
    transform: translateX(0);
  }

  .sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    top: var(--header-h);
    background: rgba(0, 0, 0, 0.5);
    z-index: 80;
  }

  .sidebar-overlay.is-visible {
    display: block;
  }

  .menu-toggle {
    display: block;
  }

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

  .header-nav a.header-support-btn {
    padding: 0.35rem 0.7rem;
    font-size: 0.72rem;
  }

  .brand > span {
    max-width: 9rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .platform-nav a {
    padding: 0.3rem 0.55rem;
    font-size: 0.75rem;
  }

  .main {
    padding: 1.5rem 1.25rem 3rem;
  }
}

.lead-muted {
  margin: 0 0 1.25rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  background: var(--bg-card);
  border-left: 3px solid var(--border);
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.65;
}

.lead-muted strong {
  color: var(--text);
}

/* API guide — major category divider */
.api-category-banner {
  margin: 2.5rem 0 1.25rem;
  padding: 0.85rem 1.1rem;
  border-radius: var(--radius);
  background: var(--emph-yellow-dim);
  border: 1px solid rgba(0, 99, 249, 0.25);
  border-left: 4px solid var(--emph-yellow);
}

.api-category-banner h2 {
  margin: 0;
  font-size: 1.2rem;
  color: var(--emph-yellow);
  border: none;
  padding: 0;
}

.api-category-banner p {
  margin: 0.4rem 0 0;
  font-size: 0.9rem;
  color: var(--text-muted);
}


.doc-build-stamp {
  margin: 2rem 0 1rem;
  padding: 0.75rem 0;
  border-top: 1px solid var(--border);
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: center;
}
