/*
Theme Name: ptosnm
Description: Научпоп о материалах — «лабораторный журнал»: бумага в клетку, листы, моно-метки, рубрики-клетки.
Version: 1.0.0
Author: ptosnm.ru
Text Domain: ptosnm
Requires PHP: 8.0
*/

:root {
	--paper: #f5f6f2;
	--grid: #e3e8ec;
	--sheet: #ffffff;
	--ink: #16191d;
	--text: #272b30;
	--muted: #5f666e;
	--line: #d9dde1;
	--acc: #3538a8;
	--acc-ink: #282b8c;
	--acc-soft: #ecedf9;
	--cu: #a8522b;
	--cu-soft: #f7ece5;
	--serif: "Source Serif 4", Georgia, "Times New Roman", serif;
	--head: "Inter Tight", "Helvetica Neue", Arial, sans-serif;
	--mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 16px; }
body {
	margin: 0;
	background-color: var(--paper);
	background-image: linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px);
	background-size: 24px 24px;
	color: var(--text);
	font: 400 18px/1.65 var(--serif);
	overflow-x: hidden;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--acc); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { color: var(--acc-ink); }
h1, h2, h3, h4 { font-family: var(--head); color: var(--ink); line-height: 1.2; letter-spacing: -.01em; }
.pt-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.pt-skip { position: absolute; left: -999px; top: 8px; background: var(--ink); color: #fff; padding: 6px 12px; z-index: 10; font: 14px var(--mono); }
.pt-skip:focus { left: 8px; }

.pt-wrap { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 16px; }
.pt-label { margin: 0; font: 600 12px/1.4 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.pt-sheet { background: var(--sheet); border: 1px solid var(--line); border-radius: 2px; box-shadow: 0 1px 0 rgba(22, 25, 29, .04); }

/* ---------- Клетка-элемент ---------- */
.pt-cell {
	position: relative; display: inline-flex; align-items: center; justify-content: center; flex: none;
	width: 44px; height: 44px; border: 1.5px solid var(--ink); background: #fff;
	font: 700 19px/1 var(--head); color: var(--ink);
}
.pt-cell i { position: absolute; top: 3px; left: 4px; font: 400 9px/1 var(--mono); font-style: normal; color: var(--acc); }
.pt-cell--logo { background: var(--ink); color: #fff; border-color: var(--ink); }
.pt-cell--logo i { color: #b9bcf2; }
.pt-cell--sm { width: 30px; height: 30px; font-size: 13px; border-width: 1px; }
.pt-cell--sm i { font-size: 7px; top: 2px; left: 2px; }
.pt-cell--lg { width: 76px; height: 76px; font-size: 32px; border-width: 2px; }
.pt-cell--lg i { font-size: 12px; top: 5px; left: 6px; }

/* ---------- Шапка ---------- */
.pt-head { background: var(--sheet); border-bottom: 1px solid var(--ink); box-shadow: 0 3px 0 -1px var(--sheet), 0 4px 0 -1px var(--ink); margin-bottom: 4px; }
.pt-head__row { display: flex; flex-direction: column; gap: 10px; padding-top: 12px; padding-bottom: 8px; }
.pt-brand { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; color: var(--ink); }
.pt-brand__txt { display: flex; flex-direction: column; }
.pt-brand__txt b { font: 700 20px/1.1 var(--head); letter-spacing: .02em; }
.pt-brand__txt small { font: 400 12px/1.4 var(--mono); color: var(--muted); }
.pt-nav { margin: 0 -16px; overflow-x: auto; scrollbar-width: none; }
.pt-nav::-webkit-scrollbar { display: none; }
.pt-nav__list { list-style: none; margin: 0; padding: 0 16px; display: flex; gap: 4px; white-space: nowrap; }
.pt-nav__list a { display: block; padding: 6px 10px; font: 600 12px/1.3 var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--ink); text-decoration: none; border: 1px solid transparent; }
.pt-nav__list a:hover, .pt-nav__list .current-menu-item > a { border-color: var(--ink); }

/* ---------- Блоки ---------- */
.pt-main { padding-bottom: 40px; }
.pt-block { margin-top: 28px; }
.pt-block__head { display: flex; align-items: baseline; gap: 12px; margin: 0 0 10px; }
.pt-block__head h1, .pt-block__head h2 { margin: 0; font-size: 22px; }
.pt-more { display: inline-block; margin-top: 10px; font: 600 13px var(--mono); text-decoration: none; }

/* Интро */
.pt-intro { margin-top: 20px; }
.pt-intro__sheet { padding: 22px 18px; display: grid; gap: 22px; }
.pt-intro__h1 { font-size: 28px; margin: 8px 0 12px; letter-spacing: -.02em; }
.pt-intro__lead { margin: 0 0 16px; color: var(--text); }
.pt-find { display: flex; border: 1.5px solid var(--ink); background: #fff; }
.pt-find input { flex: 1; min-width: 0; border: 0; padding: 10px 12px; font: 16px var(--mono); color: var(--ink); background: transparent; }
.pt-find input:focus { outline: 2px solid var(--acc); outline-offset: -2px; }
.pt-find button { border: 0; background: var(--ink); color: #fff; font: 600 13px var(--mono); padding: 0 16px; cursor: pointer; }
.pt-find button:hover { background: var(--acc); }

/* «Таблица» рубрик */
.pt-table { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0; border-top: 1.5px solid var(--ink); border-left: 1.5px solid var(--ink); align-self: start; }
.pt-table__el {
	position: relative; display: flex; flex-direction: column; min-height: 118px; padding: 22px 10px 10px;
	border-right: 1.5px solid var(--ink); border-bottom: 1.5px solid var(--ink);
	color: var(--ink); text-decoration: none; background: #fff; transition: background .15s;
}
.pt-table__el:hover { background: var(--acc-soft); color: var(--ink); }
.pt-table__el i { position: absolute; top: 6px; left: 8px; font: 400 11px var(--mono); font-style: normal; color: var(--acc); }
.pt-table__el b { font: 700 34px/1 var(--head); }
.pt-table__el span { margin-top: 8px; font: 600 14px/1.25 var(--head); }
.pt-table__el small { margin-top: auto; padding-top: 6px; font: 400 11px var(--mono); color: var(--muted); }
.pt-table__el:first-child { background: var(--ink); color: #fff; }
.pt-table__el:first-child i { color: #b9bcf2; }
.pt-table__el:first-child small { color: #b8bcc2; }
.pt-table__el:first-child:hover { background: var(--acc-ink); }

/* Журнал: строки */
.pt-log { padding: 0 16px; }
.pt-entry { display: grid; grid-template-columns: minmax(0, 1fr) 88px; grid-template-areas: "meta meta" "text img"; gap: 6px 14px; padding: 16px 0; border-bottom: 1px dashed var(--line); }
.pt-entry:last-child { border-bottom: 0; }
.pt-entry__meta { grid-area: meta; display: flex; flex-wrap: wrap; gap: 4px 12px; font: 400 12px/1.4 var(--mono); color: var(--muted); }
.pt-entry__no { color: var(--cu); font-weight: 600; }
.pt-entry__cat { color: var(--acc); text-decoration: none; }
.pt-entry__text { grid-area: text; min-width: 0; }
.pt-entry__title { margin: 0 0 4px; font-size: 18px; line-height: 1.3; }
.pt-entry__title a { color: var(--ink); text-decoration: none; }
.pt-entry__title a:hover { color: var(--acc); }
.pt-entry__text p { margin: 0; font-size: 16px; line-height: 1.5; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.pt-entry__img { grid-area: img; display: block; aspect-ratio: 1; overflow: hidden; border: 1px solid var(--line); background: var(--paper); }
.pt-entry__img img { width: 100%; height: 100%; object-fit: cover; filter: saturate(.85); }

/* Заглушка: решётка графена */
.pt-lattice {
	position: relative; display: flex; align-items: center; justify-content: center; width: 100%; height: 100%;
	background-color: #fff;
	background-image:
		radial-gradient(circle at 50% 50%, var(--acc) 1.6px, transparent 2.2px),
		linear-gradient(30deg, transparent 47%, #c9cdf0 48%, #c9cdf0 52%, transparent 53%),
		linear-gradient(150deg, transparent 47%, #c9cdf0 48%, #c9cdf0 52%, transparent 53%),
		linear-gradient(90deg, transparent 48%, #c9cdf0 49%, #c9cdf0 51%, transparent 52%);
	background-size: 20px 34.6px;
}
.pt-lattice b { background: #fff; border: 1.5px solid var(--ink); padding: 4px 8px; font: 700 18px/1 var(--head); color: var(--ink); }

/* Рекорды и Нобелевки */
.pt-twin { display: grid; gap: 28px; }
.pt-records { display: grid; gap: 8px; }
.pt-record { display: flex; flex-direction: column; gap: 4px; padding: 14px 16px; border-left: 4px solid var(--cu); color: var(--ink); text-decoration: none; }
.pt-record b { font: 700 17px/1.3 var(--head); }
.pt-record:hover b { color: var(--acc); }
.pt-nobel { list-style: none; margin: 0; padding: 6px 16px; }
.pt-nobel li { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 12px; align-items: baseline; padding: 12px 0; border-bottom: 1px dashed var(--line); }
.pt-nobel li:last-child { border-bottom: 0; }
.pt-nobel__y { font: 600 18px var(--mono); color: var(--acc); }
.pt-nobel a { font: 600 16px/1.35 var(--head); color: var(--ink); text-decoration: none; }
.pt-nobel a:hover { color: var(--acc); }

/* Картотека */
.pt-files { display: grid; gap: 14px; }
.pt-file { padding: 16px; }
.pt-file__head { display: flex; gap: 12px; align-items: center; text-decoration: none; color: var(--ink); padding-bottom: 12px; border-bottom: 1px solid var(--ink); }
.pt-file__head b { display: block; font: 700 17px/1.25 var(--head); }
.pt-file__head small { display: block; font: 400 12px/1.4 var(--mono); color: var(--muted); }
.pt-file__list { margin: 10px 0 0; padding: 0; list-style: none; counter-reset: f; }
.pt-file__list li { counter-increment: f; position: relative; padding: 7px 0 7px 30px; border-bottom: 1px dashed var(--line); font-size: 16px; line-height: 1.4; }
.pt-file__list li::before { content: counter(f, decimal-leading-zero); position: absolute; left: 0; top: 9px; font: 400 12px var(--mono); color: var(--cu); }
.pt-file__list a { color: var(--ink); text-decoration: none; }
.pt-file__list a:hover { color: var(--acc); text-decoration: underline; }

/* Архив */
.pt-arch { display: flex; gap: 16px; align-items: flex-start; padding: 20px 16px; margin-bottom: 14px; }
.pt-arch__title { margin: 4px 0 6px; font-size: 26px; }
.pt-arch__desc { color: var(--muted); font-size: 16px; }
.pt-arch__desc p { margin: 0; }
.pt-arch--find > div { flex: 1; }
.pt-arch--find .pt-find { margin-top: 12px; max-width: 520px; }
.pt-empty { padding: 20px 16px; }
.pt-slot { margin-top: 24px; }

/* Пагинация */
.pagination { margin-top: 16px; }
.pagination .nav-links { display: flex; flex-wrap: wrap; gap: 6px; }
.pagination .page-numbers { display: inline-block; min-width: 38px; padding: 7px 10px; text-align: center; background: #fff; border: 1px solid var(--ink); font: 600 13px var(--mono); color: var(--ink); text-decoration: none; }
.pagination .page-numbers.current { background: var(--ink); color: #fff; }

/* ---------- Статья ---------- */
.pt-article { padding: 20px 16px 24px; }
.pt-article__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; font: 400 12px/1.4 var(--mono); color: var(--muted); padding-bottom: 12px; border-bottom: 1px solid var(--ink); }
.pt-article__cat { display: inline-flex; align-items: center; gap: 8px; color: var(--ink); text-decoration: none; font-weight: 600; }
.pt-article__h1 { font-size: 30px; margin: 16px 0 10px; letter-spacing: -.02em; }
.pt-article__lead { margin: 0 0 8px; font-size: 19px; color: var(--muted); font-style: italic; }
.pt-article__fig { margin: 16px -16px 0; }
.pt-article__fig img { width: 100%; aspect-ratio: 1200 / 630; object-fit: cover; }
.pt-article__fig figcaption { padding: 6px 16px 0; font: 400 12px var(--mono); color: var(--muted); }
.pt-article__grid { display: grid; gap: 18px; margin-top: 20px; }
.pt-article--page .pt-text { max-width: 720px; }

.pt-toc details { border: 1px solid var(--ink); background: var(--paper); }
.pt-toc summary { cursor: pointer; padding: 10px 12px; font: 600 12px var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--ink); }
.pt-toc ol { list-style: none; margin: 0; padding: 0 12px 10px; }
.pt-toc li a { display: grid; grid-template-columns: 34px minmax(0, 1fr); padding: 5px 0; font: 400 14px/1.35 var(--head); color: var(--ink); text-decoration: none; border-top: 1px dashed var(--line); }
.pt-toc li a span { font: 600 12px/1.6 var(--mono); color: var(--cu); }
.pt-toc li a:hover { color: var(--acc); }

/* Текст */
.pt-text { min-width: 0; max-width: 700px; counter-reset: sec; }
.pt-text > *:first-child { margin-top: 0; }
.pt-text p, .pt-text ul, .pt-text ol { margin: 0 0 1.05em; }
.pt-text h2 { counter-increment: sec; font-size: 24px; margin: 1.8em 0 .6em; padding-top: 12px; border-top: 1px solid var(--line); }
.pt-text h2::before { content: "§" counter(sec) " "; font: 600 15px var(--mono); color: var(--cu); vertical-align: 3px; margin-right: 4px; }
.pt-text h3 { font-size: 19px; margin: 1.5em 0 .5em; }
.pt-text li { margin-bottom: .35em; }
.pt-text li::marker { color: var(--acc); }
.pt-text sub, .pt-text sup { font-size: .7em; }
.pt-text code { font: 15px var(--mono); background: var(--acc-soft); padding: 1px 5px; color: var(--acc-ink); }
.pt-text blockquote { margin: 1.4em 0; padding: 4px 0 4px 18px; border-left: 3px solid var(--cu); font-style: italic; color: var(--ink); }
.pt-text blockquote p:last-child { margin: 0; }
.pt-text figure { margin: 1.4em 0; }
.pt-text figcaption, .pt-text .wp-element-caption { margin-top: 6px; font: 400 12px/1.5 var(--mono); color: var(--muted); }
.pt-text img { border: 1px solid var(--line); }
.pt-tbl { overflow-x: auto; margin: 1.4em 0; }
.pt-text table { width: 100%; min-width: 460px; border-collapse: collapse; margin: 0; font: 400 15px/1.4 var(--head); }
.pt-text th { text-align: left; font: 600 12px var(--mono); letter-spacing: .04em; text-transform: uppercase; color: var(--ink); border-bottom: 2px solid var(--ink); padding: 8px 10px; white-space: nowrap; }
.pt-text td { border-bottom: 1px solid var(--line); padding: 8px 10px; vertical-align: top; }
.pt-text .wp-block-table { margin: 1.4em 0; overflow-x: auto; }
.pt-text .wp-block-table table { margin: 0; }

/* «Коротко: что это» */
.pt-brief { margin: 0 0 1.6em; padding: 16px; background-color: #fff; background-image: linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px); background-size: 16px 16px; border: 1.5px solid var(--ink); }
.pt-brief h2 { margin: 0 0 8px; padding: 0; border: 0; font: 600 12px var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--acc); }
.pt-brief h2::before { content: "◆ "; font-size: 12px; color: var(--acc); vertical-align: 0; }
.pt-brief p, .pt-brief li { font-size: 17px; background: rgba(255, 255, 255, .85); }
.pt-brief > :last-child { margin-bottom: 0; }

/* «Где применяют» */
.pt-uses ul { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; }
.pt-uses li { margin: 0; padding: 10px 12px 10px 14px; border: 1px solid var(--line); border-left: 3px solid var(--acc); background: var(--acc-soft); font-size: 16px; line-height: 1.45; }

/* FAQ */
.pt-faq h3 { font-size: 17px; margin: 1.2em 0 .3em; padding-left: 26px; position: relative; }
.pt-faq h3::before { content: "?"; position: absolute; left: 0; top: 0; width: 18px; height: 18px; border: 1px solid var(--ink); font: 600 12px/16px var(--mono); text-align: center; }

/* Формула и цифра */
.pt-formula { margin: 1.4em 0; padding: 16px; border: 1px solid var(--ink); background: var(--paper); text-align: center; }
.pt-formula__body { font: 400 20px/1.5 var(--mono); color: var(--ink); overflow-x: auto; }
.pt-formula figcaption { margin-top: 6px; font: 400 12px var(--mono); color: var(--muted); }
.pt-fact { display: inline-flex; flex-direction: column; margin: 0 8px 8px 0; padding: 8px 12px; border: 1px solid var(--cu); background: var(--cu-soft); vertical-align: top; }
.pt-fact b { font: 600 18px/1.2 var(--mono); color: var(--cu); }
.pt-fact small { font: 400 12px/1.3 var(--head); color: var(--text); }

/* Партнёрский блок */
.pt-ref { display: flex; flex-direction: column; gap: 12px; margin: 1.6em 0; padding: 16px; border: 1px dashed var(--ink); background: var(--paper); }
.pt-ref__note { display: block; font: 400 11px var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.pt-ref__title { margin: 4px 0; font: 700 17px/1.3 var(--head); color: var(--ink); }
.pt-ref__text { margin: 0; font-size: 16px; }
.pt-ref__btn { align-self: flex-start; padding: 10px 16px; background: var(--ink); color: #fff; text-decoration: none; font: 600 13px var(--mono); }
.pt-ref__btn:hover { background: var(--acc); color: #fff; }
.pt-slot-title { font: 600 12px var(--mono); text-transform: uppercase; color: var(--muted); }

/* Редакция */
.pt-editor { display: flex; gap: 14px; margin-top: 2em; padding-top: 16px; border-top: 1px solid var(--ink); font-size: 16px; line-height: 1.5; color: var(--muted); }
.pt-editor p { margin: 0; }
.pt-editor__name { font: 700 15px var(--head); color: var(--ink); margin-bottom: 2px !important; }
.pt-see { margin-top: 28px; }

/* ---------- Подвал ---------- */
.pt-foot { background: var(--sheet); border-top: 1px solid var(--ink); padding: 18px 0 22px; font: 400 13px/1.5 var(--mono); color: var(--muted); }
.pt-foot__row { display: flex; flex-direction: column; gap: 10px; }
.pt-foot__brand { display: flex; align-items: center; gap: 10px; margin: 0; }
.pt-foot__links { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 18px; }
.pt-foot__links a { color: var(--ink); }

/* ---------- ≥561 ---------- */
@media (min-width: 561px) {
	.pt-table { grid-template-columns: repeat(3, minmax(0, 1fr)); }
	.pt-entry { grid-template-columns: minmax(0, 1fr) 150px; }
	.pt-entry__img { aspect-ratio: 4 / 3; }
	.pt-files { grid-template-columns: repeat(2, minmax(0, 1fr)); }
	.pt-intro__h1 { font-size: 32px; }
	.pt-article { padding: 26px 26px 30px; }
	.pt-article__fig { margin: 18px -26px 0; }
	.pt-article__fig figcaption { padding: 6px 26px 0; }
	.pt-ref { flex-direction: row; align-items: center; justify-content: space-between; }
	.pt-ref__btn { align-self: center; flex: none; }
	.pt-foot__row { flex-direction: row; justify-content: space-between; align-items: center; }
}

/* ---------- ≥921 ---------- */
@media (min-width: 921px) {
	body { font-size: 18.5px; }
	.pt-head__row { flex-direction: row; align-items: center; justify-content: space-between; padding-top: 14px; padding-bottom: 14px; }
	.pt-nav { margin: 0; overflow: visible; }
	.pt-nav__list { padding: 0; flex-wrap: wrap; justify-content: flex-end; }
	.pt-intro__sheet { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 40px; padding: 36px; }
	.pt-intro__h1 { font-size: 40px; }
	.pt-log { padding: 0 24px; }
	.pt-entry { grid-template-columns: 150px minmax(0, 1fr) 190px; grid-template-areas: "meta text img"; gap: 20px; padding: 20px 0; }
	.pt-entry__meta { flex-direction: column; gap: 2px; }
	.pt-entry__title { font-size: 20px; }
	.pt-files { grid-template-columns: repeat(3, minmax(0, 1fr)); }
	.pt-twin { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 24px; }
	.pt-article { padding: 40px 48px 44px; }
	.pt-article__head { max-width: 900px; }
	.pt-article__h1 { font-size: 42px; }
	.pt-article__fig { margin: 24px 0 0; }
	.pt-article__fig figcaption { padding: 6px 0 0; }
	.pt-article__grid { grid-template-columns: 240px minmax(0, 700px); gap: 48px; margin-top: 32px; }
	.pt-toc { position: sticky; top: 16px; align-self: start; max-height: calc(100vh - 32px); overflow-y: auto; }
	.pt-toc summary { pointer-events: none; list-style: none; }
	.pt-toc summary::-webkit-details-marker { display: none; }
	.pt-article__grid > .pt-text:only-child { grid-column: 2; }
}
