/*
Theme Name: Health Marginalia
Description: Dark single-topic tech notes theme (EN/RU): cover slider, list of notes with author sidebar, About me and Contact me templates.
Version: 1.0.0
Requires at least: 6.0
Requires PHP: 7.4
License: GPLv2 or later
Text Domain: healthmarginalia
*/

:root {
	--bg: #111111;
	--bg-2: #181818;
	--panel: #1d1d1d;
	--line: #2c2c2c;
	--fg: #ece7e1;
	--fg-2: #a8a29a;
	--amber: #ff8a1f;
	--amber-2: #ffb35e;
	--sans: 'Golos Text', 'Segoe UI', Arial, sans-serif;
	--mono: 'JetBrains Mono', Consolas, monospace;
}

*, *::before, *::after { box-sizing: border-box; }
html { color-scheme: dark; }
body { margin: 0; min-height: 100vh; display: flex; flex-direction: column; background: var(--bg); color: var(--fg); font: 400 17px/1.7 var(--sans); }
.hm-main { flex: 1; }
img { max-width: 100%; height: auto; display: block; }
a { color: var(--amber); }
a:hover { color: var(--amber-2); }
h1, h2, h3 { font-weight: 700; line-height: 1.2; letter-spacing: -.015em; margin: 0 0 .5em; color: #fff; }
p { margin: 0 0 1em; }
.screen-reader-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.hm-mono { font-family: var(--mono); font-size: 13px; letter-spacing: .02em; color: var(--amber); }
.hm-mono a { color: inherit; text-decoration: none; }

.hm-shell { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 24px; }
.hm-narrow { max-width: 780px; }
.hm-pad { padding-top: 40px; padding-bottom: 60px; }

.hm-cta { display: inline-block; padding: 13px 24px; border: 1px solid var(--amber); border-radius: 4px; background: var(--amber); color: #140b02; font: 600 15px/1 var(--sans); text-decoration: none; cursor: pointer; }
.hm-cta:hover { background: var(--amber-2); border-color: var(--amber-2); color: #140b02; }
.hm-cta--line { background: transparent; color: var(--amber); }
.hm-cta--line:hover { background: rgba(255, 138, 31, .1); color: var(--amber-2); }
.hm-more { font: 500 14px/1 var(--mono); text-decoration: none; }
.hm-more::after { content: " ->"; }
.hm-links-row { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 32px; }

/* Header */
.hm-head { background: rgba(17, 17, 17, .92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 50; }
.hm-head__line { display: flex; align-items: center; gap: 20px; min-height: 68px; }
.hm-id { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--fg); }
.hm-id span { font: 500 19px/1 var(--sans); letter-spacing: -.01em; }
.hm-id b { font-weight: 700; color: var(--amber); }
.hm-id img { border-radius: 8px; }
.hm-nav { margin-left: auto; display: flex; align-items: center; gap: 20px; }
.hm-menu { display: flex; gap: 2px; list-style: none; margin: 0; padding: 0; }
.hm-menu a { display: block; padding: 9px 13px; color: var(--fg-2); font-size: 15px; font-weight: 500; text-decoration: none; border-radius: 4px; }
.hm-menu a:hover { color: #fff; background: var(--panel); }
.hm-menu a.is-current, .hm-menu .current-menu-item a { color: var(--amber); }
.hm-lang { display: flex; border: 1px solid var(--line); border-radius: 4px; overflow: hidden; }
.hm-lang a { padding: 6px 10px; font: 500 12px/1 var(--mono); color: var(--fg-2); text-decoration: none; }
.hm-lang a[aria-current] { background: var(--amber); color: #140b02; }
.hm-toggle { display: none; margin-left: auto; width: 42px; height: 42px; border: 1px solid var(--line); border-radius: 4px; background: var(--panel); cursor: pointer; position: relative; }
.hm-toggle span:first-child, .hm-toggle span:first-child::before, .hm-toggle span:first-child::after { position: absolute; left: 11px; width: 18px; height: 2px; background: var(--fg); content: ""; transition: transform .2s; }
.hm-toggle span:first-child { top: 19px; }
.hm-toggle span:first-child::before { left: 0; top: -6px; }
.hm-toggle span:first-child::after { left: 0; top: 6px; }

/* Cover slider */
.hm-cover { position: relative; overflow: hidden; border-bottom: 1px solid var(--line); }
.hm-cover__frame { position: absolute; inset: 0; background: var(--img) center / cover no-repeat; opacity: 0; transition: opacity 1.1s; }
.hm-cover__frame.is-on { opacity: 1; }
.hm-cover::after { content: ""; position: absolute; inset: 0; background: linear-gradient(0deg, rgba(17, 17, 17, .95) 0%, rgba(17, 17, 17, .25) 55%, rgba(17, 17, 17, .1) 100%); }
.hm-cover__inner { position: relative; z-index: 2; min-height: clamp(420px, 42vw, 580px); display: flex; align-items: flex-end; padding-bottom: 44px; }
.hm-cover__box { max-width: 620px; padding: 26px 28px; border-left: 3px solid var(--amber); background: rgba(17, 17, 17, .7); backdrop-filter: blur(6px); }
.hm-cover__box h1 { font-size: clamp(28px, 3.4vw, 44px); margin-bottom: 12px; }
.hm-cover__box p { color: #d6d0c8; }
.hm-cover__kicker { margin-bottom: 10px !important; }
.hm-cover__bars { position: absolute; z-index: 3; right: 24px; bottom: 20px; display: flex; gap: 6px; }
.hm-cover__bars i { width: 22px; height: 3px; background: rgba(255, 255, 255, .3); }
.hm-cover__bars i.is-on { background: var(--amber); }

/* Band (inner page titles) */
.hm-band { padding: 42px 0 34px; border-bottom: 1px solid var(--line); background: linear-gradient(90deg, rgba(255, 138, 31, .08), transparent 60%), var(--bg-2); }
.hm-band h1 { margin: 6px 0 0; font-size: clamp(28px, 3.4vw, 42px); }
.hm-band .hm-mono { margin: 0; }

/* Two columns */
.hm-split { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 48px; padding-top: 44px; padding-bottom: 64px; align-items: start; }
.hm-list__head { font-size: 15px; font-family: var(--mono); font-weight: 500; color: var(--fg-2); letter-spacing: .04em; text-transform: uppercase; padding-bottom: 14px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.hm-row { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 24px; padding: 24px 0; border-bottom: 1px solid var(--line); }
.hm-row__media { display: block; aspect-ratio: 3 / 2; border-radius: 6px; overflow: hidden; background: var(--panel); }
.hm-row__media img { width: 100%; height: 100%; object-fit: cover; transition: transform .3s; }
.hm-row:hover .hm-row__media img { transform: scale(1.04); }
.hm-row__ph { display: grid; place-items: center; height: 100%; background: radial-gradient(circle at 70% 30%, rgba(255, 138, 31, .25), transparent 60%), var(--panel); }
.hm-row__ph img { width: 56px; height: 56px; }
.hm-row:hover .hm-row__ph img { transform: none; }
.hm-row__meta { margin: 0 0 6px !important; color: var(--fg-2); }
.hm-row__title { font-size: 21px; margin-bottom: 8px; }
.hm-row__title a { color: #fff; text-decoration: none; }
.hm-row__title a:hover { color: var(--amber); }
.hm-row__text { margin: 0; color: var(--fg-2); font-size: 15.5px; }
.hm-none { color: var(--fg-2); padding: 24px 0; }

.pagination { margin-top: 34px; }
.pagination .nav-links { display: flex; gap: 6px; }
.pagination .page-numbers { min-width: 40px; height: 40px; display: inline-grid; place-items: center; padding: 0 10px; border: 1px solid var(--line); border-radius: 4px; color: var(--fg); text-decoration: none; font: 500 14px/1 var(--mono); }
.pagination .current { background: var(--amber); border-color: var(--amber); color: #140b02; }

/* Sidebar & author */
.hm-side { display: grid; gap: 24px; }
.hm-side--sticky { position: sticky; top: 92px; }
.hm-me { padding: 22px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); }
.hm-me__photo { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 6px; margin-bottom: 18px; filter: saturate(1.05); }
.hm-me__tag { margin: 0 0 4px !important; }
.hm-me__name { font-size: 22px; margin-bottom: 2px; }
.hm-me__line { color: var(--fg-2); font-size: 14px; }
.hm-me__text > p:not(.hm-me__tag):not(.hm-me__line) { font-size: 15px; color: #d2ccc4; }
.hm-me--wide { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 36px; align-items: center; padding: 32px; }
.hm-me--wide .hm-me__photo { margin: 0; }
.hm-me--wide .hm-me__name { font-size: 30px; }
.hm-me--wide .hm-me__text > p:not(.hm-me__tag):not(.hm-me__line) { font-size: 18px; }

.hm-search { display: flex; align-items: center; gap: 8px; padding: 6px 6px 6px 14px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg-2); }
.hm-search input { flex: 1; min-width: 0; padding: 8px 0; border: 0; background: transparent; color: var(--fg); font: inherit; outline: none; }
.hm-search button { padding: 9px 14px; border: 0; border-radius: 4px; background: var(--amber); color: #140b02; font-weight: 600; cursor: pointer; }

/* Post body */
.hm-post__img img { width: 100%; border-radius: 8px; margin-bottom: 26px; }
.hm-copy { font-size: 18px; color: #ddd7cf; }
.hm-copy h2 { font-size: 26px; margin-top: 1.6em; }
.hm-copy h3 { font-size: 21px; margin-top: 1.4em; }
.hm-copy ul, .hm-copy ol { padding-left: 1.3em; }
.hm-copy li::marker { color: var(--amber); }
.hm-copy blockquote { margin: 1.5em 0; padding: 4px 0 4px 20px; border-left: 3px solid var(--amber); color: #fff; font-size: 19px; }
.hm-copy code { padding: .15em .4em; border-radius: 4px; background: #262626; font: .88em var(--mono); color: var(--amber-2); }
.hm-copy pre { padding: 18px; border: 1px solid var(--line); border-radius: 6px; background: #0b0b0b; overflow-x: auto; }
.hm-copy pre code { background: none; padding: 0; color: #e6e0d8; }
.hm-copy table { width: 100%; border-collapse: collapse; display: block; overflow-x: auto; font-size: 16px; }
.hm-copy th, .hm-copy td { padding: 10px; border-bottom: 1px solid var(--line); text-align: left; }
.post-navigation .nav-links { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 36px; }
.post-navigation a { display: block; height: 100%; padding: 14px 16px; border: 1px solid var(--line); border-radius: 6px; color: #fff; text-decoration: none; font-weight: 600; }
.post-navigation a:hover { border-color: var(--amber); }
.post-navigation .hm-mono { display: block; margin-bottom: 6px; }
.post-navigation .nav-next { text-align: right; }
.hm-comments { margin-top: 40px; }
.hm-comments input[type="text"], .hm-comments input[type="email"], .hm-comments input[type="url"], .hm-comments textarea { width: 100%; padding: 11px 13px; border: 1px solid var(--line); border-radius: 4px; background: var(--bg-2); color: var(--fg); font: inherit; }
.hm-comments .submit { padding: 12px 22px; border: 0; border-radius: 4px; background: var(--amber); color: #140b02; font-weight: 600; cursor: pointer; }

/* Forms */
.hm-lead { font-size: 18px; color: #d2ccc4; }
.hm-form { display: grid; gap: 16px; padding: 26px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); }
.hm-form label { display: grid; gap: 6px; font: 500 13px/1 var(--mono); color: var(--fg-2); text-transform: uppercase; letter-spacing: .05em; }
.hm-form input, .hm-form textarea { padding: 12px 14px; border: 1px solid var(--line); border-radius: 4px; background: var(--bg); color: var(--fg); font: 400 16px/1.5 var(--sans); text-transform: none; letter-spacing: 0; }
.hm-form input:focus, .hm-form textarea:focus { outline: none; border-color: var(--amber); }
.hm-form .hm-cta { justify-self: start; }
.hm-trap { position: absolute; left: -9999px; }
.hm-alert { padding: 12px 16px; border-radius: 4px; font-weight: 500; }
.hm-alert--ok { background: rgba(76, 175, 80, .15); color: #9be09e; }
.hm-alert--bad { background: rgba(255, 82, 82, .14); color: #ff9c8f; }
.hm-404 { text-align: center; }
.hm-404 .hm-search { max-width: 440px; margin: 20px auto; }

/* Footer */
.hm-foot { border-top: 1px solid var(--line); background: var(--bg-2); color: var(--fg-2); }
.hm-foot__line { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 18px; padding-top: 30px; padding-bottom: 22px; }
.hm-foot__small { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px; padding-top: 14px; padding-bottom: 22px; border-top: 1px solid var(--line); font-size: 13px; }

/* Responsive */
@media (max-width: 980px) {
	.hm-toggle { display: block; }
	.hm-head__line { flex-wrap: wrap; }
	.hm-nav { display: none; width: 100%; margin: 0; padding-bottom: 16px; flex-direction: column; align-items: flex-start; }
	.hm-nav.is-open { display: flex; }
	.hm-nav nav, .hm-nav .hm-menu { width: 100%; }
	.hm-nav .hm-menu { flex-direction: column; }
	.hm-nav .hm-menu a { padding: 12px 4px; border-bottom: 1px solid var(--line); border-radius: 0; }
	.hm-toggle.is-open span:first-child { background: transparent; }
	.hm-toggle.is-open span:first-child::before { transform: translateY(6px) rotate(45deg); }
	.hm-toggle.is-open span:first-child::after { transform: translateY(-6px) rotate(-45deg); }
	.hm-split { grid-template-columns: 1fr; }
	.hm-side { grid-template-columns: 1fr 1fr; align-items: start; }
	.hm-side--sticky { position: static; grid-template-columns: 1fr; }
	.hm-me--wide { grid-template-columns: 240px minmax(0, 1fr); }
}

@media (max-width: 640px) {
	body { font-size: 16px; }
	.hm-shell { padding: 0 16px; }
	.hm-id span { font-size: 17px; }
	.hm-cover__inner { min-height: 540px; padding-bottom: 20px; }
	.hm-split { padding-top: 32px; gap: 32px; }
	.hm-cover__box { padding: 20px; }
	.hm-cover__frame { background-position: 62% center; }
	.hm-row { grid-template-columns: 1fr; gap: 14px; }
	.hm-row__media { aspect-ratio: 16 / 9; }
	.hm-side { grid-template-columns: 1fr; }
	.hm-me--wide { grid-template-columns: 1fr; padding: 20px; }
	.hm-me--wide .hm-me__name { font-size: 24px; }
	.hm-form { padding: 18px; }
	.post-navigation .nav-links { grid-template-columns: 1fr; }
	.post-navigation .nav-next { text-align: left; }
	.hm-foot__line { flex-direction: column; align-items: flex-start; }
	.hm-foot .hm-menu { flex-wrap: wrap; }
}
