/* ===== Custom Properties (Dark Mode Default) ===== */
:root {
  --bg: #111111;
  --bg-card: #1a1a1a;
  --bg-code: #0d0d0d;
  --text: #e0e0e0;
  --text-muted: #777777;
  --merah: #e63946;
  --merah-hover: #ff4d5a;
  --border: #2a2a2a;
  --green: #22c55e;
  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "Cascadia Code", "Fira Code", "SF Mono", Menlo, Consolas, monospace;
  --transition-speed: 0.25s;
  --ease-out-smooth: cubic-bezier(0.25, 0.46, 0.45, 0.94);
  --ease-out-back: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
}

/* Light mode overrides */
html.light {
  --bg: #fafafa;
  --bg-card: #ffffff;
  --bg-code: #f4f4f4;
  --text: #1a1a1a;
  --text-muted: #666666;
  --merah: #d32f2f;
  --merah-hover: #c62828;
  --border: #e0e0e0;
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 64px;
}

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  transition: background var(--transition-speed) var(--ease-out-smooth),
              color var(--transition-speed) var(--ease-out-smooth);
  min-height: 100vh;
}

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

a {
  color: var(--merah);
  text-decoration: none;
  position: relative;
}

a:hover {
  color: var(--merah-hover);
}

/* ===== Header ===== */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  height: 52px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  transition: background var(--transition-speed) var(--ease-out-smooth),
              border-color var(--transition-speed) var(--ease-out-smooth);
}

.header-inner {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 1.5rem;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  font-weight: 700;
  font-size: 1rem;
  color: var(--merah);
  letter-spacing: -0.02em;
}

.logo:hover {
  color: var(--merah-hover);
}

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

.header-nav a {
  color: var(--text-muted);
  font-size: 0.875rem;
  position: relative;
  transition: color var(--transition-speed) var(--ease-out-smooth);
}

/* Underline wipe animation for nav links */
.header-nav a::after {
  content: "";
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--merah);
  transition: width var(--transition-speed) var(--ease-out-expo);
}

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

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

.theme-toggle {
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color var(--transition-speed) var(--ease-out-smooth),
              border-color var(--transition-speed) var(--ease-out-smooth),
              box-shadow var(--transition-speed) var(--ease-out-smooth);
}

.theme-toggle:hover {
  color: var(--text);
  border-color: var(--text-muted);
  box-shadow: 0 0 0 2px var(--border);
}

/* Show sun in dark, moon in light */
.icon-sun { display: none; }
.icon-moon { display: block; }
html.light .icon-sun { display: block; }
html.light .icon-moon { display: none; }

/* ===== Language Toggle ===== */
.lang-toggle {
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  min-height: 32px;
  transition: color var(--transition-speed) var(--ease-out-smooth),
              border-color var(--transition-speed) var(--ease-out-smooth),
              box-shadow var(--transition-speed) var(--ease-out-smooth);
}

.lang-toggle:hover {
  color: var(--text);
  border-color: var(--text-muted);
  box-shadow: 0 0 0 2px var(--border);
}

.lang-label {
  display: block;
  line-height: 1;
}

/* ===== Main ===== */
main {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 1.5rem;
  padding-top: 84px;
}

/* ===== Hero ===== */
.hero {
  padding-bottom: 2rem;
}

.hero-title {
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 900;
  letter-spacing: -0.03em;
  line-height: 1.1;
  margin-bottom: 0.5rem;
  position: relative;
  display: inline-block;
}

/* Accent bar next to hero title */
.hero-title::before {
  content: "";
  position: absolute;
  left: -14px;
  top: 0.1em;
  bottom: 0.1em;
  width: 4px;
  background: var(--merah);
  border-radius: 2px;
}

.hero-tagline {
  font-size: 1.125rem;
  color: var(--text-muted);
  max-width: 600px;
}

.hero-tagline code {
  background: var(--bg-code);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.85em;
  border: 1px solid var(--border);
}

/* ===== Quick CTAs ===== */
.quick-ctas {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  padding-bottom: 3rem;
}

.cta-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.875rem;
  padding: 10px 20px;
  border-radius: 6px;
  cursor: pointer;
  min-height: 44px;
  position: relative;
  overflow: hidden;
  transition: border-color var(--transition-speed) var(--ease-out-smooth),
              color var(--transition-speed) var(--ease-out-smooth),
              box-shadow var(--transition-speed) var(--ease-out-smooth),
              transform var(--transition-speed) var(--ease-out-back);
}

/* Pseudo-element border slide from left */
.cta-btn::before {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 2px;
  background: var(--merah);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform var(--transition-speed) var(--ease-out-expo);
}

.cta-btn:hover {
  border-color: var(--merah);
  color: var(--merah);
  box-shadow: 0 4px 12px rgba(230, 57, 70, 0.12);
  transform: translateY(-1px);
}

.cta-btn:hover::before {
  transform: scaleX(1);
}

/* ===== Try It Live ===== */
.try-it {
  padding-bottom: 3rem;
}

.try-it h2 {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 1rem;
  position: relative;
  padding-left: 16px;
}

/* Accent bar on section headings */
.try-it h2::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.15em;
  bottom: 0.15em;
  width: 4px;
  background: var(--merah);
  border-radius: 2px;
}

.try-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 3px solid var(--merah);
  border-radius: 8px;
  overflow: hidden;
  transition: background var(--transition-speed) var(--ease-out-smooth),
              border-color var(--transition-speed) var(--ease-out-smooth),
              box-shadow var(--transition-speed) var(--ease-out-smooth);
}

.try-card:hover {
  box-shadow: 0 2px 16px rgba(0, 0, 0, 0.15);
}

.try-buttons {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: center;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
}

.date-dropdowns {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
  flex-basis: 100%;
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

.date-dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.try-input-label {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  user-select: none;
}

.try-select {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  padding: 6px 8px;
  min-width: 80px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-code);
  color: var(--text);
  outline: none;
  min-height: 36px;
  cursor: pointer;
  transition: border-color var(--transition-speed) var(--ease-out-smooth),
              background var(--transition-speed) var(--ease-out-smooth),
              color var(--transition-speed) var(--ease-out-smooth),
              box-shadow var(--transition-speed) var(--ease-out-smooth);
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23777' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  padding-right: 28px;
}

.try-select:focus {
  border-color: var(--merah);
  box-shadow: 0 0 0 2px rgba(230, 57, 70, 0.2);
}

.try-btn {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: none;
  color: var(--text-muted);
  cursor: pointer;
  min-height: 44px;
  position: relative;
  overflow: hidden;
  transition: background var(--transition-speed) var(--ease-out-smooth),
              border-color var(--transition-speed) var(--ease-out-smooth),
              color var(--transition-speed) var(--ease-out-smooth),
              box-shadow var(--transition-speed) var(--ease-out-smooth),
              transform var(--transition-speed) var(--ease-out-back);
}

/* Underline wipe on try buttons */
.try-btn::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 2px;
  background: var(--merah);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform var(--transition-speed) var(--ease-out-expo);
}

.try-btn:hover {
  border-color: var(--merah);
  color: var(--text);
  transform: translateY(-1px);
}

.try-btn:hover::after {
  transform: scaleX(1);
}

.try-btn.active {
  background: var(--merah);
  border-color: var(--merah);
  color: #fff;
}

.try-btn.active::after {
  display: none;
}

.try-response {
  padding: 0;
}

.response-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 1.25rem;
  border-bottom: 1px solid var(--border);
  min-height: 36px;
}

.response-status {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.response-header .copy-btn {
  top: auto;
}

.response-body {
  background: var(--bg-code);
  padding: 1rem 1.25rem;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  line-height: 1.7;
  margin: 0;
  transition: background var(--transition-speed) var(--ease-out-smooth);
}

/* ===== Documentation ===== */
.documentation {
  padding-bottom: 3rem;
}

.documentation h2 {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 1.5rem;
  position: relative;
  padding-left: 16px;
}

/* Accent bar on documentation heading */
.documentation h2::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.15em;
  bottom: 0.15em;
  width: 4px;
  background: var(--merah);
  border-radius: 2px;
}

.endpoint-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 3px solid transparent;
  border-radius: 8px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  transition: border-color var(--transition-speed) var(--ease-out-smooth),
              background var(--transition-speed) var(--ease-out-smooth),
              box-shadow var(--transition-speed) var(--ease-out-smooth),
              transform var(--transition-speed) var(--ease-out-back);
}

.endpoint-card:hover {
  border-left-color: var(--merah);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
  transform: translateY(-2px);
}

.endpoint-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.method-badge {
  display: inline-block;
  background: var(--bg-code);
  color: #fff;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 4px;
  letter-spacing: 0.02em;
}

html.light .method-badge {
  background: #333;
}

.endpoint-path {
  font-size: 1rem;
  font-weight: 600;
}

.endpoint-desc {
  color: var(--text-muted);
  margin-bottom: 1.25rem;
}

.endpoint-card h4 {
  font-size: 0.8125rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
  margin-top: 1.25rem;
}

.params-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.params-table th,
.params-table td {
  text-align: left;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  transition: border-color var(--transition-speed) var(--ease-out-smooth);
}

.params-table th {
  color: var(--text-muted);
  font-weight: 700;
  font-size: 0.8125rem;
}

.params-table code {
  background: var(--bg-code);
  padding: 2px 6px;
  border-radius: 3px;
  border: 1px solid var(--border);
  font-size: 0.85em;
}

.params-none {
  color: var(--text-muted);
  font-size: 0.875rem;
}

.code-block {
  position: relative;
  margin-bottom: 0.5rem;
}

.code-block pre {
  background: var(--bg-code);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.875rem 1rem;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  line-height: 1.7;
  margin: 0;
  transition: background var(--transition-speed) var(--ease-out-smooth),
              border-color var(--transition-speed) var(--ease-out-smooth);
}

.copy-btn {
  position: absolute;
  top: 6px;
  right: 6px;
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px 8px;
  font-size: 0.75rem;
  transition: color var(--transition-speed) var(--ease-out-smooth),
              border-color var(--transition-speed) var(--ease-out-smooth),
              box-shadow var(--transition-speed) var(--ease-out-smooth),
              transform var(--transition-speed) var(--ease-out-back);
}

.copy-btn:hover {
  color: var(--text);
  border-color: var(--text-muted);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  transform: translateY(-1px);
}

.copy-btn.copied {
  color: var(--green);
  border-color: var(--green);
}

.response-header .copy-btn {
  position: static;
}

/* ===== JSON Syntax Highlighting ===== */
.json-key { color: #7dd3fc; }
.json-string { color: #86efac; }
.json-number { color: #fbbf24; }
.json-bool { color: #c084fc; }
.json-null { color: #f87171; }

html.light .json-key { color: #1d4ed8; }
html.light .json-string { color: #15803d; }
html.light .json-number { color: #b45309; }
html.light .json-bool { color: #7e22ce; }
html.light .json-null { color: #dc2626; }

/* ===== Footer ===== */
.site-footer {
  max-width: 960px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
  border-top: 1px solid var(--border);
  text-align: center;
  color: var(--text-muted);
  font-size: 0.875rem;
  transition: border-color var(--transition-speed) var(--ease-out-smooth);
}

.site-footer a {
  position: relative;
}

.site-footer a::after {
  content: "";
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 1px;
  background: var(--merah);
  transition: width var(--transition-speed) var(--ease-out-expo);
}

.site-footer a:hover::after {
  width: 100%;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
  main {
    padding-top: 72px;
  }

  .hero-title {
    font-size: clamp(1.75rem, 7vw, 2.5rem);
  }

  .hero-tagline {
    font-size: 1rem;
  }

  .endpoint-card {
    padding: 1rem;
  }

  .params-table {
    font-size: 0.8125rem;
  }

  .params-table th,
  .params-table td {
    padding: 6px 8px;
  }

  .response-body {
    font-size: 0.75rem;
  }
}

@media (max-width: 480px) {
  .header-inner {
    padding: 0 1rem;
  }

  main {
    padding: 0 1rem;
    padding-top: 72px;
  }

  .quick-ctas {
    flex-direction: column;
  }

  .cta-btn {
    width: 100%;
    text-align: center;
  }

  .try-select {
    min-width: 70px;
  }

  .hero-title::before {
    left: -10px;
    width: 3px;
  }
}

/* T8: hide input fields when not on /api endpoint */
.hidden {
  display: none !important;
}

/* ===== Reduced Motion ===== */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    transition-delay: 0ms !important;
    animation-delay: 0ms !important;
  }

  html {
    scroll-behavior: auto;
  }
}
