:root {
  color-scheme: dark;
  --bg: #08090b;
  --bg-2: #0e1116;
  --panel: #121720;
  --panel-2: #171e28;
  --panel-3: #1d2632;
  --line: #2b3746;
  --line-2: #3e5062;
  --text: #f2f5f2;
  --muted: #a9b6bf;
  --dim: #748391;
  --cyan: #32d6c7;
  --green: #9ad66b;
  --orange: #f0a84d;
  --red: #ff6f61;
  --blue: #69a7ff;
  --violet: #b28cff;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.42);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  background:
    linear-gradient(90deg, rgba(50, 214, 199, 0.08), transparent 32rem),
    linear-gradient(250deg, rgba(255, 111, 97, 0.08), transparent 30rem),
    var(--bg);
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  letter-spacing: 0;
}

body.lang-fa {
  direction: rtl;
  font-family:
    Tahoma, "Segoe UI", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    sans-serif;
}

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

button,
input {
  font: inherit;
}

img,
svg {
  display: block;
}

.section-band {
  width: min(1280px, calc(100% - 2rem));
  margin: 0 auto;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 1rem;
  min-height: 4.5rem;
  padding: 0 4vw;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(8, 9, 11, 0.9);
  backdrop-filter: blur(18px);
}

.brand,
.nav-links,
.scope-link,
.header-actions,
.lang-toggle,
.hero-actions,
.manual-head,
.track-tabs,
.lesson-meta,
.tool-line,
.card-meta,
.command-label {
  display: flex;
  align-items: center;
}

.brand {
  gap: 0.7rem;
  font-size: 1.08rem;
  font-weight: 900;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 2.4rem;
  height: 2.1rem;
  border: 1px solid rgba(50, 214, 199, 0.7);
  border-radius: 8px;
  background: #0b1718;
  color: var(--cyan);
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 0.78rem;
}

.nav-links {
  justify-content: center;
  gap: 0.25rem;
}

.nav-links a,
.scope-link {
  min-height: 2.4rem;
  padding: 0 0.85rem;
  border-radius: 8px;
  color: var(--muted);
  font-weight: 700;
}

.nav-links a {
  display: inline-flex;
  align-items: center;
}

.nav-links a:hover,
.nav-links a:focus-visible,
.scope-link:hover,
.scope-link:focus-visible {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  outline: none;
}

.scope-link {
  border: 1px solid rgba(50, 214, 199, 0.38);
  color: var(--cyan);
}

.header-actions {
  justify-content: flex-end;
  gap: 0.5rem;
}

.lang-toggle {
  justify-content: center;
  min-height: 2.4rem;
  padding: 0 0.85rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(18, 23, 32, 0.72);
  color: var(--text);
  font-weight: 900;
  cursor: pointer;
}

.lang-toggle:hover,
.lang-toggle:focus-visible {
  border-color: rgba(50, 214, 199, 0.7);
  color: var(--cyan);
  outline: none;
}

.hero {
  position: relative;
  min-height: min(720px, calc(100svh - 4.5rem));
  overflow: hidden;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background:
    linear-gradient(90deg, rgba(8, 9, 11, 0.95) 0%, rgba(8, 9, 11, 0.78) 45%, rgba(8, 9, 11, 0.36) 100%),
    url("assets/hero-tool-wall.svg") center / cover no-repeat,
    var(--bg-2);
}

body.lang-fa .hero {
  background:
    linear-gradient(270deg, rgba(8, 9, 11, 0.99) 0%, rgba(8, 9, 11, 0.94) 48%, rgba(8, 9, 11, 0.58) 100%),
    url("assets/hero-tool-wall.svg") center / cover no-repeat,
    var(--bg-2);
}

.hero-inner {
  display: grid;
  align-content: center;
  gap: 1.25rem;
  min-height: inherit;
  width: min(1280px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 3rem 0 4rem;
}

.eyebrow {
  margin: 0;
  color: var(--cyan);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

h1,
h2,
h3,
h4,
p,
dl,
dd {
  margin-top: 0;
}

h1 {
  max-width: 12ch;
  margin-bottom: 0;
  font-size: clamp(3.4rem, 7vw, 6.6rem);
  line-height: 0.88;
}

body.lang-fa h1 {
  max-width: 14ch;
  font-size: clamp(3rem, 5.1vw, 4.9rem);
  line-height: 1.12;
}

h2 {
  margin-bottom: 0;
  font-size: clamp(1.8rem, 3vw, 3rem);
  line-height: 1;
}

h3 {
  margin-bottom: 0.35rem;
  font-size: 1.1rem;
  line-height: 1.18;
}

h4 {
  margin-bottom: 0.65rem;
  color: var(--text);
  font-size: 0.95rem;
  text-transform: uppercase;
}

.hero p {
  max-width: 44rem;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 1.1rem;
  line-height: 1.65;
}

.hero-actions {
  flex-wrap: wrap;
  gap: 0.75rem;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  min-height: 3rem;
  padding: 0 1rem;
  border: 1px solid transparent;
  border-radius: 8px;
  font-weight: 900;
}

.button-primary {
  background: var(--cyan);
  color: #041111;
}

.button-secondary {
  border-color: var(--line-2);
  background: rgba(18, 23, 32, 0.72);
  color: var(--text);
}

.tool-strip,
.manual,
.scope {
  padding: 4.5rem 0;
}

.strip-heading,
.manual-head > div,
.reader-title,
.empty-state {
  display: grid;
  gap: 0.45rem;
}

.tool-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 0.8rem;
  margin-top: 1.25rem;
}

.tool-grid article {
  display: grid;
  grid-template-columns: 2.5rem 1fr;
  align-items: center;
  gap: 0.75rem;
  min-height: 4.2rem;
  padding: 0.8rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(18, 23, 32, 0.86);
}

.tool-grid img,
.tool-line img,
.card-icon {
  width: 2.5rem;
  height: 2.5rem;
  object-fit: contain;
}

.tool-grid span {
  font-weight: 900;
}

.manual {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.manual-head {
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.search-box {
  display: grid;
  grid-template-columns: auto minmax(12rem, 24rem);
  align-items: center;
  gap: 0.7rem;
  min-height: 3rem;
  padding: 0 0.9rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--dim);
}

.search-box:focus-within {
  border-color: rgba(50, 214, 199, 0.7);
}

.search-box span {
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.search-box input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
}

.track-tabs {
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.track-tab {
  min-height: 2.45rem;
  padding: 0 0.85rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #10151c;
  color: var(--muted);
  cursor: pointer;
}

.track-tab:hover,
.track-tab:focus-visible,
.track-tab[aria-pressed="true"] {
  border-color: rgba(50, 214, 199, 0.72);
  background: rgba(50, 214, 199, 0.11);
  color: var(--text);
  outline: none;
}

.manual-layout {
  display: grid;
  grid-template-columns: minmax(22rem, 0.9fr) minmax(0, 1.35fr);
  gap: 1rem;
  align-items: start;
}

.catalog {
  display: grid;
  gap: 0.75rem;
}

.tutorial-card {
  display: grid;
  grid-template-columns: 11.5rem minmax(0, 1fr);
  gap: 0.8rem;
  padding: 0.75rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(18, 23, 32, 0.82);
  color: inherit;
  cursor: pointer;
}

.tutorial-card:hover,
.tutorial-card:focus-visible,
.tutorial-card.is-active {
  border-color: rgba(50, 214, 199, 0.78);
  outline: none;
}

.tutorial-card.is-active {
  background: rgba(20, 36, 40, 0.9);
}

.card-media {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: 6px;
  background: #0a0e13;
}

.card-media > img:first-child {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.card-icon {
  position: absolute;
  right: 0.5rem;
  bottom: 0.5rem;
  padding: 0.25rem;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(8, 9, 11, 0.82);
}

body.lang-fa .card-icon {
  right: auto;
  left: 0.5rem;
}

.card-body {
  display: grid;
  gap: 0.55rem;
}

.card-kicker,
.tag,
.time {
  color: var(--dim);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.card-title {
  margin-bottom: 0;
  font-size: 1.05rem;
}

.card-summary,
.reader p,
.scope p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.62;
}

.card-meta {
  flex-wrap: wrap;
  gap: 0.4rem;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 1.5rem;
  padding: 0 0.5rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  color: var(--muted);
}

.tag-accent {
  border-color: rgba(50, 214, 199, 0.42);
  color: var(--cyan);
}

.reader {
  position: sticky;
  top: 5.35rem;
  max-height: calc(100svh - 6.2rem);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(18, 23, 32, 0.92);
  box-shadow: var(--shadow);
}

.reader-hero {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: contain;
  border-bottom: 1px solid var(--line);
  background: #0a0e13;
}

.reader-content {
  display: grid;
  gap: 1.15rem;
  padding: 1rem;
}

.tool-line {
  gap: 0.8rem;
}

.tool-line strong,
.lesson-meta strong {
  display: block;
}

.tool-line span,
.lesson-meta span {
  color: var(--dim);
  font-size: 0.85rem;
}

.lesson-meta {
  flex-wrap: wrap;
  gap: 0.45rem;
}

.reader-section {
  display: grid;
  gap: 0.65rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.reader-section ul,
.reader-section ol {
  display: grid;
  gap: 0.55rem;
  margin: 0;
  padding-left: 1.15rem;
  color: var(--muted);
  line-height: 1.55;
}

body.lang-fa .reader-section ul,
body.lang-fa .reader-section ol {
  padding-right: 1.15rem;
  padding-left: 0;
}

.reader-section li::marker {
  color: var(--cyan);
  font-weight: 900;
}

.command-stack {
  display: grid;
  gap: 0.65rem;
}

.command-block {
  overflow: hidden;
  border: 1px solid #263443;
  border-radius: 8px;
  background: #080c10;
}

.command-label {
  justify-content: space-between;
  gap: 1rem;
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid #263443;
  background: #101820;
  color: var(--dim);
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 0.78rem;
  font-weight: 900;
}

pre {
  direction: ltr;
  text-align: left;
  margin: 0;
  overflow-x: auto;
  padding: 0.85rem;
  color: #d8f7ef;
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 0.86rem;
  line-height: 1.55;
  white-space: pre-wrap;
}

.command-block,
.command-label {
  direction: ltr;
}

.safety-note {
  padding: 0.85rem;
  border: 1px solid rgba(240, 168, 77, 0.42);
  border-radius: 8px;
  background: rgba(240, 168, 77, 0.08);
  color: #f4c985;
  line-height: 1.55;
}

.scope {
  display: grid;
  grid-template-columns: 0.95fr 1.05fr;
  gap: 2rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 2rem 4vw;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--muted);
}

.empty-state {
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--muted);
}

@media (max-width: 1100px) {
  .tool-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .manual-layout {
    grid-template-columns: 1fr;
  }

  .reader {
    position: static;
    max-height: none;
  }
}

@media (max-width: 760px) {
  .site-header {
    position: static;
    grid-template-columns: 1fr;
    padding-top: 1rem;
    padding-bottom: 1rem;
  }

  .nav-links {
    justify-content: space-between;
  }

  .scope-link {
    justify-content: center;
  }

  .header-actions {
    justify-content: stretch;
  }

  .header-actions > * {
    flex: 1;
  }

  .hero {
    min-height: 0;
    background:
      linear-gradient(90deg, rgba(8, 9, 11, 0.98) 0%, rgba(8, 9, 11, 0.9) 100%),
      url("assets/hero-tool-wall.svg") 68% center / cover no-repeat,
      var(--bg-2);
  }

  body.lang-fa .hero {
    background:
      linear-gradient(270deg, rgba(8, 9, 11, 0.99) 0%, rgba(8, 9, 11, 0.92) 100%),
      url("assets/hero-tool-wall.svg") 68% center / cover no-repeat,
      var(--bg-2);
  }

  .hero-inner {
    padding: 3rem 0;
  }

  h1 {
    font-size: clamp(3rem, 14vw, 4.3rem);
  }

  .manual-head,
  .scope,
  .site-footer {
    align-items: stretch;
    grid-template-columns: 1fr;
    flex-direction: column;
  }

  .manual-head {
    display: grid;
  }

  .search-box {
    grid-template-columns: auto minmax(0, 1fr);
  }

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

  .tutorial-card {
    grid-template-columns: 1fr;
  }

  .card-media {
    aspect-ratio: 16 / 8;
  }
}

@media (max-width: 460px) {
  .section-band,
  .hero-inner {
    width: min(100% - 1rem, 1280px);
  }

  .tool-grid {
    grid-template-columns: 1fr;
  }

  .button,
  .lang-toggle {
    width: 100%;
  }
}
