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

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: 'DM Sans', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  transition: background 0.2s, color 0.2s;
}

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

.container       { max-width: 760px; margin: 0 auto; padding: 0 1.5rem; }
.container-wide  { max-width: 920px; margin: 0 auto; padding: 0 1.5rem; }

/* ── NAV ── */
.topnav {
  border-bottom: 0.5px solid var(--border);
  padding: 1rem 0;
  position: sticky; top: 0;
  background: var(--bg); z-index: 100;
  transition: background 0.2s;
}
.topnav-inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }

.logo { display: flex; align-items: center; gap: 7px; text-decoration: none; flex-shrink: 0; }
.logo-mark {
  width: 24px; height: 24px;
  background: var(--text); border-radius: 5px;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.2s;
}
.logo-mark span { font-family: 'DM Mono', monospace; font-size: 11px; font-weight: 500; color: var(--bg); line-height: 1; }
.logo-name   { font-size: 14px; font-weight: 500; color: var(--text); }
.logo-domain { font-size: 14px; font-weight: 300; color: var(--text2); }

.breadcrumb { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text3); min-width: 0; overflow: hidden; }
.breadcrumb a { color: var(--text2); text-decoration: none; white-space: nowrap; }
.breadcrumb a:hover { color: var(--text); }
.breadcrumb .sep { color: var(--text3); }
.breadcrumb .current { color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.nav-links { display: flex; gap: 1.5rem; list-style: none; align-items: center; }
.nav-links a { font-size: 14px; color: var(--text2); text-decoration: none; transition: color 0.15s; }
.nav-links a:hover, .nav-links a.active { color: var(--text); font-weight: 500; }

/* ── THEME TOGGLE ── */
#theme-toggle {
  width: 32px; height: 32px;
  border-radius: 6px;
  border: 0.5px solid var(--border2);
  background: transparent;
  color: var(--text2);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s, color 0.15s;
  flex-shrink: 0;
}
#theme-toggle:hover { background: var(--bg2); color: var(--text); }

/* ── HERO (index) ── */
.hero { margin-bottom: 3.5rem; }
.eyebrow {
  font-family: 'DM Mono', monospace;
  font-size: 11px; color: var(--text3);
  letter-spacing: 0.08em; text-transform: uppercase; margin-bottom: 0.75rem;
}
.hero h1 {
  font-size: clamp(28px, 5vw, 38px); font-weight: 500;
  letter-spacing: -0.03em; line-height: 1.1; margin-bottom: 1rem;
}
.hero p { font-size: 16px; color: var(--text2); max-width: 480px; line-height: 1.65; font-weight: 300; }

/* ── SECTION HEADERS ── */
section { margin-bottom: 3.5rem; }
.section-header {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-bottom: 1.25rem; padding-bottom: 0.75rem;
  border-bottom: 0.5px solid var(--border);
}
.section-title { font-size: 12px; font-weight: 500; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text2); }
.section-count { font-family: 'DM Mono', monospace; font-size: 11px; color: var(--text3); }

/* ── COURSES GRID ── */
.courses-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1px; border: 0.5px solid var(--border); border-radius: var(--radius);
  overflow: hidden; background: var(--border);
}
.course-card {
  background: var(--bg); padding: 1.25rem;
  display: flex; flex-direction: column; gap: 10px;
  text-decoration: none; color: inherit; transition: background 0.12s;
}
.course-card:hover { background: var(--bg2); }
.course-card.coming-soon { opacity: .42; pointer-events: none; }

.card-top { display: flex; align-items: center; justify-content: space-between; }

.tag { font-family: 'DM Mono', monospace; font-size: 11px; padding: 3px 8px; border-radius: 4px; }
.tag-android { background: var(--tag-android-bg); color: var(--tag-android-fg); }
.tag-kotlin  { background: var(--tag-kotlin-bg);  color: var(--tag-kotlin-fg);  }
.tag-compose { background: var(--tag-compose-bg); color: var(--tag-compose-fg); }
.tag-arch    { background: var(--tag-arch-bg);    color: var(--tag-arch-fg);    }
.tag-pronto  { background: var(--tag-pronto-bg);  color: var(--tag-pronto-fg); border: 0.5px solid var(--border); }
.article-tag { font-size: 11px; padding: 2px 7px; border-radius: 4px; }

.level { display: flex; gap: 3px; align-items: center; }
.dot   { width: 5px; height: 5px; border-radius: 50%; background: var(--border2); }
.dot.on { background: var(--text2); }

.course-title { font-size: 15px; font-weight: 500; letter-spacing: -0.01em; line-height: 1.3; }
.course-desc  { font-size: 13px; color: var(--text2); line-height: 1.5; font-weight: 300; flex: 1; }
.course-meta  { display: flex; align-items: center; gap: 10px; margin-top: 4px; }
.meta         { font-size: 12px; color: var(--text3); }

/* ── ARTICLES LIST ── */
.articles-list { border: 0.5px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.article-row {
  display: flex; align-items: flex-start; gap: 1rem;
  padding: 1rem 1.25rem; border-bottom: 0.5px solid var(--border);
  text-decoration: none; color: inherit; background: var(--bg); transition: background 0.12s;
}
.article-row:last-child { border-bottom: none; }
.article-row:hover { background: var(--bg2); }
.art-num   { font-family: 'DM Mono', monospace; font-size: 11px; color: var(--text3); padding-top: 3px; min-width: 20px; }
.art-body  { flex: 1; min-width: 0; }
.art-title { font-size: 15px; font-weight: 500; letter-spacing: -0.01em; margin-bottom: 3px; }
.art-excerpt { font-size: 13px; color: var(--text2); font-weight: 300; line-height: 1.4; }
.art-right { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; min-width: 72px; }
.art-date  { font-family: 'DM Mono', monospace; font-size: 11px; color: var(--text3); white-space: nowrap; }

/* ── COURSE HERO ── */
.course-hero {
  background: var(--bg2); border-bottom: 0.5px solid var(--border);
  padding: 3rem 0 2.5rem; margin-bottom: 3rem; transition: background 0.2s;
}
.course-tag {
  font-family: 'DM Mono', monospace; font-size: 11px; padding: 3px 8px;
  border-radius: 4px; display: inline-block; margin-bottom: 1rem;
  background: var(--accent-bg); color: var(--accent);
}
.course-hero h1 { font-size: clamp(24px, 4vw, 34px); font-weight: 500; letter-spacing: -0.03em; line-height: 1.15; margin-bottom: 0.75rem; }
.course-hero .subtitle { font-size: 16px; color: var(--text2); font-weight: 300; max-width: 520px; line-height: 1.6; }
.course-meta-bar { display: flex; gap: 1.5rem; margin-top: 1.5rem; flex-wrap: wrap; }
.meta-chip { font-size: 13px; color: var(--text2); }

/* ── LESSON LIST ── */
.lesson-list { list-style: none; border: 0.5px solid var(--border); border-radius: var(--radius); overflow: hidden; margin-bottom: 3rem; }
.lesson-item { border-bottom: 0.5px solid var(--border); }
.lesson-item:last-child { border-bottom: none; }
.lesson-link {
  display: flex; align-items: center; gap: 1rem; padding: 1rem 1.25rem;
  text-decoration: none; color: inherit; background: var(--bg); transition: background 0.12s;
}
.lesson-link:hover { background: var(--bg2); }
.lesson-link.locked { opacity: .4; pointer-events: none; }
.lesson-num    { font-family: 'DM Mono', monospace; font-size: 11px; color: var(--text3); min-width: 22px; }
.lesson-info   { flex: 1; }
.lesson-title  { font-size: 15px; font-weight: 500; letter-spacing: -0.01em; margin-bottom: 2px; }
.lesson-desc   { font-size: 13px; color: var(--text2); font-weight: 300; }
.lesson-badge  { font-family: 'DM Mono', monospace; font-size: 11px; padding: 2px 8px; border-radius: 4px; background: var(--bg3); color: var(--text3); }
.lesson-badge.done { background: var(--green-bg); color: var(--green); }

/* ── LESSON PAGE ── */
.lesson-layout {
  display: grid; grid-template-columns: 200px 1fr;
  gap: 3rem; padding: 2.5rem 0 4rem; align-items: start;
}
@media (max-width: 720px) {
  .lesson-layout { grid-template-columns: 1fr; }
  .lesson-sidebar { display: none; }
}
.lesson-sidebar { position: sticky; top: 70px; }
.sidebar-title { font-size: 11px; font-weight: 500; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text3); margin-bottom: 0.75rem; }
.sidebar-list { list-style: none; }
.sidebar-item a {
  display: block; padding: 5px 0 5px 10px; font-size: 13px; color: var(--text2);
  text-decoration: none; border-left: 2px solid transparent; transition: color 0.12s, border-color 0.12s; line-height: 1.4;
}
.sidebar-item a:hover { color: var(--text); border-left-color: var(--border2); }
.sidebar-item a.active { color: var(--accent); border-left-color: var(--accent); }

/* ── LESSON CONTENT ── */
.lesson-content h2 {
  font-size: 22px; font-weight: 500; letter-spacing: -0.02em;
  margin: 2.5rem 0 0.75rem; padding-top: 2rem; border-top: 0.5px solid var(--border);
}
.lesson-content h2:first-child { border-top: none; padding-top: 0; margin-top: 0; }
.lesson-content h3 { font-size: 17px; font-weight: 500; letter-spacing: -0.01em; margin: 1.75rem 0 0.5rem; }
.lesson-content p  { margin-bottom: 1rem; font-size: 16px; }
.lesson-content ul, .lesson-content ol { margin: 0.75rem 0 1rem 1.5rem; }
.lesson-content li { margin-bottom: 0.35rem; font-size: 16px; }
.lesson-content code {
  font-family: 'DM Mono', monospace; font-size: 13px; padding: 2px 6px;
  background: var(--code-bg); color: var(--code-text); border-radius: 4px;
}
.lesson-content pre {
  background: var(--bg2); border: 0.5px solid var(--border); border-radius: var(--radius);
  padding: 1.25rem 1.5rem; overflow-x: auto; margin: 1rem 0 1.5rem;
}
.lesson-content pre code { background: none; color: var(--text); font-size: 13.5px; padding: 0; line-height: 1.65; }
.lesson-content .callout {
  border-left: 3px solid var(--accent); background: var(--accent-bg);
  border-radius: 0 var(--radius) var(--radius) 0; padding: 0.9rem 1.1rem; margin: 1.25rem 0;
}
.lesson-content .callout.tip  { border-left-color: var(--green); background: var(--green-bg); }
.lesson-content .callout.warn { border-left-color: var(--amber); background: var(--amber-bg); }
.lesson-content .callout p { margin: 0; font-size: 15px; }
.lesson-content .callout strong {
  display: block; font-size: 11px; font-weight: 500; letter-spacing: 0.05em;
  text-transform: uppercase; margin-bottom: 4px; color: var(--text2);
}

/* ── LESSON NAV ── */
.lesson-nav {
  display: flex; justify-content: space-between; gap: 1rem;
  margin-top: 3rem; padding-top: 1.5rem; border-top: 0.5px solid var(--border);
}
.lesson-nav a {
  display: flex; flex-direction: column; text-decoration: none;
  padding: 0.9rem 1.1rem; border: 0.5px solid var(--border); border-radius: var(--radius);
  background: var(--bg); transition: background 0.12s, border-color 0.12s; max-width: 48%;
}
.lesson-nav a:hover { background: var(--bg2); border-color: var(--border2); }
.nav-label { font-size: 11px; color: var(--text3); font-family: 'DM Mono', monospace; text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 3px; }
.nav-title { font-size: 14px; font-weight: 500; color: var(--text); letter-spacing: -0.01em; }
.lesson-nav .next { margin-left: auto; text-align: right; }

/* ── ARTICLE HEADER ── */
.article-header { padding: 3.5rem 0 2.5rem; border-bottom: 0.5px solid var(--border); margin-bottom: 3rem; }
.article-header h1 { font-size: clamp(26px, 4vw, 38px); font-weight: 500; letter-spacing: -0.03em; line-height: 1.15; margin-bottom: 1rem; }
.article-header .subtitle { font-size: 18px; color: var(--text2); font-weight: 300; line-height: 1.55; margin-bottom: 1.5rem; }
.article-meta { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.meta-item { font-size: 13px; color: var(--text3); font-family: 'DM Mono', monospace; }
.meta-sep  { color: var(--border2); }

/* ── ARTICLE LAYOUT ── */
.article-layout { display: grid; grid-template-columns: 180px 1fr; gap: 3.5rem; align-items: start; padding-bottom: 5rem; }
@media (max-width: 720px) {
  .article-layout { grid-template-columns: 1fr; }
  .article-sidebar { display: none; }
}
.article-sidebar { position: sticky; top: 70px; }

/* ── ARTICLE BODY ── */
.article-body h2 {
  font-size: 22px; font-weight: 500; letter-spacing: -0.02em;
  margin: 2.75rem 0 0.75rem; padding-top: 2.5rem; border-top: 0.5px solid var(--border);
}
.article-body h2:first-child { border-top: none; padding-top: 0; margin-top: 0; }
.article-body h3 { font-size: 17px; font-weight: 500; letter-spacing: -0.01em; margin: 2rem 0 0.5rem; }
.article-body p  { font-size: 17px; line-height: 1.75; margin-bottom: 1.1rem; }
.article-body ul, .article-body ol { margin: 0.75rem 0 1.1rem 1.5rem; }
.article-body li { font-size: 17px; line-height: 1.7; margin-bottom: 0.4rem; }
.article-body code {
  font-family: 'DM Mono', monospace; font-size: 13.5px; padding: 2px 6px;
  background: var(--code-bg); color: var(--code-text); border-radius: 4px;
}
.article-body pre {
  background: var(--bg2); border: 0.5px solid var(--border); border-radius: var(--radius);
  padding: 1.25rem 1.5rem; overflow-x: auto; margin: 1rem 0 1.75rem;
}
.article-body pre code { background: none; color: var(--text); font-size: 13.5px; padding: 0; line-height: 1.65; }
.article-body .callout {
  border-left: 3px solid var(--accent); background: var(--accent-bg);
  border-radius: 0 var(--radius) var(--radius) 0; padding: 0.9rem 1.1rem; margin: 1.25rem 0 1.75rem;
}
.article-body .callout.tip  { border-left-color: var(--green); background: var(--green-bg); }
.article-body .callout.warn { border-left-color: var(--amber); background: var(--amber-bg); }
.article-body .callout p { margin: 0; font-size: 15px; }
.article-body .callout strong { display: block; font-size: 11px; font-weight: 500; letter-spacing: 0.05em; text-transform: uppercase; margin-bottom: 5px; color: var(--text2); }

/* ── RELATED ── */
.related-section { border-top: 0.5px solid var(--border); padding-top: 2.5rem; margin-top: 3rem; padding-bottom: 4rem; }
.related-title { font-size: 12px; font-weight: 500; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text3); margin-bottom: 1.25rem; }
.related-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1px; border: 0.5px solid var(--border); border-radius: var(--radius);
  overflow: hidden; background: var(--border);
}
.related-card { background: var(--bg); padding: 1rem 1.25rem; text-decoration: none; color: inherit; transition: background 0.12s; display: flex; flex-direction: column; gap: 6px; }
.related-card:hover { background: var(--bg2); }
.related-label { font-family: 'DM Mono', monospace; font-size: 11px; padding: 2px 7px; border-radius: 4px; display: inline-block; width: fit-content; }
.related-label.curso   { background: var(--green-bg); color: var(--green); }
.related-label.leccion { background: var(--accent-bg); color: var(--accent); }
.related-card-title { font-size: 14px; font-weight: 500; letter-spacing: -0.01em; }
.related-card-desc  { font-size: 12px; color: var(--text2); font-weight: 300; line-height: 1.4; }

/* ── FOOTER ── */
.site-footer, footer { border-top: 0.5px solid var(--border); padding: 1.75rem 0; margin-top: 2rem; }
.site-footer p, .footer-inner { font-size: 13px; color: var(--text3); font-weight: 300; text-align: center; }
.footer-inner { display: flex; align-items: center; justify-content: space-between; }
.footer-text { font-size: 13px; color: var(--text3); font-weight: 300; }
.footer-text a { color: var(--text2); text-decoration: none; }
.footer-text a:hover { color: var(--text); }
.site-footer a { color: var(--text2); text-decoration: none; }
.site-footer a:hover { color: var(--text); }

@media (max-width: 600px) {
  .nav-links { display: none; }
  .art-right { display: none; }
  .footer-inner { flex-direction: column; gap: 0.5rem; text-align: center; }
}
