/* Recess Code Camp lessons, in Methalo's look (methalo.dev/rcc).
   The lessons are the camp's own (recesscodecamp.co.za/html, /day2, /layouts), all on one page in
   their order; only the look is new. rcc.js switches lessons, copies code and opens the menu. */
:root {
    --bg: #0a0a0a;
    --bg-2: #111111;
    --card: #141414;
    --text: #f2f2f2;
    --soft: #c8c8c8;
    --muted: #8a8a8a;
    --line: rgba(255, 255, 255, 0.09);
    --red: #ff4d2e;
    --yellow: #ffd23f;
    --mint: #8fe0bf;
    --blue: #0d99ff;
    --violet: #7c5cff;
    --spectrum: linear-gradient(90deg, #ff4d2e 0%, #ffd23f 34%, #8fe0bf 66%, #0d99ff 100%);
    --accent: var(--blue); /* each lesson keeps its guide's colour: html red, css yellow, layouts mint */
    --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    --top: 64px;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: Inter, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
.guide-html { --accent: var(--red); }
.guide-css { --accent: var(--yellow); }
.guide-layouts { --accent: var(--mint); }

/* ---- Top bar: Methalo and the camp. */
.topbar {
    position: sticky;
    top: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    gap: 20px;
    height: var(--top);
    padding: 0 clamp(16px, 3vw, 40px);
    background: rgba(10, 10, 10, 0.86);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--line);
}
.topbar::after { content: ''; position: absolute; left: 0; right: 0; bottom: -1px; height: 1px; background: var(--spectrum); opacity: 0.55; }
.brand { display: flex; align-items: center; gap: 14px; text-decoration: none; }
.logo { display: flex; align-items: flex-end; gap: 2px; font-size: 22px; font-weight: 800; letter-spacing: -0.04em; line-height: 0.75; }
.logo svg { width: 0.893em; height: 0.774em; }
.brand .x { color: var(--muted); font-size: 14px; }
.camp { display: flex; align-items: center; gap: 8px; color: var(--soft); font-size: 13px; font-weight: 600; white-space: nowrap; }
.camp img { height: 13px; width: auto; display: block; }
.brand a { color: var(--text); text-decoration: none; }
/* Back to Methalo's home page. */
.home-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
    padding: 8px 16px;
    border-radius: 999px;
    color: var(--soft);
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    transition: color 0.15s, background 0.15s;
}
.home-link:hover { color: var(--text); background: var(--card); }
.menu-toggle {
    display: none;
    width: 40px;
    height: 40px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--card);
    color: var(--text);
    font-size: 20px;
    cursor: pointer;
}

/* ---- The guide: lessons on the left, the open lesson on the right. */
.container { display: flex; max-width: 1440px; margin: 0 auto; min-height: calc(100vh - var(--top)); }
.sidebar {
    flex: none;
    width: 300px;
    position: sticky;
    top: var(--top);
    align-self: flex-start;
    max-height: calc(100vh - var(--top));
    overflow-y: auto;
    padding: 32px 16px 40px clamp(16px, 3vw, 40px);
    border-right: 1px solid var(--line);
    scrollbar-width: thin;
}
.sidebar-header { padding: 0 12px 18px; }
.sidebar-kicker { margin: 0 0 6px; color: var(--muted); font-size: 12px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; }
.sidebar-title { margin: 0; font-size: 22px; font-weight: 800; letter-spacing: -0.03em; line-height: 1.2; }
.sidebar-title::after { content: ''; display: block; width: 36px; height: 4px; margin-top: 12px; border-radius: 4px; background: var(--accent); }
.lesson-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.lesson-item {
    display: flex;
    align-items: baseline;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 12px;
    color: var(--soft);
    font-size: 15px;
    line-height: 1.35;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}
.lesson-item:hover { background: var(--bg-2); color: var(--text); }
.lesson-item:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.lesson-item.active { background: var(--card); color: var(--text); }
.lesson-number { flex: none; color: var(--muted); font-family: var(--mono); font-size: 12px; }
.lesson-item.active .lesson-number { color: var(--accent); }

.main-content { flex: 1; min-width: 0; padding: 48px clamp(16px, 4vw, 64px) 96px; }
.lesson-container { display: none; max-width: 920px; }
.lesson-container.active { display: block; animation: lesson-in 0.25s ease; }
@keyframes lesson-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.lesson-header { padding-bottom: 28px; margin-bottom: 32px; border-bottom: 1px solid var(--line); }
.lesson-title { display: flex; align-items: center; gap: 16px; margin: 0 0 14px; font-size: clamp(28px, 3.4vw, 44px); font-weight: 800; letter-spacing: -0.035em; line-height: 1.08; }
.lesson-icon {
    flex: none;
    display: grid;
    place-items: center;
    width: 52px;
    height: 52px;
    border-radius: 16px;
    background: var(--accent);
    color: var(--bg);
    font-size: 24px;
}
.lesson-description { margin: 0; max-width: 760px; color: var(--soft); font-size: 18px; }

/* Code windows: the file's name on a bar, the code in Methalo's colours. */
.code-section { margin: 0 0 24px; border: 1px solid var(--line); border-radius: 18px; background: var(--bg-2); overflow: hidden; }
.code-header { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px 10px 18px; background: var(--card); border-bottom: 1px solid var(--line); }
.code-filename { display: flex; align-items: center; gap: 10px; color: var(--soft); font-family: var(--mono); font-size: 13px; }
.code-filename::before { content: ''; width: 34px; height: 8px; background: radial-gradient(circle at 4px 4px, var(--red) 3.5px, transparent 4px), radial-gradient(circle at 17px 4px, var(--yellow) 3.5px, transparent 4px), radial-gradient(circle at 30px 4px, var(--mint) 3.5px, transparent 4px); }
.code-filename i { display: none; }
.code-action {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    transition: color 0.15s, background 0.15s;
}
.code-action:hover { color: var(--text); background: var(--bg); }
/* (no ligatures: <!-- and --> are typed as they are, not shown as arrows) */
.code-content { padding: 22px 24px 24px; overflow-x: auto; color: var(--text); font-family: var(--mono); font-size: 14px; line-height: 1.75; white-space: nowrap; font-variant-ligatures: none; }
code, .lesson-number { font-variant-ligatures: none; }
.code-tag { color: var(--blue); }
.code-attribute, .code-property { color: var(--mint); }
.code-value { color: var(--yellow); }
.code-selector { color: var(--red); }
.code-text { color: var(--text); }
.code-comment { color: #6b6b6b; font-style: italic; }

/* Explanations, notes and tags. */
.explanation { margin: 0 0 24px; padding: 22px 26px; border-radius: 18px; background: var(--card); color: var(--soft); font-size: 16px; }
.explanation-title { display: flex; align-items: center; gap: 10px; margin: 0 0 8px; color: var(--text); font-size: 13px; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; }
.explanation-title i { color: var(--mint); font-size: 16px; }
.explanation code, .note-box code { font-family: var(--mono); font-size: 0.9em; }
.note-box { margin: 0 0 24px; padding: 20px 24px; border: 1px solid var(--line); border-radius: 18px; background: linear-gradient(90deg, rgba(255, 255, 255, 0.04), transparent); color: var(--soft); font-size: 15px; line-height: 1.8; }
.note-box strong { color: var(--text); font-weight: 600; }
.lesson-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 32px; }
.tag { display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px; border: 1px solid var(--line); border-radius: 999px; color: var(--soft); font-size: 13px; font-weight: 500; }
.tag i { color: var(--accent); }

/* Layout demos (the layouts guide). */
.flex-demo-container { margin: 0 0 24px; padding: 26px; border: 1px solid var(--line); border-radius: 18px; background: var(--card); }
.flex-demo-container h3 { margin: 0 0 6px; font-size: 20px; font-weight: 800; letter-spacing: -0.02em; }
.flex-demo-container h4 { margin: 20px 0 10px; color: var(--muted); font-family: var(--mono); font-size: 13px; font-weight: 500; }
.flex-container { display: flex; min-height: 96px; margin: 0; padding: 14px; border: 1px dashed rgba(255, 255, 255, 0.16); border-radius: 14px; background: var(--bg); }
.flex-item { min-width: 80px; margin: 5px; padding: 18px; border-radius: 10px; background: var(--blue); color: #ffffff; font-weight: 700; text-align: center; }
.flex-item:nth-child(3n + 2) { background: var(--violet); }
.flex-item:nth-child(3n) { background: var(--red); }
.direction-row { flex-direction: row; }
.direction-column { flex-direction: column; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.align-center { align-items: center; height: 150px; }
.wrap-demo { flex-wrap: wrap; }
.wrap-demo .flex-item { width: 30%; }
.gap-demo { gap: 15px; }
.grow-demo .flex-item:nth-child(2) { flex-grow: 1; }
.shrink-demo .flex-item { flex-basis: 150px; }
.shrink-demo .flex-item:nth-child(2) { flex-shrink: 0; }
.order-demo .flex-item:nth-child(1) { order: 2; }
.order-demo .flex-item:nth-child(2) { order: 1; }
.position-demo-container { position: relative; height: 300px; margin: 16px 0; padding: 20px; border: 1px dashed rgba(255, 255, 255, 0.16); border-radius: 14px; background: var(--bg); overflow: auto; }
.position-box { display: flex; align-items: center; justify-content: center; width: 100px; height: 100px; border-radius: 12px; color: #0a0a0a; font-size: 13px; font-weight: 700; }
.static-box { background: var(--blue); color: #ffffff; }
.relative-box { position: relative; top: 20px; left: 30px; background: var(--mint); }
.absolute-box { position: absolute; top: 50px; right: 50px; background: var(--yellow); }
.fixed-box { position: fixed; right: 20px; bottom: 20px; z-index: 40; width: 80px; height: 80px; background: var(--red); color: #ffffff; }
.sticky-box { position: sticky; top: 20px; display: flex; align-items: center; justify-content: center; width: 100%; height: 60px; margin-top: 40px; border-radius: 12px; background: var(--violet); color: #ffffff; font-weight: 700; }
.hidden-box { display: none; margin-top: 12px; background: var(--soft); }
.demo-controls { display: flex; flex-wrap: wrap; gap: 10px; margin: 16px 0 0; }
.demo-btn { padding: 11px 20px; border: 0; border-radius: 999px; background: var(--text); color: var(--bg); font: inherit; font-size: 14px; font-weight: 700; cursor: pointer; transition: transform 0.15s; }
.demo-btn:hover { transform: translateY(-1px); }

/* Previous / next lesson, under each lesson. */
.lesson-steps { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 48px; padding-top: 28px; border-top: 1px solid var(--line); }
.lesson-step { display: flex; flex-direction: column; gap: 4px; padding: 16px 20px; border: 1px solid var(--line); border-radius: 16px; background: var(--bg-2); color: var(--text); font: inherit; font-size: 16px; font-weight: 600; text-align: left; cursor: pointer; transition: border-color 0.15s, background 0.15s; }
.lesson-step:hover { border-color: rgba(255, 255, 255, 0.22); background: var(--card); }
.lesson-step small { color: var(--muted); font-size: 12px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; }
.lesson-step-next { grid-column: 2; text-align: right; }
.lesson-step-next small { align-self: flex-end; }
.lesson-step span { font-variant-ligatures: none; }

/* ---- Bottom: the camp, made with Methalo. */
.footer { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; padding: 28px clamp(16px, 3vw, 40px); border-top: 1px solid var(--line); color: var(--muted); font-size: 14px; }
.footer .camp img { height: 14px; }
.footer a { color: var(--soft); text-decoration: none; }
.footer a:hover { color: var(--text); }
.made { display: flex; align-items: center; gap: 8px; }
.made .logo { font-size: 16px; color: var(--text); }

/* ---- Phones: the lessons open from a menu. */
.sidebar-overlay { display: none; }
@media (max-width: 860px) {
    .camp span { display: none; }
    .menu-toggle { display: grid; place-items: center; }
    .sidebar {
        position: fixed;
        top: var(--top);
        left: 0;
        bottom: 0;
        z-index: 45;
        width: min(320px, 86vw);
        max-height: none;
        background: var(--bg);
        transform: translateX(-102%);
        transition: transform 0.25s ease;
    }
    .sidebar.active { transform: none; box-shadow: 30px 0 80px rgba(0, 0, 0, 0.6); }
    .sidebar-overlay.active { display: block; position: fixed; inset: var(--top) 0 0; z-index: 44; background: rgba(0, 0, 0, 0.55); }
    .main-content { padding-top: 32px; }
    .lesson-icon { width: 42px; height: 42px; border-radius: 13px; font-size: 20px; }
    .code-content { font-size: 13px; padding: 18px; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } html { scroll-behavior: auto; } }
