/* isv.fitik.me
   Tokens, sizes and spacing follow design/Main-v2.dc.html and Article-v2.dc.html.
   Zero radius, no shadows, no gradients except the .rule-x divider. */

:root {
  color-scheme: light;
  --bg: #FFFFFF;
  --ink: #1A1A18;
  --muted: #5C5B56;
  --rule: #E5E3DD;
  --soft: #F3F2EE;
  --chip: #EFEDE7;
  --accent: #B4282E;
  --img: #E7E5DF;
  --dash2: #E3A800;
  --shade: #000000; /* hovered boxes mix a little of this into their background */
  --body: 'Literata', Georgia, serif;
  --ui: 'IBM Plex Sans', system-ui, sans-serif; /* labels, buttons, tags, meta */
  --mono: 'IBM Plex Mono', ui-monospace, monospace; /* code and addresses */
}

/* Dark: chosen with the header button, or by the system when nothing is chosen. */
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #111316; --ink: #E9EAEC; --muted: #A1A7B0; --rule: #2B2F36; --soft: #181B1F;
  --chip: #1B2A38; --accent: #FF7A70; --img: #23272D; --dash2: #F2C230;
  --shade: #FFFFFF;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #111316; --ink: #E9EAEC; --muted: #A1A7B0; --rule: #2B2F36; --soft: #181B1F;
    --chip: #1B2A38; --accent: #FF7A70; --img: #23272D; --dash2: #F2C230;
    --shade: #FFFFFF;
  }
}

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

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

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--body);
  font-size: 21px;
  line-height: 1.65;
}

main { flex: 1 0 auto; }

img, picture, svg { max-width: 100%; }
img { height: auto; }
picture { display: contents; }

a {
  color: var(--ink);
  text-decoration-color: var(--accent);
  text-decoration-thickness: 1.5px;
  text-underline-offset: 4px;
}
a:hover { color: var(--accent); }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

h1, h2, h3 { margin: 0; font-weight: 700; overflow-wrap: break-word; }
h1 { line-height: 1.15; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

/* Controls that only work with JavaScript stay hidden without it. */
html:not(.js) .needs-js { display: none !important; }

[hidden] { display: none !important; }

/* Microformats values for machines; they take no space. */
data:empty { display: none; }

.wrap {
  width: 100%;
  max-width: calc(1040px + 48px);
  margin: 0 auto;
  padding-left: 24px;
  padding-right: 24px;
}
.wrap-narrow {
  width: 100%;
  max-width: calc(720px + 48px);
  margin: 0 auto;
  padding-left: 24px;
  padding-right: 24px;
}

.eyebrow {
  margin: 0;
  font-family: var(--ui);
  font-weight: 500;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.section-title { font-size: 28px; line-height: 1.3; }

/* ---------- Divider ---------- */

.rule-x {
  height: 4px;
  flex: none;
  background: repeating-linear-gradient(90deg,
    var(--accent) 0 18px, transparent 18px 26px,
    var(--dash2) 26px 44px, transparent 44px 52px);
}

/* ---------- Header ---------- */

.header-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
  padding-top: 16px;
  padding-bottom: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  text-decoration: none;
}
.brand .sticker { display: block; flex: none; }
.brand-text { display: flex; flex-direction: column; gap: 1px; line-height: 1.15; }
.brand-name { font-family: var(--body); font-weight: 700; font-size: 21px; }
.brand-domain { font-family: var(--mono); font-size: 13px; color: var(--muted); }

.controls { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
/* Narrow screens: the buttons get their own row under the name, «Мењу» at its right end.
   640 px: the header stops fitting on one row a little below this (in both scripts). */
@media (max-width: 640px) {
  .controls { flex-basis: 100%; }
  .menu { margin-left: auto; }
}

.script-switch { display: flex; border: 1px solid var(--rule); }
.script-switch a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  min-width: 56px;
  padding: 0 12px;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--ui);
  font-size: 16px;
  text-decoration: none;
}
.script-switch a[aria-current] { background: var(--ink); color: var(--bg); }

.icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--rule);
  border-radius: 0;
  background: var(--bg);
  color: var(--ink);
  cursor: pointer;
}
.icon-btn[aria-expanded="true"] { background: var(--ink); color: var(--bg); }

/* Theme button shows the moon in light mode and the sun in dark mode. */
.to-dark { display: flex; }
.to-light { display: none; }
:root[data-theme="dark"] .to-dark { display: none; }
:root[data-theme="dark"] .to-light { display: flex; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .to-dark { display: none; }
  :root:not([data-theme="light"]) .to-light { display: flex; }
}

.menu { position: relative; }
.menu summary {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid var(--rule);
  background: var(--bg);
  color: var(--ink);
  font-family: var(--ui);
  font-size: 16px;
  cursor: pointer;
  list-style: none;
  user-select: none;
}
.menu summary::-webkit-details-marker { display: none; }
.menu nav {
  position: absolute;
  right: 0;
  top: 52px;
  z-index: 10;
  width: 280px;
  max-width: calc(100vw - 48px);
  padding: 8px 0;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  border: 1px solid var(--ink);
}
.menu nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  padding: 0 16px;
  font-size: 19px;
  text-decoration: none;
}
.menu nav svg { flex: none; }
.menu nav .ext { margin-left: auto; color: var(--muted); }

.search-panel { padding-bottom: 16px; }
.search-field {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  padding: 0 14px;
  border: 1px solid var(--ink);
  background: var(--bg);
}
.search-field svg { flex: none; color: var(--muted); }
.search-field input {
  flex: 1 1 auto;
  min-width: 0;
  height: 50px;
  border: none;
  outline: none;
  background: transparent;
  color: var(--ink);
  font-family: var(--body);
  font-size: 20px;
}
.search-field:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
input[type="search"]::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; }

.search-results {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--ink);
  border-top: none;
  background: var(--bg);
}
.search-results a {
  display: flex;
  align-items: center;
  min-height: 48px;
  padding: 0 14px;
  border-top: 1px solid var(--rule);
  font-size: 19px;
  text-decoration: none;
}
.search-results p { margin: 0; padding: 12px 14px; color: var(--muted); font-size: 18px; }

/* ---------- Chips (tags) ---------- */

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 14px;
  border: none;
  border-radius: 0;
  background: var(--chip);
  color: var(--ink);
  font-family: var(--ui);
  font-size: 17px;
  text-decoration: none;
  cursor: pointer;
}
.chip .hash { color: var(--accent); }
.chip .count { color: var(--muted); margin-left: 6px; }
.chip[aria-current] { background: var(--ink); color: var(--bg); }
.chip[aria-current] .hash,
.chip[aria-current] .count { color: var(--bg); }

.chips.small { gap: 6px; margin-top: 4px; }
.chips.small .chip { padding: 0 10px; font-size: 15px; }
.chips.meta-tags { gap: 6px; }
.chips.meta-tags .chip { padding: 0 12px; font-size: 16px; }

/* ---------- Home ---------- */

.home {
  padding-top: 48px;
  padding-bottom: 72px;
  display: flex;
  flex-direction: column;
  gap: 40px;
}

.intro { display: flex; flex-direction: column; gap: 10px; max-width: 760px; }
.intro h1 { font-size: clamp(30px, 7.5vw, 44px); }
.intro p { margin: 0; color: var(--muted); }

.topics { display: flex; flex-direction: column; gap: 14px; }

.posts { display: flex; flex-direction: column; }

.list-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--ink);
}
/* While the tag filter (?tema=…) loads, the unfiltered list stays hidden.
   site.js shows it again; so does a 3 s fallback if the script never runs. */
.filtering .posts { visibility: hidden; animation: reveal 0s 3s forwards; }
@keyframes reveal { to { visibility: visible; } }

.clear-filter {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid var(--rule);
  background: var(--bg);
  color: var(--ink);
  font-family: var(--ui);
  font-size: 16px;
  text-decoration: none;
}

.post-item {
  display: flex;
  flex-wrap: wrap;
  gap: 20px 32px;
  padding: 28px 0;
  border-bottom: 1px solid var(--rule);
}
.post-item-text {
  flex: 1 1 420px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.post-item h3 { font-size: 28px; line-height: 1.25; }
.post-item h3 a { text-decoration: none; }
.post-item p { margin: 0; }

.thumb {
  flex: 0 0 168px;
  height: 126px;
  display: block;
  overflow: hidden;
  background: var(--img);
}
.thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
@media (max-width: 560px) {
  .thumb { flex: 1 1 100%; height: auto; aspect-ratio: 4 / 3; }
}

.empty { margin: 0; padding: 28px 0; color: var(--muted); }

.more {
  align-self: center;
  margin-top: 24px;
  display: inline-flex;
  align-items: center;
  min-height: 48px;
  padding: 0 24px;
  border: 1px solid var(--ink);
  background: var(--bg);
  color: var(--ink);
  font-family: var(--ui);
  font-size: 16px;
  text-decoration: none;
}

/* ---------- Resources ---------- */

.resources {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 16px;
  scroll-margin-top: 16px;
  container: resources / inline-size; /* .grid88 columns follow its width */
}
.resources-head {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--ink);
}
.resources-head p { margin: 0; font-size: 17px; color: var(--muted); }

.grid88 {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  border-top: 1px solid var(--rule);
  border-left: 1px solid var(--rule);
}
.grid88 > * {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 72px;
  border-right: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  text-decoration: none;
}
.grid88 img { display: block; width: 88px; height: 31px; image-rendering: pixelated; }
/* Columns: the largest count that divides the number of buttons (classes c2..c9,
   set by the template) and still gives each cell at least 112 px. Later rules win. */
@container resources (min-width: 224px) { .grid88.c2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@container resources (min-width: 336px) { .grid88.c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@container resources (min-width: 448px) { .grid88.c4 { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@container resources (min-width: 560px) { .grid88.c5 { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
@container resources (min-width: 672px) { .grid88.c6 { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
@container resources (min-width: 784px) { .grid88.c7 { grid-template-columns: repeat(7, minmax(0, 1fr)); } }
@container resources (min-width: 896px) { .grid88.c8 { grid-template-columns: repeat(8, minmax(0, 1fr)); } }
@container resources (min-width: 1008px) { .grid88.c9 { grid-template-columns: repeat(9, minmax(0, 1fr)); } }

/* ---------- Article ---------- */

.article-main {
  padding-top: 32px;
  padding-bottom: 80px;
  display: flex;
  flex-direction: column;
  gap: 26px;
  line-height: 1.7;
}

.back {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-family: var(--ui);
  font-size: 16px;
  text-decoration: none;
}
.back span { margin-right: 8px; }

.h-entry { display: flex; flex-direction: column; gap: 26px; }

.article-head { display: flex; flex-direction: column; gap: 12px; }
.article-head h1 { font-size: clamp(32px, 8vw, 48px); }
.meta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--rule);
}
.meta { font-family: var(--ui); font-size: 15px; color: var(--muted); }

/* Body text */
.prose > * { margin-top: 0; margin-bottom: 0; }
.prose > * + * { margin-top: 26px; }
.prose > p:first-child { font-size: 23px; }
.prose h2 { margin-top: 42px; font-size: 32px; line-height: 1.25; }
.prose h3 { margin-top: 36px; font-size: 26px; line-height: 1.3; }
.prose ul, .prose ol { padding-left: 1.3em; }
.prose li + li { margin-top: 6px; }
.prose li::marker { color: var(--accent); }
.prose blockquote { margin-left: 0; margin-right: 0; padding-left: 20px; border-left: 4px solid var(--accent); color: var(--muted); }
.prose blockquote > * { margin: 0; }
.prose blockquote > * + * { margin-top: 12px; }
.prose hr { border: 0; border-top: 1px solid var(--rule); }
.prose code { font-family: var(--mono); font-size: 0.85em; padding: 0.1em 0.3em; background: var(--soft); }
.prose pre {
  overflow-x: auto;
  padding: 16px 20px;
  background: var(--soft);
  font-family: var(--mono);
  font-size: 16px;
  line-height: 1.5;
}
.prose pre code { padding: 0; background: none; font-size: inherit; }
.prose table { display: block; overflow-x: auto; border-collapse: collapse; }
.prose th, .prose td { padding: 8px 14px; border: 1px solid var(--rule); text-align: left; }
.prose img { display: block; max-width: 100%; height: auto; }

.link-icon { display: inline-block; vertical-align: -3px; margin-right: 4px; }
.link-icon-arrow { vertical-align: -2px; margin-right: 0; margin-left: 4px; }
.nw { white-space: nowrap; }

.post-image { margin: 16px 0 0; display: flex; flex-direction: column; gap: 12px; }
.post-image img { display: block; width: 100%; height: auto; background: var(--img); }
.post-image figcaption { font-size: 17px; line-height: 1.5; color: var(--muted); }

.transcription {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 18px 22px;
  border: 1px solid var(--rule);
}
.transcription .eyebrow { font-size: 13px; font-weight: 400; }
.transcription p { margin: 0; font-size: 19px; white-space: pre-line; }

.related { display: flex; flex-direction: column; gap: 26px; margin-top: 24px; }
.related h2 { font-size: 32px; line-height: 1.25; }
.related-list { display: flex; flex-direction: column; border-top: 2px solid var(--ink); }
.related-list a {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 60px;
  padding: 8px 0;
  border-bottom: 1px solid var(--rule);
  font-size: 21px;
  font-weight: 600;
  line-height: 1.35;
  text-decoration: none;
}
.related-list svg { flex: none; color: var(--accent); }

/* Likes and reposts (webmention.io): shown only when there are some. */
.reactions { display: flex; flex-wrap: wrap; gap: 8px 24px; font-family: var(--ui); font-size: 16px; color: var(--muted); }
.reaction { display: inline-flex; align-items: center; gap: 8px; }
.reaction svg { flex: none; color: var(--accent); }

/* ---------- Footer ---------- */

.site-footer { background: var(--soft); }
.footer-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 32px 64px;
  padding-top: 40px;
  padding-bottom: 48px;
  font-size: 18px;
}
.footer-about { flex: 1 1 280px; display: flex; flex-direction: column; gap: 8px; }
.footer-brand { font-family: var(--mono); font-weight: 600; }
.license { margin: 0; color: var(--muted); }
.license a { color: var(--muted); }
.footer-links { display: flex; flex-wrap: wrap; gap: 0 20px; }
.footer-links a { display: inline-flex; align-items: center; gap: 4px; min-height: 44px; }

.follow { flex: 1 1 400px; display: flex; flex-direction: column; gap: 2px; }
.follow .eyebrow { margin-bottom: 4px; font-size: 13px; font-weight: 400; }
.follow-row { display: flex; flex-wrap: wrap; align-items: center; gap: 0 12px; min-height: 44px; }
.follow-label { width: 100px; font-family: var(--ui); font-size: 14px; color: var(--muted); }
.follow-value { font-family: var(--mono); font-size: 16px; overflow-wrap: anywhere; }
a.follow-value { display: inline-flex; align-items: center; min-height: 44px; }

.copy-btn {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--rule);
  border-radius: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--ui);
  font-size: 14px;
  cursor: pointer;
}
.copy-btn > span { display: inline-flex; align-items: center; gap: 6px; }

/* ---------- Hover ----------
   Text links turn --accent (see `a:hover`). Everything drawn as a box
   (buttons, chips, resource cells) keeps its text colour and mixes a little
   --shade into its background: darker in light mode, lighter in dark mode.
   Filled (selected) boxes have --surface: --ink, so they stay as they are.
   Only on devices with a real pointer, so a tap on a phone leaves no shade. */

.license a:hover,
.menu nav a:hover .ext { color: var(--accent); }

.script-switch a, .icon-btn, .menu summary, .clear-filter, .more, .copy-btn, .grid88 > a {
  --surface: var(--bg);
}
.chip { --surface: var(--chip); }
.script-switch a[aria-current], .icon-btn[aria-expanded="true"], .chip[aria-current] {
  --surface: var(--ink);
  --on-surface: var(--bg);
}

@media (hover: hover) {
  :is(.script-switch a, .icon-btn, .menu summary, .chip, .clear-filter, .more, .copy-btn, .grid88 > a):hover {
    background: color-mix(in srgb, var(--surface) 93%, var(--shade));
    color: var(--on-surface, var(--ink));
  }
}
