/* =========================================================
   InstaFeed — тема Ghost в стиле инстаграм-ленты
   ========================================================= */

:root {
  --bg: #fafafa;
  --surface: #ffffff;
  --border: #e9e9ec;
  --ink: #1a1a1c;
  --muted: #8e8e93;
  --like: #ec3b5b;
  --link: #2a6fdb;
  --ring-a: #feda75;
  --ring-b: #d62976;
  --ring-c: #4f5bd5;
  --feed-w: 470px;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 8px 24px rgba(0,0,0,.04);
  --font-ui: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-script: "Grand Hotel", cursive;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--gh-font-body, var(--font-ui));
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

:focus-visible {
  outline: 2px solid var(--link);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ---------- Top bar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255,255,255,.86);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
}
.topbar__inner {
  max-width: 975px;
  margin: 0 auto;
  padding: 0 20px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.wordmark {
  font-family: var(--font-script);
  font-size: 30px;
  line-height: 1;
  letter-spacing: .5px;
  color: var(--ink);
  padding-top: 6px; /* оптическое выравнивание скрипт-шрифта */
}
.wordmark--sm { font-size: 22px; }

.nav {
  display: flex;
  align-items: center;
  gap: 18px;
}
.nav ul {
  display: flex;
  align-items: center;
  gap: 18px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.nav a { font-size: 14px; font-weight: 500; color: var(--ink); }
.nav a:hover { color: var(--muted); }
.nav__account {
  font-weight: 600 !important;
  color: var(--link) !important;
}
.nav__subscribe {
  display: inline-flex;
  align-items: center;
  padding: 7px 16px;
  border-radius: 999px;
  background: var(--link);
  color: #fff !important;
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
}
.nav__subscribe:hover { background: #1f5fc4; }

/* ---------- Layout ---------- */
.site {
  max-width: var(--feed-w);
  margin: 0 auto;
  padding: 28px 16px 64px;
}

/* ---------- Profile header ---------- */
.profile {
  display: flex;
  align-items: center;
  gap: 28px;
  padding: 8px 4px 30px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--border);
}
.profile__avatar {
  flex: 0 0 auto;
  width: 90px;
  height: 90px;
  border-radius: 50%;
  padding: 3px;
  background: conic-gradient(from 215deg, var(--ring-a), var(--ring-b), var(--ring-c), var(--ring-a));
}
.profile__avatar img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--surface);
  background: var(--surface);
}
.profile__avatar .avatar__blank {
  border: 3px solid var(--surface);
}
.profile__title {
  font-size: 22px;
  font-weight: 600;
  margin: 0 0 6px;
}
.profile__bio { margin: 0; color: var(--ink); }
.profile__count { margin: 8px 0 0; color: var(--muted); font-size: 14px; }
.profile--archive .profile__title { font-size: 20px; }

/* ---------- Avatar blank fallback ---------- */
.avatar__blank {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  font-weight: 700;
  color: #fff;
  text-transform: uppercase;
  background: linear-gradient(135deg, var(--ring-b), var(--ring-c));
  font-size: 0;
}
.avatar__blank::first-letter { font-size: 16px; }
.avatar__blank--lg::first-letter { font-size: 30px; }

/* ---------- Feed ---------- */
.feed {
  display: flex;
  flex-direction: column;
  gap: 26px;
}

.post-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

/* card header */
.post-card__head {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 12px 14px;
}
.avatar {
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  padding: 2px;
  background: conic-gradient(from 215deg, var(--ring-a), var(--ring-b), var(--ring-c), var(--ring-a));
}
.avatar img,
.avatar .avatar__blank {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--surface);
}
.post-card__byline { display: flex; flex-direction: column; line-height: 1.25; }
.post-card__byline .name { font-weight: 600; font-size: 14px; }
.post-card__byline .name:hover { color: var(--muted); }
.loc { font-size: 12px; color: var(--muted); }
.post-card__time {
  margin-left: auto;
  font-size: 12px;
  color: var(--muted);
}

/* card media — квадрат, как в инсте */
.post-card__media {
  display: block;
  aspect-ratio: 1 / 1;
  background: #f0f0f3;
  overflow: hidden;
}
.post-card__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .5s ease;
}
.post-card__media:hover img { transform: scale(1.03); }

.post-card__placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px;
  text-align: center;
  background: linear-gradient(135deg, var(--ring-c), var(--ring-b));
}
.post-card__placeholder span {
  color: #fff;
  font-size: 22px;
  font-weight: 600;
  line-height: 1.3;
  text-shadow: 0 1px 12px rgba(0,0,0,.25);
}

/* action row */
.post-card__actions {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 14px 4px;
}
.act {
  display: inline-flex;
  padding: 0;
  background: none;
  border: 0;
  cursor: pointer;
  color: var(--ink);
}
.act svg {
  width: 26px;
  height: 26px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform .15s ease;
}
.act:hover svg { transform: scale(1.08); }
.act:active svg { transform: scale(.92); }
.act--save { margin-left: auto; }
.act--like[aria-pressed="true"] svg { fill: var(--like); stroke: var(--like); }

/* card body / caption */
.post-card__body { padding: 4px 14px 16px; }
.caption { margin: 0 0 4px; }
.caption .name { font-weight: 600; margin-right: 6px; }
.caption__title { font-weight: 400; }
.caption__title:hover { color: var(--muted); }
.excerpt { margin: 4px 0 8px; color: #3a3a3e; }
.post-card__more { font-size: 14px; font-weight: 600; color: var(--link); }
.post-card__more:hover { opacity: .8; }
.post-card__date {
  display: block;
  margin-top: 10px;
  font-size: 11px;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--muted);
}

/* infinite-scroll loader / button */
.feed__next {
  display: block;
  width: max-content;
  margin: 30px auto 0;
  padding: 11px 22px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  font-weight: 600;
  font-size: 14px;
  color: var(--ink);
  box-shadow: var(--shadow);
}
.feed__next:hover { background: #f3f3f5; }
.feed__next.is-loading { color: var(--muted); pointer-events: none; }

/* enter animation for appended cards */
.post-card.is-entering { opacity: 0; transform: translateY(14px); }
.post-card { transition: opacity .4s ease, transform .4s ease; }

/* ---------- Single post / page ---------- */
.post {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.post__media { background: #f0f0f3; }
.post__media img { width: 100%; height: auto; }
.post__actions { padding: 12px 16px 6px; }
.post__content { padding: 6px 18px 24px; }
.post__title { font-family: var(--gh-font-heading, var(--font-ui)); font-size: 22px; font-weight: 700; margin: 6px 0 2px; line-height: 1.25; }
.post__caption-author { margin-bottom: 14px; }
.post__caption-author .name { font-weight: 600; }

/* tags */
.post__tags { margin-top: 22px; display: flex; flex-wrap: wrap; gap: 8px; }
.tagchip {
  font-size: 13px;
  font-weight: 500;
  color: var(--link);
  background: #eef3fd;
  padding: 4px 10px;
  border-radius: 999px;
}
.tagchip:hover { background: #e2ebfb; }

/* article content */
.gh-content { font-size: 16px; line-height: 1.7; color: #26262a; }
.gh-content > * { margin: 0 0 1.1em; }
.gh-content h2 { font-family: var(--gh-font-heading, var(--font-ui)); font-size: 20px; font-weight: 700; margin: 1.4em 0 .5em; }
.gh-content h3 { font-family: var(--gh-font-heading, var(--font-ui)); font-size: 17px; font-weight: 700; margin: 1.3em 0 .5em; }
.gh-content a { color: var(--link); text-decoration: underline; text-underline-offset: 2px; }
.gh-content img,
.gh-content .kg-image { border-radius: 10px; }
.gh-content figcaption { font-size: 13px; color: var(--muted); text-align: center; margin-top: 6px; }

/* Koenig editor: wide & full-width breakouts inside the narrow card */
.gh-content .kg-width-wide {
  margin-left: -8px;
  margin-right: -8px;
  width: calc(100% + 16px);
  max-width: none;
}
.gh-content .kg-width-full {
  margin-left: -18px;
  margin-right: -18px;
  width: calc(100% + 36px);
  max-width: none;
}
.gh-content .kg-width-full img { border-radius: 0; width: 100%; }
.gh-content blockquote {
  margin: 1.2em 0;
  padding: 4px 0 4px 18px;
  border-left: 3px solid var(--ink);
  color: #3a3a3e;
  font-style: italic;
}
.gh-content pre {
  background: #16161a;
  color: #f4f4f5;
  padding: 16px;
  border-radius: 10px;
  overflow: auto;
  font-size: 14px;
}
.gh-content code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .92em; }
.kg-bookmark-card { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }

/* comments */
.post__comments { padding: 8px 18px 26px; border-top: 1px solid var(--border); }

/* ---------- Footer ---------- */
.site-foot {
  max-width: 975px;
  margin: 0 auto;
  padding: 30px 20px 50px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px 16px;
  color: var(--muted);
  font-size: 13px;
}
.site-foot__nav ul {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px 16px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.site-foot__nav a { color: var(--muted); }
.site-foot__nav a:hover { color: var(--ink); }
.site-foot__copy { color: var(--muted); }

/* ---------- Responsive ---------- */
@media (max-width: 520px) {
  .site { padding: 16px 0 56px; }
  .feed { gap: 16px; }
  .post-card, .post { border-radius: 0; border-left: 0; border-right: 0; }
  .profile { margin: 0 14px 14px; gap: 18px; }
  .profile__avatar { width: 72px; height: 72px; }
  .topbar__inner { padding: 0 14px; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
  .post-card.is-entering { opacity: 1; transform: none; }
}
