/* styles.css — photomob.com.ua
   Light editorial / tech theme: ivory paper + forest green + clay accent */

:root {
  /* Palette */
  --bg: #f5f2ea;
  --bg-grid: rgba(47, 84, 64, 0.045);
  --surface: #fbfaf6;
  --card: #ffffff;
  --surface-alt: #eeeae0;
  --code-bg: #efece3;
  --text: #23271f;
  --text-soft: #353a31;
  --muted: #5a6056;
  --border: #dcd7ca;
  --border-soft: #e7e3d8;
  --accent: #2e5a44;
  --accent-strong: #1f4232;
  --accent-tint: rgba(46, 90, 68, 0.09);
  --accent2: #97492a;
  --accent2-tint: rgba(151, 73, 42, 0.09);
  --focus: #1f6fb2;

  /* Typography */
  --font-main: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --font-serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
  --font-mono: ui-monospace, "SF Mono", "Cascadia Code", Menlo, Consolas, "Liberation Mono", monospace;
  --fs-base: 1.0625rem;
  --fs-sm: 0.875rem;
  --fs-xs: 0.75rem;
  --lh-body: 1.7;
  --lh-head: 1.3;

  /* Spacing scale */
  --space-2xs: 4px;
  --space-xs: 8px;
  --space-sm: 12px;
  --space-md: 20px;
  --space-lg: 32px;
  --space-xl: 48px;
  --space-2xl: 72px;

  /* Radius & shadows */
  --radius-sm: 6px;
  --radius: 12px;
  --radius-lg: 18px;
  --radius-pill: 999px;
  --shadow-sm: 0 1px 2px rgba(35, 39, 31, 0.05);
  --shadow: 0 2px 6px rgba(35, 39, 31, 0.04), 0 10px 24px -12px rgba(35, 39, 31, 0.12);
  --shadow-hover: 0 4px 10px rgba(35, 39, 31, 0.05), 0 18px 34px -16px rgba(46, 90, 68, 0.25);

  /* Layout */
  --container: 1160px;
  --measure: 68ch;
  --gutter: 16px;
  --tap: 44px;
  --ease: 0.2s ease;
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  background-color: var(--bg);
  background-image:
    linear-gradient(var(--bg-grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--bg-grid) 1px, transparent 1px);
  background-size: 32px 32px;
  background-position: -1px -1px;
  color: var(--text);
  font-family: var(--font-main);
  font-size: var(--fs-base);
  line-height: var(--lh-body);
  overflow-x: hidden;
  overflow-wrap: break-word;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

img,
video {
  height: auto;
}

iframe {
  border: 0;
}

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

ul,
ol {
  list-style: none;
}

::selection {
  background: rgba(46, 90, 68, 0.2);
  color: var(--text);
}

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

p {
  overflow-wrap: break-word;
}

a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-decoration-color: rgba(46, 90, 68, 0.4);
  text-underline-offset: 0.2em;
  transition: color var(--ease), text-decoration-color var(--ease), background-color var(--ease);
}

a:hover {
  color: var(--accent-strong);
  text-decoration-color: currentColor;
}

a:focus-visible,
button:focus-visible,
[tabindex]:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
  border-radius: 4px;
}

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

small {
  font-size: var(--fs-sm);
}

hr {
  border: 0;
  height: 1px;
  background: var(--border);
  margin: var(--space-xl) 0;
}

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(245, 242, 234, 0.88);
  -webkit-backdrop-filter: saturate(140%) blur(10px);
  backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid var(--border);
}

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

.logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: var(--tap);
  color: var(--text);
  font-weight: 800;
  font-size: 1.05rem;
  letter-spacing: 0.02em;
  text-decoration: none;
  min-width: 0;
}

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

.logo svg,
.logo img {
  flex-shrink: 0;
  width: auto;
  max-height: 32px;
}

.lang-switcher {
  display: flex;
  align-items: center;
  gap: var(--space-2xs);
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.lang-switcher a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--tap);
  min-width: var(--tap);
  padding: 0 var(--space-xs);
  color: var(--muted);
  text-decoration: none;
  border-radius: var(--radius-sm);
}

.lang-switcher a:hover {
  color: var(--accent);
  background: var(--accent-tint);
}

.lang-switcher a.active {
  color: var(--accent);
  font-weight: 700;
  box-shadow: inset 0 -2px 0 var(--accent);
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}

/* ---------- Main layout ---------- */
main {
  display: block;
  max-width: var(--container);
  margin: 0 auto;
  padding: var(--space-lg) var(--gutter) var(--space-xl);
}

.article-title {
  max-width: 40ch;
  margin-bottom: var(--space-lg);
  font-size: clamp(1.25rem, 1.05rem + 1.1vw, 1.9rem);
  font-weight: 750;
  line-height: 1.3;
  letter-spacing: -0.015em;
  color: var(--text);
  overflow-wrap: anywhere;
  padding-left: var(--space-sm);
  border-left: 3px solid var(--accent2);
}

/* ---------- Hero ---------- */
.hero {
  display: grid;
  gap: var(--space-lg);
  margin-bottom: var(--space-xl);
}

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

.hero-content .lead {
  margin-bottom: var(--space-md);
  max-width: var(--measure);
  font-family: var(--font-serif);
  font-size: 1.15rem;
  line-height: 1.65;
  color: var(--text-soft);
}

.meta-info {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-xs) var(--space-sm);
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
  color: var(--muted);
  padding-top: var(--space-sm);
  border-top: 1px dashed var(--border);
}

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

.hero-visual {
  position: relative;
  width: 100%;
  height: 260px;
  overflow: hidden;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.hero-visual::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: inherit;
  box-shadow: inset 0 0 0 6px rgba(255, 255, 255, 0.45);
}

.visual-texture {
  width: 100%;
  height: 100%;
  background-color: var(--surface-alt);
  background-image:
    radial-gradient(at 85% 10%, rgba(151, 73, 42, 0.16) 0, transparent 55%),
    radial-gradient(at 10% 90%, rgba(46, 90, 68, 0.18) 0, transparent 55%),
    repeating-linear-gradient(135deg, rgba(46, 90, 68, 0.06) 0 1px, transparent 1px 12px);
}

.hero-visual img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  border-radius: inherit;
}

/* ---------- Article content ---------- */
.content-body {
  max-width: var(--measure);
  margin: 0 0 var(--space-xl);
  color: var(--text-soft);
}

.content-body > * + * {
  margin-top: var(--space-md);
}

.content-body p {
  font-size: 1em;
  line-height: var(--lh-body);
  color: var(--text-soft);
}

.content-body h2,
.content-body h3,
.content-body h4 {
  margin-top: var(--space-xl);
  margin-bottom: var(--space-sm);
  scroll-margin-top: 80px;
}

.content-body h2 + *,
.content-body h3 + *,
.content-body h4 + * {
  margin-top: 0;
}

.content-body h2 {
  font-size: clamp(1.15rem, 1.05rem + 0.6vw, 1.45rem);
  color: var(--accent-strong);
  padding-bottom: var(--space-xs);
  border-bottom: 1px solid var(--border);
}

.content-body h3 {
  font-size: clamp(1.05rem, 1rem + 0.35vw, 1.2rem);
  color: var(--text);
}

.content-body h3::before {
  content: "§ ";
  color: var(--accent2);
  font-weight: 600;
}

.content-body h4 {
  font-size: 1rem;
  color: var(--text);
}

.content-body a {
  overflow-wrap: anywhere;
}

.content-body blockquote {
  margin: var(--space-lg) 0;
  padding: var(--space-md) var(--space-md) var(--space-md) calc(var(--space-md) + 2px);
  background: var(--accent2-tint);
  border-left: 3px solid var(--accent2);
  border-radius: 0 var(--radius) var(--radius) 0;
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 1.08em;
  line-height: 1.65;
  color: var(--text);
}

.content-body blockquote p {
  color: inherit;
}

.content-body blockquote p + p {
  margin-top: var(--space-sm);
}

.content-body blockquote cite,
.content-body blockquote footer {
  display: block;
  margin-top: var(--space-sm);
  font-family: var(--font-main);
  font-style: normal;
  font-size: var(--fs-sm);
  color: var(--muted);
  background: none;
  border: 0;
}

.content-body ul,
.content-body ol {
  padding-left: 1.4em;
}

.content-body ul li {
  list-style-type: disc;
  color: var(--text-soft);
}

.content-body ol li {
  list-style-type: decimal;
  color: var(--text-soft);
}

.content-body li + li {
  margin-top: var(--space-xs);
}

.content-body li::marker {
  color: var(--accent);
  font-weight: 700;
}

.content-body li > ul,
.content-body li > ol {
  margin-top: var(--space-xs);
}

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

.content-body img,
.content-body video,
.content-body iframe {
  max-width: 100%;
  border-radius: var(--radius);
}

.content-body iframe {
  width: 100%;
  aspect-ratio: 16 / 9;
  height: auto;
}

.content-body figure {
  margin: var(--space-lg) 0;
}

.content-body figcaption {
  margin-top: var(--space-xs);
  font-size: var(--fs-sm);
  color: var(--muted);
}

/* Code */
code,
kbd,
samp,
pre {
  font-family: var(--font-mono);
  font-size: 0.9em;
}

:not(pre) > code,
kbd {
  padding: 0.12em 0.4em;
  background: var(--code-bg);
  border: 1px solid var(--border-soft);
  border-radius: 5px;
  color: var(--accent2);
  overflow-wrap: anywhere;
  word-break: break-word;
}

pre {
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding: var(--space-md);
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  line-height: 1.6;
  color: var(--text);
  tab-size: 4;
}

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

/* Tables */
table {
  display: block;
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-collapse: collapse;
  font-size: 0.95em;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

th,
td {
  padding: 10px 14px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--border-soft);
  min-width: 120px;
}

th {
  background: var(--surface-alt);
  color: var(--text);
  font-weight: 650;
  font-size: var(--fs-sm);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

tbody tr:nth-child(even) {
  background: rgba(238, 234, 224, 0.45);
}

tbody tr:hover {
  background: var(--accent-tint);
}

tbody tr:last-child td {
  border-bottom: 0;
}

/* ---------- Related materials ---------- */
.related-materials {
  margin-top: var(--space-2xl);
}

.section-header {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
}

.section-header h2,
.section-header h3 {
  flex-shrink: 1;
  min-width: 0;
  font-size: 0.85rem;
  font-family: var(--font-mono);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
}

.divider-line {
  flex-grow: 1;
  height: 1px;
  min-width: 24px;
  background: linear-gradient(90deg, var(--border), transparent);
}

.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr));
  gap: var(--space-md);
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: var(--space-md);
  background: var(--card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: transform var(--ease), box-shadow var(--ease), border-color var(--ease);
}

.card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.25s ease;
}

.card:hover,
.card:focus-within {
  transform: translateY(-2px);
  border-color: var(--border);
  box-shadow: var(--shadow-hover);
}

.card:hover::before,
.card:focus-within::before {
  transform: scaleX(1);
}

.card a {
  color: inherit;
  text-decoration: none;
}

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

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

.badge {
  display: inline-block;
  padding: 3px 10px;
  background: var(--accent-tint);
  color: var(--accent-strong);
  border: 1px solid rgba(46, 90, 68, 0.18);
  border-radius: var(--radius-pill);
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  line-height: 1.5;
}

.badge.accent-badge {
  background: var(--accent2-tint);
  color: var(--accent2);
  border-color: rgba(151, 73, 42, 0.2);
}

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

.card h4 {
  margin-bottom: var(--space-xs);
  font-size: 1.02rem;
  line-height: 1.35;
  color: var(--text);
  overflow-wrap: anywhere;
}

.card p {
  flex-grow: 1;
  margin-bottom: var(--space-md);
  font-size: 0.93rem;
  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(--space-sm);
  border-top: 1px solid var(--border-soft);
  color: var(--accent);
  opacity: 0.75;
  transition: opacity var(--ease), transform var(--ease);
}

.card:hover .card-footer {
  opacity: 1;
}

/* ---------- Footer ---------- */
footer {
  margin-top: var(--space-xl);
  background: var(--surface);
  border-top: 1px solid var(--border);
}

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

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

.footer-center {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-2xs) var(--space-sm);
}

.footer-center a {
  display: inline-flex;
  align-items: center;
  min-height: var(--tap);
  padding: 0 var(--space-xs);
  color: var(--text-soft);
  font-size: var(--fs-sm);
  text-decoration: none;
  border-radius: var(--radius-sm);
}

.footer-center a:hover {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 0.25em;
}

.dmca-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 6px 12px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  color: var(--muted);
  cursor: default;
}

/* ---------- Breakpoints ---------- */
@media (min-width: 480px) {
  :root {
    --gutter: 20px;
  }

  .hero-visual {
    height: 300px;
  }

  .content-body blockquote {
    padding-left: var(--space-lg);
  }
}

@media (min-width: 768px) {
  :root {
    --gutter: 32px;
  }

  body {
    font-size: 1.09375rem;
  }

  main {
    padding-top: var(--space-xl);
  }

  .header-inner {
    min-height: 68px;
  }

  .article-title {
    padding-left: var(--space-md);
  }

  .hero-visual {
    height: 360px;
  }

  .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) {
  body {
    font-size: 1.125rem;
  }

  main {
    padding-bottom: var(--space-2xl);
  }

  .hero {
    grid-template-columns: 1fr 1.15fr;
    gap: var(--space-xl);
    align-items: stretch;
  }

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

  .cards-grid {
    gap: var(--space-lg) var(--space-md);
  }
}

@media (min-width: 1280px) {
  :root {
    --gutter: 40px;
  }
}

/* ---------- 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:focus-within {
    transform: none;
  }
}

/* ---------- Print ---------- */
@media print {
  body {
    background: #fff;
    color: #000;
  }

  .site-header {
    position: static;
    backdrop-filter: none;
  }

  .card {
    box-shadow: none;
    break-inside: avoid;
  }
}