/* ================================================================
   site.css — htmlandcss.dev site shell styles
   ================================================================
   Layout: fixed header + fixed sidebar + scrollable content area.
   Mobile: sidebar collapses behind hamburger menu.
   Color palette based on teal #1a7a6d accent.
   ================================================================ */

/* ----------------------------------------------------------------
   CSS Custom Properties
   ---------------------------------------------------------------- */
:root {
  --color-teal:       #1a7a6d;
  --color-teal-dark:  #145f54;
  --color-teal-light: #e6f5f3;
  --color-bg:         #f7f8fa;
  --color-white:      #ffffff;
  --color-text:       #2c3e50;
  --color-text-light: #6b7c8d;
  --color-border:     #e1e4e8;
  --color-code-bg:    #f0f2f5;
  --color-accent-orange: #e67e22;

  --sidebar-width:    280px;
  --header-height:    56px;

  --font-sans:  "Inter", system-ui, -apple-system, sans-serif;
  --font-mono:  "Fira Code", "SF Mono", "Cascadia Code", monospace;

  --shadow-sm:  0 1px 3px rgba(0, 0, 0, 0.08);
  --shadow-md:  0 4px 12px rgba(0, 0, 0, 0.1);
  --radius-sm:  4px;
  --radius-md:  8px;
  --radius-lg:  12px;
}

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

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

body {
  font-family: var(--font-sans);
  color: var(--color-text);
  background: var(--color-bg);
  line-height: 1.6;
  overflow: hidden; /* prevent body scroll; content area scrolls */
}

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

a:hover {
  text-decoration: underline;
}

/* ----------------------------------------------------------------
   Header
   ---------------------------------------------------------------- */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  background: var(--color-white);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  padding: 0 1rem;
  z-index: 1000;
  box-shadow: var(--shadow-sm);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* Hamburger — only visible on mobile */
.hamburger-btn {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.25rem;
  color: var(--color-text);
  font-size: 1.5rem;
  line-height: 1;
}

.site-logo {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--color-teal);
  letter-spacing: -0.02em;
}

.site-logo:hover {
  text-decoration: none;
}

.site-logo span {
  color: var(--color-text-light);
  font-weight: 400;
}

/* ----------------------------------------------------------------
   Sidebar
   ---------------------------------------------------------------- */
.sidebar {
  position: fixed;
  top: var(--header-height);
  left: 0;
  bottom: 0;
  width: var(--sidebar-width);
  background: var(--color-white);
  border-right: 1px solid var(--color-border);
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 900;
  padding-bottom: 2rem;

  /* Smooth scrollbar */
  scrollbar-width: thin;
  scrollbar-color: var(--color-border) transparent;
}

.sidebar::-webkit-scrollbar {
  width: 6px;
}

.sidebar::-webkit-scrollbar-thumb {
  background: var(--color-border);
  border-radius: 3px;
}

/* ---- Part groups ---- */
.nav-part {
  border-bottom: 1px solid var(--color-border);
}

.part-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 0.75rem 1rem;
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--font-sans);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-light);
  transition: background 0.15s;
}

.part-header:hover {
  background: var(--color-teal-light);
}

.part-header .chevron {
  font-size: 0.65rem;
  transition: transform 0.2s;
  color: var(--color-text-light);
}

.nav-part.expanded > .part-header .chevron {
  transform: rotate(90deg);
}

.part-chapters {
  display: none;
}

.nav-part.expanded > .part-chapters {
  display: block;
}

/* ---- Chapter items ---- */
.nav-chapter {
  border-top: 1px solid var(--color-border);
}

.chapter-header {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 0.55rem 1rem 0.55rem 1.25rem;
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--color-text);
  text-align: left;
  gap: 0.5rem;
  transition: background 0.15s;
}

.chapter-header:hover {
  background: var(--color-teal-light);
}

.chapter-header .chevron {
  font-size: 0.6rem;
  transition: transform 0.2s;
  color: var(--color-text-light);
  flex-shrink: 0;
}

.nav-chapter.expanded > .chapter-header .chevron {
  transform: rotate(90deg);
}

.chapter-header .ch-num {
  color: var(--color-text-light);
  font-weight: 400;
  flex-shrink: 0;
}

/* ---- Chapter sub-items (lesson, examples, exercises) ---- */
.chapter-items {
  display: none;
  padding-bottom: 0.25rem;
}

.nav-chapter.expanded > .chapter-items {
  display: block;
}

.chapter-items a {
  display: block;
  padding: 0.35rem 1rem 0.35rem 2.5rem;
  font-size: 0.8rem;
  color: var(--color-text-light);
  transition: background 0.15s, color 0.15s;
}

.chapter-items a:hover {
  background: var(--color-teal-light);
  color: var(--color-teal);
  text-decoration: none;
}

.chapter-items a.active {
  background: var(--color-teal-light);
  color: var(--color-teal);
  font-weight: 600;
}

/* Sub-section headers within chapter items */
.chapter-items .sub-label {
  display: block;
  padding: 0.4rem 1rem 0.15rem 2rem;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-light);
  opacity: 0.7;
}

/* ----------------------------------------------------------------
   Content Area
   ---------------------------------------------------------------- */
.content-area {
  position: fixed;
  top: var(--header-height);
  left: var(--sidebar-width);
  right: 0;
  bottom: 0;
  overflow-y: auto;
  padding: 2rem;
  background: var(--color-bg);
}

/* ----------------------------------------------------------------
   Landing Page
   ---------------------------------------------------------------- */
.landing {
  max-width: 800px;
  margin: 0 auto;
}

.landing-hero {
  text-align: center;
  padding: 3rem 1rem 2.5rem;
}

.landing-hero h1 {
  font-size: 2.75rem;
  font-weight: 800;
  color: var(--color-text);
  line-height: 1.15;
  margin-bottom: 0.75rem;
}

.landing-hero h1 .accent {
  color: var(--color-teal);
}

.landing-hero .tagline {
  font-size: 1.2rem;
  color: var(--color-text-light);
  max-width: 520px;
  margin: 0 auto 2rem;
  line-height: 1.5;
}

.cta-btn {
  display: inline-block;
  padding: 0.85rem 2rem;
  background: var(--color-teal);
  color: var(--color-white);
  font-size: 1.05rem;
  font-weight: 600;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background 0.2s, transform 0.15s;
}

.cta-btn:hover {
  background: var(--color-teal-dark);
  text-decoration: none;
  transform: translateY(-1px);
}

/* ---- Stats bar ---- */
.landing-stats {
  display: flex;
  justify-content: center;
  gap: 2.5rem;
  padding: 1.5rem 0;
  border-top: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
  margin-bottom: 2.5rem;
}

.stat {
  text-align: center;
}

.stat-num {
  display: block;
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--color-teal);
}

.stat-label {
  font-size: 0.85rem;
  color: var(--color-text-light);
}

/* ---- Feature cards ---- */
.landing-features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2.5rem;
}

.feature-card {
  background: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  text-align: center;
  transition: box-shadow 0.2s;
}

.feature-card:hover {
  box-shadow: var(--shadow-md);
}

.feature-icon {
  font-size: 2rem;
  margin-bottom: 0.5rem;
  /* Icons are text characters — keep them accessible */
}

.feature-card h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 0.35rem;
}

.feature-card p {
  font-size: 0.85rem;
  color: var(--color-text-light);
  line-height: 1.5;
}

/* ---- Course outline ---- */
.landing-outline {
  margin-bottom: 2.5rem;
}

.landing-outline h2 {
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 1rem;
  text-align: center;
  color: var(--color-text);
}

.outline-parts {
  display: grid;
  gap: 1rem;
}

.outline-part {
  background: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  border-left: 4px solid var(--color-teal);
}

.outline-part h3 {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--color-teal);
  margin-bottom: 0.35rem;
}

.outline-part p {
  font-size: 0.85rem;
  color: var(--color-text-light);
  line-height: 1.5;
}

/* ---- Bottom CTA ---- */
.landing-bottom-cta {
  text-align: center;
  padding: 2rem 0 3rem;
}

.landing-bottom-cta p {
  font-size: 1rem;
  color: var(--color-text-light);
  margin-bottom: 1rem;
}

/* ----------------------------------------------------------------
   Sidebar overlay (mobile)
   ---------------------------------------------------------------- */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 899;
}

.sidebar-overlay.visible {
  display: block;
}

/* ----------------------------------------------------------------
   Loading state
   ---------------------------------------------------------------- */
.loading-msg {
  text-align: center;
  padding: 4rem 1rem;
  color: var(--color-text-light);
  font-size: 1.05rem;
}

/* ----------------------------------------------------------------
   Responsive: tablets and below (< 768px)
   ---------------------------------------------------------------- */
@media (max-width: 768px) {
  .hamburger-btn {
    display: block;
  }

  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    box-shadow: none;
  }

  .sidebar.open {
    transform: translateX(0);
    box-shadow: var(--shadow-md);
  }

  .content-area {
    left: 0;
    padding: 1.25rem;
  }

  .landing-hero h1 {
    font-size: 2rem;
  }

  .landing-stats {
    gap: 1.5rem;
  }

  .stat-num {
    font-size: 1.4rem;
  }
}

/* ----------------------------------------------------------------
   Responsive: small phones (< 480px)
   ---------------------------------------------------------------- */
@media (max-width: 480px) {
  .landing-stats {
    flex-direction: column;
    gap: 0.75rem;
  }

  .landing-hero h1 {
    font-size: 1.65rem;
  }

  .landing-hero .tagline {
    font-size: 1rem;
  }
}
