:root {
  --bg: #0f1115;
  --card: #171923;
  --text: #e6e6e6;
  --muted: #a0a0a0;
  --accent: #6ee7b7;
  --danger: #f87171;
  --border: #2a2f3a;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, "Helvetica Neue", Arial;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
.container { max-width: 1100px; margin: 0 auto; padding: 20px; }
.header, .footer {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; color: var(--text); }
.brand img { width: 28px; height: 28px; filter: invert(1); }
nav a { margin-left: 16px; }
.badge { background: var(--accent); color: #0b0d12; border-radius: 999px; padding: 2px 8px; font-size: 12px; font-weight: 700; }
.hero { text-align: center; padding: 40px 0; }
.hero h1 { font-size: 42px; margin: 0 0 10px; }
.btn, .btn-outline, .btn-danger {
  display: inline-block; padding: 10px 16px; border-radius: 10px; border: 1px solid var(--accent);
  background: var(--accent); color: #0b0d12; font-weight: 700; cursor: pointer;
}
.btn-outline { background: transparent; color: var(--accent); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #201313; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 18px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.card { background: var(--card); border: 1px solid var(--border); border-radius: 14px; overflow: hidden; }
.card-body { padding: 12px; }
.muted { color: var(--muted); }
.placeholder { background: #222736; border: 1px dashed var(--border); color: var(--muted); height: 180px; display: grid; place-items: center; }
.placeholder.lg { height: 380px; }
.artwork { display: grid; grid-template-columns: 1.2fr 1fr; gap: 24px; }
.artwork .thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)); gap: 8px; margin-top: 10px; }
.artwork-info .price { font-size: 20px; font-weight: 700; }
.tag { display: inline-block; font-size: 12px; background: #273042; padding: 2px 8px; border-radius: 999px; margin-left: 8px; }
.stats { display: flex; gap: 16px; }
.stat { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 12px 16px; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { border-bottom: 1px solid var(--border); padding: 10px; text-align: left; vertical-align: middle; }
.table img.thumb { width: 60px; height: 40px; object-fit: cover; border-radius: 6px; }
.form label { display: block; margin: 10px 0; }
.form input[type="text"], .form input[type="number"], .form input[type="file"], .form textarea {
  width: 100%; padding: 10px; border-radius: 8px; background: #0e121a; border: 1px solid var(--border); color: var(--text);
}
.actions { display: flex; gap: 12px; margin-top: 10px; }
.header nav a { color: var(--text); }
.header nav a:hover { color: var(--accent); }
@media (max-width: 900px) {
  .artwork { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
}
/* ============ Theme base ============ */
:root {
  --bg: #0f0f12;
  --bg-soft: #15161a;
  --text: #f2f2f2;
  --muted: #b6b7bb;
  --brand: #9b87f5; /* сиреневый акцент */
  --card: #15161a;
  --card-2: #1a1b20;
  --border: #2a2b32;
  --shadow: 0 10px 30px rgba(0,0,0,.25);
}
body.theme {
  background: radial-gradient(1200px 600px at 50% -10%, rgba(155,135,245,.12), transparent 60%) var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Containers */
.container {
  width: min(1120px, 92vw);
  margin: 0 auto;
  padding: 0 12px;
}
.site-main { padding: 96px 0 72px; }

/* ============ Header ============ */
.site-header {
  position: sticky; top: 0; z-index: 10;
  backdrop-filter: blur(8px);
  background: rgba(15,15,18,.35);
  border-bottom: 1px solid transparent;
  transition: background .25s ease, border-color .25s ease, box-shadow .25s ease;
}
.site-header.is-scrolled {
  background: rgba(15,15,18,.7);
  border-color: var(--border);
  box-shadow: var(--shadow);
}
.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  height: 64px;
}
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; }
.brand img { width: 28px; height: 28px; }
.brand-title { font-weight: 700; letter-spacing: .3px; }

.nav {
  display:flex;
  gap:18px;
  position: relative;
}

/* Базовый стиль ссылок */
.nav a {
  position: relative;
  color:#111;
  text-decoration:none;
  padding: 6px 0;
}

/* Подчеркивающая линия — псевдоэлемент */
.nav a::after {
  content:"";
  position:absolute;
  left:0;
  bottom:-4px;  /* чуть ниже текста */
  width:100%;
  height:2px;
  background:#111;
  transform:scaleX(0);
  transform-origin:left;
  opacity:0;
  transition: transform .25s ease, opacity .5s ease;
}

/* При наведении — линия появляется */
.nav a:hover::after {
  transform:scaleX(1);
  opacity:1;
}

/* Чтобы линия исчезала мягко */
.nav a::after {
  transition: transform .25s ease, opacity .6s ease;
}
.badge { display:inline-block; min-width:22px; height:22px; line-height:22px; text-align:center; font-size:12px;
  border-radius: 11px; background: var(--brand); color: #0b0b0e; padding: 0 6px; margin-left: 6px; }

/* ============ Cards & Grid ============ */
.grid { display: grid; gap: 18px; }
.grid-squares { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }

.card {
  background: linear-gradient(180deg, var(--card), var(--card-2));
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.card:hover { transform: translateY(-2px); border-color: #3a3b45; }

.thumb { display:block; background: #0c0d10; }
.thumb.square { aspect-ratio: 1 / 1; position: relative; overflow: hidden; }
.thumb.square img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center;
  transition: transform .35s ease;
}
.card:hover .thumb.square img { transform: scale(1.04); }

.placeholder {
  display:grid; place-items:center; color: var(--muted);
  width:100%; height:100%; font-size:14px; border: 1px dashed #343641;
}
.card-body { padding: 14px 14px 16px; }
.card-body .title { margin: 6px 0 6px; font-size: 16px; line-height: 1.35; }
.card-body .title a { color: var(--text); text-decoration: none; }
.card-body .title a:hover { text-decoration: underline; }
.muted { color: var(--muted); }

/* Buttons */
.btn, .btn-outline, .btn-danger {
  display:inline-flex; align-items:center; justify-content:center; gap:8px;
  padding: 10px 14px; border-radius: 10px; border:1px solid transparent;
  text-decoration: none; cursor: pointer; transition: transform .12s ease, background .12s ease, border-color .12s ease;
  font-weight: 600;
}
.btn { background: var(--brand); color:#0b0b0e; }
.btn:hover { transform: translateY(-1px); }
.btn-outline { background: transparent; border-color: var(--border); color: var(--text); }
.btn-outline:hover { border-color: #3a3b45; }
.btn-danger { background: #ff3b30; color: #fff; }
.btn-danger:hover { filter: brightness(1.05); }

/* ===== Reset (минимальный) ===== */
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin:0; color:#111; background:#fff; font: 16px/1.55 system-ui, -apple-system, Segoe UI, Roboto, "Helvetica Neue", Arial; }
img { max-width:100%; display:block; }

/* ===== Variables ===== */
:root{
  --wrap: 1160px;
  --muted:#6b7280;
  --brand:#111;
  --border:#e5e7eb;
  --shadow: 0 10px 30px rgba(0,0,0,.06);
  --radius: 14px;
}

/* Page transitions */
html.is-loading body { opacity: 0; }
html.is-loaded body { opacity: 1; transition: opacity .18s ease; }
html.is-fading body { opacity: 0; transition: opacity .12s ease; }

/* ===== Layout ===== */
.wrap { width:min(var(--wrap), 92vw); margin:0 auto; padding:0 10px; }
.site-header { position: sticky; top:0; backdrop-filter: blur(8px); background:rgba(255,255,255,.72); border-bottom:1px solid var(--border); z-index:10; }
.site-header .wrap { height:66px; display:flex; align-items:center; justify-content:space-between; }
.brand { display:flex; align-items:center; gap:10px; color:#111; text-decoration:none; font-weight:700; }
.brand img { width:28px; height:28px; }
.nav { display:flex; gap:18px; }
.nav a { color:#111; text-decoration:none; }
.nav a:hover { text-decoration: underline; }
.badge { display:inline-block; min-width:22px; height:22px; line-height:22px; text-align:center; font-size:12px; background:#111; color:#fff; border-radius:11px; padding:0 6px; margin-left:6px; }
.content { padding: 48px 0 72px; }

.site-footer { border-top:1px solid var(--border); background:#fafafa; }
.site-footer .wrap { padding: 26px 0; }
.footer-grid { display:grid; grid-template-columns: 2fr 1fr 1fr; gap: 16px; }
.footer-grid a { display:block; color:#111; text-decoration:none; margin:3px 0; }
.footer-grid a:hover { text-decoration: underline; }
.ftitle { font-weight:700; margin-bottom:6px; color:#111; }

/* ===== Hero ===== */
.hero { margin: 8px 0 26px; }
.hero h1 { font-size: 40px; letter-spacing: .2px; margin: 0 0 8px; }
.hero p { color: var(--muted); margin: 0 0 14px; }
.btn, .btn-outline { display:inline-flex; align-items:center; gap:8px; padding:10px 14px; border-radius:10px; border:1px solid #111; text-decoration:none; cursor:pointer; }
.btn { background:#111; color:#fff; }
.btn:hover { filter: brightness(0.92); }
.btn-outline { background:#fff; color:#111; }
.btn-outline:hover { background:#111; color:#fff; }

/* ===== Grid & Cards ===== */
.grid { display:grid; gap: 18px; }
.grid-squares { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.card { border:1px solid var(--border); border-radius: var(--radius); overflow:hidden; box-shadow: var(--shadow); background:#fff; transition: transform .15s ease, box-shadow .15s ease; }
.card:hover { transform: translateY(-2px); box-shadow: 0 12px 40px rgba(0,0,0,.08); }
.thumb { display:block; background:#f3f4f6; }
.thumb.square { aspect-ratio:1/1; position:relative; overflow:hidden; }
.thumb.square img { position:absolute; inset:0; width:100%; height:100%; object-fit:cover; object-position:center; transition: transform .35s ease; }
.card:hover .thumb.square img { transform: scale(1.04); }
.card-body { padding: 14px 14px 16px; }
.card-body .title { margin: 6px 0 6px; font-size:16px; line-height:1.35; }
.card-body .title a { color:#111; text-decoration:none; }
.card-body .title a:hover { text-decoration: underline; }
.muted { color:var(--muted); }

/* ===== Artwork page ===== */
.artwork { display:grid; grid-template-columns: 1.1fr .9fr; gap: 24px; align-items:start; }
.artwork-main { border:1px solid var(--border); border-radius: var(--radius); overflow:hidden; background:#f3f4f6; }
.artwork-main img { width:100%; height:auto; }
.price { font-weight:700; }
.tag { font-size:12px; padding:.2em .5em; border:1px solid var(--border); border-radius:999px; margin-left:.5em; color:#111; }
.desc { color:#24262b; margin: 10px 0 14px; }
.thumbs { display:grid; grid-template-columns: repeat(auto-fill, minmax(74px,1fr)); gap:10px; margin-top:10px; }
.thumbs img.thumb { width:100%; aspect-ratio:1/1; object-fit:cover; border-radius: 10px; border:1px solid var(--border); cursor:pointer; transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease; }
.thumbs img.thumb:hover { transform: translateY(-1px); border-color:#111; }
.thumbs img.thumb.is-active { box-shadow: 0 0 0 2px #111 inset; border-color:#111; }

@media (max-width: 900px){ .artwork { grid-template-columns:1fr; } }

/* ===== Forms & Table (admin basic alignment preserved) ===== */
.table { width:100%; border-collapse: collapse; }
.table th, .table td { border-bottom: 1px solid var(--border); padding:10px; text-align:left; }
.form label { display:block; margin:10px 0; }
.form input[type="text"], .form input[type="number"], .form textarea { width:100%; border:1px solid var(--border); border-radius:10px; padding:10px; }

/* ===== Accessibility: reduce motion ===== */
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* ===== About page ===== */
.about-hero {
  display:grid; grid-template-columns: 520px 1fr; gap: 36px; align-items:center;
  margin: 8px 0 36px;
}
.about-portrait picture, .about-portrait img {
  display:block; width:100%; height:auto; border-radius:14px; box-shadow: var(--shadow);
}
.about-intro h1 { font-size: 40px; margin:0 0 10px; }
.about-intro .lede { color: var(--muted); font-size: 18px; line-height: 1.6; }
.about-cta { margin-top: 14px; display:flex; gap: 10px; flex-wrap: wrap; }

.about-body { display:grid; grid-template-columns: 1.2fr .8fr; gap: 28px; margin: 10px 0 26px; }
.about-body .col p { margin: 0 0 12px; }
.about-body .meta { display:grid; gap: 12px; }
.about-card { border:1px solid var(--border); border-radius: 14px; padding: 14px 14px 12px; background:#fff; box-shadow: var(--shadow); }
.about-card h3 { margin: 0 0 8px; font-size: 16px; }
ul.plain { list-style: none; margin: 0; padding: 0; }
ul.plain li { margin: 6px 0; }

.about-grid {
  display:grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px;
  margin: 8px 0 32px;
}
.about-cell { border-radius: 14px; overflow: hidden; border:1px solid var(--border); background:#fff; box-shadow: var(--shadow); }
.about-cell img { width:100%; height:auto; display:block; }
.about-cell figcaption { padding: 8px 10px; color:#444; font-size: 14px; }

@media (max-width: 1020px){
  .about-hero { grid-template-columns: 1fr; }
  .about-intro h1 { font-size: 34px; }
}
@media (max-width: 860px){
  .about-body { grid-template-columns: 1fr; }
}
/* ===== Magic underline for nav ===== */
.nav {
  display: flex;
  gap: 26px;
  position: relative;
  align-items: center;
}

.nav a {
  position: relative;
  color: #111;
  text-decoration: none;
  font-weight: 500;
  padding: 6px 0;
  transition: color .25s ease;
}

.nav a:hover {
  color: #000;
}

/* Линия */
.nav-underline {
  position: absolute;
  bottom: -6px;
  left: 0;
  height: 2px;
  background: #111;
  border-radius: 2px;
  width: 0;
  transition: left .3s ease, width .3s ease, opacity .4s ease;
  opacity: 0;
  pointer-events: none;
}
/* ===== Magic underline (header nav) ===== */
.site-header .nav {
  display: flex;
  gap: 26px;
  position: relative;
  align-items: center;
  padding-bottom: 8px;              /* чтобы линия была видна снизу */
}

.site-header .nav a {
  position: relative;
  color: #111;
  text-decoration: none;
  font-weight: 500;
  padding: 6px 0;
  transition: color .25s ease;
}
.site-header .nav a:hover { color: #000; }

/* Подвижная общая линия */
.site-header .nav-underline {
  position: absolute;
  left: 0;
  bottom: 0;
  height: 2px;
  background: #111;
  border-radius: 2px;
  width: 0;                         /* из нуля будет анимироваться */
  opacity: 0;                       /* мягкое появление/исчезновение */
  transform: translateZ(0);         /* фикс микролагов */
  transition: left .28s cubic-bezier(.22,.61,.36,1),
              width .28s cubic-bezier(.22,.61,.36,1),
              opacity .5s ease;
  pointer-events: none;
}

/* ===== CSS-only резерв: индивидуальная линия под каждой ссылкой (если JS не загрузился) ===== */
html:not(.js) .site-header .nav a::after {
  content:"";
  position:absolute;
  left:0;
  bottom:-4px;
  width:100%;
  height:2px;
  background:#111;
  transform:scaleX(0);
  transform-origin:left;
  opacity:0;
  transition: transform .25s ease, opacity .6s ease;
}
html:not(.js) .site-header .nav a:hover::after {
  transform:scaleX(1);
  opacity:1;
}

/* ==== MAGIC UNDERLINE v2 (header) ==== */
.site-header .nav {
  display: flex;
  gap: 26px;
  position: relative;       /* ВАЖНО: чтобы линия позиционировалась внутри меню */
  align-items: center;
  padding-bottom: 10px;     /* место для линии */
}

.site-header .nav a {
  position: relative;
  color: #111;
  text-decoration: none;
  font-weight: 500;
  padding: 6px 0;
  transition: color .25s ease;
  z-index: 2;               /* ссылка поверх линии */
}
.site-header .nav a:hover { color: #000; }

/* Подвижная общая линия */
.site-header .nav-underline {
  position: absolute;
  left: 0;
  bottom: 0;                /* рисуем прямо у низа меню */
  height: 2px;
  background: #111;         /* можно заменить на градиент */
  border-radius: 2px;
  width: 0;                 /* будет анимироваться JS-ом */
  opacity: 0;               /* мягкое появление/исчезание */
  z-index: 1;               /* под ссылками, над фоном */
  transform: translateZ(0); /* сглаживание */
  transition:
    left .28s cubic-bezier(.22,.61,.36,1),
    width .28s cubic-bezier(.22,.61,.36,1),
    opacity .5s ease;
  pointer-events: none;
}

/* РЕЗЕРВ: если JS не загрузился — показываем линию у каждой ссылки отдельно */
html:not(.js) .site-header .nav a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -4px;
  width: 100%;
  height: 2px;
  background: #111;
  transform: scaleX(0);
  transform-origin: left;
  opacity: 0;
  transition: transform .25s ease, opacity .6s ease;
}
html:not(.js) .site-header .nav a:hover::after {
  transform: scaleX(1);
  opacity: 1;
}

