/* Base styles */
* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --color-bg: #fff;
  --color-surface: #fafafa;
  --color-text: #222;
  --color-link: #222;
  --color-border: #ddd;
  --color-muted: #444;
  --color-footer: #666;
  --color-highlight: #f7931e;
  --color-highlight-active: #bf2b2b;
  --color-highlight-green: rgba(245, 146, 59, .96);
  --color-prompt: rgba(0, 128, 0, 1.0);
}

@media (prefers-color-scheme: dark) {
  :root {
    --color-bg: #1a1a1a;
    --color-surface: #222;
    --color-text: #eee;
    --color-link: #eee;
    --color-border: #444;
    --color-muted: #bbb;
    --color-footer: #999;
  	--color-highlight: #f7931e;
    --color-highlight-green: rgba(0, 255, 0, .2);
    --color-prompt: rgba(0, 205, 0, .8);
  }
}

html.light {
  --color-bg: #fff;
  --color-surface: #fafafa;
  --color-text: #222;
  --color-link: #222;
  --color-border: #ddd;
  --color-muted: #444;
  --color-footer: #666;
  --color-highlight: #f7931e;
  --color-highlight-active: #bf2b2b;
  --color-highlight-green: rgba(245, 146, 59, .96);
  --color-prompt: rgba(0, 128, 0, 1.0);
}

html.dark {
  --color-bg: #1a1a1a;
  --color-surface: #222;
  --color-text: #eee;
  --color-link: #eee;
  --color-border: #444;
  --color-muted: #bbb;
  --color-footer: #999;
  --color-highlight: #f7931e;
  --color-highlight-green: rgba(0, 255, 0, .2);
  --color-prompt: rgba(0, 205, 0, .8);
}
html {
  scroll-behavior: smooth;
  font-family: 'Courier New', Courier, monospace;
  color: var(--color-text);
  background: var(--color-bg);
  font-size: 18px;
}

@media (max-width: 768px) {
  html { font-size: 17px; }
}
@media (orientation: landscape) and (max-height: 450px) {
  html { font-size: 16px; }
}
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.2rem 2rem;
  border-bottom: 1px solid var(--color-border);
  position: sticky;
  top: 0;
  background: var(--color-bg);
  z-index: 10;
}
nav {
  display: flex;
}

.brand {
  font-weight: 700;
  font-size: 1.25rem;
  text-decoration: none;
  color: var(--color-link);
}
nav a {
  margin-left: 2rem;
  font-weight: 600;
  text-decoration: none;
  color: var(--color-link);
  position: relative;
}
.theme-toggle {
  margin-left: 2rem;
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--color-link);
  cursor: pointer;
}
.nav-icon { margin-right: .5rem; }
section h2 .nav-icon { margin-right: .75rem; }
nav a::after {
  content: '';
  position: absolute;
  height: 2px;
  left: 0;
  right: 0;
  bottom: -4px;
  background: var(--color-highlight);
  transform: scaleX(0);
  transition: transform .25s ease;
}
nav a:hover::after,
nav a:focus::after {
  transform: scaleX(1);
}

.nav-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--color-link);
  cursor: pointer;
}

@media (max-width: 768px) {
  .nav-toggle { display: block; }
  header { position: sticky; top: 0; }
  nav {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    flex-direction: column;
    align-items: flex-start;
    padding: 1rem 2rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, .1);
  }
  nav a { margin: .5rem 0; }
  .theme-toggle { margin: .5rem 0; }
  nav.open { display: flex; }
}
.avalan {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 3rem;
  max-width: 1050px;
  padding: 4rem 2rem;
  margin-inline: auto;
}

@media (max-width: 768px) {
  .avalan { 
    padding-top: 1.6rem; 
    padding-left: 1rem; 
    padding-right: 1rem; 
  }
}
.avalan-text { flex: 1 1 380px; }
.avalan-text h1 {
  font-size: 2.8rem;
  line-height: 1.15;
  margin-bottom: 1rem;
  padding-right: 1rem;
}
.avalan-text p {
  font-size: 1.125rem;
  line-height: 1.6;
  color: var(--color-muted);
  margin-bottom: 2rem;
  padding-right: 1rem;
}
.avalan-img { flex: 1 1 320px; text-align: center; }
.avalan-img img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, .08);
}
.section {
  padding: 0;
  border: none;
  background: none;
}
.section > div { max-width: 1050px; margin-inline: auto; }
.section-layout {
  display: flex;
  flex-wrap: wrap;
  gap: 2rem;
  align-items: flex-start;
}
.section-intro { flex: 1 1 300px; }
.section-demo { flex: 1 1 500px; }
.highlight, a.highlight, a.highlight:visited, a.highlight:active, a.highlight:hover {
  color: var(--color-text);
  background: var(--color-highlight-green);
  border-radius: 4px;
  padding: .25rem .25rem;
  cursor: pointer;
  font-weight: normal;
  text-decoration: none;
}
a.highlight.active, a.highlight:hover {
  color: var(--color-highlight-active);
}

.tabs { display: flex; justify-content: center; }
.tab {
  color: var(--color-muted);
  font: inherit;
  padding: .5rem 1rem;
  border: 1px solid var(--color-border);
  border-bottom: none;
  background: var(--color-surface);
  cursor: pointer;
  border-radius: 4px 4px 0 0;
  margin: 0 .25rem;
}
.tab.active {
  background: var(--color-bg);
  color: var(--color-highlight);
}
.section .section-preview {
  border: 1px solid var(--color-border);
}
code, pre { font-family: ui-monospace, monospace; }
pre[data-lang] { display: none; }
pre.shiki {
  padding: 1rem !important;
  margin: 0 !important;
  white-space: pre-wrap;
  overflow-x: auto;
}
pre.shiki code {
  white-space: pre-wrap;
  word-break: break-word;
}
pre.shiki .prompt {
  color: var(--color-prompt);
  user-select: none;
  opacity: 0.7;
}
section.content {
  max-width: 1050px;
  padding: 2rem 2rem;
  margin-inline: auto;
  line-height: 1.6;
}

@media (max-width: 768px) {
  section.content { padding: 1.2rem 1rem; }
}
section.content h2 { font-size: 1.9rem; margin-bottom: 1rem; }
footer {
  padding: 2rem;
  text-align: center;
  font-size: .875rem;
  color: var(--color-footer);
}
footer a { color: inherit; text-decoration: none; }
