:root {
    --ink: #071917;
    --ink-soft: #14302d;
    --paper: #f4f0e8;
    --paper-strong: #fffdf8;
    --mint: #81efb4;
    --line-dark: rgba(244, 240, 232, .16);
    --line-light: rgba(7, 25, 23, .15);
    --display: "Manrope", sans-serif;
    --body: "DM Sans", sans-serif;
    --shell: min(1120px, calc(100% - 40px));
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; color: var(--ink); background: var(--paper); font-family: var(--body); font-size: 16px; line-height: 1.6; -webkit-font-smoothing: antialiased; }
a { color: inherit; }
.materials-shell { width: var(--shell); margin-inline: auto; }

.skip-link { position: fixed; z-index: 100; top: 12px; left: 12px; padding: 10px 16px; color: var(--ink); background: var(--mint); border-radius: 8px; transform: translateY(-150%); transition: transform .2s ease; }
.skip-link:focus { transform: translateY(0); }

.materials-header { color: var(--paper-strong); background: var(--ink); border-bottom: 1px solid var(--line-dark); }
.header-row { min-height: 78px; display: flex; align-items: center; justify-content: space-between; gap: 30px; }
.materials-brand { display: inline-flex; align-items: center; gap: 13px; text-decoration: none; }
.brand-mark { width: 40px; height: 40px; display: grid; place-items: center; color: var(--mint); border: 1px solid rgba(129,239,180,.55); border-radius: 50%; font-family: var(--display); font-size: 12px; font-weight: 800; }
.materials-brand > span:last-child { display: grid; line-height: 1.15; }
.materials-brand strong { font-family: var(--display); font-size: 15px; }
.materials-brand small { color: rgba(255,255,255,.5); font-size: 11px; text-transform: uppercase; letter-spacing: .12em; }
.back-link { display: inline-flex; align-items: center; gap: 10px; color: rgba(255,255,255,.7); font-size: 14px; font-weight: 600; text-decoration: none; }
.back-link:hover { color: var(--mint); }

.materials-intro { padding: 86px 0 78px; color: var(--paper-strong); background: var(--ink); }
.intro-grid { display: grid; grid-template-columns: 1.35fr .65fr; gap: clamp(45px, 8vw, 110px); align-items: end; }
.eyebrow { display: flex; align-items: center; gap: 10px; margin: 0 0 24px; color: var(--mint); font-size: 12px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; }
.eyebrow span { width: 26px; height: 1px; background: currentColor; }
.materials-intro h1 { max-width: 760px; margin: 0; font-family: var(--display); font-size: clamp(42px, 5.5vw, 72px); font-weight: 700; line-height: 1.04; letter-spacing: -.055em; }
.intro-grid > p { margin: 0 0 7px; color: rgba(255,255,255,.58); font-size: 17px; }

.catalog-section { min-height: 440px; padding: 76px 0 110px; }
.empty-state { display: grid; grid-template-columns: 76px 1fr; gap: 30px; align-items: start; max-width: 790px; margin: 35px auto 0; padding: 42px; background: var(--paper-strong); border: 1px solid var(--line-light); border-radius: 24px; }
.empty-icon { width: 64px; height: 64px; display: grid; place-items: center; color: #28785b; border: 1px solid var(--line-light); border-radius: 50%; font-size: 25px; }
.empty-label, .institution-heading p, .subject-heading p { margin: 0 0 8px; color: #28785b; font-size: 12px; font-weight: 700; letter-spacing: .13em; text-transform: uppercase; }
.empty-state h2 { margin: 0; font-family: var(--display); font-size: clamp(27px, 3vw, 38px); line-height: 1.2; letter-spacing: -.035em; }
.empty-state div > p:last-child { margin: 17px 0 0; color: #60706d; }

.institution-block + .institution-block { margin-top: 82px; }
.institution-heading { display: grid; grid-template-columns: 60px 1fr; gap: 24px; align-items: start; padding-bottom: 24px; border-bottom: 1px solid var(--line-light); }
.institution-heading > span { padding-top: 5px; color: #28785b; font-family: var(--display); font-size: 13px; }
.institution-heading h2 { margin: 0; font-family: var(--display); font-size: clamp(34px, 4vw, 50px); line-height: 1.1; letter-spacing: -.045em; }
.subjects-list { margin-left: 84px; }
.subject-card { display: grid; grid-template-columns: minmax(220px, .55fr) 1.45fr; gap: clamp(35px, 6vw, 80px); padding: 42px 0; border-bottom: 1px solid var(--line-light); }
.subject-heading h3 { margin: 0; font-family: var(--display); font-size: 25px; line-height: 1.25; letter-spacing: -.03em; }
.classes-list { min-width: 0; }
.class-panel { border-top: 1px solid var(--line-light); }
.class-panel:last-child { border-bottom: 1px solid var(--line-light); }
.class-panel summary { padding: 18px 4px; display: flex; align-items: center; justify-content: space-between; gap: 20px; cursor: pointer; list-style: none; font-family: var(--display); font-size: 17px; font-weight: 700; }
.class-panel summary::-webkit-details-marker { display: none; }
.class-panel summary::after { content: "+"; color: #28785b; font-size: 20px; font-weight: 400; }
.class-panel[open] summary::after { content: "−"; }
.class-panel summary small { margin-left: auto; color: #697572; font-family: var(--body); font-size: 12px; font-weight: 500; }
.class-content { padding: 4px 4px 25px; }
.material-group + .material-group { margin-top: 28px; }
.material-group h4 { margin: 0 0 10px; color: #53625f; font-size: 12px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
.files-list { display: grid; gap: 8px; }
.file-card { display: grid; grid-template-columns: 54px 1fr 30px; gap: 14px; align-items: center; min-height: 70px; padding: 10px 14px 10px 10px; background: var(--paper-strong); border: 1px solid rgba(7,25,23,.11); border-radius: 14px; text-decoration: none; transition: border-color .2s ease, transform .2s ease, box-shadow .2s ease; }
.file-card:hover { border-color: rgba(40,120,91,.55); transform: translateY(-2px); box-shadow: 0 12px 25px rgba(7,25,23,.07); }
.file-type { width: 50px; height: 48px; display: grid; place-items: center; color: #28785b; background: #e3f0e8; border-radius: 10px; font-size: 11px; font-weight: 800; }
.file-info { min-width: 0; display: grid; }
.file-info strong { overflow: hidden; font-size: 15px; text-overflow: ellipsis; white-space: nowrap; }
.file-info small { color: #71807d; font-size: 12px; }
.file-action { color: #28785b; font-size: 18px; text-align: center; }

.materials-footer { padding: 31px 0; color: rgba(255,255,255,.53); background: #04110f; }
.materials-footer .materials-shell { display: flex; justify-content: space-between; gap: 30px; }
.materials-footer p { margin: 0; font-size: 12px; }
.materials-footer a { color: var(--mint); font-size: 12px; text-decoration: none; }

@media (max-width: 820px) {
    :root { --shell: min(100% - 28px, 1120px); }
    .materials-intro { padding: 58px 0; }
    .intro-grid, .subject-card { grid-template-columns: 1fr; gap: 28px; }
    .materials-intro h1 { font-size: clamp(39px, 11vw, 56px); }
    .catalog-section { padding: 52px 0 80px; }
    .empty-state { grid-template-columns: 1fr; padding: 28px 22px; }
    .institution-heading { grid-template-columns: 34px 1fr; gap: 12px; }
    .subjects-list { margin-left: 46px; }
    .subject-card { gap: 24px; padding: 34px 0; }
}

@media (max-width: 520px) {
    .materials-brand small { display: none; }
    .back-link { font-size: 0; }
    .back-link span { font-size: 22px; }
    .subjects-list { margin-left: 0; }
    .institution-heading { grid-template-columns: 1fr; }
    .class-panel summary { align-items: flex-start; flex-wrap: wrap; }
    .class-panel summary small { margin-left: 0; }
    .file-card { grid-template-columns: 46px 1fr 22px; gap: 10px; }
    .file-type { width: 44px; height: 44px; font-size: 10px; }
    .materials-footer .materials-shell { flex-direction: column; gap: 8px; }
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after { transition-duration: .01ms !important; }
}
