/* ========== CSS Custom Properties ========== */
:root {
  --color-primary: #1a1a2e;
  --color-primary-light: #16213e;
  --color-accent: #f9a825;
  --color-accent-hover: #f57f17;
  --color-bg: #f8f9fa;
  --color-bg-alt: #ffffff;
  --color-text: #333333;
  --color-text-light: #666666;
  --color-text-muted: #999999;
  --color-border: #e0e0e0;
  --color-code-bg: #1e1e2e;
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-mono: 'Fira Code', 'Consolas', 'Monaco', monospace;
  --max-width: 1100px;
  --header-height: 64px;
  --radius: 8px;
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 4px 20px rgba(0, 0, 0, 0.12);
  --transition: 0.3s ease;
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: var(--header-height);
}

body {
  font-family: var(--font-sans);
  color: var(--color-text);
  background: var(--color-bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

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

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

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

ul {
  list-style: none;
}

/* ========== Layout ========== */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 16px;
}

/* ========== Header ========== */
body > header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  background: var(--color-primary);
  z-index: 1000;
  transition: background var(--transition), box-shadow var(--transition);
}

body > header.scrolled {
  background: rgba(26, 26, 46, 0.95);
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(8px);
}

body > header > .container {
  display: flex;
  align-items: center;
  height: 100%;
  gap: 10px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #ffffff;
  font-weight: 700;
  font-size: 1.2rem;
  text-decoration: none;
  flex-shrink: 0;
}

.logo:hover {
  color: #ffffff;
}

.logo-img {
  height: 50px;
  width: auto;
  max-width: initial;
}

/* ========== Language Switch ========== */
.lang-switch {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  margin-left: auto;
}

.lang-link {
  color: rgba(255, 255, 255, 0.5);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 4px;
  transition: color var(--transition), background var(--transition);
}

.lang-link:hover {
  color: #ffffff;
}

.lang-link.active {
  color: #ffffff;
  background: var(--color-accent);
}

/* ========== Hero (mobile default) ========== */
.hero {
  padding: 100px 0 50px;
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-light) 50%, #0f3460 100%);
  color: #ffffff;
  text-align: center;
}

.hero-title {
  font-size: 1.8rem;
  font-weight: 800;
  margin-bottom: 12px;
  letter-spacing: -0.02em;
  font-family: var(--font-mono);
}

.hero-subtitle {
  font-size: 1.1rem;
  font-weight: 300;
  opacity: 0.9;
  margin-bottom: 16px;
}

.hero-description {
  font-size: 0.95rem;
  opacity: 0.75;
  max-width: 600px;
  margin: 0 auto 40px;
  line-height: 1.7;
}

.hero-stats {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  flex-direction: column;
  align-items: center;
}

.stat {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius);
  padding: 12px 20px;
  backdrop-filter: blur(4px);
  user-select: none;
  width: 100%;
  max-width: 240px;
}

.stat-value {
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

/* ========== Sections ========== */
.section {
  padding: 50px 0;
}

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

.section-title {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--color-primary);
  text-align: center;
  margin-bottom: 12px;
  letter-spacing: -0.01em;
}

.section-intro {
  text-align: center;
  color: var(--color-text-light);
  font-size: 0.95rem;
  max-width: 600px;
  margin: 0 auto 16px;
}

.section-notice {
  text-align: center;
  color: var(--color-text-muted);
  font-size: 0.9rem;
  font-style: italic;
  max-width: 600px;
  margin: 0 auto 48px;
}

/* ========== Components / Modules ========== */
.component-groups {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
}

.component-group {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 20px;
}

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

.group-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--color-accent);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--color-accent);
}

.component-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.module-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

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

.module-row-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.module-name a {
  color: var(--color-primary);
  font-family: var(--font-mono);
  font-size: 0.95rem;
  font-weight: 700;
  text-decoration: none;
  transition: color var(--transition);
}

.module-name a:hover {
  color: var(--color-accent);
}

.module-desc {
  margin: 0;
  color: var(--color-text-muted);
  font-size: 0.85rem;
}

.module-row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.module-row-actions a.icon {
  padding: 4px;
  line-height: 0;
}

.module-row-actions a.icon:hover {
  opacity: .8;
}

.module-row-actions a.icon.github {
  color: var(--color-text);
}

.module-row-actions a.icon.packagist {
  color: #f28d1a;
}

.module-row-actions .link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  text-decoration: none;
  background: rgba(0, 0, 0, 0.05);
  color: var(--color-text);
  transition: background var(--transition), color var(--transition);
}

.module-row-actions .link:hover {
  background: rgba(0, 0, 0, 0.1);
  color: var(--color-primary);
}

.module-row-actions .link.demo {
  background: var(--color-accent);
  color: #fff;
}

.module-row-actions .link.demo:hover {
  background: var(--color-accent-hover);
  color: #fff;
}

.module-row-actions .link.example {
  background: rgba(0, 119, 182, 0.12);
  color: var(--color-accent);
}

.module-row-actions .link.example:hover {
  background: rgba(0, 119, 182, 0.22);
  color: var(--color-accent);
}

@media (min-width: 768px) {
  .module-row {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
  }

  .module-row-actions {
    justify-content: flex-end;
    flex-shrink: 0;
  }
}

/* ========== About ========== */
.about-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

.about-card {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 24px;
}

.about-card h3 {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--color-primary);
  margin-bottom: 12px;
}

.about-card p {
  color: var(--color-text-light);
  font-size: 0.95rem;
  line-height: 1.7;
  margin-bottom: 12px;
}

.about-card p:last-child {
  margin-bottom: 0;
}

.about-links a {
  font-weight: 600;
}

/* ========== Module Detail ========== */
.hero-package {
  padding: 120px 0 48px;
}

.hero-package .hero-title {
  font-size: 2.4rem;
  margin-bottom: 8px;
}

.hero-package .hero-subtitle {
  font-size: 1.15rem;
  margin-bottom: 16px;
}

.back-link {
  display: inline-block;
  color: rgba(255, 255, 255, 0.6);
  font-size: 0.9rem;
  margin-bottom: 24px;
  transition: color var(--transition);
}

.back-link:hover {
  color: #ffffff;
}

.pkg-badge {
  display: inline-block;
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #ffffff;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 4px 14px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  user-select: none;
}

.pkg-detail {
  max-width: 800px;
  margin: 0 auto;
}

.pkg-detail h2 {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--color-primary);
  margin: 40px 0 16px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--color-border);
}

.pkg-detail h2:first-child {
  margin-top: 0;
}

.pkg-detail p {
  color: var(--color-text-light);
  font-size: 0.95rem;
  line-height: 1.7;
  margin-bottom: 12px;
}

.pkg-detail ul {
  list-style: none;
  padding: 0;
  margin: 0 0 16px;
}

.pkg-detail ul li {
  padding: 6px 0;
  font-size: 0.9rem;
  color: var(--color-text-light);
  border-bottom: 1px solid rgba(0, 0, 0, 0.04);
  padding-left: 16px;
  position: relative;
}

.pkg-detail ul li::before {
  content: '>';
  position: absolute;
  left: 0;
  color: var(--color-accent);
  font-weight: 700;
}

.pkg-detail ul li:last-child {
  border-bottom: none;
}

.pkg-detail ul li strong {
  color: var(--color-text);
}

.pkg-install {
  margin-top: 48px;
}

.pkg-links {
  display: flex;
  gap: 10px;
  flex-direction: column;
  align-items: center;
  margin: 20px auto;
  width: 300px;
  background: rgba(255, 255, 255, .4);
  padding: 10px;
  border-radius: 6px;
}

.pkg-links>a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #222;
  opacity: .7;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  font-weight: 500;
  transition: opacity var(--transition);
  user-select: none;
}

.pkg-links>a:hover {
  opacity: 1;
}

.pkg-links>a svg {
  flex-shrink: 0;
}

.pkg-links>a.pkg-private {
  color: #d0021b;
  cursor: default;
}

.pkg-links>a.pkg-private:hover {
  color: #d0021b;
}

.pkg-install pre {
  background: #eef1f5;
  color: var(--color-text);
  padding: 16px 20px;
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: 0.9rem;
  overflow-x: auto;
  border: 1px solid var(--color-border);
}

.pkg-install code {
  font-family: inherit;
}

/* ========== Footer ========== */
body > footer {
  background: var(--color-primary);
  color: rgba(255, 255, 255, 0.6);
  padding: 32px 0;
  text-align: center;
  font-size: 0.9rem;
}

body > footer > .container {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

body > footer > .container > nav a {
  color: rgba(255, 255, 255, 0.6);
  font-size: 0.8rem;
  transition: color var(--transition);
}

body > footer > .container > nav a:hover {
  color: #ffffff;
}

body > footer > .container > nav a+a::before {
  content: ' - ';
  color: rgba(255, 255, 255, 0.4);
}

/* ========== Desktop (768px+) ========== */
@media (min-width: 768px) {
  .container {
    padding: 0 24px;
  }

  .hero {
    padding: 140px 0 80px;
  }

  .hero-title {
    font-size: 3.2rem;
  }

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

  .hero-description {
    font-size: 1.05rem;
  }

  .hero-stats {
    flex-direction: row;
    gap: 32px;
  }

  .stat {
    width: auto;
    max-width: none;
    padding: 16px 28px;
  }

  .section {
    padding: 80px 0;
  }

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

  .section-intro {
    font-size: 1.05rem;
  }

  .component-groups {
    grid-template-columns: repeat(2, 1fr);
    gap: 32px;
  }

  .component-group {
    padding: 24px;
  }

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

  .about-card {
    padding: 32px;
  }
}

/* ========== Module hero meta ========== */
.pkg-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
  justify-content: center;
}

.pkg-badge-demo,
.pkg-badge-example {
  padding: 8px 18px;
  font-size: 0.85rem;
  background: var(--color-accent);
  border-color: var(--color-accent);
  color: #fff;
  text-decoration: none;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
  transition: opacity var(--transition), color var(--transition);
}

.pkg-badge-demo:hover,
.pkg-badge-example:hover {
  opacity: 0.7;
  color: #000;
}

/* ========== Example page ========== */
.example-article {
  max-width: 800px;
  margin: 0 auto;
}

.example-article section code {
  background-color: var(--color-text-muted);
  padding: 4px 6px;
  border-radius: 6px;
}

.example-article>section {
  margin: 0 auto 32px auto;
  padding: 20px;
}

.example-article>section h2 {
  font-size: 1.2rem;
  margin: 10px 0;
  color: var(--color-primary-light);
}

.example-article>section h3 {
  font-size: 1.1rem;
  margin: 10px 0;
  color: var(--color-primary-light);
}

.example-article>section .buttons {
  margin-top: 16px;
  display: flex;
  column-gap: 30px;
  justify-content: center;
}

.example-400 {
  max-width: 400px;
  background-color: var(--color-accent);
}

.example-400 > h2:first-child {
  margin-top: 0;
}

.sr-only {
  position: absolute;
  left: -10000px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* ========== Modalizer example ========== */
body.modalizer-open>.tooltip {
  z-index: 100900;
}

body.modalizer-open .app-messages,
body.modalizer-open .redactor-dropdown {
  z-index: 100899;
}

.gallery {
  display: flex;
  flex-wrap: wrap;
  column-gap: 10px;
}

.gallery>figure {
  max-width: 100px;
  height: 100px;
  margin: 0;
}

.gallery>figure img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  cursor: pointer;
}