/* Admin of mandaruus.ru — colors of the site, system fonts (they have the Yakut letters ҕ ҥ һ ө ү). */
:root {
  --paper: #f1f2ee;
  --card: #fbfbf9;
  --ink: #293b4d;
  --muted: #5b666e;
  --accent: #386286;
  --line: rgba(41, 59, 77, 0.16);
  --line-strong: rgba(41, 59, 77, 0.32);
  --ok: #2f6b45;
  --ok-bg: #e3efe6;
  --warn-bg: #f4ecd9;
  --err: #a2312b;
  --err-bg: #f7e4e2;
  --r: 10px;
  color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 17px/1.5 system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
}
a { color: var(--accent); }
h1 { font-family: Georgia, 'Times New Roman', serif; font-weight: 400; font-size: clamp(28px, 6vw, 38px); line-height: 1.15; margin: 0; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* ── top bar ── */
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top)); border-bottom: 1px solid var(--line); background: var(--paper); }
.top__brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-family: Georgia, serif; font-size: 19px; min-height: 44px; }
.top__brand small { font-family: system-ui, sans-serif; font-size: 13px; color: var(--muted); margin-left: 4px; }
.top__nav { display: flex; align-items: center; gap: 16px; font-size: 15px; }
.top__nav a, .linkbtn { min-height: 44px; display: inline-flex; align-items: center; }
.top__who { color: var(--muted); }
.top__nav form { margin: 0; }
.linkbtn { border: 0; background: none; padding: 0; font: inherit; color: var(--accent); text-decoration: underline; cursor: pointer; }

/* ── publish status ── */
.pub { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 10px 16px; font-size: 15px; border-bottom: 1px solid var(--line); }
.pub form { margin: 0; }
.pub--ok { background: var(--ok-bg); color: var(--ok); }
.pub--busy { background: var(--warn-bg); }
.pub--busy .pub__text::before { content: ''; display: inline-block; width: 12px; height: 12px; margin-right: 8px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; vertical-align: -1px; animation: spin 0.9s linear infinite; }
.pub--error { background: var(--err-bg); color: var(--err); }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .pub--busy .pub__text::before { animation: none; } }

/* ── layout ── */
.main { max-width: 760px; margin: 0 auto; padding: 20px 16px 64px; padding-bottom: max(64px, env(safe-area-inset-bottom)); }
.head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 8px 0 20px; }
.back { display: inline-flex; align-items: center; min-height: 44px; font-size: 15px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 24px 20px; margin-top: 12px; }
.card--narrow { max-width: 440px; margin: 8vh auto 0; }
.card h1 { margin-bottom: 8px; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.empty { padding: 32px 16px; text-align: center; color: var(--muted); border: 1px dashed var(--line-strong); border-radius: var(--r); }

/* ── buttons ── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 10px 20px; border: 1px solid var(--line-strong); border-radius: 999px; background: var(--card); color: var(--ink); font: inherit; font-size: 16px; font-weight: 500; text-decoration: none; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.btn:hover { border-color: var(--ink); }
.btn--primary { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.btn--primary:hover { background: var(--accent); border-color: var(--accent); }
.btn--danger { background: var(--err); border-color: var(--err); color: #fff; }
.btn--small { min-height: 36px; padding: 6px 14px; font-size: 14px; }
.btn--block { width: 100%; }
.btn[disabled] { opacity: 0.5; cursor: progress; }
.iconbtn { width: 44px; height: 44px; border: 1px solid var(--line-strong); border-radius: 50%; background: var(--card); color: var(--ink); font-size: 18px; cursor: pointer; }
.iconbtn:disabled { opacity: 0.3; cursor: default; }
.iconbtn--danger { color: var(--err); }

/* ── alerts and tags ── */
.alert { padding: 12px 16px; border-radius: var(--r); margin: 0 0 16px; }
.alert p { margin: 0; }
.alert ul { margin: 6px 0 0; padding-left: 20px; }
.alert--ok { background: var(--ok-bg); color: var(--ok); }
.alert--error { background: var(--err-bg); color: var(--err); }
.tag { display: inline-block; padding: 2px 10px; border-radius: 999px; background: var(--paper); border: 1px solid var(--line-strong); font-size: 13px; color: var(--muted); white-space: nowrap; }
.tag--ok { background: var(--ok-bg); border-color: transparent; color: var(--ok); }

/* ── event list ── */
.list { list-style: none; margin: 0 0 20px; padding: 0; display: grid; gap: 10px; }
.item { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.item__main { display: grid; grid-template-columns: 88px minmax(0, 1fr); gap: 14px; padding: 12px; color: inherit; text-decoration: none; }
.item__main:hover .item__title { text-decoration: underline; }
.item__thumb { width: 88px; height: 88px; border-radius: 6px; background: var(--paper) center / 40% no-repeat url('/static/favicon.svg'); overflow: hidden; }
.item__thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.item__body { display: grid; gap: 6px; align-content: center; min-width: 0; }
.item__title { font-weight: 600; line-height: 1.3; overflow-wrap: anywhere; }
.item__meta { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 14px; color: var(--muted); align-items: center; }
.item__site { display: flex; align-items: center; min-height: 44px; padding: 0 12px; border-top: 1px solid var(--line); font-size: 14px; }

/* ── form ── */
.form { display: grid; gap: 22px; }
.field { display: grid; gap: 6px; margin: 0; padding: 0; border: 0; min-width: 0; }
.field > span, .field legend { font-weight: 600; font-size: 15px; padding: 0; }
.field small { color: var(--muted); font-size: 14px; }
input, textarea, select { width: 100%; font: inherit; font-size: 17px; color: var(--ink); background: #fff; border: 1px solid var(--line-strong); border-radius: 8px; padding: 12px; min-height: 48px; }
textarea { resize: vertical; line-height: 1.55; }
input:focus, textarea:focus { outline: 3px solid rgba(56, 98, 134, 0.35); border-color: var(--accent); }
.field--date input { max-width: 240px; }
.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 999px; padding: 4px; gap: 4px; background: #fff; }
.seg label { position: relative; }
.seg input { position: absolute; opacity: 0; width: 1px; height: 1px; min-height: 0; }
.seg span { display: inline-flex; align-items: center; min-height: 40px; padding: 0 18px; border-radius: 999px; cursor: pointer; font-weight: 500; }
.seg input:checked + span { background: var(--ink); color: var(--paper); }
.seg input:focus-visible + span { outline: 3px solid var(--accent); outline-offset: 1px; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; }
.actions .btn { flex: 1 1 200px; }
.danger { margin-top: 40px; padding-top: 16px; border-top: 1px solid var(--line); }
.danger a { color: var(--err); display: inline-flex; align-items: center; min-height: 44px; }

/* ── photos ── */
.photos { list-style: none; margin: 4px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr)); gap: 12px; }
.photos:empty { display: none; }
.photo { position: relative; display: grid; gap: 8px; padding: 8px; background: #fff; border: 1px solid var(--line); border-radius: var(--r); }
.photo__img { display: block; aspect-ratio: 4 / 3; border-radius: 6px; overflow: hidden; background: var(--paper); }
.photo__img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo__cover { display: none; position: absolute; left: 14px; top: 14px; padding: 2px 10px; border-radius: 999px; background: var(--ink); color: var(--paper); font-size: 13px; }
.photo:first-child .photo__cover { display: block; }
.photo:first-child { border-color: var(--ink); }
.photo__caption { font-size: 15px; min-height: 44px; padding: 8px 10px; }
.photo__tools { display: flex; justify-content: space-between; gap: 6px; }
.photo.is-uploading .photo__img { opacity: 0.55; }
.photo.is-uploading .photo__tools, .photo.is-uploading .photo__caption { visibility: hidden; }
.photo__bar { position: absolute; left: 8px; right: 8px; top: 8px; height: 4px; border-radius: 2px; background: var(--line); overflow: hidden; }
.photo__bar i { display: block; height: 100%; width: 0; background: var(--accent); transition: width 0.2s; }
.photos__progress { margin: 0; font-size: 14px; color: var(--muted); }
.btn--file { position: relative; justify-self: start; overflow: hidden; }
.btn--file input { position: absolute; inset: 0; opacity: 0; cursor: pointer; min-height: 0; padding: 0; font-size: 0; }
.btn--file:focus-within { outline: 3px solid var(--accent); outline-offset: 2px; }

@media (min-width: 700px) {
  .main { padding-top: 32px; }
  .card { padding: 32px; }
}
