/* =========================================================================
   FLASH NEWS — базовые стили
   Токены перенесены из theme.json блочной темы Moog (ElmaStudio):
   палитра, флюидная типографика, шкала отступов, Inter Variable.
   ========================================================================= */

/* ---------- Шрифт ---------- */
@font-face {
  font-family: "Inter";
  src: url("/assets/fonts/Inter-VariableFont.woff2") format("woff2-variations");
  font-weight: 200 900;
  font-style: normal;
  font-display: swap;
}

/* ---------- Токены ---------- */
:root {
  /* Цвета (theme.json → settings.color.palette) */
  --text-primary: #0b0b0b;
  --text-secondary: #454545;
  --text-tertiary: rgba(0, 0, 0, 0.4);
  --text-brand: #0265dc;
  --text-accent: #ea3829;
  --surface-primary: #ffffff;
  --surface-secondary: #ebebeb;
  --surface-brand: #59a7f6;
  --border-secondary: #b2b2b2;
  --border-input: rgba(0, 0, 0, 0.1);

  /* Типографика (fluid, как в теме) */
  --text-xxs: 0.875rem;
  --text-xs: 1rem;
  --text-s: 1.125rem;
  --text-m: 1.25rem;
  --text-l: clamp(1.25rem, 1.1rem + 0.6vw, 1.5rem);
  --text-xl: clamp(1.5rem, 1.3rem + 0.9vw, 1.875rem);
  --text-xxl: clamp(1.875rem, 1.6rem + 1.2vw, 2.25rem);
  --text-xxxl: clamp(2.25rem, 1.85rem + 1.8vw, 3rem);
  --text-4xl: clamp(2.25rem, 1.5rem + 3.2vw, 3.75rem);
  --text-6xl: clamp(3rem, 1.7rem + 5.4vw, 5rem);

  --lh-body: 1.55; /* тема даёт 1.3; для кириллицы поднято до читаемого */
  --lh-heading: 1.06;

  /* Отступы (theme.json → spacingSizes) */
  --sp-2: clamp(0.25rem, 0.15rem + 0.44vw, 0.5rem);
  --sp-4: clamp(0.5rem, 0.3rem + 0.88vw, 1rem);
  --sp-6: clamp(0.75rem, 0.38rem + 1.57vw, 1.5rem);
  --sp-7: clamp(1rem, 0.6rem + 1.75vw, 2rem);
  --sp-9: clamp(1.5rem, 0.89rem + 2.63vw, 3rem);
  --sp-10: clamp(2rem, 1.19rem + 3.51vw, 4rem);
  --sp-12: clamp(3rem, 1.79rem + 5.26vw, 6rem);

  /* Layout (theme.json → settings.layout) */
  --content: 45rem;
  --wide: 102.5rem;
  --radius: 1.5rem;
}

/* ---------- Сброс ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--surface-primary);
  color: var(--text-secondary);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: var(--text-xs);
  font-weight: 400;
  line-height: var(--lh-body);
  -webkit-font-smoothing: antialiased;
}

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

a {
  color: var(--text-brand);
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

a:hover {
  color: var(--text-primary);
}

h1,
h2,
h3,
h4 {
  color: var(--text-primary);
  font-weight: 600;
  line-height: var(--lh-heading);
  margin: 0 0 var(--sp-6);
}

h1 {
  font-size: var(--text-6xl);
  letter-spacing: -0.03em;
}

h2 {
  font-size: var(--text-xxl);
  letter-spacing: -0.02em;
}

h3 {
  font-size: var(--text-l);
  letter-spacing: -0.01em;
}

/* ---------- Раскладка ---------- */
.wrap {
  width: 100%;
  max-width: var(--wide);
  margin-inline: auto;
  padding-inline: var(--sp-9);
}

.container {
  width: 100%;
  max-width: var(--content);
  margin-inline: auto;
}

.skip-link {
  position: absolute;
  left: -9999px;
}

.skip-link:focus {
  left: var(--sp-4);
  top: var(--sp-4);
  z-index: 100;
  background: var(--surface-primary);
  padding: var(--sp-4);
  border-radius: 8px;
}

:focus-visible {
  outline: 2px solid var(--text-brand);
  outline-offset: 3px;
}

/* ---------- Шапка ---------- */
.site-header {
  padding-block: var(--sp-9);
}

.site-header__inner {
  background: var(--surface-secondary);
  border-radius: var(--radius);
  padding: var(--sp-6) var(--sp-7);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-6);
}

.site-title {
  font-size: var(--text-m);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  text-decoration: none;
  white-space: nowrap;
}

.site-title:hover {
  color: var(--text-brand);
}

.nav {
  display: flex;
  gap: var(--sp-6);
  align-items: center;
  flex-wrap: wrap;
}

.nav a {
  color: var(--text-primary);
  text-decoration: none;
  font-size: var(--text-xxs);
  font-weight: 600;
}

.nav a:hover,
.nav a[aria-current="page"] {
  color: var(--text-brand);
}

/* ---------- Главная ---------- */
.hero {
  padding-block: var(--sp-10) var(--sp-9);
  max-width: 60rem;
}

.hero p {
  font-size: var(--text-m);
  color: var(--text-secondary);
  margin: 0;
}

.eyebrow {
  font-size: var(--text-xxs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-tertiary);
  margin: 0 0 var(--sp-4);
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(20rem, 1fr));
  gap: var(--sp-9);
  padding-bottom: var(--sp-12);
  list-style: none;
  margin: 0;
  padding-inline: 0;
}

.card {
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
}

.card__media {
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface-secondary);
  aspect-ratio: 16 / 10;
}

.card__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.card:hover .card__media img {
  transform: scale(1.03);
}

.card__title {
  font-size: var(--text-l);
  margin: 0;
}

.card__title a {
  color: var(--text-primary);
  text-decoration: none;
}

.card:hover .card__title a {
  color: var(--text-brand);
}

.card__meta,
.article__meta {
  font-size: var(--text-xxs);
  color: var(--text-tertiary);
}

.card__excerpt {
  margin: 0;
  font-size: var(--text-xxs);
}

/* ---------- Статья ---------- */
.article {
  padding-bottom: var(--sp-12);
}

.article__header {
  padding-block: var(--sp-9);
}

.article__header h1 {
  font-size: var(--text-4xl);
}

.article__cover {
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: var(--sp-9);
}

.article__body {
  font-size: var(--text-s);
}

.article__body p,
.article__body ul,
.article__body ol {
  margin: 0 0 var(--sp-6);
}

.article__body h2 {
  font-size: var(--text-xl);
  margin-top: var(--sp-9);
}

.article__body h3 {
  margin-top: var(--sp-7);
}

.article__body li {
  margin-bottom: var(--sp-2);
}

.article__body figure {
  margin: var(--sp-9) 0;
}

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

.article__body figcaption {
  font-size: var(--text-xxs);
  color: var(--text-tertiary);
  margin-top: var(--sp-2);
}

.article__body blockquote {
  margin: var(--sp-9) 0;
  padding-left: var(--sp-6);
  border-left: 3px solid var(--surface-brand);
  color: var(--text-primary);
  font-size: var(--text-m);
}

.article__body blockquote p:last-child {
  margin-bottom: 0;
}

.breadcrumbs {
  font-size: var(--text-xxs);
  color: var(--text-tertiary);
  padding-block: var(--sp-6) 0;
}

.breadcrumbs a {
  color: var(--text-tertiary);
}

.breadcrumbs a:hover {
  color: var(--text-brand);
}

/* Навигация между статьями */
.post-nav {
  display: flex;
  justify-content: space-between;
  gap: var(--sp-6);
  border-top: 1px solid var(--border-input);
  margin-top: var(--sp-10);
  padding-top: var(--sp-7);
  font-size: var(--text-xxs);
}

.post-nav a {
  font-weight: 600;
  text-decoration: none;
}

/* ---------- Подвал ---------- */
.site-footer {
  padding-block: var(--sp-9);
}

.site-footer__inner {
  background: var(--surface-secondary);
  border-radius: var(--radius);
  padding: var(--sp-10) var(--sp-9);
  text-align: center;
}

.site-footer .nav {
  justify-content: center;
  margin-bottom: var(--sp-7);
}

.footer-credit {
  font-size: var(--text-xxs);
  color: var(--text-tertiary);
  margin: 0;
}

/* ---------- Мобильные ---------- */
@media (max-width: 640px) {
  .site-header__inner {
    flex-direction: column;
    align-items: flex-start;
  }

  .nav {
    gap: var(--sp-4);
  }
}

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