/* styles.css — domadoma.dp.ua — Dark Slate & Amber editorial theme */

:root {
  color-scheme: dark;

  /* Palette */
  --bg: #121418;
  --bg-deep: #0f1114;
  --surface: #181b21;
  --raised: #1f232a;
  --raised-2: #262b33;
  --border: #2b3039;
  --border-strong: #3a404b;

  --text: #dde0e5;
  --text-soft: #c9cdd4;
  --heading: #eef0f3;
  --muted: #a2a8b2;
  --faint: #8a919c;

  --accent: #d9a55b;
  --accent-hover: #e8bb78;
  --accent-visited: #c49a6c;
  --accent-soft: rgba(217, 165, 91, 0.12);
  --accent-line: rgba(217, 165, 91, 0.45);

  --support: #8fb3a0;
  --support-soft: rgba(143, 179, 160, 0.12);

  --selection-bg: rgba(217, 165, 91, 0.32);
  --focus: #f0c27f;

  /* Typography */
  --font-main: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-head: "Manrope", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  --font-mono: "JetBrains Mono", "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;

  --fs-base: 16px;
  --fs-sm: 0.875rem;
  --fs-xs: 0.78rem;
  --fs-lead: 1.08rem;
  --fs-h1: 1.375rem;
  --fs-h2: 1.25rem;
  --fs-h3: 1.1rem;
  --fs-h4: 1rem;
  --lh-body: 1.72;
  --lh-head: 1.3;

  /* Spacing scale */
  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 24px;
  --s-6: 32px;
  --s-7: 48px;
  --s-8: 64px;

  /* Shape */
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
  --radius-pill: 999px;
  --bw: 1px;
  --line: var(--bw) solid var(--border);

  /* Layout */
  --container: 1160px;
  --measure: 70ch;
  --gutter: var(--s-4);
  --header-h: 60px;

  --ease: cubic-bezier(0.2, 0.6, 0.2, 1);
  --dur: 0.18s;
}

/* ---------- Reset ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  font-size: var(--fs-base);
  background-color: var(--bg);
  scroll-padding-top: calc(var(--header-h) + var(--s-4));
  scrollbar-color: var(--border-strong) var(--bg-deep);
  scrollbar-width: thin;
}

body {
  min-height: 100vh;
  background-color: var(--bg);
  background-image:
    linear-gradient(180deg, rgba(217, 165, 91, 0.035) 0, transparent 360px),
    radial-gradient(rgba(255, 255, 255, 0.018) 1px, transparent 1px);
  background-size: 100% 100%, 22px 22px;
  background-repeat: no-repeat, repeat;
  color: var(--text);
  font-family: var(--font-main);
  font-weight: 400;
  line-height: var(--lh-body);
  overflow-x: hidden;
  overflow-wrap: break-word;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

@supports (overflow: clip) {
  body { overflow-x: clip; }
}

::selection {
  background: var(--selection-bg);
  color: var(--heading);
}

/* Scrollbar (WebKit) */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg-deep); }
::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: var(--radius-pill);
  border: 2px solid var(--bg-deep);
}
::-webkit-scrollbar-thumb:hover { background: #4a515e; }
::-webkit-scrollbar-corner { background: var(--bg-deep); }

img,
svg,
video,
canvas,
picture,
iframe {
  display: block;
  max-width: 100%;
}

img,
video {
  height: auto;
  border-radius: var(--radius-sm);
  filter: brightness(0.92);
}

ul,
ol { list-style: none; }

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

/* ---------- Links ---------- */
a {
  color: inherit;
  text-decoration: none;
  transition: color var(--dur) var(--ease), background-color var(--dur) var(--ease), border-color var(--dur) var(--ease), text-decoration-color var(--dur) var(--ease);
}

:focus { outline: none; }

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

/* ---------- Forms ---------- */
input,
textarea,
select {
  width: 100%;
  min-height: 44px;
  padding: var(--s-2) var(--s-3);
  background: var(--raised);
  color: var(--text);
  border: var(--line);
  border-radius: var(--radius);
  transition: border-color var(--dur) var(--ease), background-color var(--dur) var(--ease);
}

textarea {
  min-height: 120px;
  resize: vertical;
  line-height: 1.6;
}

input::placeholder,
textarea::placeholder { color: var(--faint); opacity: 1; }

input:hover,
textarea:hover,
select:hover { border-color: var(--border-strong); }

input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  border-color: var(--accent);
  outline: 2px solid var(--accent-line);
  outline-offset: 1px;
}

button,
[type="button"],
[type="submit"],
[type="reset"] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  min-height: 44px;
  padding: var(--s-2) var(--s-5);
  background: var(--raised-2);
  color: var(--heading);
  border: var(--bw) solid var(--border-strong);
  border-radius: var(--radius);
  font-weight: 600;
  cursor: pointer;
  transition: background-color var(--dur) var(--ease), border-color var(--dur) var(--ease), color var(--dur) var(--ease);
}

button:hover,
[type="submit"]:hover {
  border-color: var(--accent);
  color: var(--accent-hover);
}

button:active,
[type="submit"]:active {
  background: var(--accent);
  color: #1a1408;
  border-color: var(--accent);
}

/* ---------- Typography ---------- */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-head);
  color: var(--heading);
  font-weight: 700;
  line-height: var(--lh-head);
  letter-spacing: -0.01em;
  overflow-wrap: anywhere;
  hyphens: auto;
}

h1 { font-size: var(--fs-h1); }
h2 { font-size: var(--fs-h2); }
h3 { font-size: var(--fs-h3); font-weight: 650; }
h4 { font-size: var(--fs-h4); font-weight: 650; }

p { overflow-wrap: break-word; }

small { font-size: var(--fs-xs); color: var(--muted); }

strong, b { font-weight: 650; color: var(--heading); }

mark {
  background: var(--accent-soft);
  color: var(--accent-hover);
  padding: 0 var(--s-1);
  border-radius: 3px;
}

kbd {
  display: inline-block;
  padding: 1px var(--s-2);
  font-family: var(--font-mono);
  font-size: 0.82em;
  line-height: 1.5;
  color: var(--heading);
  background: var(--raised-2);
  border: var(--line);
  border-bottom-width: 2px;
  border-radius: var(--radius-sm);
}

code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  padding: 2px 6px;
  background: var(--raised-2);
  color: #eccb97;
  border: var(--line);
  border-radius: var(--radius-sm);
  overflow-wrap: anywhere;
}

pre {
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: var(--s-5) 0;
  padding: var(--s-4) var(--s-5);
  background: var(--bg-deep);
  border: var(--line);
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: 0.875rem;
  line-height: 1.65;
  color: var(--text-soft);
  tab-size: 2;
}

pre code {
  padding: 0;
  background: none;
  border: 0;
  color: inherit;
  font-size: inherit;
  overflow-wrap: normal;
  white-space: pre;
}

hr {
  border: 0;
  height: var(--bw);
  margin: var(--s-7) 0;
  background: linear-gradient(90deg, transparent, var(--border-strong) 20%, var(--border-strong) 80%, transparent);
}

figure {
  margin: var(--s-6) 0;
}

figure img { width: 100%; border: var(--line); border-radius: var(--radius); }

figcaption {
  margin-top: var(--s-2);
  font-size: var(--fs-sm);
  color: var(--muted);
  line-height: 1.55;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.94rem;
}

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(18, 20, 24, 0.94);
  border-bottom: var(--line);
}

@supports (backdrop-filter: blur(8px)) or (-webkit-backdrop-filter: blur(8px)) {
  .site-header {
    background: rgba(18, 20, 24, 0.82);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
  }
}

.header-inner {
  max-width: var(--container);
  min-height: var(--header-h);
  margin: 0 auto;
  padding: var(--s-2) var(--gutter);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-4);
  flex-wrap: wrap;
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: var(--s-3);
  min-height: 44px;
  min-width: 0;
  font-family: var(--font-head);
  font-weight: 800;
  font-size: 1.05rem;
  letter-spacing: 0.02em;
  color: var(--heading);
}

.logo svg,
.logo img {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  filter: none;
  color: var(--accent);
}

.logo:hover { color: var(--accent-hover); }

.lang-switcher {
  display: flex;
  align-items: center;
  gap: var(--s-1);
  padding: 3px;
  background: var(--surface);
  border: var(--line);
  border-radius: var(--radius-pill);
  font-size: var(--fs-sm);
  font-weight: 600;
}

.lang-switcher a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 38px;
  padding: 0 var(--s-3);
  border-radius: var(--radius-pill);
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: var(--fs-xs);
}

.lang-switcher a:hover {
  color: var(--heading);
  background: var(--raised);
}

.lang-switcher a.active {
  color: #1a1408;
  background: var(--accent);
}

/* ---------- Main ---------- */
main {
  display: block;
  max-width: var(--container);
  margin: 0 auto;
  padding: var(--s-6) var(--gutter) var(--s-7);
}

.article-title {
  max-width: 34ch;
  margin-bottom: var(--s-5);
  padding-left: var(--s-4);
  border-left: 3px solid var(--accent);
  font-size: var(--fs-h1);
  line-height: 1.3;
  color: var(--heading);
}

/* ---------- Hero ---------- */
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--s-5);
  margin-bottom: var(--s-7);
  padding: var(--s-4);
  background: var(--surface);
  border: var(--line);
  border-radius: var(--radius-lg);
}

.hero-content {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
}

.hero-content .lead {
  margin-bottom: var(--s-5);
  font-size: var(--fs-lead);
  line-height: 1.7;
  color: var(--text);
}

.meta-info {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-2) var(--s-3);
  padding-top: var(--s-4);
  border-top: var(--line);
  font-size: var(--fs-sm);
  color: var(--muted);
}

.meta-info svg {
  width: 16px;
  height: 16px;
  color: var(--accent);
  flex-shrink: 0;
}

.hero-visual {
  position: relative;
  width: 100%;
  height: 220px;
  overflow: hidden;
  background: var(--raised);
  border: var(--line);
  border-radius: var(--radius);
}

.visual-texture {
  width: 100%;
  height: 100%;
  background-color: var(--raised);
  background-image:
    linear-gradient(135deg, rgba(217, 165, 91, 0.1), transparent 55%),
    linear-gradient(315deg, rgba(143, 179, 160, 0.08), transparent 50%),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.025) 0 1px, transparent 1px 24px),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.025) 0 1px, transparent 1px 24px);
}

.hero-visual img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  border-radius: 0;
  filter: brightness(0.9) saturate(0.95);
}

/* ---------- Article content ---------- */
.content-body {
  max-width: var(--measure);
  margin: 0 auto var(--s-7);
  font-size: 1rem;
  line-height: var(--lh-body);
}

.content-body > *:first-child { margin-top: 0; }

.content-body p {
  margin-bottom: var(--s-5);
  color: var(--text-soft);
}

.content-body a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: var(--accent-line);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  overflow-wrap: anywhere;
}

.content-body a:visited { color: var(--accent-visited); }

.content-body a:hover {
  color: var(--accent-hover);
  text-decoration-color: currentColor;
  text-decoration-thickness: 2px;
}

.content-body h2,
.content-body h3,
.content-body h4 {
  color: var(--heading);
  scroll-margin-top: calc(var(--header-h) + var(--s-4));
}

.content-body h2 {
  position: relative;
  margin: var(--s-7) 0 var(--s-4);
  padding-top: var(--s-5);
  border-top: var(--line);
  font-size: var(--fs-h2);
}

.content-body h2::before {
  content: "";
  position: absolute;
  top: -1px;
  left: 0;
  width: 48px;
  height: 2px;
  background: var(--accent);
}

.content-body h3 {
  margin: var(--s-6) 0 var(--s-3);
  font-size: var(--fs-h3);
}

.content-body h4 {
  margin: var(--s-5) 0 var(--s-2);
  font-size: var(--fs-h4);
}

.content-body blockquote {
  margin: var(--s-6) 0;
  padding: var(--s-4) var(--s-5);
  background: var(--surface);
  border: var(--line);
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius) var(--radius) 0;
  color: var(--muted);
  font-size: 1.02rem;
  font-style: italic;
  line-height: 1.7;
}

.content-body blockquote p { color: inherit; margin-bottom: var(--s-3); }
.content-body blockquote p:last-child { margin-bottom: 0; }

.content-body blockquote cite {
  display: block;
  margin-top: var(--s-2);
  font-size: var(--fs-sm);
  font-style: normal;
  color: var(--faint);
}

.content-body ul,
.content-body ol {
  margin: 0 0 var(--s-5);
  padding-left: var(--s-5);
}

.content-body ul li,
.content-body ol li {
  margin-bottom: var(--s-2);
  padding-left: var(--s-1);
  color: var(--text-soft);
}

.content-body ul li { list-style-type: disc; }
.content-body ol li { list-style-type: decimal; }

.content-body ul li::marker { color: var(--accent); font-size: 0.95em; }

.content-body ol li::marker {
  color: var(--accent);
  font-weight: 700;
  font-family: var(--font-mono);
  font-size: 0.88em;
}

.content-body li ul,
.content-body li ol {
  margin: var(--s-2) 0 var(--s-2);
  padding-left: var(--s-5);
}

.content-body li ul li { list-style-type: circle; }
.content-body li ul li::marker { color: var(--support); }

.content-body ul li strong,
.content-body ol li strong { color: var(--heading); }

.content-body img,
.content-body video {
  margin: var(--s-5) 0;
  border: var(--line);
  border-radius: var(--radius);
}

.content-body table {
  display: block;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: var(--s-6) 0;
  background: var(--surface);
  border: var(--line);
  border-radius: var(--radius);
}

.content-body th,
.content-body td {
  padding: var(--s-3) var(--s-4);
  text-align: left;
  vertical-align: top;
  border-bottom: var(--line);
  min-width: 120px;
}

.content-body th {
  background: var(--raised);
  color: var(--heading);
  font-weight: 650;
  font-size: var(--fs-sm);
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.content-body td { color: var(--text-soft); }

.content-body tr:last-child td { border-bottom: 0; }

.content-body tbody tr:nth-child(even) td { background: rgba(255, 255, 255, 0.015); }

.content-body tbody tr:hover td { background: var(--accent-soft); }

/* ---------- Related materials ---------- */
.related-materials {
  margin-top: var(--s-8);
}

.section-header {
  display: flex;
  align-items: center;
  gap: var(--s-4);
  margin-bottom: var(--s-5);
}

.section-header h2,
.section-header h3 {
  flex-shrink: 0;
  max-width: 75%;
  font-size: var(--fs-sm);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
}

.divider-line {
  flex-grow: 1;
  height: var(--bw);
  min-width: var(--s-6);
  background: var(--border);
}

.cards-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--s-4);
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: var(--s-5);
  background: var(--surface);
  border: var(--line);
  border-radius: var(--radius-lg);
  transition: border-color var(--dur) var(--ease), background-color var(--dur) var(--ease), transform var(--dur) var(--ease);
}

.card:hover {
  background: var(--raised);
  border-color: var(--accent-line);
  transform: translateY(-2px);
}

.card:focus-within { border-color: var(--accent-line); }

.card a { color: inherit; }

.card a:hover { color: var(--accent-hover); }

.card-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-2);
  margin-bottom: var(--s-4);
  font-size: var(--fs-xs);
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px var(--s-3);
  background: var(--accent-soft);
  color: var(--accent);
  border: var(--bw) solid rgba(217, 165, 91, 0.28);
  border-radius: var(--radius-pill);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  line-height: 1.5;
}

.badge.accent-badge {
  background: var(--support-soft);
  color: var(--support);
  border-color: rgba(143, 179, 160, 0.3);
}

.date {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.75rem;
}

.card h4 {
  margin-bottom: var(--s-2);
  font-size: 1.02rem;
  line-height: 1.4;
  color: var(--heading);
}

.card p {
  flex-grow: 1;
  margin-bottom: var(--s-4);
  font-size: 0.92rem;
  line-height: 1.6;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-footer {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  padding-top: var(--s-3);
  border-top: var(--line);
  color: var(--faint);
}

.card-footer svg {
  width: 18px;
  height: 18px;
  transition: transform var(--dur) var(--ease), color var(--dur) var(--ease);
}

.card:hover .card-footer { color: var(--accent); }
.card:hover .card-footer svg { transform: translateX(3px); }

/* ---------- Footer ---------- */
footer {
  margin-top: var(--s-7);
  background: var(--bg-deep);
  border-top: var(--line);
}

.footer-inner {
  max-width: var(--container);
  margin: 0 auto;
  padding: var(--s-6) var(--gutter);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--s-4);
  text-align: center;
}

.footer-left {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  font-size: var(--fs-sm);
  color: var(--muted);
}

.footer-left svg {
  width: 20px;
  height: 20px;
  color: var(--accent);
}

.footer-center {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--s-1) var(--s-2);
}

.footer-center a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 var(--s-3);
  border-radius: var(--radius-sm);
  font-size: var(--fs-sm);
  color: var(--text-soft);
  text-decoration: underline;
  text-decoration-color: transparent;
  text-underline-offset: 4px;
}

.footer-center a:hover {
  color: var(--accent-hover);
  text-decoration-color: var(--accent-line);
}

.dmca-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  min-height: 32px;
  padding: var(--s-1) var(--s-3);
  background: var(--surface);
  border: var(--line);
  border-radius: var(--radius-sm);
  font-size: var(--fs-xs);
  color: var(--muted);
  cursor: default;
}

.dmca-badge svg {
  width: 14px;
  height: 14px;
  color: var(--support);
}

/* ---------- Breakpoints ---------- */
@media (min-width: 480px) {
  :root {
    --gutter: 20px;
    --fs-h1: 1.5rem;
    --fs-h2: 1.3rem;
  }

  .hero { padding: var(--s-5); }
  .hero-visual { height: 260px; }
}

@media (min-width: 768px) {
  :root {
    --fs-base: 17px;
    --gutter: var(--s-6);
    --fs-h1: 1.625rem;
    --fs-h2: 1.35rem;
    --fs-h3: 1.14rem;
    --header-h: 64px;
  }

  main { padding-top: var(--s-7); padding-bottom: var(--s-8); }

  .article-title { margin-bottom: var(--s-6); padding-left: var(--s-5); }

  .hero-visual { height: 320px; }

  .cards-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-5); }

  .content-body blockquote { padding: var(--s-5) var(--s-6); }

  .footer-inner {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: space-between;
    text-align: left;
  }

  .footer-left { justify-content: flex-start; }
}

@media (min-width: 1024px) {
  :root {
    --fs-base: 17.5px;
    --fs-h1: 1.8rem;
    --fs-h2: 1.42rem;
    --fs-h3: 1.18rem;
  }

  .hero {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
    align-items: stretch;
    gap: var(--s-6);
    padding: var(--s-6);
  }

  .hero-visual {
    height: 100%;
    min-height: 380px;
  }

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

  .footer-inner { flex-wrap: nowrap; }
}

@media (min-width: 1280px) {
  :root {
    --fs-base: 18px;
    --fs-h1: 1.875rem;
  }

  .hero-visual { min-height: 420px; }
}

/* ---------- Motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .card:hover,
  .card:hover .card-footer svg { transform: none; }
}

/* ---------- Print ---------- */
@media print {
  body { background: #fff; color: #111; }
  .site-header, footer, .related-materials { display: none; }
  .hero, .content-body blockquote, .content-body table { background: none; border-color: #ccc; }
}