:root {
    --bg: #f2faf5;
    --surface: #ffffff;
    --surface-soft: #e7f4ed;
    --text: #173b35;
    --muted: #5e746f;
    --primary: #28785f;
    --primary-dark: #175944;
    --accent: #7cc596;
    --line: #c9dfd2;
    --danger: #a13d4b;
    --shadow: 0 18px 48px rgba(24, 74, 59, .12);
    --radius: 22px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    line-height: 1.55;
}
a { color: var(--primary-dark); text-decoration: none; }
a:hover { color: var(--primary); }
img { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; }
h1, h2, h3, p { margin-top: 0; }
h1 { max-width: 850px; font-size: clamp(2.2rem, 6vw, 5rem); line-height: 1.02; letter-spacing: -.05em; }
h2 { font-size: clamp(1.6rem, 3vw, 2.4rem); line-height: 1.15; }
.container { width: min(1180px, calc(100% - 40px)); margin-inline: auto; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }
.muted { color: var(--muted); }
.eyebrow { margin-bottom: 10px; color: var(--primary); font-size: .78rem; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; }

.site-header {
    position: sticky;
    z-index: 20;
    top: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 74px;
    padding: 12px max(20px, calc((100vw - 1180px) / 2));
    border-bottom: 1px solid rgba(201, 223, 210, .85);
    background: rgba(242, 250, 245, .9);
    backdrop-filter: blur(18px);
}
.brand { font-size: 1.3rem; font-weight: 900; letter-spacing: -.04em; }
.main-nav { display: flex; align-items: center; gap: 22px; }
.main-nav form { margin: 0; }
.link-button { border: 0; padding: 0; background: transparent; color: var(--primary-dark); cursor: pointer; }

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    padding: 11px 22px;
    border: 1px solid var(--primary);
    border-radius: 999px;
    background: var(--primary);
    color: white;
    font-weight: 750;
    cursor: pointer;
}
.button:hover { background: var(--primary-dark); color: white; }
.button:disabled { opacity: .55; cursor: not-allowed; }
.button-small { min-height: 38px; padding: 7px 16px; }
.button-wide { width: 100%; }

.hero {
    min-height: 630px;
    display: grid;
    align-items: center;
    background:
        linear-gradient(90deg, rgba(236, 249, 241, .98) 0%, rgba(236, 249, 241, .88) 52%, rgba(236, 249, 241, .25) 100%),
        url("../img/aurora-bg.jpg") center/cover;
}
.hero-content { padding-block: 90px; }
.hero-text { max-width: 700px; color: #355d53; font-size: clamp(1.05rem, 2vw, 1.35rem); }
.search-form { display: flex; max-width: 720px; gap: 10px; margin-top: 32px; }
.search-form input, .catalog-filters input, .catalog-filters select, .form-field input, .form-field select, .form-field textarea {
    width: 100%;
    min-height: 50px;
    padding: 12px 16px;
    border: 1px solid var(--line);
    border-radius: 14px;
    outline: none;
    background: white;
    color: var(--text);
}
.search-form input:focus, .catalog-filters input:focus, .catalog-filters select:focus, .form-field input:focus { border-color: var(--primary); box-shadow: 0 0 0 4px rgba(40, 120, 95, .12); }

.section { padding-block: 72px; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 28px; }
.section-heading h1, .section-heading h2 { margin-bottom: 0; }
.category-list { display: flex; flex-wrap: wrap; gap: 10px; }
.category-chip, .course-tags span { border: 1px solid var(--line); border-radius: 999px; background: var(--surface); }
.category-chip { padding: 10px 18px; font-weight: 650; }
.category-chip:hover { border-color: var(--accent); background: var(--surface-soft); }

.course-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 20px; }
.course-card { overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: 0 7px 24px rgba(24, 74, 59, .06); }
.course-cover { display: grid; aspect-ratio: 16/10; place-items: center; overflow: hidden; background: linear-gradient(135deg, #bee2cc, #3b8b70); color: white; font-size: 4rem; font-weight: 900; }
.course-cover img { width: 100%; height: 100%; object-fit: cover; }
.course-card-body { padding: 20px; }
.course-card h3 { margin: 12px 0 8px; font-size: 1.25rem; line-height: 1.25; }
.course-card p { color: var(--muted); }
.course-meta { color: var(--muted); font-size: .86rem; }
.course-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.course-tags span { padding: 4px 9px; font-size: .72rem; }
.empty-state { grid-column: 1 / -1; padding: 44px; border: 1px dashed var(--line); border-radius: var(--radius); background: rgba(255,255,255,.6); text-align: center; }

.page-header { padding-top: 70px; }
.page-header h1 { margin-bottom: 30px; }
.catalog-filters { display: grid; grid-template-columns: minmax(220px, 1fr) minmax(190px, 280px) auto; gap: 12px; }
.pagination { display: flex; justify-content: center; align-items: center; gap: 24px; margin-top: 40px; }

.course-hero { padding-block: 80px; background: #dcefe5; }
.course-hero-grid { display: grid; grid-template-columns: 1.25fr .75fr; align-items: center; gap: 60px; }
.course-hero h1 { margin: 20px 0; }
.detail-cover { display: grid; aspect-ratio: 4/3; place-items: center; overflow: hidden; border-radius: 30px; background: linear-gradient(135deg, #8dceb1, #236d57); color: white; font-size: 7rem; font-weight: 900; box-shadow: var(--shadow); }
.detail-cover img { width: 100%; height: 100%; object-fit: cover; }
.detail-layout { display: grid; grid-template-columns: .85fr 1.15fr; gap: 70px; }
.prose { color: #38564f; }
.module-list details { margin-bottom: 12px; padding: 18px; border: 1px solid var(--line); border-radius: 16px; background: white; }
.module-list summary { display: flex; justify-content: space-between; gap: 16px; font-weight: 800; cursor: pointer; }
.module-list summary span { color: var(--muted); font-size: .85rem; font-weight: 500; }

.auth-page { min-height: calc(100vh - 140px); display: grid; place-items: center; padding: 70px 20px; background: linear-gradient(rgba(235,248,240,.9), rgba(235,248,240,.96)), url("../img/aurora-bg.jpg") center/cover; }
.auth-card { width: min(720px, 100%); padding: clamp(26px, 5vw, 52px); border: 1px solid rgba(255,255,255,.8); border-radius: 30px; background: rgba(255,255,255,.9); box-shadow: var(--shadow); }
.auth-card-small { width: min(500px, 100%); }
.auth-card h1 { margin-bottom: 18px; font-size: clamp(2.2rem, 5vw, 3.8rem); }
.stack-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; margin-top: 30px; }
.stack-form > .button-wide, .stack-form > .field-error { grid-column: 1 / -1; }
.auth-card-small .stack-form { grid-template-columns: 1fr; }
.form-field { display: grid; gap: 7px; }
.form-field label { font-weight: 700; }
.form-field small { color: var(--muted); font-size: .74rem; }
.form-field ul { margin: 4px 0 0; padding-left: 18px; }
.form-checkbox { display: flex; align-items: center; flex-wrap: wrap; }
.form-checkbox input { width: 20px; min-height: 20px; }
.field-error { color: var(--danger); font-size: .86rem; }
.auth-switch { margin: 24px 0 0; text-align: center; }

.dashboard-list { display: grid; gap: 14px; }
.dashboard-list article { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 24px; border: 1px solid var(--line); border-radius: 18px; background: white; }
.dashboard-list article h2 { margin: 8px 0; font-size: 1.35rem; }
.dashboard-list article p { margin-bottom: 0; color: var(--muted); }
.status { display: inline-block; padding: 4px 9px; border-radius: 999px; background: var(--surface-soft); color: var(--primary-dark); font-size: .72rem; font-weight: 750; }
.status-review { background: #fff1c9; color: #765814; }
.status-archived { background: #ececec; color: #555; }

.messages { margin-top: 18px; }
.message { padding: 12px 16px; border: 1px solid var(--line); border-radius: 12px; background: white; }
.site-footer { padding-block: 30px; border-top: 1px solid var(--line); color: var(--muted); }
.footer-row { display: flex; justify-content: space-between; gap: 20px; }

@media (max-width: 900px) {
    .course-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .course-hero-grid, .detail-layout { grid-template-columns: 1fr; }
    .detail-cover { max-width: 620px; }
    .main-nav { gap: 12px; }
}

@media (max-width: 680px) {
    .container { width: min(100% - 28px, 1180px); }
    .site-header { align-items: flex-start; padding: 14px; }
    .main-nav { justify-content: flex-end; flex-wrap: wrap; font-size: .88rem; }
    .main-nav a:not(.button), .link-button { padding-block: 7px; }
    .hero { min-height: 560px; }
    .hero-content { padding-block: 65px; }
    .search-form, .section-heading, .dashboard-list article { align-items: stretch; flex-direction: column; }
    .course-grid { grid-template-columns: 1fr; }
    .catalog-filters, .stack-form { grid-template-columns: 1fr; }
    .page-header { padding-top: 48px; }
    .section { padding-block: 50px; }
    .course-hero { padding-block: 52px; }
    .footer-row { flex-direction: column; }
}
