/* ==========================================================================
   Root variables & theme
   ========================================================================== */
:root {
  --bg: #0a0e17;
  --bg-alt: #0f1420;
  --surface: #131a2b;
  --surface-hover: #1a2338;
  --border: rgba(148, 163, 184, 0.12);
  --text: #e7ebf3;
  --text-muted: #8f9bb3;
  --accent: #7c5cff;
  --accent-2: #22d3ee;
  --accent-gradient: linear-gradient(135deg, #7c5cff 0%, #22d3ee 100%);
  --success: #34d399;
  --danger: #f87171;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
  --radius: 16px;
  --radius-sm: 10px;
  --header-h: 72px;
}

[data-theme="light"] {
  --bg: #f6f7fb;
  --bg-alt: #ffffff;
  --surface: #ffffff;
  --surface-hover: #eef1f8;
  --border: rgba(15, 23, 42, 0.08);
  --text: #10131c;
  --text-muted: #5a6478;
  --shadow: 0 20px 50px rgba(15, 23, 42, 0.08);
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  transition: background 0.4s ease, color 0.4s ease;
  overflow-x: hidden;
}

@media (pointer: fine) {
  body {
    cursor: none;
  }

  a,
  button {
    cursor: none;
  }
}

.icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

a {
  color: inherit;
  text-decoration: none;
}

code {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 0.9em;
}

img {
  max-width: 100%;
  display: block;
}

.gradient-text {
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.accent {
  color: var(--accent-2);
}

/* ==========================================================================
   Preloader
   ========================================================================== */
.preloader {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
}

.preloader-logo {
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.preloader-bar {
  width: 160px;
  height: 3px;
  border-radius: 999px;
  background: var(--border);
  overflow: hidden;
}

.preloader-bar-fill {
  display: block;
  width: 0%;
  height: 100%;
  background: var(--accent-gradient);
}

/* ==========================================================================
   Custom cursor
   ========================================================================== */
.cursor-dot,
.cursor-outline {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 250;
  border-radius: 50%;
  pointer-events: none;
  transform: translate(-50%, -50%);
}

.cursor-dot {
  width: 6px;
  height: 6px;
  background: var(--accent-2);
}

.cursor-outline {
  width: 36px;
  height: 36px;
  border: 1.5px solid var(--accent);
  transition: width 0.2s ease, height 0.2s ease, border-color 0.2s ease, opacity 0.2s ease;
}

.cursor-outline.is-active {
  width: 56px;
  height: 56px;
  border-color: var(--accent-2);
}

@media (pointer: coarse) {
  .cursor-dot,
  .cursor-outline {
    display: none;
  }
}

/* ==========================================================================
   Scroll progress bar
   ========================================================================== */
.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: 0%;
  background: var(--accent-gradient);
  z-index: 110;
}

/* ==========================================================================
   Header / Nav
   ========================================================================== */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-h);
  z-index: 100;
  backdrop-filter: blur(14px);
  background: rgba(10, 14, 23, 0.55);
  border-bottom: 1px solid var(--border);
  transition: background 0.4s ease;
}

[data-theme="light"] .site-header {
  background: rgba(255, 255, 255, 0.7);
}

.nav-wrap {
  max-width: 1180px;
  height: 100%;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  font-size: 1.3rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.nav-links {
  display: flex;
  gap: 28px;
}

.nav-link {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-muted);
  position: relative;
  padding: 4px 0;
  transition: color 0.25s ease;
}

.nav-link::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -2px;
  width: 0;
  height: 2px;
  background: var(--accent-gradient);
  transition: width 0.25s ease;
}

.nav-link:hover,
.nav-link.active {
  color: var(--text);
}

.nav-link:hover::after,
.nav-link.active::after {
  width: 100%;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1rem;
  transition: transform 0.25s ease, background 0.25s ease;
}

.icon-btn:hover {
  transform: translateY(-2px);
  background: var(--surface-hover);
}

.icon-btn .icon-sun,
.icon-btn .icon-moon {
  width: 18px;
  height: 18px;
}

.icon-btn .icon-sun {
  display: none;
}

[data-theme="light"] .icon-btn .icon-moon {
  display: none;
}

[data-theme="light"] .icon-btn .icon-sun {
  display: block;
}

.nav-burger {
  display: none;
  flex-direction: column;
  gap: 4px;
  border-radius: 10px;
}

.nav-burger span {
  width: 18px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
}

/* ==========================================================================
   Hero
   ========================================================================== */
.hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--header-h) 24px 40px;
  overflow: hidden;
}

.hero-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.35;
}

.orb-1 {
  width: 420px;
  height: 420px;
  background: #7c5cff;
  top: -120px;
  left: -100px;
}

.orb-2 {
  width: 360px;
  height: 360px;
  background: #22d3ee;
  bottom: -100px;
  right: -80px;
}

.orb-3 {
  width: 260px;
  height: 260px;
  background: #f472b6;
  top: 40%;
  left: 60%;
  opacity: 0.2;
}

.hero-content {
  position: relative;
  z-index: 1;
  max-width: 760px;
  text-align: center;
}

.hero-eyebrow {
  display: inline-block;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-2);
  margin-bottom: 20px;
}

.hero-title {
  font-size: clamp(2.4rem, 6vw, 4.2rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.05;
  margin-bottom: 22px;
}

.hero-title .line {
  display: block;
  overflow: visible;
  line-height: 1.25;
  padding-bottom: 0.06em;
}

.hero-subtitle {
  font-size: clamp(1rem, 2vw, 1.2rem);
  color: var(--text-muted);
  max-width: 560px;
  margin: 0 auto 36px;
}

.hero-cta {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
}

.api-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 28px;
  padding: 8px 16px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 0.85rem;
  color: var(--text-muted);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
  flex-shrink: 0;
}

.status-dot.is-live {
  background: var(--success);
  box-shadow: 0 0 0 4px rgba(52, 211, 153, 0.18);
}

.status-dot.is-static {
  background: var(--accent-2);
  box-shadow: 0 0 0 4px rgba(34, 211, 238, 0.18);
}

.scroll-cue {
  position: absolute;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  width: 24px;
  height: 40px;
  border: 2px solid var(--border);
  border-radius: 14px;
  z-index: 1;
}

.scroll-cue span {
  position: absolute;
  top: 6px;
  left: 50%;
  transform: translateX(-50%);
  width: 4px;
  height: 8px;
  border-radius: 2px;
  background: var(--accent-2);
  animation: scrollCue 1.8s ease infinite;
}

@keyframes scrollCue {
  0% { opacity: 1; top: 6px; }
  70% { opacity: 0; top: 20px; }
  100% { opacity: 0; top: 6px; }
}

/* ==========================================================================
   Buttons
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 14px 28px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  border: 1px solid transparent;
  transition: transform 0.25s ease, box-shadow 0.25s ease, background 0.25s ease, border-color 0.25s ease;
}

.btn-primary {
  background: var(--accent-gradient);
  color: #fff;
  box-shadow: 0 10px 30px rgba(124, 92, 255, 0.35);
}

.btn-primary:hover {
  transform: translateY(-3px);
  box-shadow: 0 16px 40px rgba(124, 92, 255, 0.45);
}

.btn-ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--text);
}

.btn-ghost:hover {
  border-color: var(--accent-2);
  color: var(--accent-2);
  transform: translateY(-3px);
}

.btn-block {
  width: 100%;
}

/* ==========================================================================
   Sections
   ========================================================================== */
.section {
  padding: 100px 24px;
}

.section-tight {
  padding: 72px 24px;
}

.section-alt {
  background: var(--bg-alt);
}

.section-inner {
  max-width: 1080px;
  margin: 0 auto;
}

.section-tag {
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 12px;
}

.section-title {
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 32px;
}

.overview-text {
  font-size: 1.05rem;
  color: var(--text-muted);
  max-width: 760px;
  margin-bottom: 32px;
}

/* Endpoints table */
.endpoints-table {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
}

.endpoint-row {
  display: grid;
  grid-template-columns: 100px 220px 1fr;
  gap: 16px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  align-items: center;
  font-size: 0.9rem;
}

.endpoint-row:last-child {
  border-bottom: none;
}

.endpoint-head {
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: var(--bg-alt);
}

.method {
  font-weight: 700;
  font-size: 0.75rem;
  padding: 4px 10px;
  border-radius: 6px;
  width: fit-content;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

.method-get {
  background: rgba(52, 211, 153, 0.15);
  color: var(--success);
}

.method-post {
  background: rgba(124, 92, 255, 0.15);
  color: var(--accent);
}

.path {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  color: var(--accent-2);
}

.data-source-note {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 28px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Projects */
.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
  perspective: 1200px;
}

.project-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  transition: box-shadow 0.3s ease, border-color 0.3s ease;
  transform-style: preserve-3d;
  will-change: transform;
}

.project-card:hover {
  box-shadow: var(--shadow);
  border-color: var(--accent);
}

.project-card-top {
  display: flex;
  align-items: center;
  gap: 12px;
}

.project-icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: rgba(124, 92, 255, 0.12);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.project-icon svg {
  width: 18px;
  height: 18px;
}

.project-card h3 {
  font-size: 1.1rem;
  font-weight: 700;
}

.project-card p {
  color: var(--text-muted);
  font-size: 0.95rem;
  flex: 1;
}

.project-meta {
  display: flex;
  gap: 14px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.project-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.project-tags span {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(124, 92, 255, 0.12);
  color: var(--accent);
}

.project-link {
  font-weight: 600;
  color: var(--accent-2);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  transition: gap 0.25s ease;
}

.project-link:hover {
  gap: 10px;
}

/* Skills list */
.skills-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.skill-row {
  display: grid;
  grid-template-columns: 220px 1fr 110px;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: border-color 0.25s ease, transform 0.25s ease;
}

.skill-row:hover {
  border-color: var(--accent);
  transform: translateX(4px);
}

.skill-name {
  font-weight: 600;
}

.skill-bar-track {
  height: 8px;
  border-radius: 999px;
  background: var(--bg);
  overflow: hidden;
}

.skill-bar-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: var(--accent-gradient);
}

.skill-level {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  text-align: right;
  color: var(--text-muted);
}

/* API Explorer */
.explorer {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}

.explorer-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 20px;
  border-bottom: 1px solid var(--border);
}

.explorer-btn {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  transition: border-color 0.25s ease, transform 0.25s ease, background 0.25s ease;
}

.explorer-btn:hover {
  border-color: var(--accent-2);
  transform: translateY(-2px);
}

.explorer-btn.is-loading {
  opacity: 0.6;
}

.explorer-output {
  margin: 0;
  padding: 24px;
  max-height: 420px;
  overflow: auto;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 0.85rem;
  line-height: 1.6;
  color: var(--accent-2);
  white-space: pre-wrap;
  word-break: break-word;
}

/* Contact / feedback form */
.contact-grid {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 40px;
}

.contact-form {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
}

.form-group input,
.form-group textarea {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  color: var(--text);
  font-family: inherit;
  font-size: 0.95rem;
  resize: vertical;
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(124, 92, 255, 0.2);
}

.form-group.has-error input,
.form-group.has-error textarea {
  border-color: var(--danger);
}

.form-error {
  font-size: 0.8rem;
  color: var(--danger);
  min-height: 16px;
}

.form-success {
  display: none;
  background: rgba(52, 211, 153, 0.12);
  color: var(--success);
  border: 1px solid rgba(52, 211, 153, 0.3);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: 0.9rem;
  font-weight: 600;
  text-align: center;
}

.form-success.visible {
  display: block;
}

.contact-info {
  display: flex;
  flex-direction: column;
  gap: 16px;
  justify-content: center;
}

.contact-info > p {
  color: var(--text-muted);
}

.contact-link {
  font-weight: 600;
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
  transition: transform 0.25s ease, border-color 0.25s ease;
}

.contact-link:hover {
  transform: translateX(6px);
  border-color: var(--accent-2);
}

/* ==========================================================================
   Footer
   ========================================================================== */
.site-footer {
  padding: 32px 24px 48px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
  border-top: 1px solid var(--border);
}

.footer-links {
  margin-top: 12px;
  display: flex;
  gap: 20px;
  justify-content: center;
}

.footer-links a {
  font-weight: 600;
  color: var(--text-muted);
  transition: color 0.25s ease;
}

.footer-links a:hover {
  color: var(--accent-2);
}

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

  .endpoint-row {
    grid-template-columns: 80px 1fr;
  }

  .endpoint-row span:last-child {
    grid-column: 1 / -1;
    color: var(--text-muted);
  }

  .skill-row {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .skill-level {
    text-align: left;
  }
}

@media (max-width: 720px) {
  .nav-links {
    position: fixed;
    top: var(--header-h);
    left: 0;
    right: 0;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    padding: 20px 24px;
    gap: 18px;
    transform: translateY(-150%);
    transition: transform 0.35s ease;
  }

  .nav-links.open {
    transform: translateY(0);
  }

  .nav-burger {
    display: flex;
  }

  .section {
    padding: 80px 20px;
  }

  .section-tight {
    padding: 56px 20px;
  }
}

@media (max-width: 480px) {
  .hero-cta {
    flex-direction: column;
    width: 100%;
  }

  .hero-cta .btn {
    width: 100%;
  }
}

/* ==========================================================================
   Back to top
   ========================================================================== */
.back-to-top {
  position: fixed;
  right: 24px;
  bottom: 24px;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 90;
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
  transition: opacity 0.3s ease, transform 0.3s ease, border-color 0.25s ease;
}

.back-to-top svg {
  width: 18px;
  height: 18px;
}

.back-to-top.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.back-to-top:hover {
  border-color: var(--accent-2);
  transform: translateY(-4px);
}

/* Respect reduced motion preference */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}
