* { box-sizing: border-box; }

:root {
  --bg: #f4f1e8;
  --card: #ffffff;
  --ink: #2c2a26;
  --muted: #6b675e;
  --line: #e5e0d2;
  --accent: #4a6b3a;
  --accent-dark: #3a563a;
  --accent-ink: #ffffff;
  --error: #a3402b;
  --alive: #5b8a4a;
  --dead: #a3402b;
}

body {
  font-family: Georgia, "Times New Roman", serif;
  background-color: #ece4cf;
  background-image:
    radial-gradient(ellipse at 50% 38%, rgba(0,0,0,0) 45%, rgba(58,42,18,0.22) 100%),
    radial-gradient(circle at 18% 22%, rgba(74,107,58,0.07) 0, rgba(74,107,58,0) 38%),
    radial-gradient(circle at 82% 78%, rgba(74,107,58,0.06) 0, rgba(74,107,58,0) 45%),
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='320' height='320' viewBox='0 0 320 320'><g stroke='%23355a25' stroke-width='1.1' stroke-linecap='round' stroke-linejoin='round' opacity='0.42'><path d='M44 70 Q62 38 92 54 Q112 74 96 104 Q66 114 46 88 Z' fill='%235a8a3a' fill-opacity='0.55'/><path d='M56 64 Q70 86 90 92' fill='none'/><path d='M64 70 Q70 80 78 84' fill='none'/><path d='M218 36 Q244 24 262 50 Q268 80 244 92 Q220 80 218 56 Z' fill='%236a9a45' fill-opacity='0.5'/><path d='M228 46 Q240 60 254 66' fill='none'/><path d='M134 226 Q148 200 174 196' fill='none'/><path d='M140 220 Q152 208 166 208' fill='none'/><path d='M146 214 Q154 210 160 212' fill='none'/><path d='M44 224 Q60 206 80 214 Q90 230 78 244 Q60 248 46 238 Z' fill='%234e7a30' fill-opacity='0.55'/><path d='M54 222 Q66 232 76 236' fill='none'/><path d='M242 168 Q258 162 270 178 Q272 194 258 200 Q244 194 240 182 Z' fill='%235a8a3a' fill-opacity='0.5'/><circle cx='250' cy='112' r='2' fill='%23355a25' stroke='none'/><circle cx='110' cy='150' r='1.5' fill='%23355a25' stroke='none'/><circle cx='190' cy='256' r='1.7' fill='%23355a25' stroke='none'/><circle cx='28' cy='160' r='1.4' fill='%23355a25' stroke='none'/></g></svg>"),
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160' viewBox='0 0 160 160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.2  0 0 0 0 0.18  0 0 0 0 0.12  0 0 0 0.06 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
  background-repeat: no-repeat, no-repeat, no-repeat, repeat, repeat;
  background-size: cover, auto, auto, 320px 320px, 160px 160px;
  background-attachment: fixed, fixed, fixed, fixed, fixed;
  margin: 0;
  padding: 1rem;
  color: var(--ink);
  line-height: 1.55;
}

.page {
  max-width: 720px;
  margin: 0 auto;
  padding: 1rem 0 2rem;
}

.page-header {
  text-align: center;
  margin: 0 0 1.5rem;
}
.hero {
  width: 100%;
  height: 180px;
  background-image: url("/assets/img/harvest.jpg");
  background-size: cover;
  background-position: center 35%;
  border-radius: 6px;
  margin-bottom: 1rem;
  filter: sepia(0.25) saturate(0.85);
  box-shadow: inset 0 0 60px rgba(60,40,20,0.35), 0 1px 0 rgba(0,0,0,0.04);
}
.page-header h1 {
  font-size: 1.7rem;
  font-weight: normal;
  margin: 0 0 0.4rem;
  cursor: default;
  user-select: none;
}
.page-header .lead {
  margin: 0;
  color: var(--muted);
  font-style: italic;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 1.25rem 1.5rem;
  margin: 1rem 0;
  box-shadow: 0 1px 0 rgba(0,0,0,.03);
}

.card h2 {
  margin: 0 0 0.75rem;
  font-size: 1.1rem;
  font-weight: normal;
  color: var(--accent-dark);
  border-bottom: 1px solid var(--line);
  padding-bottom: 0.4rem;
}

/* погода */
.weather .forecast {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}
.weather .temp {
  font-size: 2.4rem;
  color: var(--accent);
  font-weight: bold;
  min-width: 5rem;
  text-align: center;
}
.weather .cond p { margin: 0.15rem 0; }
.weather .hint { color: var(--muted); font-style: italic; font-size: 0.92rem; }

/* таблица */
.table-wrap { overflow-x: auto; }
table.cal {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}
table.cal th, table.cal td {
  text-align: left;
  padding: 0.55rem 0.6rem;
  border-bottom: 1px solid var(--line);
}
table.cal th {
  font-weight: normal;
  color: var(--muted);
  background: #faf7ec;
}
table.cal tbody tr:hover { background: #faf7ec; }
.footnote { color: var(--muted); font-style: italic; font-size: 0.88rem; margin: 0.6rem 0 0; }

/* советы */
.tips { margin: 0; padding-left: 1.4rem; }
.tips li { margin: 0.4rem 0; }

/* галерея */
.gallery-lead {
  color: var(--muted);
  font-style: italic;
  margin: 0 0 0.9rem;
}
.gallery {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.8rem;
}
.gallery figure {
  margin: 0;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0.4rem 0.4rem 0.55rem;
  box-shadow: 0 1px 0 rgba(0,0,0,0.04);
  transition: transform 0.18s, box-shadow 0.18s;
}
.gallery figure.clickable { cursor: zoom-in; }
.gallery figure:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}
.gallery img {
  display: block;
  width: 100%;
  height: 140px;
  object-fit: cover;
  border-radius: 3px;
  background: #efece2;
}
.gallery figcaption {
  font-size: 0.82rem;
  color: var(--muted);
  text-align: center;
  margin-top: 0.4rem;
  font-style: italic;
}
@media (max-width: 640px) {
  .gallery { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 380px) {
  .gallery { grid-template-columns: 1fr; }
  .gallery img { height: 180px; }
}

.page-footer {
  text-align: center;
  color: var(--muted);
  font-style: italic;
  margin: 2rem 0 0.5rem;
  font-size: 0.9rem;
}

/* ─── модал логина ─── */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(40, 40, 30, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 100;
}
.modal {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 1.5rem;
  width: 100%;
  max-width: 380px;
  position: relative;
  box-shadow: 0 8px 24px rgba(0,0,0,.18);
}
.modal h3 {
  margin: 0 0 1rem;
  font-size: 1.1rem;
  font-weight: normal;
  color: var(--accent-dark);
}
.modal form { display: flex; flex-direction: column; gap: 0.65rem; }
.modal input[type="password"] {
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 4px;
  font-size: 1rem;
  font-family: inherit;
  background: #fff;
  color: var(--ink);
}
.modal input[type="password"]:focus { outline: none; border-color: var(--accent); }
.modal button[type="submit"] {
  padding: 0.65rem 1rem;
  border-radius: 4px;
  font-size: 0.95rem;
  cursor: pointer;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: var(--accent-ink);
  font-family: inherit;
}
.modal button[type="submit"]:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
.modal button[type="submit"]:disabled { opacity: 0.6; cursor: wait; }
.modal-close {
  position: absolute;
  top: 0.4rem;
  right: 0.6rem;
  background: none;
  border: none;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
  padding: 0.25rem 0.5rem;
}
.modal-close:hover { color: var(--ink); }
.error { color: var(--error); margin: 0.25rem 0 0; font-style: italic; font-size: 0.9rem; }

/* ─── страница участника ─── */
.member-card {
  max-width: 560px;
  margin: 3rem auto 1rem;
  padding: 1.5rem 1.75rem;
}
.member-card h1 { margin: 0; font-size: 1.4rem; font-weight: normal; }
.member-card h2 {
  margin: 1.5rem 0 0.6rem;
  font-size: 0.85rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  font-weight: normal;
  border: none;
  padding: 0;
}
.member-card .subtitle {
  color: var(--muted);
  font-style: italic;
  margin: 0.2rem 0 0.8rem;
}
.header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}
.link-btn {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 0;
  font-size: 0.9rem;
  font-style: italic;
  font-family: inherit;
}
.link-btn:hover { color: var(--ink); text-decoration: underline; }

/* блоки ссылок (несколько маршрутов) */
.links { display: flex; flex-direction: column; gap: 1rem; margin: 0.4rem 0 0; }
.link-block .link-title {
  margin: 0 0 0.35rem;
  font-size: 0.78rem;
  font-weight: normal;
  color: var(--accent-dark);
  text-transform: uppercase;
  letter-spacing: 0.7px;
}
.link-block .link-hint {
  margin: 0.4rem 0 0;
  font-size: 0.85rem;
  color: var(--muted);
  font-style: italic;
}

/* строка с ссылкой и иконкой копирования */
.link-row {
  display: flex;
  align-items: stretch;
  gap: 0.5rem;
  background: #faf7ec;
  border: 1px dashed var(--line);
  border-radius: 4px;
  padding: 0.6rem 0.75rem;
}
.tg-link {
  flex: 1;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 0.82rem;
  word-break: break-all;
  color: var(--accent-dark);
  text-decoration: underline;
  text-underline-offset: 2px;
  align-self: center;
}
.tg-link:hover { color: var(--accent); }
.icon-btn {
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  align-self: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--muted);
  cursor: pointer;
  padding: 0;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.icon-btn:hover { background: #f4f1e8; color: var(--ink); border-color: var(--accent); }
.icon-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.icon-btn.ok { color: var(--alive); border-color: var(--alive); }

/* посты */
.servers { display: flex; flex-direction: column; gap: 0.4rem; }
.server {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0.75rem;
  background: #faf7ec;
  border-radius: 4px;
  font-size: 0.92rem;
}
.server .dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  margin-right: 0.55rem;
  background: var(--dead);
  vertical-align: middle;
}
.server.alive .dot { background: var(--alive); }
.server .endpoint { color: var(--muted); font-size: 0.85em; font-style: italic; }
.server .ms { font-style: normal; font-variant-numeric: tabular-nums; opacity: 0.85; }
.meta { color: var(--muted); font-size: 0.82rem; margin-top: 1rem; text-align: center; font-style: italic; }

@media (max-width: 480px) {
  .page-header h1 { font-size: 1.4rem; }
  .hero { height: 130px; }
  .weather .forecast { flex-direction: column; align-items: flex-start; gap: 0.5rem; }
  .weather .temp { min-width: auto; text-align: left; font-size: 2rem; }
}

/* ─── лайтбокс галереи ─── */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(20, 18, 14, 0.88);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2.5rem 1rem 4rem;
  z-index: 200;
  animation: lb-fade 0.18s ease-out;
}
@keyframes lb-fade {
  from { opacity: 0; }
  to   { opacity: 1; }
}
.lightbox img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 4px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.6);
  background: #1a1714;
}
.lightbox-caption {
  position: absolute;
  bottom: 1rem;
  left: 50%;
  transform: translateX(-50%);
  margin: 0;
  color: #e9e3d2;
  font-style: italic;
  font-size: 0.92rem;
  text-align: center;
  max-width: 90%;
  text-shadow: 0 1px 2px rgba(0,0,0,0.6);
}
.lightbox-close,
.lightbox-nav {
  position: absolute;
  background: rgba(0, 0, 0, 0.35);
  color: #f4f1e8;
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 50%;
  cursor: pointer;
  font-family: inherit;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.12s, border-color 0.12s;
}
.lightbox-close:hover,
.lightbox-nav:hover {
  background: rgba(0, 0, 0, 0.55);
  border-color: rgba(255,255,255,0.35);
}
.lightbox-close {
  top: 0.8rem;
  right: 0.8rem;
  width: 36px;
  height: 36px;
  font-size: 1.5rem;
  padding-bottom: 2px;
}
.lightbox-nav {
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  font-size: 2rem;
  padding-bottom: 4px;
}
.lightbox-nav.prev { left: 0.8rem; }
.lightbox-nav.next { right: 0.8rem; }
@media (max-width: 480px) {
  .lightbox { padding: 1rem 0.5rem 3rem; }
  .lightbox-nav { width: 36px; height: 36px; font-size: 1.5rem; }
  .lightbox-caption { font-size: 0.85rem; }
}
