:root {
  --bg: #f7f3ee;
  --surface: #fffdf9;
  --ink: #1f1b16;
  --muted: #716759;
  --line: #e5dccf;
  --accent: #9a4a2e;
  --accent-hover: #7f3a22;
  --ok: #3c6e47;
  --warn: #a8741a;
  --err: #a33a2a;
  --on-accent: #ffffff;
  --ok-bg: #e6efe5;
  --err-bg: #f6e3df;
  --badge-bg: rgba(31, 27, 22, .82);
  --shadow: rgba(40, 25, 10, .45);
  --serif: 'Cormorant Garamond', Georgia, 'Times New Roman', serif;
  --sans: 'Manrope', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --radius: 4px;
  color-scheme: light;
}

/* Тёмная тема: по настройке системы (если пользователь не выбрал сам) или по кнопке. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #15120f;
    --surface: #1e1a16;
    --ink: #ede6db;
    --muted: #a99f92;
    --line: #36302a;
    --accent: #d98a68;
    --accent-hover: #e8a184;
    --ok: #86c393;
    --warn: #e2b766;
    --err: #f0a294;
    --on-accent: #1a110c;
    --ok-bg: #1f3125;
    --err-bg: #3b211c;
    --badge-bg: rgba(10, 8, 6, .8);
    --shadow: rgba(0, 0, 0, .7);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #15120f;
  --surface: #1e1a16;
  --ink: #ede6db;
  --muted: #a99f92;
  --line: #36302a;
  --accent: #d98a68;
  --accent-hover: #e8a184;
  --ok: #86c393;
  --warn: #e2b766;
  --err: #f0a294;
  --on-accent: #1a110c;
  --ok-bg: #1f3125;
  --err-bg: #3b211c;
  --badge-bg: rgba(10, 8, 6, .8);
  --shadow: rgba(0, 0, 0, .7);
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.6 var(--sans);
  transition: background-color .25s, color .25s;
}
img { max-width: 100%; display: block; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.15; margin: 0 0 .5em; }
h1 { font-size: clamp(2.2rem, 5vw, 3.4rem); }
h2 { font-size: clamp(1.7rem, 3.5vw, 2.3rem); }
p { margin: 0 0 1em; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 20px; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.center { text-align: center; }
.eyebrow { text-transform: uppercase; letter-spacing: .14em; font-size: .78rem; color: var(--muted); margin-bottom: .6em; }
.lead { font-size: 1.15rem; color: var(--muted); }

/* Header */
.site-header { border-bottom: 1px solid var(--line); background: var(--bg); position: sticky; top: 0; z-index: 10; }
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 68px; }
.logo { font-family: var(--serif); font-size: 1.6rem; font-weight: 600; color: var(--ink); }
.nav { display: flex; gap: 28px; margin-left: auto; }
.nav a { color: var(--ink); font-size: .95rem; padding: 4px 0; border-bottom: 1px solid transparent; }
.nav a:hover, .nav a.active { border-bottom-color: var(--accent); color: var(--ink); }
.menu-btn { display: none; background: none; border: 0; width: 40px; height: 40px; padding: 10px 8px; cursor: pointer; }
.menu-btn span { display: block; height: 2px; background: var(--ink); margin: 6px 0; transition: transform .2s; }

.header-tools { display: flex; align-items: center; gap: 10px; margin-left: 28px; }
.lang-switch { display: flex; border: 1px solid var(--line); border-radius: 999px; padding: 2px; }
.lang-switch a { color: var(--muted); font-size: .78rem; font-weight: 600; letter-spacing: .04em; padding: 4px 8px; border-radius: 999px; line-height: 1.2; }
.lang-switch a:hover { color: var(--ink); }
.lang-switch a.active { background: var(--ink); color: var(--bg); }
.theme-btn { display: grid; place-items: center; width: 36px; height: 36px; border: 1px solid var(--line); border-radius: 50%; background: none; color: var(--ink); cursor: pointer; padding: 0; }
.theme-btn:hover { border-color: var(--ink); }
/* В светлой теме показываем луну (включить тёмную), в тёмной — солнце. */
.icon-sun { display: none; }
:root[data-theme="dark"] .icon-sun { display: block; }
:root[data-theme="dark"] .icon-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .icon-sun { display: block; }
  :root:not([data-theme="light"]) .icon-moon { display: none; }
}

@media (max-width: 900px) {
  .nav { gap: 18px; }
  .header-tools { margin-left: 18px; }
}
@media (max-width: 720px) {
  .header-tools { margin-left: auto; }
  .logo { font-size: 1.3rem; margin-right: 10px; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .header-tools { gap: 6px; flex-shrink: 0; }
  .lang-switch a { padding: 4px 6px; }
  .theme-btn { width: 34px; height: 34px; }
  .menu-btn { display: block; }
  .nav { display: none; position: absolute; top: 68px; left: 0; right: 0; background: var(--bg); flex-direction: column; gap: 0; border-bottom: 1px solid var(--line); padding: 8px 20px 16px; }
  .nav a { padding: 12px 0; border-bottom: 1px solid var(--line); }
  .menu-open .nav { display: flex; }
  .menu-open .menu-btn span:first-child { transform: translateY(4px) rotate(45deg); }
  .menu-open .menu-btn span:last-child { transform: translateY(-4px) rotate(-45deg); }
}

/* Buttons */
.btn {
  display: inline-block; background: var(--accent); color: var(--on-accent); border: 1px solid var(--accent);
  padding: 13px 26px; border-radius: var(--radius); font: 500 .95rem var(--sans); cursor: pointer;
  transition: background .15s;
}
.btn:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--on-accent); }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--ink); }
.btn-ghost:hover { background: var(--ink); color: var(--bg); }
.btn-wide { width: 100%; text-align: center; }
.link-arrow { font-weight: 500; }
.link-back { display: inline-block; margin-bottom: 24px; color: var(--muted); }

/* Hero */
.hero { padding: 64px 0 72px; }
.hero-inner { display: grid; grid-template-columns: 1fr 1.1fr; gap: 56px; align-items: center; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 28px; }
.hero-art { position: relative; display: block; }
.hero-art img { width: 100%; max-height: 620px; object-fit: cover; box-shadow: 0 24px 60px -30px var(--shadow); }
.hero-caption { display: block; margin-top: 12px; font-family: var(--serif); font-style: italic; font-size: 1.1rem; color: var(--muted); }
@media (max-width: 860px) {
  .hero { padding: 36px 0 48px; }
  .hero-inner { grid-template-columns: 1fr; gap: 32px; }
}

/* Sections */
.section { padding: 56px 0; }
.section-alt { background: var(--surface); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.section-head { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 12px 24px; margin-bottom: 32px; }
.section-head h1, .section-head h2 { margin: 0; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.tabs a { padding: 7px 16px; border: 1px solid var(--line); border-radius: 999px; color: var(--ink); font-size: .9rem; }
.tabs a.active { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.empty { color: var(--muted); padding: 40px 0; }

/* Gallery grid (masonry) */
.grid { columns: 3 300px; column-gap: 28px; }
.card { display: block; break-inside: avoid; margin-bottom: 36px; color: var(--ink); }
.card:hover { color: var(--ink); }
.card-img { position: relative; background: var(--line); overflow: hidden; }
.card-img img { width: 100%; height: auto; transition: transform .4s ease; }
.card:hover .card-img img { transform: scale(1.025); }
.card-body { padding-top: 12px; }
.card-title { font-family: var(--serif); font-size: 1.35rem; font-weight: 600; line-height: 1.2; }
.card-meta { color: var(--muted); font-size: .88rem; margin-top: 2px; }
.card-price { margin-top: 4px; font-weight: 600; }
.badge { position: absolute; top: 12px; left: 12px; background: var(--badge-bg); color: #fff; font-size: .75rem; padding: 4px 10px; border-radius: 999px; letter-spacing: .02em; }
.no-img { aspect-ratio: 4/3; display: grid; place-items: center; color: var(--muted); background: var(--line); }
.no-img.big { aspect-ratio: 4/3; font-size: 1.1rem; }

/* Painting page */
.painting { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 56px; align-items: start; }
.main-img { display: block; width: 100%; padding: 0; border: 0; background: none; cursor: zoom-in; }
.main-img img { width: 100%; max-height: 80vh; object-fit: contain; background: var(--surface); }
.thumbs { display: flex; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.thumb { width: 76px; height: 76px; padding: 0; border: 2px solid transparent; background: none; cursor: pointer; opacity: .7; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb.active, .thumb:hover { border-color: var(--accent); opacity: 1; }
.painting-info { position: sticky; top: 100px; }
.specs { display: grid; grid-template-columns: auto 1fr; gap: 8px 24px; margin: 0 0 28px; padding: 20px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.specs dt { color: var(--muted); }
.specs dd { margin: 0; }
.status { font-weight: 600; }
.status-available { color: var(--ok); }
.status-reserved { color: var(--warn); }
.status-sold, .status-not_for_sale { color: var(--muted); }
.buy-box { margin-bottom: 32px; scroll-margin-top: 100px; }
.price { font-family: var(--serif); font-size: 2.2rem; font-weight: 600; margin-bottom: 16px; }
.price-ask { font-size: 1.5rem; }
.order-form label { display: block; margin-bottom: 14px; font-size: .9rem; font-weight: 500; }
.order-form input, .order-form textarea {
  display: block; width: 100%; margin-top: 6px; padding: 11px 13px; font: 1rem var(--sans);
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--ink);
}
.order-form input:focus, .order-form textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: var(--accent); }
.hp { position: absolute !important; left: -9999px !important; width: 1px; height: 1px; opacity: 0; }
.alert { padding: 14px 16px; border-radius: var(--radius); margin-bottom: 16px; }
.alert-ok { background: var(--ok-bg); color: var(--ok); }
.alert-error { background: var(--err-bg); color: var(--err); }
.prose { max-width: 68ch; }
.prose p { margin-bottom: 1em; }
.prev-next { display: flex; justify-content: space-between; gap: 20px; margin-top: 64px; padding-top: 24px; border-top: 1px solid var(--line); }
@media (max-width: 860px) {
  .painting { grid-template-columns: 1fr; gap: 28px; }
  .painting-info { position: static; }
}

/* Lightbox */
.lightbox { position: fixed; inset: 0; background: rgba(15, 12, 9, .94); z-index: 50; display: grid; place-items: center; padding: 20px; cursor: zoom-out; }
.lightbox[hidden] { display: none; }
.lightbox img { max-width: 100%; max-height: 100%; object-fit: contain; }
.lightbox-close { position: absolute; top: 12px; right: 16px; background: none; border: 0; color: #fff; font-size: 2.4rem; cursor: pointer; line-height: 1; }

/* About */
.about-teaser { display: grid; grid-template-columns: 260px 1fr; gap: 48px; align-items: center; }
.about-teaser:not(:has(.about-photo)) { grid-template-columns: 1fr; }
.about-photo { width: 100%; aspect-ratio: 4/5; object-fit: cover; }
.clamp { display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; margin-bottom: 1em; }
.artist { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); gap: 56px; align-items: start; }
.artist:not(:has(.artist-photo)) { grid-template-columns: 1fr; max-width: 760px; }
.artist-photo { width: 100%; object-fit: cover; position: sticky; top: 100px; }
.artist-text h2 { margin-top: 40px; scroll-margin-top: 90px; }
@media (max-width: 760px) {
  .about-teaser, .artist { grid-template-columns: 1fr; gap: 28px; }
  .about-photo { max-width: 260px; }
  .artist-photo { position: static; }
}

/* Contacts */
.contacts { list-style: none; padding: 0; margin: 0 0 28px; }
.contacts li { display: flex; gap: 16px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.c-label { width: 100px; flex-shrink: 0; color: var(--muted); }
.contacts-compact { display: flex; flex-wrap: wrap; gap: 6px 24px; margin: 0; }
.contacts-compact li { padding: 0; border: 0; }
.contacts-compact .c-label { display: none; }

/* Footer */
.site-footer { border-top: 1px solid var(--line); padding: 40px 0 28px; margin-top: 40px; }
.footer-inner { display: flex; justify-content: space-between; gap: 24px; flex-wrap: wrap; margin-bottom: 24px; }
.footer-name { font-family: var(--serif); font-size: 1.4rem; font-weight: 600; }
.footer-bottom { display: flex; justify-content: space-between; gap: 8px 24px; flex-wrap: wrap; }
.footer-legal { display: flex; gap: 20px; }
.footer-legal a { color: var(--muted); text-decoration: underline; text-underline-offset: 3px; }
.footer-legal a:hover { color: var(--ink); }
.form-privacy { margin: 12px 0 0; }
.form-privacy a { text-decoration: underline; text-underline-offset: 2px; }

/* Impressum / Datenschutz */
.legal { max-width: 760px; }
.legal .prose { max-width: none; }
.legal .prose h2 { font-size: 1.5rem; margin: 1.6em 0 .4em; }
.legal .prose p { overflow-wrap: anywhere; }
