/* ============================================
   HTML-курс для підлітків — дизайн-система
   Ідея: зошит + вікно редактора + вікно браузера,
   бо саме так проходить кожен урок в житті учня.
   ============================================ */

:root{
  --bg:        #EEF1F6;   /* блакитно-сіре "світло екрана" */
  --paper:     #FFFFFF;   /* сторінка/картка */
  --ink:       #1B2430;   /* майже чорний, "чорнило" */
  --muted:     #626C7B;   /* другорядний текст */
  --line:      #D8DEE9;   /* лінії, рамки */
  --accent:    #FFB300;   /* жовтий маркер — "твоє завдання" */
  --accent-ink:#5C4400;
  --accent2:   #2FB88A;   /* м'ятно-зелений — "результат/успіх" */
  --accent2-ink:#0E5C42;
  --coral:     #FF6B57;   /* корал — акценти тегів у прикладах */
  --editor-bg: #1B2430;   /* темне вікно "блокнота/коду" */
  --editor-line:#2A3444;
  --editor-text:#E7ECF3;
  --editor-tag: #7FD1AE;
  --editor-attr:#FFC876;
  --editor-str: #9FD1FF;

  --font-display: 'Fraunces', Georgia, serif;
  --font-body: 'Inter', -apple-system, Segoe UI, sans-serif;
  --font-mono: 'JetBrains Mono', 'Courier New', monospace;

  --radius: 14px;
}

*{box-sizing:border-box;}
html{scroll-behavior:smooth;}
body{
  margin:0;
  background:var(--bg);
  color:var(--ink);
  font-family:var(--font-body);
  line-height:1.6;
  -webkit-font-smoothing:antialiased;
}

a{color:inherit;}

/* ---------- Layout shell ---------- */
.shell{
  display:grid;
  grid-template-columns: 280px 1fr;
  min-height:100vh;
}

/* ---------- Sidebar ---------- */
.sidebar{
  background:var(--editor-bg);
  color:var(--editor-text);
  padding:28px 20px 40px;
  position:sticky;
  top:0;
  height:100vh;
  overflow-y:auto;
}
.sidebar .brand{
  display:block;
  font-family:var(--font-display);
  font-weight:600;
  font-size:1.35rem;
  color:#fff;
  text-decoration:none;
  margin-bottom:4px;
}
.sidebar .brand span{color:var(--accent);}
.brand-row{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:10px;
}
.lang-switch{
  display:flex;
  gap:2px;
  background:var(--editor-line);
  border-radius:7px;
  padding:2px;
  flex-shrink:0;
}
.lang-switch a{
  font-family:var(--font-mono);
  font-size:.72rem;
  font-weight:600;
  color:#8792A3;
  text-decoration:none;
  padding:4px 8px;
  border-radius:5px;
  transition:background .15s, color .15s;
}
.lang-switch a:hover{color:#fff;}
.lang-switch a.active{background:var(--accent); color:var(--accent-ink);}
.lang-this-page{
  display:block;
  font-size:.78rem;
  color:#B7C0CE;
  text-decoration:none;
  background:var(--editor-line);
  border-radius:8px;
  padding:9px 12px;
  margin:14px 0 4px;
  transition:background .15s, color .15s;
}
.lang-this-page:hover{background:#3A4658; color:#fff;}
.sidebar .brand-sub{
  font-size:.78rem;
  color:#8792A3;
  margin-bottom:28px;
  display:block;
}
.nav-section{
  margin:22px 0 0;
  border-top:1px solid var(--editor-line);
  padding-top:14px;
}
.nav-section:first-of-type{
  border-top:none;
  padding-top:0;
}
.sidebar .section-label{
  font-size:.72rem;
  text-transform:uppercase;
  letter-spacing:.08em;
  color:#7A879C;
  font-weight:600;
  cursor:pointer;
  list-style:none;
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:4px 2px;
  user-select:none;
}
.sidebar .section-label::-webkit-details-marker{display:none;}
.sidebar .section-label::after{
  content:'▸';
  font-size:.7rem;
  color:#5B6678;
  transition:transform .15s;
}
.nav-section[open] > .section-label::after{
  transform:rotate(90deg);
}
.sidebar .section-label:hover{color:#B7C0CE;}
.sidebar nav ol{
  list-style:none;
  margin:8px 0 0;
  padding:0;
  counter-reset:lesson;
}
.sidebar nav li{
  counter-increment:lesson;
  margin-bottom:2px;
}
.sidebar nav a{
  display:flex;
  align-items:baseline;
  gap:10px;
  text-decoration:none;
  color:#B7C0CE;
  font-size:.92rem;
  padding:8px 10px;
  border-radius:8px;
  transition:background .15s, color .15s;
}
.sidebar nav a::before{
  content:counter(lesson, decimal-leading-zero);
  font-family:var(--font-mono);
  font-size:.78rem;
  color:#5B6678;
  flex-shrink:0;
}
.sidebar nav a:hover{background:var(--editor-line); color:#fff;}
.sidebar nav a.active{
  background:var(--editor-line);
  color:#fff;
  font-weight:600;
  box-shadow:inset 3px 0 0 var(--accent);
}
.sidebar nav a.active::before{color:var(--accent);}

/* ---------- Main content ---------- */
main{
  padding:48px 56px 100px;
  max-width:840px;
}
.eyebrow{
  font-family:var(--font-mono);
  font-size:.8rem;
  color:var(--muted);
  text-transform:uppercase;
  letter-spacing:.06em;
  margin-bottom:10px;
}
h1.lesson-title{
  font-family:var(--font-display);
  font-weight:600;
  font-size:2.5rem;
  line-height:1.15;
  margin:0 0 28px;
}
.lead{
  font-size:1.08rem;
  color:var(--muted);
  margin-bottom:32px;
}

/* ---------- Task card (жовта "стікер"-нотатка) ---------- */
.task-card{
  background:var(--paper);
  border:1px solid var(--line);
  border-left:5px solid var(--accent);
  border-radius:var(--radius);
  padding:24px 26px;
  margin:22px 0;
  box-shadow:0 1px 2px rgba(27,36,48,.04);
}
.task-card .task-label{
  font-family:var(--font-mono);
  font-size:.75rem;
  text-transform:uppercase;
  letter-spacing:.06em;
  color:var(--accent-ink);
  background:#FFF3D6;
  display:inline-block;
  padding:3px 9px;
  border-radius:6px;
  margin-bottom:12px;
}
.task-card p{margin:0 0 12px;}
.task-card p:last-child{margin-bottom:0;}
.task-card strong{color:var(--ink);}

.note{
  background:#EAF7F1;
  border-left:5px solid var(--accent2);
  border-radius:var(--radius);
  padding:18px 22px;
  margin:22px 0;
  font-size:.96rem;
}
.note .note-label{
  font-family:var(--font-mono);
  font-size:.72rem;
  text-transform:uppercase;
  letter-spacing:.06em;
  color:var(--accent2-ink);
  font-weight:700;
  margin-bottom:6px;
  display:block;
}

/* ---------- Editor window (Блокнот) ---------- */
.editor{
  background:var(--editor-bg);
  border-radius:var(--radius);
  overflow:hidden;
  margin:26px 0;
  box-shadow:0 8px 24px rgba(27,36,48,.18);
}
.editor-titlebar{
  display:flex;
  align-items:center;
  gap:8px;
  padding:11px 14px;
  background:var(--editor-line);
}
.editor-dot{width:10px;height:10px;border-radius:50%;}
.editor-dot.r{background:#FF6058;}
.editor-dot.y{background:#FFBD2E;}
.editor-dot.g{background:#28C93F;}
.editor-filename{
  margin-left:8px;
  font-family:var(--font-mono);
  font-size:.78rem;
  color:#9AA5B5;
}
.editor pre{
  margin:0;
  padding:20px 22px;
  overflow-x:auto;
  font-family:var(--font-mono);
  font-size:.86rem;
  line-height:1.65;
  color:var(--editor-text);
}
.editor pre .tag{color:var(--editor-tag);}
.editor pre .attr{color:var(--editor-attr);}
.editor pre .str{color:var(--editor-str);}
.editor pre .comment{color:#6E7A8E; font-style:italic;}
.editor .new-line{
  background:rgba(255,179,0,.12);
  display:inline-block;
  width:100%;
  border-left:3px solid var(--accent);
  padding-left:8px;
  margin-left:-11px;
}

.editor-caption{
  font-family:var(--font-mono);
  font-size:.75rem;
  color:var(--muted);
  margin:-14px 0 26px;
  display:flex;
  align-items:center;
  gap:6px;
}
.editor-caption .chip{
  background:var(--accent);
  color:var(--accent-ink);
  padding:1px 7px;
  border-radius:5px;
  font-weight:700;
}

/* ---------- Full cumulative code (для 15) ---------- */
.full-code pre{max-height:640px;}

/* ---------- Lesson nav footer ---------- */
.lesson-pager{
  display:flex;
  justify-content:space-between;
  margin-top:56px;
  padding-top:26px;
  border-top:1px solid var(--line);
  gap:16px;
}
.site-credit{
  margin-top:40px;
  padding-top:18px;
  border-top:1px solid var(--line);
  font-size:.78rem;
  color:var(--muted);
  text-align:center;
}
.site-credit a{
  color:var(--muted);
  font-weight:600;
  text-decoration:underline;
  text-underline-offset:2px;
}
.site-credit a:hover{color:var(--ink);}
.pager-btn{
  text-decoration:none;
  border:1px solid var(--line);
  background:var(--paper);
  border-radius:10px;
  padding:14px 18px;
  flex:1;
  transition:border-color .15s, transform .15s;
}
.pager-btn:hover{border-color:var(--accent); transform:translateY(-1px);}
.pager-btn.next{text-align:right;}
.pager-btn .pager-dir{
  display:block;
  font-family:var(--font-mono);
  font-size:.72rem;
  color:var(--muted);
  text-transform:uppercase;
  margin-bottom:4px;
}
.pager-btn .pager-title{font-weight:600;}
.pager-spacer{flex:1;}

/* ---------- Index page ---------- */
.hero{
  padding:70px 56px 40px;
  max-width:760px;
}
.hero .eyebrow{margin-bottom:14px;}
.hero h1{
  font-family:var(--font-display);
  font-size:3rem;
  line-height:1.1;
  margin:0 0 20px;
}
.hero p.lead{font-size:1.15rem;}

.lesson-grid{
  padding:0 56px 80px;
  display:grid;
  grid-template-columns:repeat(auto-fill, minmax(230px,1fr));
  gap:16px;
  max-width:980px;
}
.lesson-tile{
  background:var(--paper);
  border:1px solid var(--line);
  border-radius:var(--radius);
  padding:20px;
  text-decoration:none;
  color:var(--ink);
  transition:transform .15s, box-shadow .15s, border-color .15s;
  display:flex;
  flex-direction:column;
  gap:8px;
}
.lesson-tile:hover{
  transform:translateY(-3px);
  box-shadow:0 10px 24px rgba(27,36,48,.08);
  border-color:var(--accent);
}
.lesson-tile .num{
  font-family:var(--font-mono);
  color:var(--muted);
  font-size:.8rem;
}
.lesson-tile .name{font-weight:600; font-size:1.02rem;}

/* ---------- Responsive ---------- */
@media (max-width: 860px){
  .shell{grid-template-columns:1fr;}
  .sidebar{position:relative; height:auto;}
  main{padding:32px 22px 80px;}
  .hero, .lesson-grid{padding-left:22px; padding-right:22px;}
  h1.lesson-title{font-size:1.9rem;}
}
