/* Shared base styles and reusable components across all tools. */

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

html {
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: var(--leading-normal);
  color: var(--text);
  background-color: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
}

/* Optional modular active background slot (populated by tool layer). */

.site-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

main {
  flex: 1;
  position: relative;
  z-index: 1;
}

h1,
h2,
h3,
h4,
p {
  margin: 0;
}

h1 {
  font-size: var(--text-3xl);
  line-height: var(--leading-tight);
  letter-spacing: -0.025em;
  font-weight: 700;
}

h2 {
  font-size: var(--text-2xl);
  line-height: var(--leading-tight);
  letter-spacing: -0.02em;
  font-weight: 650;
}

h3 {
  font-size: var(--text-lg);
  line-height: var(--leading-snug);
  letter-spacing: -0.01em;
  font-weight: 600;
}

p {
  color: var(--text-muted);
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

code,
pre {
  font-family: var(--font-mono);
}

/* Layout primitives */

.container {
  width: 100%;
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--container-pad);
}

.section {
  padding-block: var(--space-7);
}

.section + .section {
  border-top: 1px solid var(--border);
}

.section-hero {
  padding-block: var(--space-7) var(--space-8);
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.95fr);
  align-items: center;
  gap: var(--space-7);
}

.hero-copy {
  min-width: 0;
}

.hero-subheadline {
  font-size: var(--text-base);
  max-width: 58ch;
}

.hero-media {
  display: flex;
  justify-content: center;
  min-width: 0;
}

.app-screenshot {
  display: block;
  width: 100%;
  max-width: 390px;
  height: auto;
}

/* Shared screenshot carousel and native <dialog> lightbox */

.carousel {
  width: 100%;
  max-width: var(--carousel-max-width, 440px);
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.carousel-track {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radius-lg);
}

.carousel-track::-webkit-scrollbar {
  display: none;
}

.carousel-track:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.carousel-slide {
  flex: 0 0 100%;
  width: 100%;
  margin: 0;
  scroll-snap-align: center;
  scroll-snap-stop: always;
  display: flex;
  align-items: center;
  justify-content: center;
}

.carousel-zoom-trigger {
  appearance: none;
  border: 0;
  padding: 0;
  margin: 0;
  background: transparent;
  width: 100%;
  aspect-ratio: var(--carousel-aspect-ratio, 1344 / 1220);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: zoom-in;
  border-radius: var(--radius-lg);
}

.carousel-zoom-trigger:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.carousel-image {
  display: block;
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  transition: transform 180ms ease;
}

.carousel-zoom-trigger:hover .carousel-image {
  transform: scale(1.012);
}

.carousel-footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
}

.carousel-meta {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-2);
}

.carousel-caption {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.carousel-counter {
  font-family: var(--font-mono);
  color: var(--text-subtle);
}

.carousel-caption-sep {
  color: var(--border-strong);
}

.carousel-zoom-btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background-color: var(--bg-subtle);
  color: var(--text-muted);
  font: inherit;
  font-size: var(--text-xs);
  font-weight: 500;
  cursor: pointer;
  transition: background-color 120ms ease, border-color 120ms ease, color 120ms ease;
}

.carousel-zoom-btn:hover {
  color: var(--text);
  border-color: var(--border-strong);
  background-color: var(--bg-elevated);
}

.carousel-zoom-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.carousel-controls {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  padding: 4px 6px;
  border-radius: var(--radius-pill);
  background-color: var(--bg-elevated);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.carousel-nav-btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: background-color 120ms ease, color 120ms ease;
}

.carousel-nav-btn:hover {
  background-color: var(--bg-subtle);
  color: var(--text);
}

.carousel-nav-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.carousel-dots {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding-inline: 2px;
}

.carousel-dot {
  appearance: none;
  border: 0;
  padding: 0;
  width: 7px;
  height: 7px;
  border-radius: var(--radius-pill);
  background-color: var(--border-strong);
  cursor: pointer;
  transition: width 160ms ease, background-color 160ms ease;
}

.carousel-dot:hover {
  background-color: var(--text-muted);
}

.carousel-dot[aria-current="true"] {
  width: 20px;
  background-color: var(--accent);
}

.carousel-dot:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.carousel-lightbox {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  max-width: min(94vw, var(--carousel-lightbox-max-width, 940px));
  max-height: 94vh;
  width: fit-content;
  overflow: visible;
}

.carousel-lightbox[open] {
  display: flex;
}

.carousel-lightbox::backdrop {
  background: rgba(10, 12, 14, 0.78);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.carousel-lightbox-frame {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4);
  border-radius: var(--radius-lg);
  background-color: var(--bg-elevated);
  border: 1px solid var(--border);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
  max-width: 100%;
  max-height: 94vh;
}

.carousel-lightbox-header {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
}

.carousel-lightbox-title {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text);
}

.carousel-lightbox-close {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background-color: var(--bg-subtle);
  color: var(--text-muted);
  cursor: pointer;
  flex-shrink: 0;
  transition: background-color 120ms ease, border-color 120ms ease, color 120ms ease;
}

.carousel-lightbox-close:hover {
  color: var(--text);
  border-color: var(--border-strong);
  background-color: var(--bg-elevated);
}

.carousel-lightbox-close:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.carousel-lightbox-stage {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
  overflow: hidden;
}

.carousel-lightbox-image {
  display: block;
  max-width: min(86vw, var(--carousel-lightbox-image-max-width, 880px));
  max-height: calc(90vh - 140px);
  width: auto;
  height: auto;
  object-fit: contain;
}

.carousel-lightbox-controls {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  padding: 4px 6px;
  border-radius: var(--radius-pill);
  background-color: var(--bg-subtle);
  border: 1px solid var(--border);
}

.section-header {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-bottom: var(--space-5);
}

.grid {
  display: grid;
  gap: var(--space-4);
}

.grid-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid-3 {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.stack {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
}

/* Header */

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background-color: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.site-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  min-height: 60px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--text);
  font-weight: 650;
  font-size: var(--text-base);
  letter-spacing: -0.01em;
}

.brand:hover {
  text-decoration: none;
}

.brand-icon {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  display: block;
  flex-shrink: 0;
}

.brand-mark {
  width: 10px;
  height: 10px;
  border-radius: var(--radius-pill);
  background-color: var(--accent);
  display: inline-block;
}

.site-nav {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-4);
  font-size: var(--text-sm);
}

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

.site-nav a:hover {
  color: var(--text);
  text-decoration: none;
}

/* Segmented controls (shared theme toggle) */

.segmented {
  display: inline-flex;
  align-items: center;
  padding: 2px;
  border-radius: var(--radius-pill);
  background-color: var(--bg-subtle);
  border: 1px solid var(--border);
  gap: 2px;
}

.segmented button {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: var(--text-xs);
  font-weight: 500;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: background-color 120ms ease, color 120ms ease;
}

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

.segmented button[aria-pressed="true"] {
  background-color: var(--bg-elevated);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

/* Buttons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 0.625rem 1.125rem;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: var(--text-sm);
  font-weight: 600;
  line-height: 1.2;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background-color 120ms ease, border-color 120ms ease, color 120ms ease;
}

.btn:hover {
  text-decoration: none;
}

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

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

.btn-secondary {
  background-color: var(--bg-elevated);
  color: var(--text);
  border-color: var(--border-strong);
}

.btn-secondary:hover {
  background-color: var(--bg-subtle);
}

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

.btn-ghost:hover {
  background-color: var(--bg-subtle);
  color: var(--text);
}

/* Badges */

.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-pill);
  background-color: var(--accent-soft);
  color: var(--accent);
  font-size: var(--text-xs);
  font-weight: 600;
  width: fit-content;
}

/* Cards */

.card {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-5);
  border-radius: var(--radius-lg);
  background-color: var(--bg-elevated);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.card-kicker {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--accent);
  font-family: var(--font-mono);
}

.card-title {
  color: var(--text);
}

.card-body {
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.card-link {
  margin-top: auto;
  padding-top: var(--space-2);
  font-size: var(--text-sm);
  font-weight: 500;
  width: fit-content;
}

/* Command / code block */

.cmd-block {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  width: fit-content;
  max-width: 100%;
  padding: 0.625rem 0.75rem 0.625rem 1rem;
  border-radius: var(--radius-md);
  background-color: var(--bg-elevated);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.cmd-text {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  line-height: var(--leading-snug);
  color: var(--text);
  min-width: 0;
  white-space: normal;
  overflow-wrap: anywhere;
}

.cmd-prompt {
  color: var(--accent);
  user-select: none;
  margin-right: var(--space-2);
}

.cmd-copy {
  appearance: none;
  border: 1px solid var(--border);
  background-color: var(--bg-subtle);
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  font-weight: 500;
  padding: 0.35rem 0.65rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  flex-shrink: 0;
  transition: background-color 120ms ease, border-color 120ms ease, color 120ms ease;
}

.cmd-copy:hover {
  color: var(--text);
  border-color: var(--border-strong);
}

.cmd-copy[data-copied="true"] {
  border-color: var(--accent);
  background-color: var(--accent-soft);
  color: var(--accent);
}

/* Footer */

.site-footer {
  position: relative;
  z-index: 1;
  margin-top: var(--space-8);
  border-top: 1px solid var(--border);
  padding-block: var(--space-6);
  font-size: var(--text-sm);
  color: var(--text-subtle);
}

.site-footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
}

.footer-links a {
  color: var(--text-muted);
}

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

.footer-muted {
  color: var(--text-subtle);
}

/* Responsive adjustments */

@media (max-width: 820px) {
  .hero-grid {
    grid-template-columns: 1fr;
    gap: var(--space-6);
  }

  .app-screenshot,
  .carousel {
    max-width: var(--carousel-mobile-max-width, 400px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .carousel-track {
    scroll-behavior: auto;
  }

  .carousel-image,
  .carousel-zoom-btn,
  .carousel-nav-btn,
  .carousel-dot,
  .carousel-lightbox-close {
    transition: none;
  }

  .carousel-zoom-trigger:hover .carousel-image {
    transform: none;
  }
}

@media (max-width: 700px) {
  .grid-2 {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 600px) {
  .site-header-inner {
    flex-wrap: wrap;
    min-height: auto;
    gap: var(--space-2) var(--space-3);
    padding-block: var(--space-2);
  }

  .site-nav {
    gap: var(--space-2) var(--space-3);
  }

  .section,
  .section-hero {
    padding-block: var(--space-6);
  }

  .cmd-block {
    width: 100%;
  }
}
