/* medlib — «Античный манускрипт»: базовая палитра и фундамент вёрстки */

:root {
    --bg: #F5F0E6;
    --text: #1A1A1A;
    --accent-1: #8B2E1F;
    --accent-2: #8B6F1F;
    --divider: #D4CCB8;
    --card-light: #EDE3CE;
    --card-dark: #D8C9A8;

    --serif: 'Cormorant Garamond', 'Georgia', serif;
    --sans: 'IBM Plex Sans', -apple-system, sans-serif;
    --mono: 'IBM Plex Mono', 'Courier New', monospace;

    --plate: #F5F0E6;
    --nav-bg: rgba(245, 240, 230, 0.85);
}

[data-theme="dark"] {
    --bg: #16120D;
    --text: #E8E0D2;
    --accent-1: #CA6B51;
    --accent-2: #BFA05A;
    --divider: #3A3025;
    --card-light: #241D15;
    --card-dark: #1F1913;
    --plate: #EFE7D7;
    --nav-bg: rgba(22, 18, 13, 0.85);
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body,
h1, h2, h3, h4, h5, h6,
p,
figure {
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--sans);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    transition: background-color 0.25s ease, color 0.25s ease;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--serif);
    font-weight: 600;
    letter-spacing: 0.01em;
}

a {
    color: inherit;
    text-decoration: none;
}

img {
    max-width: 100%;
    display: block;
}

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

/* Верхняя навигация */

.nav {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--bg); /* fallback для браузеров без backdrop-filter */
    border-bottom: 1px solid var(--divider);
}

@supports (backdrop-filter: blur(10px)) or (-webkit-backdrop-filter: blur(10px)) {
    .nav {
        background: var(--nav-bg);
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
    }
}

.nav__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
    padding: 1rem 2rem;
}

.nav__logo {
    font-family: var(--serif);
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
}

.nav__logo em {
    font-style: italic;
    color: var(--accent-1);
}

.nav__brand {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.nav__tagline {
    font-family: var(--sans);
    font-size: 10px;
    font-weight: 400;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--accent-2);
    opacity: 0.7;
    line-height: 1;
}

.nav__links {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2rem;
    list-style: none;
    flex: 1;
}

.nav__links a {
    font-size: 0.95rem;
    letter-spacing: 0.02em;
    transition: color 0.2s ease;
}

.nav__links a:hover {
    color: var(--accent-1);
}

.nav-link--primary {
    font-weight: 500;
    position: relative;
}

.nav-link--primary::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: -4px;
    height: 1.5px;
    background: var(--accent-1);
    opacity: 0.7;
}

.nav-link--primary:hover::after {
    opacity: 1;
}

.nav__search {
    display: flex;
    align-items: center;
    position: relative;
}

.nav__search input {
    font-family: var(--sans);
    font-size: 0.9rem;
    background: var(--card-light);
    border: 1px solid var(--divider);
    border-radius: 999px;
    padding: 0.5rem 1rem 0.5rem 40px;
    color: var(--text);
    min-width: 360px;
    width: clamp(360px, 30vw, 420px);
    outline: none;
    transition: border-color 0.2s ease;
}

.nav__search-icon {
    position: absolute;
    left: 14px;
    display: flex;
    color: var(--accent-2);
    pointer-events: none;
}

.nav__search input:focus {
    border-color: var(--accent-2);
}

.nav__search input::-webkit-search-cancel-button,
.nav__search input::-webkit-search-decoration {
    -webkit-appearance: none;
    appearance: none;
    display: none;
}

.nav__search input::-ms-clear {
    display: none;
}

.theme-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border: 1px solid var(--divider);
    border-radius: 50%;
    background: transparent;
    color: var(--accent-2);
    cursor: pointer;
    transition: border-color 0.2s ease, color 0.2s ease;
}

.theme-toggle:hover {
    border-color: var(--accent-1);
    color: var(--accent-1);
}

.theme-toggle .theme-icon-moon { display: none; }
[data-theme="dark"] .theme-toggle .theme-icon-sun { display: none; }
[data-theme="dark"] .theme-toggle .theme-icon-moon { display: block; }

/* Футер */

.footer {
    border-top: 1px solid var(--divider);
    margin-top: 4rem;
    padding: 2.5rem 0;
}

.footer__quote {
    font-family: var(--serif);
    font-style: italic;
    font-size: 1.25rem;
    color: var(--accent-1);
    text-align: center;
    margin-bottom: 1rem;
}

.footer__meta {
    font-family: var(--mono);
    font-size: 0.8rem;
    color: var(--text);
    opacity: 0.6;
    text-align: center;
    letter-spacing: 0.02em;
}

.footer__links {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin-top: 1rem;
    list-style: none;
}

.footer__links a {
    font-size: 0.85rem;
    color: var(--text);
    opacity: 0.7;
    transition: opacity 0.2s ease, color 0.2s ease;
}

.footer__links a:hover {
    opacity: 1;
    color: var(--accent-1);
}

/* Hero */

.hero {
    position: relative;
    min-height: 85vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.hero-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 0.9fr);
    align-items: center;
    gap: clamp(2.5rem, 6vw, 6rem);
}

.hero-text {
    align-self: stretch;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.hero-engraving {
    display: flex;
    justify-content: center;
    margin: 0;
}

.hero-engraving img {
    width: 100%;
    max-width: 560px;
    height: auto;
    max-height: min(64vh, 660px);
    object-fit: contain;
}

.engraving-dark { display: none; }

[data-theme="light"] .engraving-light { mix-blend-mode: multiply; }

[data-theme="dark"] .engraving-light { display: none; }
[data-theme="dark"] .engraving-dark {
    display: block;
    mix-blend-mode: screen;
}

.hero-eyebrow {
    position: relative;
    display: inline-flex;
    align-items: center;
    font-family: var(--sans);
    font-size: 0.85rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--accent-2);
    padding-left: 3rem;
    margin-bottom: 2rem;
}

.hero-eyebrow::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    width: 2.25rem;
    height: 1px;
    background: var(--accent-2);
    transform: translateY(-50%);
}

.hero-quote {
    font-family: var(--serif);
    font-style: italic;
    font-weight: 500;
    font-size: clamp(2.625rem, 6vw, 5.25rem);
    line-height: 1.05;
    color: var(--text);
    margin-bottom: 1.5rem;
}

.hero-attribution {
    font-family: var(--sans);
    font-size: 0.85rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text);
    opacity: 0.6;
    margin-bottom: 2.5rem;
}

.hero-lead {
    font-family: var(--serif);
    font-size: clamp(1.375rem, 2vw, 1.625rem);
    line-height: 1.5;
    max-width: 640px;
    color: var(--text);
    opacity: 0.85;
    margin-bottom: 2.5rem;
}

.hero-cta-group {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.hero-cta {
    display: inline-block;
    font-family: var(--sans);
    font-size: 0.95rem;
    letter-spacing: 0.02em;
    padding: 0.9rem 1.75rem;
    border-radius: 2px;
    transition: background 0.25s ease, color 0.25s ease, border-color 0.25s ease, transform 0.2s ease;
}

.hero-cta.primary,
.hero-cta.primary:visited,
.hero-cta.primary:link,
.hero-cta.primary:active,
.hero-cta.primary:focus {
    background: var(--accent-1);
    color: var(--bg);
    border: 1px solid var(--accent-1);
}

.hero-cta.primary:hover {
    background: transparent;
    color: var(--accent-1);
    transform: translateY(-2px);
}

.hero-cta.secondary,
.hero-cta.secondary:visited,
.hero-cta.secondary:link {
    background: transparent;
    color: var(--text);
    border: 1px solid var(--divider);
}

.hero-cta.secondary:hover {
    border-color: var(--accent-1);
    color: var(--accent-1);
    transform: translateY(-2px);
}

/* Section */

.section {
    padding: 120px 0;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 2rem;
    margin-bottom: 4rem;
}

.section-eyebrow {
    position: relative;
    display: inline-flex;
    align-items: center;
    font-family: var(--sans);
    font-size: 0.8rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--accent-2);
    padding-left: 2.5rem;
    margin-bottom: 0.75rem;
}

.section-eyebrow::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    width: 1.75rem;
    height: 1px;
    background: var(--accent-2);
    transform: translateY(-50%);
}

.section-title {
    font-family: var(--serif);
    font-size: 3.5rem;
    font-weight: 500;
}

.section-title em {
    font-style: italic;
    color: var(--accent-1);
}

.section-descr {
    font-family: var(--serif);
    font-style: italic;
    font-size: 1.15rem;
    opacity: 0.7;
    max-width: 340px;
    text-align: right;
}

/* Subjects grid */

.subjects-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 40px;
}

.subject-card--morphological {
    --card-bg-light: #A8563A;
    --card-bg-dark: #8B4327;
    --card-text: #F5F0E6;
    --card-accent: #D4CCB8;
}

.subject-card--functional {
    --card-bg-light: #7A2E2E;
    --card-bg-dark: #5C1E1E;
    --card-text: #F5F0E6;
    --card-accent: #D4CCB8;
}

.subject-card--clinical {
    --card-bg-light: #4A6741;
    --card-bg-dark: #3A5033;
    --card-text: #F5F0E6;
    --card-accent: #D4CCB8;
}

.subject-card--micro {
    --card-bg-light: #3D5A80;
    --card-bg-dark: #2E4560;
    --card-text: #F5F0E6;
    --card-accent: #D4CCB8;
}

.subject-card--general {
    --card-bg-light: #4A4A4A;
    --card-bg-dark: #333333;
    --card-text: #F5F0E6;
    --card-accent: #D4CCB8;
}

.subject-card--surgical {
    --card-bg-light: #96662A;
    --card-bg-dark: #7A5220;
    --card-text: #F5F0E6;
    --card-accent: #D4CCB8;
}

.subject-card--diagnostic {
    --card-bg-light: #6B5580;
    --card-bg-dark: #4A3860;
    --card-text: #F5F0E6;
    --card-accent: #D4CCB8;
}

.subject-card--humanities {
    --card-bg-light: #6B5A45;
    --card-bg-dark: #52442F;
    --card-text: #F5F0E6;
    --card-accent: #D4CCB8;
}

[data-theme="dark"] .subject-card--morphological {
    --card-bg-light: #8E4326;
    --card-bg-dark: #6E321B;
}
[data-theme="dark"] .subject-card--functional {
    --card-bg-light: #6E2C2C;
    --card-bg-dark: #532020;
}
[data-theme="dark"] .subject-card--micro {
    --card-bg-light: #2F4770;
    --card-bg-dark: #223555;
}
[data-theme="dark"] .subject-card--clinical {
    --card-bg-light: #3E5636;
    --card-bg-dark: #2E4028;
}
[data-theme="dark"] .subject-card--surgical {
    --card-bg-light: #806029;
    --card-bg-dark: #61481E;
}
[data-theme="dark"] .subject-card--diagnostic {
    --card-bg-light: #573F62;
    --card-bg-dark: #412F49;
}
[data-theme="dark"] .subject-card--general {
    --card-bg-light: #383029;
    --card-bg-dark: #29231D;
}
[data-theme="dark"] .subject-card--humanities {
    --card-bg-light: #5A4630;
    --card-bg-dark: #443524;
}

[data-theme="dark"] .subject-card--morphological,
[data-theme="dark"] .subject-card--functional,
[data-theme="dark"] .subject-card--micro,
[data-theme="dark"] .subject-card--clinical,
[data-theme="dark"] .subject-card--surgical,
[data-theme="dark"] .subject-card--diagnostic,
[data-theme="dark"] .subject-card--general,
[data-theme="dark"] .subject-card--humanities {
    --card-text: #F0E8DA;
    --card-accent: #C0AE92;
}

.subject-card {
    position: relative;
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 320px;
    margin: 0 auto;
    aspect-ratio: 3 / 4;
    padding: 1.75rem;
    overflow: hidden;
    background: linear-gradient(160deg, var(--card-bg-light) 0%, var(--card-bg-dark) 100%);
    color: var(--card-text);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08), 0 8px 24px rgba(0, 0, 0, 0.12);
    transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1),
                box-shadow 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.subject-card::before,
.subject-card::after {
    content: '';
    position: absolute;
    pointer-events: none;
}

.subject-card::before {
    inset: 10px;
    border: 1px solid var(--card-text);
    opacity: 0.55;
}

.subject-card::after {
    inset: 14px;
    border: 1px solid var(--card-text);
    opacity: 0.35;
}

.subject-spine {
    position: absolute;
    top: 0;
    bottom: 0;
    right: 0;
    left: auto;
    width: 3px;
    background: linear-gradient(
        to left,
        rgba(0, 0, 0, 0.15) 0%,
        rgba(0, 0, 0, 0) 100%
    );
    border-right: none;
    pointer-events: none;
    z-index: 1;
}

.subject-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1), 0 16px 32px rgba(0, 0, 0, 0.18);
}

.subject-card--coming-soon {
    opacity: 0.45;
    filter: saturate(0.6);
    pointer-events: none;
    cursor: default;
}

.subject-coming-soon-badge {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    font-family: var(--sans);
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.25em;
    text-transform: uppercase;
    color: var(--card-text);
    background: rgba(0, 0, 0, 0.4);
    padding: 8px 18px;
    border-radius: 999px;
    z-index: 5;
    white-space: nowrap;
}

.subject-top {
    position: relative;
    z-index: 1;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.subject-number {
    font-family: var(--serif);
    font-style: italic;
    font-size: 1.75rem;
    color: var(--card-text);
    opacity: 0.7;
}

.subject-ornament {
    font-size: 1.1rem;
    color: var(--card-text);
    opacity: 0.5;
}

.subject-bottom {
    position: relative;
    z-index: 1;
    padding-top: 10%;
    min-height: 200px;
    text-align: center;
}

.subject-name {
    font-family: var(--serif);
    font-size: 2.5rem;
    font-weight: 500;
    line-height: 1.05;
    color: var(--card-text);
    margin-bottom: 0;
    overflow-wrap: normal;
}

.subject-divider {
    width: 40px;
    height: 1px;
    margin: 48px auto 1rem;
    background: var(--card-accent);
    opacity: 0.6;
}

.subject-latin {
    font-family: var(--serif);
    font-style: italic;
    font-weight: 400;
    font-size: 20px;
    letter-spacing: 0.02em;
    color: var(--card-text);
    opacity: 0.8;
    margin-top: 8px;
    line-height: 1.3;
}

.subject-meta {
    font-family: var(--serif);
    font-style: italic;
    font-size: 1rem;
    color: var(--card-text);
    opacity: 0.7;
}

/* Subject detail page */

.subject-page--morphological {
    --page-accent: #8B4327;
}

.subject-page--functional {
    --page-accent: #5C1E1E;
}

.subject-page--clinical {
    --page-accent: #3A5033;
}

.subject-page--micro {
    --page-accent: #2E4560;
}

.subject-page--general {
    --page-accent: #333333;
}

.subject-page--surgical {
    --page-accent: #8B6428;
}

.subject-page--diagnostic {
    --page-accent: #4A3860;
}

.subject-page--humanities {
    --page-accent: #333333;
}

.subject-page-layout {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 60px;
    padding-top: 80px;
    padding-bottom: 80px;
}

.sidebar {
    border-right: 1px solid var(--divider);
    padding-right: 32px;
    position: sticky;
    top: 96px;
    align-self: start;
}

.sidebar-eyebrow {
    font-family: var(--sans);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--accent-2);
    margin-bottom: 8px;
}

.sidebar-title {
    font-family: var(--serif);
    font-weight: 600;
    font-size: 32px;
    letter-spacing: -0.01em;
    color: var(--page-accent);
    margin-bottom: 32px;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
}

.sidebar-nav-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    margin-bottom: 2px;
    border-radius: 4px;
    font-family: var(--sans);
    font-size: 14px;
    color: var(--text);
    text-decoration: none;
    transition: background 0.15s ease;
}

.sidebar-nav-item:hover {
    background: rgba(139, 111, 31, 0.08);
}

.sidebar-nav-item.active {
    background: var(--page-accent);
    color: var(--bg);
    font-weight: 500;
}

.sidebar-nav-item .count {
    font-family: var(--mono);
    font-size: 12px;
    color: var(--page-accent);
    opacity: 0.7;
}

.sidebar-nav-item.active .count {
    color: var(--divider);
}

.sidebar-nav-item.child {
    padding-left: 28px;
    font-size: 13px;
    opacity: 0.75;
}

.sidebar-nav-item.child.active {
    opacity: 1;
    background: var(--page-accent);
}

.sidebar-nav-item.grandchild {
    padding-left: 44px;
    font-size: 12px;
    opacity: 0.65;
}

.sidebar-nav-item.grandchild.active {
    opacity: 1;
    background: var(--page-accent);
}

.sidebar-group-title {
    font-family: var(--sans);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    color: var(--accent-2);
    padding: 8px 12px;
    margin-top: 16px;
}

.file-list-area {
    padding-left: 20px;
}

.topics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px;
    margin-bottom: 40px;
}

.topic-tile {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 100px;
    padding: 20px;
    border: 1px solid var(--divider);
    border-radius: 4px;
    background: var(--card-light);
    text-decoration: none;
    color: inherit;
    transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.topic-tile:hover {
    border-color: var(--page-accent);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(26, 26, 26, 0.08);
}

.topic-tile-name {
    font-family: var(--serif);
    font-weight: 500;
    font-size: 20px;
    line-height: 1.2;
    margin-bottom: 8px;
}

.topic-tile-count {
    font-family: var(--sans);
    font-size: 13px;
    color: var(--accent-2);
}

.subtopics-section {
    margin-bottom: 48px;
}

.subtopics-section h2 {
    font-family: var(--serif);
    font-size: 24px;
    font-weight: 500;
    margin-bottom: 16px;
}

.breadcrumb {
    font-size: 13px;
    color: var(--accent-2);
    letter-spacing: 0.03em;
    margin-bottom: 16px;
}

.breadcrumb a {
    color: var(--accent-2);
    text-decoration: none;
    transition: color 0.2s ease;
}

.breadcrumb a:hover {
    color: var(--text);
}

.breadcrumb .sep {
    margin: 0 8px;
    color: var(--page-accent);
    opacity: 0.5;
}

.file-list-header {
    font-family: var(--serif);
    font-weight: 500;
    font-size: 48px;
    letter-spacing: -0.01em;
    color: var(--page-accent);
    margin-bottom: 8px;
}

.file-list-subtitle {
    font-family: var(--serif);
    font-style: italic;
    font-size: 18px;
    color: var(--accent-2);
    margin-bottom: 40px;
}

.file-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 12px;
    margin: 0 -12px;
    border-bottom: 1px solid var(--divider);
    border-radius: 4px;
    transition: background 0.2s ease, padding-left 0.2s ease;
}

.file-item:hover {
    background: rgba(139, 111, 31, 0.05);
    padding-left: 20px;
}

.file-title {
    font-family: var(--serif);
    font-weight: 500;
    font-size: 20px;
    color: var(--text);
    margin-bottom: 6px;
}

.file-meta {
    font-family: var(--sans);
    font-size: 13px;
    color: var(--accent-2);
}

.file-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.file-action {
    font-family: var(--sans);
    font-size: 13px;
    padding: 6px 14px;
    border-radius: 3px;
    border: 1px solid transparent;
    text-decoration: none;
    transition: all 0.15s ease;
    cursor: pointer;
    white-space: nowrap;
}

.file-action--view {
    color: var(--accent-2);
    border-color: var(--divider);
}

.file-action--view:hover {
    color: var(--accent-2);
    border-color: var(--accent-2);
}

.file-action--download {
    background: var(--page-accent, var(--accent-1));
    color: var(--bg);
    border-color: var(--page-accent, var(--accent-1));
}

.file-action--download:hover {
    filter: brightness(0.85);
}

.file-favorite {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 6px;
    color: var(--accent-2);
    opacity: 0.6;
    transition: all 0.15s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.file-favorite:hover {
    opacity: 1;
    color: var(--accent-1);
}

.file-favorite.is-active {
    opacity: 1;
    color: var(--accent-1);
}

.file-badge {
    font-family: var(--mono);
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.1em;
    border: 1px solid;
    padding: 4px 10px;
    border-radius: 3px;
    margin-left: 8px;
    white-space: nowrap;
    min-width: 60px;
    text-align: center;
}

.file-badge--pdf {
    color: var(--accent-1);
    border-color: var(--accent-1);
}

.file-badge--docx {
    color: var(--accent-2);
    border-color: var(--accent-2);
}

.file-badge--pptx {
    color: var(--text);
    border-color: var(--text);
}

.file-badge--mp4 {
    color: var(--text);
    border-color: var(--text);
}

.file-badge--other {
    color: var(--accent-2);
    border-color: var(--accent-2);
    opacity: 0.7;
}

/* Favorites page */

.favorites-page {
    padding: 60px 0 100px;
    min-height: 60vh;
}

.favorites-list {
    display: flex;
    flex-direction: column;
}

.favorites-empty {
    font-family: var(--serif);
    font-style: italic;
    font-size: 20px;
    color: var(--accent-2);
    padding: 40px 0;
    text-align: center;
}

/* Search page */

.search-page {
    padding: 60px 0 100px;
    min-height: 60vh;
}

.search-summary {
    font-family: var(--serif);
    font-style: italic;
    font-size: 18px;
    color: var(--accent-2);
    margin-bottom: 40px;
}

.search-results-list {
    display: flex;
    flex-direction: column;
}

.search-section-title {
    font-family: var(--serif);
    font-style: italic;
    font-weight: 500;
    font-size: 26px;
    letter-spacing: 0.02em;
    color: var(--accent-2);
    margin: 32px 0 24px;
    opacity: 0.8;
}

.search-subjects {
    margin-bottom: 48px;
}

.search-subjects + .search-section-title {
    margin-top: 48px;
}

.search-subjects .subjects-grid {
    gap: 24px;
    /* Наследует template-columns из основного правила .subjects-grid */
}

.search-empty {
    padding: 0 0 120px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
}

.search-empty-quote {
    font-family: var(--serif);
    font-style: italic;
    font-weight: 400;
    font-size: clamp(48px, 6vw, 88px);
    line-height: 1.05;
    letter-spacing: -0.01em;
    color: var(--accent-1);
}

.search-empty-attribution {
    font-family: var(--sans);
    font-size: 16px;
    font-weight: 400;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--accent-2);
}

.search-empty-hint {
    font-family: var(--serif);
    font-size: 18px;
    line-height: 1.5;
    color: var(--accent-2);
    max-width: 480px;
    margin-top: 32px;
}

.search-page--empty .section-header {
    justify-content: center;
    text-align: center;
}

.search-page--empty .section-header > div {
    text-align: center;
}

.search-page--empty .section-title {
    text-align: center;
}

@media (max-width: 900px) {
    .container {
        padding: 0 1.25rem;
    }

    .nav__tagline {
        display: none;
    }

    .subject-page-layout {
        grid-template-columns: 1fr;
        padding-top: 40px;
        padding-bottom: 40px;
    }

    .sidebar {
        border-right: none;
        border-bottom: 1px solid var(--divider);
        padding-right: 0;
        padding-bottom: 24px;
        position: static;
    }

    .file-list-area {
        padding-left: 0;
    }

    .nav__inner {
        flex-wrap: wrap;
        align-items: flex-start;
        padding: 1rem 1.25rem;
        row-gap: 1rem;
    }

    .nav__brand {
        align-items: flex-start;
    }

    .nav__links {
        order: 3;
        width: 100%;
        justify-content: flex-start;
        padding-left: 0;
        margin-left: 0;
        gap: 20px;
    }

    .nav__search {
        order: 2;
    }

    .nav__search input {
        min-width: 0;
        width: 160px;
    }

    .footer__links {
        flex-wrap: wrap;
        gap: 1rem 1.5rem;
    }

    .hero {
        min-height: auto;
        padding: 4rem 0;
    }

    .hero-grid {
        grid-template-columns: 1fr;
    }

    .hero-engraving {
        display: none;
    }

    .hero-cta-group {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .section {
        padding: 64px 0;
    }

    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .section-descr {
        max-width: none;
        text-align: left;
    }

    .subjects-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .hero {
        padding: 40px 0 60px;
    }

    .hero-quote {
        font-size: clamp(56px, 14vw, 88px);
    }

    .hero-attribution {
        font-size: 11px;
        margin-top: 8px;
    }

    .hero-lead {
        font-size: 1.25rem;
        margin: 24px 0 32px;
        line-height: 1.55;
    }

    .section-title {
        font-size: clamp(48px, 11vw, 64px);
        line-height: 1;
        letter-spacing: -0.02em;
    }

    .subjects-grid {
        grid-template-columns: 1fr;
        gap: 24px;
    }

    .search-subjects .subject-card {
        width: 100%;
        max-width: 100%;
        min-width: 0;
        aspect-ratio: 3 / 4;
    }

    .subject-page-layout {
        grid-template-columns: 1fr;
    }

    .sidebar {
        width: 100%;
    }

    .file-item {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

    .file-info {
        width: 100%;
    }

    .file-actions {
        flex-direction: row;
        justify-content: space-between;
        width: 100%;
        gap: 8px;
    }

    .file-action--view,
    .file-action--download {
        flex: 1;
        min-height: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .file-favorite {
        flex: 0 0 auto;
        min-width: 44px;
        min-height: 44px;
    }

    .file-badge {
        flex: 0 0 auto;
        margin-left: 0;
    }
}

/* About page */

.about-page {
  max-width: 720px;
  margin: 0 auto;
  padding: 80px 0 120px;
}

.about-header {
  margin-bottom: 72px;
}

.about-eyebrow {
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.35em;
  text-transform: uppercase;
  color: var(--accent-1);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.about-eyebrow::before {
  content: '';
  width: 24px;
  height: 1px;
  background: var(--accent-1);
}

.about-title {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(48px, 6vw, 72px);
  line-height: 1;
  letter-spacing: -0.015em;
  color: var(--text);
}

.about-title em {
  font-style: italic;
  font-weight: 400;
  color: var(--accent-1);
}

.about-section {
  margin-bottom: 56px;
}

.about-section-title {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 28px;
  letter-spacing: -0.01em;
  color: var(--text);
  margin-bottom: 20px;
}

.about-section p {
  font-family: var(--serif);
  font-size: 19px;
  line-height: 1.6;
  color: var(--text);
  margin-bottom: 16px;
}

.about-section p:last-child {
  margin-bottom: 0;
}

.about-lead {
  font-family: var(--serif) !important;
  font-style: italic;
  font-size: 24px !important;
  color: var(--accent-1) !important;
  margin-bottom: 24px !important;
  line-height: 1.4 !important;
}

.about-link {
  color: var(--accent-1);
  text-decoration: none;
  border-bottom: 1px solid var(--accent-1);
  padding-bottom: 1px;
  transition: opacity 0.15s;
}

.about-link:hover {
  opacity: 0.7;
}

.about-disclaimer {
  margin-top: 80px;
  padding-top: 32px;
  border-top: 1px solid var(--divider);
}

.about-disclaimer p {
  font-family: var(--sans);
  font-size: 13px;
  line-height: 1.6;
  color: var(--accent-2);
  font-style: italic;
}

@media (prefers-reduced-motion: no-preference) {
    ::view-transition-old(root) {
        animation: none;
    }
    ::view-transition-new(root) {
        animation: reveal-circle 1.15s cubic-bezier(0.25, 0.6, 0.3, 1);
        z-index: 2;
    }
    @keyframes reveal-circle {
        from {
            clip-path: circle(0 at var(--reveal-x) var(--reveal-y));
        }
        to {
            clip-path: circle(var(--reveal-r) at var(--reveal-x) var(--reveal-y));
        }
    }
}

.theme-switching body {
    transition: none;
}
