@charset "UTF-8";

/* hema2 — refined clinical design, burgundy accent */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
    --accent:        #9f1239;
    --accent-hover:  #7c0a2e;
    --accent-soft:   #fef2f2;
    --accent-tint:   #fff5f6;
    --accent-border: #fecdd3;
    --accent-grad:   linear-gradient(135deg, #9f1239 0%, #7c0a2e 100%);

    --text:        #0b0f1a;
    --text-soft:   #2c3340;
    --text-muted:  #5c6675;
    --text-faint:  #8b94a3;

    --bg:          #ffffff;
    --bg-subtle:   #fafbfc;
    --bg-muted:    #f3f5f8;
    --bg-card:     #ffffff;

    --border:        #e5e7eb;
    --border-soft:   #eef0f3;
    --border-strong: #cbd2dc;

    --radius:    10px;
    --radius-lg: 16px;
    --radius-xl: 24px;

    --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.04);
    --shadow-sm: 0 2px 4px rgba(15, 23, 42, 0.05);
    --shadow:    0 4px 12px rgba(15, 23, 42, 0.05), 0 1px 3px rgba(15, 23, 42, 0.04);
    --shadow-lg: 0 12px 28px rgba(15, 23, 42, 0.08), 0 4px 8px rgba(15, 23, 42, 0.04);

    --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
            "Helvetica Neue", Arial, "Noto Sans", sans-serif,
            "Apple Color Emoji", "Segoe UI Emoji";

    --transition: 0.18s cubic-bezier(0.4, 0, 0.2, 1);
}

* { box-sizing: border-box; }
html {
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}
body {
    margin: 0;
    background: var(--bg-subtle);
    color: var(--text);
    font-family: var(--font);
    font-feature-settings: "cv02", "cv03", "cv04", "cv11";  /* Inter stylistic tweaks */
    font-size: 16px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}
img { max-width: 100%; height: auto; }
a { color: var(--accent); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--accent-hover); text-decoration: underline; }
h1, h2, h3, h4 { letter-spacing: -0.015em; }

/* --- header --- */
.site-header {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: saturate(180%) blur(12px);
    -webkit-backdrop-filter: saturate(180%) blur(12px);
    border-bottom: 1px solid var(--border-soft);
    position: sticky; top: 0;
    z-index: 20;
}
.site-header__inner {
    max-width: 1280px;
    margin: 0 auto;
    padding: 14px 28px;
    display: flex;
    align-items: center;
    gap: 32px;
}
.site-brand {
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
    transition: opacity var(--transition);
}
.site-brand:hover { text-decoration: none; opacity: 0.85; }
.site-brand__logo {
    display: block;
    height: 88px;
    width: auto;
    max-width: none;
}
@media (max-width: 600px) {
    .site-header__inner { padding: 10px 16px; }
    .site-brand__logo { height: 52px; }
}
.site-nav {
    display: flex;
    align-items: center;
    gap: 2px;
    margin-left: auto;
}
.site-nav a {
    color: var(--text-soft);
    font-weight: 500;
    font-size: 14px;
    padding: 8px 14px;
    border-radius: 8px;
    transition: background var(--transition), color var(--transition);
}
.site-nav a:hover {
    color: var(--text);
    background: var(--bg-muted);
    text-decoration: none;
}
.site-nav .nav-cta {
    color: #fff;
    background: var(--accent-grad);
    margin-left: 10px;
    box-shadow: 0 1px 2px rgba(159, 18, 57, 0.25);
    font-weight: 600;
}
.site-nav .nav-cta:hover {
    color: #fff;
    background: var(--accent-hover);
    box-shadow: 0 2px 6px rgba(159, 18, 57, 0.35);
    transform: translateY(-1px);
}

/* --- layout: flexbox 3-column with `order` --- */
.layout {
    max-width: 1280px;
    margin: 40px auto 64px;
    padding: 0 28px;
    display: flex;
    gap: 32px;
    align-items: flex-start;
}
.layout .content       { order: 2; flex: 1 1 0;    min-width: 0; }
.layout .sidebar-left  { order: 1; flex: 0 0 240px; min-width: 0; }
.layout .sidebar-right { order: 3; flex: 0 0 240px; min-width: 0; }

.layout--full .content       { flex: 1 1 auto; }
.layout--full .sidebar-left,
.layout--full .sidebar-right { display: none; }
.layout--full                { max-width: 1180px; }

.layout--no-right .sidebar-right { display: none; }
.layout--no-right                { max-width: 1180px; }

/* 900–1099px: narrower panels (200px). */
@media (max-width: 1099px) {
    .layout .sidebar-left,
    .layout .sidebar-right { flex-basis: 200px; }
    .layout { gap: 24px; padding: 0 16px; }
}

/* 720–899px: even narrower panels (180px). */
@media (max-width: 899px) {
    .layout .sidebar-left,
    .layout .sidebar-right { flex-basis: 180px; }
    .layout { gap: 16px; padding: 0 12px; }
    .sidebox { padding: 14px 14px; }
    .sidebox h3 { font-size: 10px; }
    .sidebox li a { font-size: 13px; }
}

/* Below ~720px: stack content on top, then sidebars. */
@media (max-width: 720px) {
    .layout {
        flex-direction: column;
        gap: 20px;
        padding: 0 16px;
        margin-top: 20px;
    }
    .layout .content       { order: 1; flex: 1 1 auto; }
    .layout .sidebar-left  { order: 2; flex: 1 1 auto; }
    .layout .sidebar-right { order: 3; flex: 1 1 auto; }
    .site-header__inner { padding: 10px 16px; gap: 12px; }
    .site-nav a { padding: 6px 8px; font-size: 13px; }
}

/* --- article card --- */
.article-card {
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-lg);
    padding: 28px 32px;
    background: var(--bg-card);
    margin-bottom: 18px;
    box-shadow: var(--shadow-xs);
    transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition);
}
.article-card:hover {
    border-color: var(--border);
    box-shadow: var(--shadow);
    transform: translateY(-1px);
}
.article-card__title {
    margin: 0 0 12px;
    font-size: 22px;
    line-height: 1.3;
    font-weight: 700;
    letter-spacing: -0.015em;
}
.article-card__title a { color: var(--text); transition: color var(--transition); }
.article-card__title a:hover { color: var(--accent); text-decoration: none; }
@media (max-width: 720px) {
    .article-card { padding: 22px 22px; }
    .article-card__title { font-size: 19px; }
}

.meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 16px;
}
.meta .sep { color: var(--text-faint); }
.chip {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    background: var(--accent-soft);
    color: var(--accent);
    border-radius: 100px;
    font-size: 12px;
    font-weight: 600;
    border: 1px solid var(--accent-border);
    line-height: 1.5;
    letter-spacing: 0;
    transition: background var(--transition), color var(--transition), transform var(--transition);
}
a.chip:hover {
    background: var(--accent);
    color: #fff;
    text-decoration: none;
    border-color: var(--accent);
    transform: translateY(-1px);
}

.prose {
    color: var(--text-soft);
    font-size: 15.5px;
    line-height: 1.65;
}
.prose img { border-radius: var(--radius); margin: 8px 0; box-shadow: var(--shadow-xs); }
.prose a { color: var(--accent); }
.prose a:hover { color: var(--accent-hover); }
.prose p { margin: 0 0 12px; }
.prose ul, .prose ol { padding-left: 22px; margin: 0 0 12px; }
.prose b, .prose strong { color: var(--text); font-weight: 600; }
.prose table { border-collapse: collapse; }
.prose table td, .prose table th { padding: 6px 10px; }

.read-more {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 14px;
    color: var(--accent);
    font-weight: 600;
    font-size: 14px;
}
.read-more::after { content: "→"; transition: transform var(--transition); }
.read-more:hover { text-decoration: none; color: var(--accent-hover); }
.read-more:hover::after { transform: translateX(3px); }

/* --- article detail --- */
.article-detail {
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-lg);
    padding: 44px 48px;
    background: var(--bg-card);
    box-shadow: var(--shadow-sm);
}
.article-detail h1 {
    margin: 0 0 16px;
    font-size: 34px;
    line-height: 1.2;
    font-weight: 700;
    letter-spacing: -0.025em;
    color: var(--text);
}
.article-detail .prose { font-size: 16.5px; line-height: 1.7; }
@media (max-width: 600px) {
    .article-detail { padding: 26px 22px; }
    .article-detail h1 { font-size: 24px; }
}

/* --- sidebar --- */
.sidebar { display: flex; flex-direction: column; gap: 16px; }

.sidebox {
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 18px 20px;
    background: var(--bg);
}
.sidebox--custom { padding: 0; overflow: hidden; }
.sidebox--custom > .sidebox__inner { padding: 18px 20px; }
.sidebox--custom .sidebox__banner {
    display: block;
    width: 100%;
    height: auto;
    border-bottom: 1px solid var(--border);
}
.sidebox--custom .sidebox__banner:hover { opacity: 0.94; }
.sidebox--custom h3 { margin-bottom: 8px; }
.sidebox--custom .sidebox__content {
    color: var(--text-soft);
    font-size: 14px;
    line-height: 1.55;
}
.sidebox--custom .sidebox__content p:first-child { margin-top: 0; }
.sidebox--custom .sidebox__content p:last-child { margin-bottom: 0; }
.sidebox--custom .sidebox__content a { color: var(--accent); }
.sidebox h3 {
    margin: 0 0 14px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    font-weight: 700;
}
.sidebox ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.sidebox li a {
    color: var(--text-soft);
    font-size: 14px;
    line-height: 1.45;
    display: flex;
    justify-content: space-between;
    gap: 8px;
    padding: 6px 8px;
    margin: 0 -8px;
    border-radius: 6px;
    transition: background var(--transition), color var(--transition);
}
.sidebox li a:hover {
    color: var(--accent);
    background: var(--accent-tint);
    text-decoration: none;
}
.sidebox li .count {
    color: var(--text-faint);
    font-size: 12px;
    font-variant-numeric: tabular-nums;
    flex-shrink: 0;
    font-weight: 500;
}

/* --- panels (generic) --- */
.panel {
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-lg);
    padding: 28px 32px;
    background: var(--bg-card);
    margin-bottom: 18px;
    box-shadow: var(--shadow-xs);
}
.panel h1 {
    margin: 0 0 10px;
    font-size: 26px;
    line-height: 1.25;
    font-weight: 700;
    letter-spacing: -0.02em;
}
.panel h2 {
    margin: 0 0 14px;
    font-size: 18px;
    font-weight: 600;
    letter-spacing: -0.01em;
}
.panel p.lead {
    margin: 0 0 18px;
    color: var(--text-muted);
    font-size: 15.5px;
    line-height: 1.6;
}
.panel--empty {
    text-align: center;
    padding: 70px 28px;
    color: var(--text-muted);
    font-size: 15px;
}

/* topic / category list pages */
.list-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 10px;
    margin: 0;
    padding: 0;
    list-style: none;
}
.list-grid li a {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    padding: 14px 18px;
    border: 1px solid var(--border-soft);
    border-radius: var(--radius);
    color: var(--text);
    font-weight: 500;
    font-size: 14px;
    background: var(--bg-card);
    transition: border-color var(--transition), background var(--transition),
                color var(--transition), transform var(--transition);
}
.list-grid li a:hover {
    border-color: var(--accent-border);
    background: var(--accent-soft);
    color: var(--accent);
    text-decoration: none;
    transform: translateY(-1px);
}
.list-grid .count {
    color: var(--text-muted);
    font-size: 12px;
    font-variant-numeric: tabular-nums;
    font-weight: 600;
}

.page-list { margin: 0; padding: 0; list-style: none; }
.page-list__cat {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    margin: 28px 0 10px;
    font-weight: 700;
}
.page-list__cat:first-child { margin-top: 0; }
.page-list__cat a { color: var(--text-muted); }
.page-list__cat a:hover { color: var(--accent); }
.page-list li { padding: 10px 0; border-bottom: 1px solid var(--border-soft); }
.page-list li:last-child { border-bottom: 0; }
.page-list li a { color: var(--text); font-weight: 500; transition: color var(--transition); }
.page-list li a:hover { color: var(--accent); text-decoration: none; }
.page-list li small { color: var(--text-muted); font-weight: 400; margin-left: 6px; font-size: 13px; }

/* --- pager --- */
.pager {
    display: flex;
    gap: 4px;
    margin: 28px 0 0;
    flex-wrap: wrap;
}
.pager a, .pager span {
    display: inline-block;
    padding: 7px 13px;
    border: 1px solid var(--border-soft);
    border-radius: 8px;
    color: var(--text-soft);
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    font-variant-numeric: tabular-nums;
    background: var(--bg-card);
    transition: all var(--transition);
}
.pager a:hover {
    border-color: var(--accent-border);
    color: var(--accent);
    background: var(--accent-soft);
    transform: translateY(-1px);
}
.pager .current {
    background: var(--accent-grad);
    color: #fff;
    border-color: transparent;
    box-shadow: 0 1px 2px rgba(159, 18, 57, 0.25);
}

/* --- footer --- */
.site-footer {
    border-top: 1px solid var(--border-soft);
    padding: 36px 24px;
    text-align: center;
    font-size: 13px;
    color: var(--text-muted);
    background: var(--bg);
    margin-top: 60px;
}

/* --- admin --- */
.admin-wrap {
    max-width: 1240px;
    margin: 0 auto;
    padding: 16px 24px 60px;
    font-size: 14px;
}
.admin-wrap h1 {
    font-size: 22px;
    color: var(--text);
    margin: 6px 0 18px;
    font-weight: 700;
    letter-spacing: -0.01em;
}
.admin-wrap h2 {
    font-size: 15px;
    margin: 22px 0 10px;
    color: var(--text-soft);
}
.admin-wrap .topbar {
    display: flex;
    align-items: center;
    gap: 4px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 6px 10px;
    margin: 8px 0 24px;
    font-size: 14px;
    flex-wrap: wrap;
}
.admin-wrap .topbar a {
    color: var(--text-soft);
    padding: 6px 12px;
    border-radius: 6px;
    font-weight: 500;
    font-size: 13px;
}
.admin-wrap .topbar a:hover {
    background: var(--bg-muted);
    color: var(--text);
    text-decoration: none;
}
.admin-wrap .topbar .spacer { margin-left: auto; color: var(--text-muted); font-size: 13px; }

.admin-wrap table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}
.admin-wrap th, .admin-wrap td {
    padding: 8px 12px;
    text-align: left;
    vertical-align: top;
    border-bottom: 1px solid var(--border-soft);
}
.admin-wrap tr:last-child th, .admin-wrap tr:last-child td { border-bottom: 0; }
.admin-wrap th {
    background: var(--bg-subtle);
    color: var(--text-muted);
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.admin-wrap input[type=text],
.admin-wrap input[type=password],
.admin-wrap input[type=datetime-local],
.admin-wrap textarea,
.admin-wrap select {
    font-family: var(--font);
    font-size: 14px;
    padding: 7px 10px;
    border: 1px solid var(--border-strong);
    border-radius: 6px;
    width: 100%;
    background: var(--bg);
    color: var(--text);
}
.admin-wrap input:focus, .admin-wrap textarea:focus, .admin-wrap select:focus {
    outline: 2px solid var(--accent-soft);
    border-color: var(--accent);
}
.admin-wrap textarea { min-height: 120px; line-height: 1.5; }
.admin-wrap .btn {
    display: inline-flex;
    align-items: center;
    padding: 8px 16px;
    background: var(--accent-grad);
    color: #fff;
    border: 0;
    cursor: pointer;
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    border-radius: 8px;
    font-family: var(--font);
    box-shadow: 0 1px 2px rgba(159, 18, 57, 0.2);
    transition: transform var(--transition), box-shadow var(--transition), background var(--transition);
}
.admin-wrap .btn:hover {
    color: #fff;
    text-decoration: none;
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(159, 18, 57, 0.3);
}
.admin-wrap .btn-secondary {
    background: var(--bg-muted);
    color: var(--text-soft);
    box-shadow: none;
}
.admin-wrap .btn-secondary:hover { background: var(--border); color: var(--text); box-shadow: none; }
.admin-wrap .btn-danger { background: linear-gradient(135deg, #b91c1c 0%, #7f1d1d 100%); }
.admin-wrap .btn-danger:hover { box-shadow: 0 3px 8px rgba(185, 28, 28, 0.3); }
.admin-wrap .actions { white-space: nowrap; }
.admin-wrap .actions a { margin-right: 8px; }
.admin-wrap .flash {
    padding: 10px 14px;
    margin-bottom: 14px;
    border: 1px solid;
    border-radius: 6px;
    font-size: 14px;
}
.admin-wrap .flash-ok  { background: #ecfdf5; border-color: #6ee7b7; color: #047857; }
.admin-wrap .flash-err { background: #fef2f2; border-color: #fecaca; color: #b91c1c; }
.admin-wrap .pager { margin: 14px 0 0; }
.admin-wrap .tiny { font-size: 12px; color: var(--text-muted); }

/* image preview in admin */
.admin-wrap .image-preview {
    display: inline-block;
    max-width: 260px;
    max-height: 200px;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 4px;
    background: var(--bg-subtle);
    margin-top: 6px;
}
.admin-wrap .image-preview img { display: block; max-width: 100%; height: auto; border-radius: 4px; }
.admin-wrap input[type=file] {
    font-family: var(--font);
    font-size: 13px;
    padding: 6px 0;
}

/* login screen */
.admin-login {
    max-width: 380px;
    margin: 80px auto;
    padding: 32px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--bg);
    box-shadow: var(--shadow);
}
.admin-login h1 {
    margin: 0 0 20px;
    font-size: 20px;
}
.admin-login .btn { width: 100%; justify-content: center; padding: 10px; font-size: 14px; }
