/* SONARA — Brand styles
 * Premium monochrome audio software identity.
 * Palette: pure black, deep charcoal, elevated surface, pure white, soft gray, muted gray, border.
 */

:root {
  /* Brand palette */
  --black: #050505;
  --charcoal: #111111;
  --surface: #1A1A1A;
  --surface-high: #242424;
  --white: #FFFFFF;
  --text-primary: #FFFFFF;
  --text-secondary: #A0A0A0;
  --text-tertiary: #707070;
  --border: #333333;

  --container-max: 1200px;
  --header-height: 70px;
  --radius-md: 12px;
  --radius-lg: 18px;

  --font-main: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    Helvetica, Arial, sans-serif;
  --font-mono: "JetBrains Mono", "SF Mono", Consolas, monospace;
}

/* Light theme (system or manual class override) */
@media (prefers-color-scheme: light) {
  :root {
    --black: #FFFFFF;
    --charcoal: #F5F5F5;
    --surface: #FFFFFF;
    --surface-high: #EFEFEF;
    --white: #050505;
    --text-primary: #050505;
    --text-secondary: #333333;
    --text-tertiary: #707070;
    --border: #E0E0E0;
  }
}

html {
  scroll-behavior: smooth;
}

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

html,
body {
  height: 100%;
}

body {
  margin: 0;
  background-color: var(--black);
  color: var(--text-primary);
  font-family: var(--font-main);
  font-size: 16px;
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

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

button {
  font-family: inherit;
}

/* Focus visible — accessible focus states everywhere */
:focus-visible {
  outline: 2px solid var(--text-primary);
  outline-offset: 3px;
}

/* Skip link for keyboard users */
.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--white);
  color: var(--black);
  padding: 8px 16px;
  z-index: 10001;
  transition: top 0.2s;
}

.skip-link:focus {
  top: 0;
}

/* ---------------- HEADER / NAV ---------------- */

.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  background: rgba(5, 5, 5, 0.72);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  z-index: 1000;
}

.header .container {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 1.25rem;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 800;
  font-size: 1.125rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.brand img {
  width: 34px;
  height: 34px;
  border-radius: 8px;
}

.brand span {
  letter-spacing: 0.12em;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 2rem;
}

.nav-link {
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
  padding: 0.5rem 0;
  position: relative;
  transition: color 0.18s ease;
}

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

/* Active underline indicator */
.nav-link.active::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--text-primary);
}

.github-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
  transition: background 0.18s ease, border-color 0.18s ease;
}

.github-btn:hover {
  background: var(--surface);
  border-color: var(--text-tertiary);
}

.nav-toggle {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  background: none;
  border: none;
  color: var(--text-primary);
  cursor: pointer;
  padding: 0.4rem;
}

/* The markup ships three bars; no pseudo-elements needed. */
.nav-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  border-radius: 2px;
  background: var(--text-primary);
  transition: transform 0.18s ease, opacity 0.18s ease;
}

.nav-toggle[aria-expanded="true"] span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.nav-toggle[aria-expanded="true"] span:nth-child(2) {
  opacity: 0;
}

.nav-toggle[aria-expanded="true"] span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* Mobile nav drawer */
.nav-drawer {
  position: fixed;
  top: var(--header-height);
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--black);
  border-top: 1px solid var(--border);
  padding: 2rem 1.5rem;
  transform: translateX(100%);
  transition: transform 0.28s ease;
  z-index: 999;
  overflow-y: auto;
}

.nav-drawer.open {
  transform: translateX(0);
}

.nav-drawer .nav-links {
  flex-direction: column;
  align-items: stretch;
  gap: 0.75rem;
}

.nav-drawer .nav-link {
  font-size: 1.05rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border);
}

.nav-drawer .github-btn {
  justify-content: center;
}

/* Backdrop */
.nav-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.28s ease;
  z-index: 998;
}

.nav-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

/* ---------------- PAGE LAYOUT ---------------- */

.page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main {
  flex: 1;
}

/* ---------------- SECTIONS ---------------- */

.section {
  padding: 5rem 1.25rem;
}

.section--spacious {
  padding: 7rem 1.25rem;
}

.section .container {
  max-width: var(--container-max);
  margin: 0 auto;
}

.section-tag {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  margin-bottom: 1rem;
}

.section-title {
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin: 0 0 1.25rem 0;
}

.section-desc {
  font-size: 1.125rem;
  color: var(--text-secondary);
  max-width: 680px;
  line-height: 1.7;
}

/* ---------------- BUTTONS ---------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  padding: 0.9rem 1.75rem;
  font-size: 0.95rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-primary);
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease, transform 0.16s ease,
    box-shadow 0.18s ease;
}

.btn:hover {
  background: var(--surface-high);
  border-color: var(--text-tertiary);
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
}

.btn-primary {
  background: var(--white);
  color: var(--black);
  border-color: var(--white);
}

.btn-primary:hover {
  background: #e8e8e8;
  border-color: #e8e8e8;
  box-shadow: 0 6px 20px rgba(255, 255, 255, 0.08);
}

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

.btn-secondary:hover {
  background: var(--surface);
  border-color: var(--text-tertiary);
}

.btn-large {
  padding: 1.1rem 2.2rem;
  font-size: 1.05rem;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.btn--icon {
  padding: 0.75rem;
  border-radius: 50%;
}

/* ---------------- CARDS ---------------- */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
  border-color: var(--text-tertiary);
  transform: translateY(-2px);
}

/* ---------------- GRIDS ---------------- */

.grid {
  display: grid;
  gap: 1.5rem;
}

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

.grid--3 {
  grid-template-columns: repeat(3, 1fr);
}

.grid--4 {
  grid-template-columns: repeat(4, 1fr);
}

/* ---------------- DEVICE MOCKUP ---------------- */

.mockup {
  position: relative;
  width: 300px;
  max-width: 100%;
  border-radius: 30px;
  padding: 9px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
}

.mockup-inner {
  border-radius: 24px;
  overflow: hidden;
  background: var(--charcoal);
}

.mockup-image {
  width: 100%;
  height: auto;
  display: block;
}

/* ---------------- FOOTER ---------------- */

.footer {
  border-top: 1px solid var(--border);
  background: var(--charcoal);
  padding: 3rem 1.25rem;
}

.footer .container {
  max-width: var(--container-max);
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: 2rem;
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 700;
  font-size: 1rem;
}

.footer-brand img {
  width: 22px;
  height: 22px;
  border-radius: 6px;
}

.footer-copy {
  font-size: 0.85rem;
  color: var(--text-tertiary);
  margin-top: 0.5rem;
}

.footer-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
  list-style: none;
  padding: 0;
  margin: 0;
}

.footer-nav a {
  font-size: 0.85rem;
  color: var(--text-secondary);
  transition: color 0.18s ease;
}

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

.footer-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
  font-size: 0.85rem;
  color: var(--text-tertiary);
}

.footer-meta a {
  color: var(--text-secondary);
}

.back-to-top {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: 1.25rem;
}

.back-to-top:hover {
  color: var(--text-primary);
}

/* ---------------- UTILITIES ---------------- */

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.text-center {
  text-align: center;
}

.text-secondary {
  color: var(--text-secondary);
}

/* ---------------- EMPTY STATE ---------------- */

.empty-state {
  text-align: center;
  padding: 4rem 1.5rem;
}

.empty-state h3 {
  font-size: 1.5rem;
  margin-bottom: 0.75rem;
}

.empty-state p {
  color: var(--text-secondary);
  max-width: 420px;
  margin: 0 auto;
}

/* ---------------- SKELETON LOADING ---------------- */

.skeleton {
  background: linear-gradient(90deg, var(--surface) 25%, var(--surface-high) 50%, var(--surface) 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.4s ease-in-out infinite;
  border-radius: 4px;
}

@keyframes skeleton-shimmer {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

.skeleton-text {
  height: 1em;
  width: 100%;
  margin-bottom: 0.75em;
}

/* ---------------- PAGE-SPECIFIC HERO STYLES (add in page css) ---------------- */


/* ---------------- HOME HERO ---------------- */

.hero-grid {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 3rem;
  align-items: center;
}

.hero-visual {
  display: flex;
  justify-content: center;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
}

/* Long tokens (hashes, package ids) must never widen the page */
code {
  overflow-wrap: anywhere;
  word-break: break-word;
}

/* Safety net: no accidental sideways scrolling on small screens */
html,
body {
  overflow-x: clip;
}

/* ---------------- RESPONSIVE ---------------- */

@media (max-width: 900px) {
  .grid--3,
  .grid--4 {
    grid-template-columns: repeat(2, 1fr);
  }

  .section {
    padding: 4rem 1.25rem;
  }

  .section--spacious {
    padding: 5rem 1.25rem;
  }
}

@media (max-width: 768px) {
  /* Only the header collapses into the drawer; the drawer itself keeps every
     link, including GitHub, so nothing is trimmed on mobile. */
  .header .nav-links,
  .header .github-btn {
    display: none;
  }

  .nav-drawer .nav-links {
    display: flex;
  }

  .nav-drawer .github-btn {
    display: flex;
  }

  .nav-toggle {
    display: flex;
    min-width: 44px;
    min-height: 44px;
    margin-right: -0.4rem;
  }

  .grid--2,
  .grid--3,
  .grid--4 {
    grid-template-columns: 1fr;
  }

  .hero-content {
    text-align: center;
  }

  .hero-actions {
    justify-content: center;
  }

  .footer .container {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .footer-meta {
    justify-content: center;
  }
}

@media (max-width: 900px) {
  .hero-grid {
    grid-template-columns: 1fr;
    gap: 2.25rem;
    text-align: center;
  }

  .hero-content .section-tag {
    justify-content: center;
  }

  .hero-actions {
    justify-content: center;
  }

}

@media (max-width: 600px) {
  .hero-title {
    font-size: clamp(2rem, 9vw, 2.6rem);
    line-height: 1.12;
  }

  .hero-subtitle {
    font-size: 0.98rem;
  }

  .hero-actions {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
  }

  .hero-actions .btn {
    width: 100%;
    justify-content: center;
  }

  .mockup {
    width: min(300px, 74vw);
  }
}

@media (max-width: 380px) {
  .mockup {
    width: min(280px, 78vw);
  }

  .section-title {
    font-size: 1.85rem;
  }
}

/* Comfortable tap targets on touch devices */
@media (hover: none) and (pointer: coarse) {
  .nav-toggle {
    min-width: 44px;
    min-height: 44px;
    align-items: center;
    justify-content: center;
  }

  .nav-link,
  .nav-drawer a {
    min-height: 44px;
    display: flex;
    align-items: center;
  }
}
