/* ==========================================================================
   Αρχοντικό Τσακνάκη — главная страница (адаптивная вёрстка)
   Заменяет таблицы NetObjects Fusion и абсолютное позиционирование.
   ========================================================================== */

:root {
  --sand: #d3c89b;
  --gold: #caa138;
  --ink: #330000;            /* основной цвет текста (было rgb(51,0,0)) */
  --link: #663300;           /* цвет ссылок «περισσότερα» (было rgb(102,51,0)) */
  --link-hover: #b0974e;
  --bar-dark: #050100;

  /* Ширина золотой колонки слева. Поставьте 0px, чтобы убрать её совсем
     (тогда блок карточек центрируется строго по ширине окна). */
  --rail: clamp(150px, 17vw, 210px);

  --card-gap: clamp(14px, 2vw, 24px);
  --card-max: 232px;
}

*,
*::before,
*::after { box-sizing: border-box; }

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

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: "Times New Roman", "Times New Roman Greek", Times, serif;
  font-size: 16px;
  line-height: 1.5;
  color: var(--ink);
  /* песочный фон + золотая колонка слева (как на оригинальном сайте) */
  background: linear-gradient(to right, var(--gold) 0, var(--gold) var(--rail), var(--sand) var(--rail));
}

img { max-width: 100%; height: auto; border: 0; }

a { color: var(--link); text-decoration: none; }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- Верхняя тёмная полоса ---------- */
.topbar {
  height: 12px;
  background: linear-gradient(to bottom, #9c9c9a, #494949 40%, #1e1e1e 75%, var(--bar-dark));
}

/* ---------- Шапка с логотипом ---------- */
.site-header { position: relative; }

.site-header__inner {
  display: flex;
  align-items: flex-start;
  min-height: 232px;
}

.logo {
  display: block;
  flex: 0 0 var(--rail);
  width: var(--rail);
  padding: 8px 12px 0;
  margin-top: -12px;           /* логотип заходит на верхнюю полосу, как раньше */
}
.logo img { display: block; width: 100%; max-width: 194px; margin: 0 auto; }

/* ---------- Главное меню ---------- */
.nav {
  background: linear-gradient(to bottom,
      #9c9c9a 0, #6e6e6e 12%, #494949 25%, #3a3a3a 38%, #2c2c2c 52%,
      #1e1e1e 66%, #101413 80%, var(--bar-dark) 100%);
  border-bottom: 1px solid #000;
}

.nav__toggle { display: none; }

.nav__list {
  list-style: none;
  margin: 0;
  padding: 0 8px;               /* пункты центрируются по всей ширине окна */
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
}

.nav__list a {
  display: block;
  padding: 6px clamp(9px, 1.5vw, 20px);
  font: 700 17px/21px Arial, "Arial Greek", Helvetica, sans-serif;
  color: #fff;
  text-shadow: 0 1px 1px rgba(0, 0, 0, .6);
  white-space: nowrap;
}
.nav__list a:hover,
.nav__list a:focus-visible,
.nav__list a[aria-current="page"] { color: var(--link-hover); }
.nav__list a:focus-visible { outline: 2px solid var(--link-hover); outline-offset: -2px; }

/* ---------- Основная часть ---------- */
.main {
  flex: 1 0 auto;
  padding: clamp(20px, 3vw, 36px) 16px clamp(24px, 4vw, 48px) calc(var(--rail) + 16px);
}

/* Блок карточек — по центру области контента */
.cards {
  list-style: none;
  margin: 0 auto;
  padding: 0;
  max-width: calc(var(--card-max) * 4 + var(--card-gap) * 3);
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--card-gap);
}

.card {
  position: relative;               /* для растянутой ссылки */
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid #9a9a96;
  border-radius: 3px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .35);
  overflow: hidden;
  transition: transform .18s ease, box-shadow .18s ease;
}
.card:hover,
.card:focus-within {
  transform: translateY(-3px);
  box-shadow: 0 6px 14px rgba(0, 0, 0, .35);
}

/* Картинка (заголовок + фото) — отдельный блок, текст никогда не заходит на неё */
.card__title {
  margin: 0;
  font-size: 0;                      /* заголовок — это картинка с текстом */
  line-height: 0;
  background: #000;
}
.card__title img {
  display: block;
  width: 100%;
  aspect-ratio: 164 / 158;
  object-fit: cover;
}

.card__body {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  padding: 14px 14px 12px;
}

.card__text {
  margin: 0 0 14px;
  font-size: 15px;
  line-height: 1.5;
  hyphens: auto;
  -webkit-hyphens: auto;
  overflow-wrap: break-word;
}

.card__more {
  margin-top: auto;                  /* «περισσότερα» всегда прижато к низу карточки */
  align-self: flex-start;
  font: 700 12px/1.4 Arial, "Arial Greek", Helvetica, sans-serif;
  color: var(--link);
}
.card__more::after {                 /* вся карточка — кликабельная */
  content: "";
  position: absolute;
  inset: 0;
}
.card:hover .card__more,
.card__more:focus-visible { color: var(--link-hover); }
.card__more:focus-visible { outline: none; }
.card:focus-within { outline: 2px solid var(--link); outline-offset: 2px; }

/* ---------- Код МИТЕ ---------- */
.mite {
  max-width: calc(var(--card-max) * 4 + var(--card-gap) * 3);
  margin: clamp(18px, 3vw, 32px) auto 0;
  text-align: right;
  font-size: 14px;
  font-weight: 700;
}

/* ---------- Подвал ---------- */
.footer {
  flex-shrink: 0;
  background: #a0761a url("../assets/images/btm-5.jpg") center / cover repeat-x;
  font-size: 13px;
}
.footer__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 4px 24px;
  padding: 10px 16px 10px calc(var(--rail) + 16px);
  min-height: 39px;
}
.footer p { margin: 0; }
.footer a { font-weight: 700; color: var(--link); }
.footer a:hover { color: #fff; }

/* ==========================================================================
   Адаптивность
   ========================================================================== */

/* Планшеты и узкие ноутбуки: 2 × 2 */
@media (max-width: 1040px) {
  .cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    max-width: calc(var(--card-max) * 2 + var(--card-gap));
  }
  .mite { max-width: calc(var(--card-max) * 2 + var(--card-gap)); }
}

/* Телефоны и маленькие планшеты: без золотой колонки, меню-«гамбургер» */
@media (max-width: 720px) {
  :root { --rail: 0px; }

  body { background: var(--sand); }

  .site-header { background: var(--gold); }
  .site-header__inner { min-height: 0; justify-content: center; }
  .logo { flex: 0 0 auto; width: 150px; margin-top: 0; padding: 14px 0 12px; }

  /* меню по умолчанию раскрыто (если JS не сработал); .js включает сворачивание */
  .nav__toggle {
    display: none;
    width: 100%;
    padding: 10px 16px;
    border: 0;
    background: transparent;
    color: #fff;
    font: 700 16px/1.2 Arial, "Arial Greek", Helvetica, sans-serif;
    text-align: left;
    cursor: pointer;
  }
  .js .nav__toggle { display: flex; justify-content: space-between; align-items: center; }
  .nav__toggle::after { content: "▾"; font-size: 18px; transition: transform .2s; }
  .nav__toggle[aria-expanded="true"]::after { transform: rotate(180deg); }
  .js .nav__list[hidden] { display: none; }

  .nav__list { padding: 0; flex-direction: column; justify-content: flex-start; }
  .nav__list li + li { border-top: 1px solid rgba(255, 255, 255, .14); }
  .nav__list a { padding: 12px 16px; font-size: 17px; }

  .main { padding: 20px 14px 28px; }
  .footer__inner { padding: 12px 14px; justify-content: center; text-align: center; }
}

/* Узкие телефоны: одна колонка, карточка по центру */
@media (max-width: 520px) {
  .cards {
    grid-template-columns: minmax(0, 1fr);
    max-width: 340px;
  }
  .mite { max-width: 340px; text-align: center; }
}

@media (prefers-reduced-motion: reduce) {
  .card { transition: none; }
  .card:hover, .card:focus-within { transform: none; }
}
