/* ---------- Design tokens ---------- */
:root {
  --color-bg: #ffffff;
  --color-surface: #f5f5f7;
  --color-text: #000000;
  --color-text-muted: rgba(25, 25, 26, 0.5);
  --color-accent: #6c4cf0;
  --color-accent-strong: #5a3ce0;
  --color-border: #e3e5ea;
  --color-chip: rgba(25, 25, 26, 0.07);
  --color-link: #17a9fe;
  --color-placeholder: #707070;
  --color-placeholder-dark: #5b6f7b;

  --font-heading: "Poppins", "Noto Sans KR", -apple-system, BlinkMacSystemFont, sans-serif;
  --font-body: "DM Sans", "Noto Sans KR", -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: "SF Mono", SFMono-Regular, ui-monospace, Consolas, "Liberation Mono", Menlo, monospace;

  --container-width: 1100px;
  --space-1: 0.5rem;
  --space-2: 1rem;
  --space-3: 1.5rem;
  --space-4: 2.5rem;
  --space-5: 4rem;
  --space-6: 7rem;
  --space-7: 9.5rem;
  --radius: 8px;
  --radius-full: 9999px;
}

/* ---------- Reset ---------- */
*, *::before, *::after {
  box-sizing: border-box;
}

html {
  scrollbar-gutter: stable;
}

body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
}

/* Pin the footer to the bottom of the viewport on short pages, instead of
   letting it float up right under a short <main>. Excludes the full-
   viewport app pages (view.html, playground-example.html), which already
   manage their own height: 100vh layout and have no footer. */
body:not(.page-view):not(.page-example) {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

body:not(.page-view):not(.page-example) > main {
  flex: 1 0 auto;
}

h1, h2, h3, h4 {
  margin: 0;
  font-family: var(--font-heading);
}

p {
  margin: 0;
}

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

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

/* ---------- Bullet lists (shared dot style for docs content & showcase) ---------- */
.docs-content ul,
.showcase-row-media--list ul {
  padding-left: 0;
  list-style: none;
}

.docs-content li,
.showcase-row-media--list li {
  position: relative;
  padding-left: 1.4rem;
}

.docs-content li::before,
.showcase-row-media--list li::before {
  content: '\2022';
  position: absolute;
  left: 0.1rem;
  top: 0.15em;
  font-size: 1.4em;
  line-height: 1;
  color: #cccccc;
}

/* ---------- Layout ---------- */
.container {
  width: 100%;
  max-width: var(--container-width);
  margin: 0 auto;
  padding: 0 clamp(1.25rem, 4vw, 3rem);
}

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--color-bg);
  border-bottom: 1px solid var(--color-border);
  transition: transform 0.25s ease;
}

.site-header.is-hidden {
  transform: translateY(-100%);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 76px;
  max-width: 1440px;
  /* Fixed 32px side padding (overrides .container's responsive clamp,
     which grows up to 48px) to match the reference header. TODO: revisit
     whether the rest of the site should also move off the growing-up-to-
     48px pattern, or whether the header should go back to matching it. */
  padding: 0 2rem;
}

.logo {
  display: inline-flex;
  align-items: center;
}

.logo-img {
  height: 30px;
  width: auto;
  aspect-ratio: 620 / 185;
  display: block;
  transition: opacity 0.15s ease;
}

.logo:hover .logo-img {
  opacity: 0.33;
}

.main-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-1) var(--space-3);
}

.main-nav a {
  color: var(--color-text);
  font-size: 0.87rem;
  font-weight: 400;
  letter-spacing: 0.03em;
  white-space: nowrap;
  transition: color 0.15s ease;
}

.main-nav a:hover {
  color: #aaaaaa;
}

.main-nav a.active {
  color: var(--color-text-muted);
}

.nav-external {
  position: relative;
  margin-right: 1.1em;
}

.external-icon {
  position: absolute;
  top: 50%;
  left: 100%;
  width: 0.75em;
  height: 0.75em;
  margin-left: 0.3em;
  transform: translateY(-65%);
  transition: opacity 0.15s ease;
}

.nav-external:hover .external-icon {
  opacity: 0.33;
}

.nav-dropdown {
  position: relative;
}

.nav-dropdown-trigger {
  display: inline-flex;
  align-items: center;
  gap: 0.35em;
  padding: 0;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--color-text);
  font-family: inherit;
  font-size: 0.87rem;
  font-weight: 400;
  letter-spacing: 0.02em;
  white-space: nowrap;
  transition: color 0.15s ease;
}

.nav-dropdown-trigger:hover {
  color: #aaaaaa;
}

.nav-dropdown-trigger.active {
  color: var(--color-text-muted);
}

.nav-dropdown-caret {
  width: 9px;
  height: 6px;
  transition: transform 0.15s ease;
}

.nav-dropdown.is-open .nav-dropdown-caret {
  transform: rotate(180deg);
}

.nav-dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  z-index: 1;
  margin-top: 0.9rem;
  padding: 0.5rem 0;
  min-width: 160px;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.08);
}

.nav-dropdown.is-open .nav-dropdown-menu {
  display: block;
}

.nav-dropdown-menu a {
  display: block;
  padding: 0.55rem 1.1rem;
}

.nav-dropdown-menu .nav-external {
  display: flex;
  align-items: center;
  margin-right: 0;
}

.nav-dropdown-menu .nav-external .external-icon {
  position: static;
  transform: none;
  margin-left: 0.3em;
}

@media (min-width: 861px) {
  .nav-dropdown::before {
    content: "";
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    height: 0.9rem;
  }

  .nav-dropdown:hover .nav-dropdown-menu {
    display: block;
  }

  .nav-dropdown:hover .nav-dropdown-caret {
    transform: rotate(180deg);
  }
}

.menu-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  padding: var(--space-1);
  cursor: pointer;
  position: relative;
  z-index: 2;
}

.menu-icon {
  width: 20px;
  height: auto;
  transition: opacity 0.15s ease;
}

.menu-toggle:hover .menu-icon {
  opacity: 0.33;
}

@media (max-width: 860px) {
  .menu-toggle {
    display: inline-flex;
  }

  .main-nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 1;
    flex-direction: column;
    flex-wrap: nowrap;
    align-items: flex-start;
    text-align: left;
    gap: var(--space-2);
    padding: var(--space-2) calc(2rem + var(--space-1)) var(--space-3);
    background: var(--color-bg);
    border-bottom: 1px solid var(--color-border);
  }

  .main-nav.is-open {
    display: flex;
    animation: nav-slide-down 0.25s ease;
  }

  @keyframes nav-slide-down {
    from {
      transform: translateY(-100%);
      opacity: 0;
    }
    to {
      transform: translateY(0);
      opacity: 1;
    }
  }

  .nav-external {
    margin-right: 0;
  }

  .main-nav a,
  .nav-dropdown-trigger {
    font-size: 0.92rem;
  }

  .nav-dropdown {
    width: 100%;
  }

  .nav-dropdown-trigger {
    width: 100%;
    justify-content: flex-start;
  }

  .nav-dropdown-menu {
    display: none;
    position: static;
    margin-top: var(--space-2);
    padding: 0;
    min-width: 0;
    background: none;
    border: none;
    box-shadow: none;
  }

  .nav-dropdown.is-open .nav-dropdown-menu {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-2);
    padding-left: var(--space-3);
  }

  .nav-dropdown-menu a {
    padding: 0;
  }

  .logo {
    position: relative;
    z-index: 2;
    margin-left: var(--space-1);
  }

  .logo-img {
    height: 30px;
  }

  .menu-toggle {
    background: var(--color-bg);
  }
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.7rem 1.4rem;
  border-radius: var(--radius-full);
  font-size: 1rem;
  font-weight: 400;
  letter-spacing: 0.01em;
  transition: background 0.15s ease, border-color 0.15s ease, opacity 0.15s ease;
}

.btn-primary {
  background: var(--color-accent);
  color: #fff;
}

.btn-primary:hover {
  background: var(--color-accent-strong);
}

.btn-secondary {
  border: 1px solid var(--color-border);
  color: var(--color-text);
}

.btn-secondary:hover,
.btn-secondary:focus-visible {
  border-color: var(--color-text);
}

.btn-arrow {
  display: inline-flex;
  align-items: center;
  max-width: 0;
  margin-left: 0;
  opacity: 0;
  overflow: hidden;
  transition: max-width 0.15s ease-in-out, margin-left 0.15s ease-in-out, opacity 0.15s ease-in-out;
}

.btn-arrow svg {
  width: 16px;
  height: 16px;
  display: block;
  flex-shrink: 0;
}

.btn-secondary:hover .btn-arrow,
.btn-secondary:focus-visible .btn-arrow {
  max-width: 24px;
  margin-left: 0.4rem;
  opacity: 1;
}

/* ---------- Generic page content ---------- */
.page-content {
  padding: var(--space-5) 0;
}

.page-content h1 {
  font-size: clamp(1.75rem, 3vw, 2.2rem);
  font-weight: 600;
}

.page-content .placeholder-text {
  margin-top: var(--space-2);
  font-size: 0.95rem;
  line-height: 1.85;
  color: var(--color-text);
}

.page-content .page-lede {
  max-width: 720px;
  margin-top: var(--space-2);
  font-size: 1rem;
  font-weight: 300;
  line-height: 1.85;
  color: var(--color-text);
}

.page-content .page-lede + .page-lede {
  margin-top: 1rem;
}

.page-content .page-lede a {
  color: var(--color-link);
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: color 0.15s ease;
}

.page-content .page-lede a:hover {
  color: #aaaaaa;
}

.playground-card-tag {
  flex-shrink: 0;
  font-size: 0.75rem;
  font-weight: 400;
  color: var(--color-text-muted);
  background: var(--color-surface);
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
}

/* ---------- Footer ---------- */
.site-footer {
  position: relative;
  background: var(--color-bg);
  border-top: 1px solid var(--color-border);
  padding: var(--space-3) 0;
  color: var(--color-text);
  font-size: 0.8rem;
  font-weight: 400;
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-3);
  max-width: 1440px;
  /* Match .header-inner's fixed side padding so footer content aligns
     with the header instead of .container's wider responsive clamp. */
  padding: 0 2rem;
}

.footer-social {
  display: flex;
  align-items: center;
  gap: 1.75rem;
}

.footer-social-icon {
  width: 20px;
  height: 20px;
}

.footer-social a .footer-social-icon {
  transition: opacity 0.15s ease;
}

.footer-social a:hover .footer-social-icon {
  opacity: 0.33;
}
