/*
Theme Name: Mavridica
Theme URI: https://mavridica.ru/
Author: Codex
Description: A warm, lightweight editorial WordPress theme for stories and articles.
Version: 1.0.1
Requires at least: 6.0
Tested up to: 6.8
Requires PHP: 7.4
Text Domain: mavridica
*/

:root {
  --paper: #fff8eb;
  --paper-deep: #f4e6cf;
  --ink: #432716;
  --muted: #7b5b43;
  --line: #7b4a34;
  --wine: #811a25;
  --wine-dark: #5e1219;
  --gold: #d1a56a;
  --soft: rgba(129, 26, 37, 0.08);
  --shadow: 0 18px 60px rgba(77, 45, 20, 0.16);
  --hand: "Segoe Print", "Comic Sans MS", "Bradley Hand ITC", cursive;
  --serif: Georgia, "Times New Roman", serif;
  --sans: "Segoe UI", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 20% 10%, rgba(209, 165, 106, 0.18), transparent 28%),
    radial-gradient(circle at 80% 0%, rgba(129, 26, 37, 0.08), transparent 26%),
    var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  line-height: 1.6;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.28;
  background-image:
    linear-gradient(rgba(67, 39, 22, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(67, 39, 22, 0.035) 1px, transparent 1px);
  background-size: 36px 36px;
}

a {
  color: inherit;
}

img {
  max-width: 100%;
  height: auto;
}

.page-shell {
  width: min(1240px, calc(100% - 28px));
  margin: 28px auto;
  border: 2px solid var(--ink);
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.32), transparent 18%, transparent 82%, rgba(255, 255, 255, 0.28)),
    var(--paper);
  box-shadow: var(--shadow);
}

.site-header {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 28px;
  align-items: center;
  padding: 22px 38px 18px;
  border-bottom: 1px solid rgba(67, 39, 22, 0.25);
}

.brand {
  display: inline-grid;
  grid-template-columns: 74px auto;
  gap: 14px;
  align-items: center;
  color: var(--ink);
  text-decoration: none;
}

.brand-mark {
  position: relative;
  display: grid;
  width: 74px;
  height: 56px;
  place-items: end center;
}

.brand-mark::before,
.brand-mark::after {
  content: "";
  position: absolute;
  border: 2px solid var(--ink);
}

.brand-mark::before {
  bottom: 8px;
  left: 15px;
  width: 34px;
  height: 24px;
  border-radius: 0 0 16px 16px;
  background: #f8ddb2;
}

.brand-mark::after {
  right: 10px;
  bottom: 16px;
  width: 14px;
  height: 12px;
  border-left: 0;
  border-radius: 0 12px 12px 0;
}

.brand-heart {
  position: absolute;
  top: 0;
  left: 32px;
  color: var(--wine);
  font-family: var(--hand);
  font-size: 25px;
  line-height: 1;
}

.brand-title {
  display: block;
  font-family: var(--hand);
  font-size: clamp(31px, 4vw, 48px);
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0;
}

.brand-subtitle {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-family: var(--hand);
  font-size: 15px;
}

.main-nav {
  display: flex;
  justify-content: center;
}

.main-nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 0;
  list-style: none;
}

.main-nav li + li::before {
  content: "|";
  margin: 0 21px;
  color: var(--line);
  font-weight: 700;
}

.main-nav a {
  color: var(--ink);
  font-family: var(--hand);
  font-size: 21px;
  font-weight: 700;
  text-decoration: none;
}

.main-nav a:hover {
  color: var(--wine);
}

.search-link {
  display: grid;
  width: 58px;
  height: 58px;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: #ead3aa;
  color: var(--ink);
  cursor: pointer;
}

.search-link span {
  position: relative;
  width: 24px;
  height: 24px;
  border: 3px solid currentColor;
  border-radius: 50%;
}

.search-link span::after {
  content: "";
  position: absolute;
  right: -10px;
  bottom: -8px;
  width: 14px;
  height: 3px;
  border-radius: 999px;
  background: currentColor;
  transform: rotate(45deg);
}

.site-main {
  padding: 0 38px 34px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.04fr) minmax(320px, 0.96fr);
  gap: 34px;
  align-items: stretch;
  margin-top: 24px;
  padding: 18px;
  border: 1px solid rgba(67, 39, 22, 0.4);
  border-radius: 12px;
  background: rgba(255, 251, 242, 0.75);
}

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

.hero.hero-no-cover .hero-copy {
  min-height: 320px;
  align-items: center;
  text-align: center;
}

.hero.hero-no-cover h1,
.hero.hero-no-cover p {
  margin-left: auto;
  margin-right: auto;
}

.journal-scene {
  position: relative;
  min-height: 380px;
  overflow: hidden;
  border-radius: 10px;
  border: 1px solid rgba(67, 39, 22, 0.22);
  background:
    linear-gradient(90deg, rgba(67, 39, 22, 0.36), transparent 6%, transparent 94%, rgba(67, 39, 22, 0.18)),
    linear-gradient(180deg, #e3c596 0 17%, #f9eed8 17% 72%, #b77b53 72% 100%);
}

.hero-cover {
  display: block;
  min-height: 380px;
  overflow: hidden;
  border-radius: 10px;
  border: 1px solid rgba(67, 39, 22, 0.22);
  background: var(--paper-deep);
}

.hero-cover img {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 380px;
  object-fit: cover;
}

.journal-scene::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 72% 26%, rgba(255, 255, 255, 0.78), transparent 28%),
    radial-gradient(circle at 24% 42%, rgba(88, 55, 28, 0.28), transparent 8%),
    linear-gradient(90deg, transparent 0 22%, rgba(93, 55, 28, 0.55) 22% 24%, transparent 24% 46%, rgba(93, 55, 28, 0.42) 46% 48%, transparent 48% 72%, rgba(93, 55, 28, 0.42) 72% 74%, transparent 74%);
  opacity: 0.95;
}

.vase,
.cup,
.book,
.pen,
.curtain,
.plant {
  position: absolute;
  z-index: 1;
}

.vase {
  left: 12%;
  bottom: 18%;
  width: 76px;
  height: 118px;
  border: 2px solid rgba(67, 39, 22, 0.75);
  border-radius: 42% 42% 28% 28%;
  background: linear-gradient(90deg, #a87848, #d3a46b 52%, #8b5a34);
}

.plant {
  left: 9%;
  bottom: 37%;
  width: 124px;
  height: 138px;
  background:
    radial-gradient(circle at 44% 14%, #6f4d22 0 4px, transparent 5px),
    radial-gradient(circle at 18% 30%, #b18745 0 5px, transparent 6px),
    radial-gradient(circle at 78% 32%, #916b2d 0 5px, transparent 6px),
    radial-gradient(circle at 54% 45%, #7b5b2b 0 4px, transparent 5px),
    linear-gradient(68deg, transparent 48%, #5d3a1f 49% 51%, transparent 52%),
    linear-gradient(110deg, transparent 48%, #5d3a1f 49% 51%, transparent 52%),
    linear-gradient(88deg, transparent 48%, #5d3a1f 49% 51%, transparent 52%);
}

.cup {
  left: 32%;
  bottom: 23%;
  width: 78px;
  height: 72px;
  border: 2px solid rgba(67, 39, 22, 0.82);
  border-radius: 0 0 32px 32px;
  background: #efd4a8;
}

.cup::after {
  content: "";
  position: absolute;
  right: -26px;
  top: 16px;
  width: 28px;
  height: 28px;
  border: 2px solid rgba(67, 39, 22, 0.82);
  border-left: 0;
  border-radius: 0 30px 30px 0;
}

.book {
  right: 12%;
  bottom: 14%;
  width: 270px;
  height: 98px;
  border: 2px solid rgba(67, 39, 22, 0.72);
  border-radius: 9px;
  background:
    linear-gradient(90deg, #f7ecd6 0 48%, #dfcba8 48% 50%, #f7ecd6 50% 100%);
  transform: rotate(3deg);
}

.book::before {
  content: "";
  position: absolute;
  inset: 20px 24px;
  background:
    repeating-linear-gradient(180deg, rgba(67, 39, 22, 0.28) 0 2px, transparent 2px 11px);
  opacity: 0.9;
}

.pen {
  right: 11%;
  bottom: 15%;
  width: 150px;
  height: 8px;
  border-radius: 999px;
  background: #332016;
  transform: rotate(-26deg);
}

.curtain {
  right: 0;
  top: 0;
  width: 92px;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 244, 222, 0.86));
}

.hero-copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 26px 28px;
}

.pill {
  display: inline-flex;
  width: fit-content;
  margin-bottom: 18px;
  padding: 8px 16px;
  border-radius: 999px;
  background: var(--wine);
  color: white;
  font-family: var(--hand);
  font-size: 17px;
  font-weight: 800;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1,
h2,
h3,
.reader-title {
  font-family: var(--hand);
  letter-spacing: 0;
}

.hero h1 {
  max-width: 620px;
  margin-bottom: 18px;
  font-size: clamp(42px, 6.8vw, 78px);
  line-height: 0.98;
}

.divider {
  display: flex;
  align-items: center;
  gap: 14px;
  width: min(360px, 100%);
  margin: 8px 0 18px;
  color: var(--wine);
}

.divider::before,
.divider::after {
  content: "";
  height: 1px;
  flex: 1;
  background: rgba(67, 39, 22, 0.35);
}

.hero p {
  max-width: 520px;
  color: var(--ink);
  font-family: var(--hand);
  font-size: 21px;
  font-weight: 700;
}

.button {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  gap: 16px;
  min-height: 56px;
  margin-top: 16px;
  padding: 0 26px;
  border: 2px solid var(--wine-dark);
  border-radius: 999px;
  background: var(--wine);
  color: white;
  font-family: var(--hand);
  font-size: 21px;
  font-weight: 800;
  text-decoration: none;
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.12);
}

.button::after {
  content: "->";
  font-family: var(--sans);
  font-size: 28px;
}

.button.secondary {
  background: transparent;
  color: var(--wine);
}

.button.secondary::after {
  content: "";
}

.button.danger {
  border-color: rgba(129, 26, 37, 0.55);
  background: rgba(129, 26, 37, 0.08);
  color: var(--wine);
}

.button.danger::after {
  content: "";
}

.button.danger:hover {
  background: var(--wine);
  color: #fff;
}

.button.is-saving {
  opacity: 0.82;
  cursor: wait;
  transform: none;
}

.button.is-complete {
  border-color: #2d7543;
  background: #2d7543;
  color: #fff;
  box-shadow: 0 10px 24px rgba(45, 117, 67, 0.22);
}

.button.is-complete::after {
  content: "✓";
  font-size: 22px;
}

.button.secondary.is-complete {
  background: rgba(45, 117, 67, 0.1);
  color: #2d7543;
}

.section-title {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 18px;
  align-items: center;
  margin: 24px 0 14px;
  color: var(--ink);
  font-family: var(--hand);
  font-size: clamp(28px, 4vw, 40px);
  line-height: 1;
  text-align: center;
}

.section-title::before,
.section-title::after {
  content: "";
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(67, 39, 22, 0.55), transparent);
}

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

.story-card {
  display: grid;
  grid-template-columns: 155px minmax(0, 1fr);
  gap: 18px;
  min-height: 205px;
  padding: 14px;
  border: 1px solid rgba(67, 39, 22, 0.5);
  border-radius: 10px;
  background: rgba(255, 251, 244, 0.78);
  color: var(--ink);
  text-decoration: none;
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.story-card-body {
  display: flex;
  min-width: 0;
  flex-direction: column;
}

.story-card.no-thumb {
  grid-template-columns: 1fr;
  min-height: 0;
}

.story-card.no-thumb .story-card-body {
  min-height: 177px;
}

.story-card-category {
  width: fit-content;
  padding: 2px 10px;
  border: 1px solid rgba(129, 26, 37, 0.42);
  border-radius: 999px;
  color: var(--wine);
  font-family: var(--hand);
  font-size: 13px;
  font-weight: 800;
}

.story-card:hover {
  box-shadow: 0 14px 28px rgba(77, 45, 20, 0.13);
  transform: translateY(-2px);
}

.story-thumb {
  position: relative;
  min-height: 165px;
  overflow: hidden;
  border-radius: 8px;
  border: 1px solid rgba(67, 39, 22, 0.25);
  background:
    radial-gradient(circle at 50% 28%, rgba(255, 250, 229, 0.95), transparent 18%),
    linear-gradient(145deg, #dfc08a, #8a6747);
}

.story-thumb.has-image {
  background-size: cover;
  background-position: center;
}

.story-thumb:not(.has-image)::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 32% 66%, #6f4d2e 0 18px, transparent 19px),
    radial-gradient(circle at 70% 62%, #8f6136 0 24px, transparent 25px),
    linear-gradient(45deg, transparent 45%, rgba(67, 39, 22, 0.45) 46% 49%, transparent 50%),
    linear-gradient(135deg, transparent 48%, rgba(67, 39, 22, 0.28) 49% 51%, transparent 52%),
    linear-gradient(180deg, transparent 0 58%, #d7b073 58% 64%, #766044 64% 100%);
}

.story-card h3 {
  margin: 5px 0 10px;
  color: var(--wine);
  font-size: 25px;
  line-height: 1.05;
  overflow-wrap: anywhere;
}

.story-card p {
  margin-bottom: 14px;
  color: var(--ink);
  font-family: var(--hand);
  font-size: 16px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin-top: auto;
  color: var(--muted);
  font-family: var(--hand);
  font-size: 14px;
  font-weight: 800;
}

.read-chip {
  display: inline-flex;
  min-height: 32px;
  align-items: center;
  padding: 0 18px;
  border: 1px solid var(--wine);
  border-radius: 999px;
  color: var(--wine);
  background: rgba(255, 255, 255, 0.42);
}

.category-row {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 20px;
  margin: 24px 0 30px;
}

.category-pill {
  display: flex;
  min-height: 64px;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: rgba(255, 251, 244, 0.8);
  color: var(--ink);
  font-family: var(--hand);
  font-size: 22px;
  font-weight: 800;
  text-decoration: none;
}

.category-pill:hover {
  color: var(--wine);
  background: white;
}

.category-icon {
  color: var(--wine);
  font-family: var(--sans);
  font-size: 28px;
}

.site-footer {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 20px;
  align-items: center;
  padding: 22px 38px;
  border-top: 1px solid rgba(67, 39, 22, 0.38);
}

.footer-brand {
  display: flex;
  gap: 14px;
  align-items: center;
  font-family: var(--hand);
  font-weight: 800;
}

.footer-heart {
  color: var(--wine);
  font-size: 42px;
  line-height: 1;
}

.footer-menu {
  display: flex;
  gap: 18px;
  justify-content: center;
  color: var(--ink);
  font-family: var(--hand);
  font-weight: 800;
}

.footer-menu a {
  text-decoration: none;
}

.socials {
  display: flex;
  gap: 14px;
  justify-content: flex-end;
}

.socials a {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: #f2dfbd;
  color: var(--ink);
  font-weight: 900;
  text-decoration: none;
}

.content-wrap {
  width: min(980px, 100%);
  margin: 30px auto;
}

.reader {
  padding: 34px;
  border: 1px solid rgba(67, 39, 22, 0.45);
  border-radius: 12px;
  background: rgba(255, 251, 244, 0.78);
}

.story-breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
  color: var(--muted);
  font-family: var(--hand);
  font-weight: 800;
}

.story-breadcrumbs a {
  color: var(--wine);
  text-decoration: none;
}

.reader-title {
  margin-bottom: 14px;
  color: var(--ink);
  font-size: clamp(42px, 7vw, 72px);
  line-height: 1;
}

.entry-meta {
  margin-bottom: 28px;
  color: var(--muted);
  font-family: var(--hand);
  font-weight: 800;
}

.entry-meta a {
  color: var(--wine);
  text-decoration: none;
}

.entry-cover {
  width: min(760px, 100%);
  margin: 0 auto 30px;
}

.entry-cover img {
  display: block;
  width: 100%;
  border: 1px solid rgba(67, 39, 22, 0.32);
  border-radius: 10px;
  box-shadow: 0 18px 38px rgba(77, 45, 20, 0.13);
}

.entry-content {
  width: min(760px, 100%);
  margin: 0 auto;
  color: var(--ink);
  font-family: var(--serif);
  font-size: 21px;
  line-height: 1.85;
}

.entry-content p {
  margin-bottom: 1.25em;
}

.entry-content h2,
.entry-content h3 {
  margin-top: 1.35em;
  font-family: var(--hand);
}

.entry-content blockquote {
  margin: 1.5em 0;
  padding: 8px 0 8px 22px;
  border-left: 3px solid var(--wine);
  color: var(--muted);
  font-family: var(--hand);
  font-size: 23px;
  font-weight: 800;
}

.entry-content hr {
  width: min(320px, 70%);
  margin: 2em auto;
  border: 0;
  border-top: 1px solid rgba(67, 39, 22, 0.35);
}

.story-footer {
  width: min(760px, 100%);
  margin: 34px auto 0;
  padding-top: 20px;
  border-top: 1px solid rgba(67, 39, 22, 0.24);
}

.story-share {
  display: grid;
  width: min(760px, 100%);
  gap: 12px;
  margin: 28px auto 0;
  padding: 16px 18px;
  border: 1px solid rgba(67, 39, 22, 0.24);
  border-radius: 10px;
  background: rgba(255, 251, 244, 0.7);
  font-family: var(--hand);
  font-weight: 800;
}

.story-share > span {
  color: var(--muted);
  font-size: 18px;
}

.story-share-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.story-share-actions a,
.story-share-actions button {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  padding: 0 14px;
  border: 1px solid rgba(129, 26, 37, 0.45);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.52);
  color: var(--wine);
  cursor: pointer;
  font: inherit;
  text-decoration: none;
}

.story-share-actions a:hover,
.story-share-actions button:hover {
  background: var(--wine);
  color: #fff;
}

.story-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 20px;
}

.story-tags a {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--wine);
  font-family: var(--hand);
  font-weight: 800;
  text-decoration: none;
}

.story-nav {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.story-nav div:last-child {
  text-align: right;
}

.story-nav a {
  color: var(--ink);
  font-family: var(--hand);
  font-size: 18px;
  font-weight: 800;
  text-decoration: none;
}

.story-nav a:hover {
  color: var(--wine);
}

.related-stories {
  margin-top: 26px;
}

.related-stories .story-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.related-stories .story-card {
  grid-template-columns: 170px minmax(0, 1fr);
}

.related-stories .story-card.no-thumb {
  grid-template-columns: 1fr;
}

.related-stories .story-thumb {
  min-height: 250px;
}

.in-story-suggestion {
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr);
  gap: 18px;
  width: min(760px, 100%);
  margin: 30px auto 8px;
  padding: 16px;
  border: 1px solid rgba(129, 26, 37, 0.35);
  border-radius: 10px;
  background: rgba(129, 26, 37, 0.055);
  font-family: var(--hand);
}

.in-story-suggestion.no-thumb {
  grid-template-columns: 1fr;
}

.suggestion-thumb {
  display: block;
  min-height: 180px;
  overflow: hidden;
  border-radius: 8px;
  border: 1px solid rgba(67, 39, 22, 0.22);
}

.suggestion-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 180px;
  object-fit: cover;
}

.suggestion-copy {
  display: grid;
  align-content: center;
  gap: 8px;
}

.suggestion-copy small {
  color: var(--muted);
  font-size: 16px;
  font-weight: 800;
}

.suggestion-copy a {
  color: var(--wine);
  font-size: 26px;
  font-weight: 800;
  line-height: 1.1;
  text-decoration: none;
}

.suggestion-copy a:hover {
  text-decoration: underline;
}

.suggestion-copy p {
  margin: 0;
  color: var(--ink);
  font-size: 17px;
  font-weight: 800;
  line-height: 1.45;
}

.suggestion-copy em {
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
  font-style: normal;
}

.cabinet .login-username,
.cabinet .login-password,
.cabinet .login-remember,
.cabinet .login-submit {
  margin: 0 0 14px;
}

.cabinet input[type="text"],
.cabinet input[type="password"] {
  width: min(420px, 100%);
  min-height: 48px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  font: inherit;
}

.cabinet input[type="submit"] {
  min-height: 46px;
  padding: 0 22px;
  border: 0;
  border-radius: 999px;
  background: var(--wine);
  color: white;
  cursor: pointer;
  font-family: var(--hand);
  font-size: 18px;
  font-weight: 800;
}

.cabinet-top {
  display: flex;
  gap: 22px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
}

.cabinet-hello,
.cabinet-title {
  font-family: var(--hand);
  font-size: 26px;
  font-weight: 800;
}

.cabinet-list {
  display: grid;
  gap: 12px;
}

.cabinet-item {
  display: flex;
  gap: 18px;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border: 1px solid rgba(67, 39, 22, 0.3);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.42);
}

.cabinet-item-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: flex-end;
}

.cabinet-item h3 {
  margin-bottom: 2px;
  color: var(--wine);
  font-size: 22px;
}

.cabinet-item span,
.cabinet-logout {
  color: var(--muted);
}

.cabinet-item a,
.cabinet-logout a,
.back-link {
  color: var(--wine);
  font-weight: 800;
  text-decoration: none;
}

.editor-wrap {
  width: min(920px, 100%);
  margin: 30px auto;
}

.story-editor {
  padding: 18px 0 28px;
}

.story-editor h1 {
  margin-bottom: 20px;
  font-family: var(--hand);
  font-size: clamp(44px, 8vw, 76px);
  line-height: 1;
}

.telegraph-form {
  display: grid;
  gap: 18px;
  width: 100%;
}

.editor-field {
  display: grid;
  gap: 8px;
  width: 100%;
  color: var(--muted);
  font-family: var(--hand);
  font-size: 18px;
  font-weight: 800;
}

.editor-field > span,
.editor-field > input,
.editor-field > textarea,
.editor-field > select {
  display: block;
}

.editor-field input,
.editor-field textarea,
.editor-field select {
  width: 100%;
  border: 1px solid rgba(67, 39, 22, 0.28);
  border-radius: 10px;
  background: rgba(255, 251, 244, 0.82);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 20px;
  line-height: 1.65;
}

.editor-field input[type="file"] {
  display: block;
  min-height: auto;
  padding: 12px;
  font-family: var(--sans);
  font-size: 16px;
}

.cover-preview {
  display: block;
}

.cover-preview img {
  width: min(280px, 100%);
  border: 1px solid rgba(67, 39, 22, 0.25);
  border-radius: 8px;
}

.editor-check {
  display: flex;
  gap: 10px;
  align-items: center;
  color: var(--ink);
  font-family: var(--hand);
  font-size: 19px;
  font-weight: 800;
}

.editor-check input {
  width: 18px;
  height: 18px;
  accent-color: var(--wine);
}

.editor-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px;
  border: 1px solid rgba(67, 39, 22, 0.24);
  border-radius: 10px;
  background: rgba(255, 251, 244, 0.62);
}

.editor-toolbar button {
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: white;
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  font-size: 14px;
}

.editor-field input,
.editor-field select {
  min-height: 52px;
  padding: 0 16px;
}

.editor-field textarea {
  padding: 15px 16px;
  resize: vertical;
}

.title-field input {
  border-color: transparent transparent rgba(67, 39, 22, 0.34);
  border-radius: 0;
  background: transparent;
  font-family: var(--hand);
  font-size: clamp(34px, 6vw, 62px);
  font-weight: 800;
  line-height: 1.1;
}

.content-field textarea {
  min-height: 440px;
}

.editor-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: center;
}

.editor-actions span {
  color: var(--muted);
}

.autosave-note,
.editor-stats {
  color: var(--muted);
  font-family: var(--hand);
  font-size: 16px;
  font-weight: 800;
}

.editor-preview {
  padding: 22px;
  border: 1px solid rgba(67, 39, 22, 0.28);
  border-radius: 10px;
  background: rgba(255, 251, 244, 0.72);
}

.editor-preview h2 {
  margin-bottom: 8px;
  color: var(--wine);
  font-family: var(--hand);
  font-size: 34px;
}

.editor-preview > p:not(.section-kicker) {
  color: var(--muted);
  font-family: var(--hand);
  font-size: 18px;
  font-weight: 800;
}

.notice {
  margin-bottom: 18px;
  padding: 14px 16px;
  border-radius: 8px;
  font-weight: 800;
}

.notice.success {
  border: 1px solid rgba(45, 117, 67, 0.35);
  background: rgba(45, 117, 67, 0.1);
}

.notice.error {
  border: 1px solid rgba(129, 26, 37, 0.35);
  background: rgba(129, 26, 37, 0.1);
}

.archive-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin: -4px 0 24px;
}

.archive-filters a {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 251, 244, 0.82);
  color: var(--ink);
  font-family: var(--hand);
  font-weight: 800;
  text-decoration: none;
}

.archive-filters a:hover {
  color: var(--wine);
  background: white;
}

.author-header p {
  max-width: 720px;
  margin: 0 auto;
  color: var(--muted);
  font-size: 18px;
}

.archive-header {
  margin: 34px 0 22px;
  text-align: center;
}

.archive-header h1 {
  color: var(--ink);
  font-family: var(--hand);
  font-size: clamp(42px, 7vw, 66px);
}

.archive-header p {
  max-width: 720px;
  margin: 0 auto;
  color: var(--muted);
  font-family: var(--hand);
  font-size: 19px;
  font-weight: 800;
}

.search-page-form {
  width: min(760px, 100%);
  margin: 0 auto 22px;
}

.stories-tools {
  margin: 0 0 24px;
}

.stories-header {
  margin-bottom: 22px;
}

.stories-filter {
  display: grid;
  grid-template-columns: minmax(220px, 1.4fr) minmax(170px, 0.8fr) minmax(170px, 0.8fr) auto;
  gap: 12px;
  align-items: end;
  margin-bottom: 18px;
  padding: 16px;
  border: 1px solid rgba(67, 39, 22, 0.26);
  border-radius: 10px;
  background: rgba(255, 251, 244, 0.72);
}

.stories-filter label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-family: var(--hand);
  font-size: 16px;
  font-weight: 800;
}

.stories-filter input,
.stories-filter select {
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  font: inherit;
}

.stories-filter button {
  min-height: 44px;
  padding: 0 18px;
  border: 0;
  border-radius: 999px;
  background: var(--wine);
  color: white;
  cursor: pointer;
  font-family: var(--hand);
  font-size: 18px;
  font-weight: 800;
}

.empty-state {
  grid-column: 1 / -1;
  padding: 24px;
  border: 1px dashed rgba(67, 39, 22, 0.35);
  border-radius: 10px;
  color: var(--muted);
  font-family: var(--hand);
  font-size: 19px;
  font-weight: 800;
  text-align: center;
}

.stories-catalog {
  align-items: stretch;
}

.stories-catalog .story-card {
  height: 100%;
}

.stories-catalog .story-thumb {
  min-height: 190px;
}

.pagination {
  margin: 28px 0;
  text-align: center;
  font-family: var(--hand);
  font-size: 20px;
}

.pagination a,
.pagination span {
  margin: 0 4px;
}

.search-panel {
  display: none;
  padding: 18px 38px 0;
}

.search-panel.is-open {
  display: block;
}

.search-form {
  display: flex;
  gap: 10px;
}

.search-form label {
  flex: 1;
}

.search-form input[type="search"] {
  width: 100%;
  min-height: 48px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: white;
  color: var(--ink);
  font: inherit;
}

.search-form input[type="submit"] {
  min-height: 48px;
  padding: 0 20px;
  border: 0;
  border-radius: 999px;
  background: var(--wine);
  color: white;
  cursor: pointer;
  font-family: var(--hand);
  font-size: 18px;
  font-weight: 800;
}

@media (max-width: 1040px) {
  .site-header {
    grid-template-columns: 1fr auto;
  }

  .main-nav {
    grid-column: 1 / -1;
    grid-row: 2;
    justify-content: flex-start;
  }

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

  .story-card {
    grid-template-columns: 190px minmax(0, 1fr);
  }

  .category-row {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .page-shell {
    width: min(100% - 18px, 1240px);
    margin: 10px auto;
  }

  .site-header,
  .site-main,
  .site-footer,
  .search-panel {
    padding-left: 18px;
    padding-right: 18px;
  }

  .site-header,
  .site-footer {
    grid-template-columns: 1fr;
  }

  .brand {
    grid-template-columns: 58px auto;
  }

  .brand-title {
    font-size: 34px;
  }

  .brand-subtitle {
    font-size: 13px;
  }

  .brand-mark {
    width: 58px;
  }

  .search-link,
  .socials {
    justify-self: start;
  }

  .main-nav li + li::before {
    margin: 0 10px;
  }

  .main-nav a {
    font-size: 18px;
  }

  .main-nav ul {
    row-gap: 6px;
    justify-content: flex-start;
  }

  .hero {
    padding: 12px;
  }

  .journal-scene {
    min-height: 260px;
  }

  .hero-cover,
  .hero-cover img {
    min-height: 260px;
  }

  .book {
    right: 8%;
    width: 180px;
  }

  .hero-copy {
    padding: 16px 4px 8px;
  }

  .story-card {
    grid-template-columns: 1fr;
  }

  .story-thumb {
    min-height: 220px;
  }

  .category-row {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .footer-menu,
  .socials {
    justify-content: flex-start;
  }

  .reader {
    padding: 18px;
  }

  .reader-title {
    font-size: clamp(42px, 14vw, 62px);
  }

  .stories-filter {
    grid-template-columns: 1fr;
  }

  .related-stories .story-grid,
  .related-stories .story-card {
    grid-template-columns: 1fr;
  }

  .related-stories .story-thumb {
    min-height: 220px;
  }

  .in-story-suggestion {
    grid-template-columns: 1fr;
    padding: 16px;
  }

  .suggestion-copy a {
    font-size: 23px;
  }

  .story-share-actions a,
  .story-share-actions button {
    flex: 1 1 auto;
  }
}
