/* blog.monokoda.com - editorial dark, consistent with monokoda.com
   Display: Fraunces (serif, optical). Body/UI: Work Sans. Accent: violet, with
   a rare orange (from the home water animation) on the reading-progress bar. */

:root {
  --bg: #050418;
  --bg-2: #0a0930;
  --bg-3: #16124d;
  --ink: #eef0ff;
  --muted: rgba(214, 218, 244, 0.86);
  --faint: rgba(198, 204, 234, 0.72);
  --line: rgba(150, 170, 255, 0.16);
  --violet: #a05cff;
  --violet-soft: #b39bea;
  --blue: #3f7cff;
  --orange: #ff8a3d;
  --panel: rgba(25, 23, 64, 0.6);
  --panel-2: rgba(14, 13, 44, 0.6);
  --sans: "Work Sans", ui-sans-serif, system-ui, sans-serif;
  --serif: "Fraunces", Georgia, "Times New Roman", serif;
  --measure: 38rem;
  --pad: clamp(1.4rem, 5vw, 4.5rem);
}

* { box-sizing: border-box; }

/* visible keyboard focus across all interactive elements */
:focus-visible {
  outline: 2px solid var(--violet);
  outline-offset: 3px;
  border-radius: 3px;
}
a:focus-visible { outline-offset: 4px; }

html {
  background: var(--bg);
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100svh;
  color: var(--ink);
  font-family: var(--sans);
  font-weight: 400;
  background:
    radial-gradient(115% 80% at 50% -6%, #100d36 0%, var(--bg-2) 50%, var(--bg) 85%) fixed,
    var(--bg);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

[hidden] { display: none !important; }

/* Pre-paint language selection (head script sets html[data-lang]) so the wrong
   language never flashes before the main i18n script runs. */
html[data-lang="en"] [data-lang-pl] { display: none !important; }
html[data-lang="en"] [data-lang-en] { display: revert !important; }
html[data-lang="pl"] [data-lang-en] { display: none !important; }
html[data-lang="pl"] [data-lang-pl] { display: revert !important; }
img { max-width: 100%; height: auto; display: block; }

/* --- atmosphere overlays (shared language with the home page) --------------- */
.bgdots, .vignette, .grain { position: fixed; inset: 0; pointer-events: none; z-index: 0; }
.bgdots {
  background-image: radial-gradient(rgba(150, 170, 255, 0.5) 1px, transparent 1.5px);
  background-size: 26px 26px;
  opacity: 0.09;
  -webkit-mask-image: radial-gradient(120% 90% at 50% 30%, transparent 50%, #000 100%);
  mask-image: radial-gradient(120% 90% at 50% 30%, transparent 50%, #000 100%);
}
.vignette { background: radial-gradient(78% 70% at 50% 40%, transparent 50%, rgba(3, 2, 16, 0.62) 100%); }
.grain {
  opacity: 0.045; mix-blend-mode: overlay; z-index: 1;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* --- reading progress ------------------------------------------------------ */
.progress { position: fixed; top: 0; left: 0; right: 0; height: 2px; z-index: 50; }
.progress span {
  display: block; height: 100%; transform: scaleX(0); transform-origin: 0 50%;
  background: linear-gradient(90deg, var(--blue), var(--violet));
  box-shadow: 0 0 8px rgba(160, 92, 255, 0.4);
}

/* --- top bar --------------------------------------------------------------- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; padding: clamp(0.85rem, 1.9vw, 1.25rem) var(--pad);
  background: rgba(7, 6, 26, 0.7);
  backdrop-filter: blur(14px) saturate(1.1);
  -webkit-backdrop-filter: blur(14px) saturate(1.1);
  border-bottom: 1px solid rgba(150, 170, 255, 0.08);
}
.brand { display: inline-flex; align-items: baseline; gap: 0.55rem; text-decoration: none; color: var(--ink); }
.brand-mark {
  font-weight: 600; letter-spacing: -0.03em; text-transform: uppercase;
  font-size: clamp(0.95rem, 1.5vw, 1.1rem);
}
.brand-sep { color: var(--faint); font-weight: 400; }
.brand-sub {
  font-family: var(--serif); font-style: italic; font-weight: 400;
  font-size: clamp(1rem, 1.6vw, 1.18rem); color: var(--violet);
  letter-spacing: 0.005em;
}
.brand:hover .brand-sub { color: #c79bff; }

.lang-toggle { display: flex; align-items: center; gap: 0.45rem; font-size: clamp(0.78rem, 1.2vw, 0.9rem); letter-spacing: 0.08em; }
.lang-toggle button {
  appearance: none; background: none; border: 0; padding: 0.15rem 0.1rem; cursor: pointer;
  font: inherit; letter-spacing: inherit; color: var(--faint); transition: color 0.25s ease;
}
.lang-toggle button:hover { color: var(--violet); }
.lang-toggle button.is-active { color: var(--ink); font-weight: 600; }
.lang-toggle .lang-sep { color: rgba(190, 196, 230, 0.3); }

/* --- layout ---------------------------------------------------------------- */
.wrap { position: relative; z-index: 10; padding: 0 var(--pad) clamp(4rem, 10vh, 7rem); }

/* --- index masthead -------------------------------------------------------- */
.masthead {
  max-width: 60rem; margin: clamp(2.5rem, 9vh, 6rem) auto clamp(2.6rem, 7vh, 4.5rem);
  text-align: center;
}
.masthead-kicker {
  margin: 0 0 0.9rem; color: var(--violet); font-weight: 600;
  font-size: 0.82rem; letter-spacing: 0.26em; text-transform: uppercase;
}
.masthead-title {
  margin: 0; font-family: var(--serif); font-weight: 500; font-optical-sizing: auto;
  font-size: clamp(3.2rem, 11vw, 7rem); line-height: 1.04; letter-spacing: -0.02em;
  padding-bottom: 0.12em; /* room for the descender (g) under background-clip: text */
  background: linear-gradient(180deg, #f3f1ff, #c4c6ea);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 0 38px rgba(140, 110, 255, 0.14));
}
.masthead-dek {
  margin: 1.3rem auto 0; max-width: 34rem; color: var(--muted);
  font-size: clamp(1.02rem, 1.7vw, 1.18rem); line-height: 1.55;
}

/* --- cards (editorial: featured first, grid after) ------------------------- */
.cards {
  max-width: 72rem; margin: 0 auto;
  display: grid; grid-template-columns: repeat(2, 1fr); gap: clamp(1.4rem, 3vw, 2.4rem);
}
.card {
  opacity: 0; transform: translateY(14px);
  animation: rise 0.7s cubic-bezier(0.2, 0.7, 0.2, 1) forwards;
  animation-delay: calc(var(--i) * 70ms + 120ms);
}
.card:first-child { grid-column: 1 / -1; }
@keyframes rise { to { opacity: 1; transform: none; } }

.card-link {
  display: flex; flex-direction: column; height: 100%;
  text-decoration: none; color: inherit;
  border: 1px solid rgba(160, 175, 255, 0.18); border-radius: 16px; overflow: hidden;
  background: linear-gradient(180deg, var(--panel), var(--panel-2));
  box-shadow: 0 18px 44px -30px rgba(0, 0, 0, 0.9), inset 0 1px 0 rgba(255, 255, 255, 0.04);
  transition: transform 0.4s cubic-bezier(0.2, 0.7, 0.2, 1), border-color 0.4s ease, box-shadow 0.4s ease;
}
.card-link:hover {
  transform: translateY(-4px);
  border-color: rgba(160, 92, 255, 0.42);
  box-shadow: 0 30px 66px -30px rgba(50, 26, 120, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}
.card-media { position: relative; aspect-ratio: 16 / 9; overflow: hidden; background: #0c0a2a; }
.card-media img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.6s cubic-bezier(0.2, 0.7, 0.2, 1), filter 0.6s ease; filter: saturate(0.8) brightness(0.88); }
.card-media::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(180deg, rgba(8, 7, 30, 0.12) 0%, rgba(8, 7, 30, 0) 34%, rgba(10, 9, 36, 0.55) 100%);
}
.card-link:hover .card-media img { transform: scale(1.03); filter: saturate(0.92) brightness(0.95); }
.card:first-child .card-media { aspect-ratio: 21 / 8; }

.card-body { padding: clamp(1.1rem, 2vw, 1.6rem); display: flex; flex-direction: column; gap: 0.6rem; flex: 1; }
.card-meta { display: flex; align-items: center; gap: 0.5rem; font-size: 0.8rem; color: var(--faint); letter-spacing: 0.01em; }
.card-meta .dot { opacity: 0.6; }
.lang-badge {
  margin-left: auto; font-size: 0.62rem; font-weight: 600; letter-spacing: 0.12em;
  padding: 0.18rem 0.42rem; border: 1px solid var(--line); border-radius: 999px; color: var(--faint);
}
.card-title {
  margin: 0; font-family: var(--serif); font-weight: 500; font-optical-sizing: auto;
  font-size: clamp(1.3rem, 2.4vw, 1.75rem); line-height: 1.1; letter-spacing: -0.01em; color: var(--ink);
}
.card:first-child .card-title { font-size: clamp(1.8rem, 4vw, 3rem); }
.card-dek { margin: 0; color: var(--muted); font-size: 0.98rem; line-height: 1.5; }
.card:first-child .card-dek { font-size: clamp(1rem, 1.6vw, 1.15rem); max-width: 46rem; }
.card-cue { margin-top: auto; color: var(--violet); font-size: 1.1rem; transition: transform 0.4s ease; }
.card-link:hover .card-cue { transform: translateX(5px); }

/* --- article (desktop: header + wide cover, sticky meta rail, reading col) -- */
.article { max-width: 44rem; margin: 0 auto; }
.back {
  display: inline-flex; align-items: center; gap: 0.4rem; text-decoration: none;
  color: var(--faint); font-size: 0.9rem; letter-spacing: 0.01em;
  margin: clamp(0.5rem, 3vh, 1.6rem) 0 clamp(1.4rem, 4vh, 2.2rem); transition: color 0.25s ease;
}
.back:hover { color: var(--violet); }

.art-head { margin-bottom: clamp(1.6rem, 4vh, 2.4rem); }
.art-title {
  margin: 0; font-family: var(--serif); font-weight: 500; font-optical-sizing: auto;
  font-size: clamp(2.1rem, 5vw, 3.5rem); line-height: 1.05; letter-spacing: -0.02em;
  color: var(--ink); max-width: 20ch;
}
.art-dek {
  margin: 1.1rem 0 0; color: var(--muted); font-size: clamp(1.12rem, 1.9vw, 1.34rem);
  line-height: 1.45; font-style: italic; font-family: var(--serif); font-weight: 400; max-width: 40rem;
}

.art-cover { margin: 0 0 clamp(1.8rem, 4vh, 2.6rem); border-radius: 16px; overflow: hidden; border: 1px solid var(--line); }
.art-cover img { width: 100%; }

.art-aside { margin: 0 0 2rem; display: flex; flex-direction: column; gap: 1.1rem; }
.art-meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.45rem 0.7rem;
  color: var(--violet-soft); font-size: 0.76rem; font-weight: 500;
  letter-spacing: 0.1em; text-transform: uppercase;
}
.art-meta .lang-badge { color: var(--faint); }
.byline { display: flex; flex-direction: column; gap: 0.15rem; padding-top: 1.1rem; border-top: 1px solid var(--line); }
.byline-name { font-weight: 600; font-size: 0.95rem; color: var(--ink); }
.byline-role { color: var(--faint); font-size: 0.85rem; line-height: 1.4; }

@media (min-width: 1024px) {
  .article {
    max-width: 64rem;
    display: grid;
    grid-template-columns: 13rem minmax(0, 43rem);
    grid-template-areas: "head head" "cover cover" "aside main";
    column-gap: clamp(2.5rem, 4.5vw, 4.5rem);
    justify-content: center;
    align-items: start;
  }
  .art-head { grid-area: head; margin-bottom: clamp(2rem, 4vh, 3rem); }
  .art-cover { grid-area: cover; }
  .art-aside { grid-area: aside; position: sticky; top: 5.5rem; margin: 0; }
  .art-main { grid-area: main; min-width: 0; }
  .art-aside .art-meta { flex-direction: column; align-items: flex-start; gap: 0.5rem; }
}

/* --- prose ----------------------------------------------------------------- */
.prose { font-size: clamp(1.06rem, 1.7vw, 1.18rem); line-height: 1.75; color: var(--muted); }
.prose > p { margin: 0 0 1.35em; }
.prose.has-dropcap > p:first-child::first-letter {
  float: left; font-family: var(--serif); font-weight: 500; color: var(--ink);
  font-size: 3.6em; line-height: 0.7; padding: 0.04em 0.12em 0 0;
}
.prose h2, .prose h3, .prose h4 {
  font-family: var(--serif); color: var(--ink); font-weight: 600; font-optical-sizing: auto;
  line-height: 1.18; letter-spacing: -0.01em;
}
.prose h2 { font-size: clamp(1.5rem, 3vw, 2rem); margin: 2.4em 0 0.7em; }
.prose h3 { font-size: clamp(1.25rem, 2.3vw, 1.5rem); margin: 2em 0 0.6em; }
.prose h4 { font-size: 1.18rem; margin: 1.8em 0 0.5em; }
.prose h2 + p, .prose h3 + p { margin-top: 0; }
.prose strong, .prose b { color: var(--ink); font-weight: 600; }
.prose em, .prose i { font-style: italic; }
.prose a {
  color: #c79bff; text-decoration: none;
  background-image: linear-gradient(var(--violet), var(--violet));
  background-size: 100% 1px; background-position: 0 1.15em; background-repeat: no-repeat;
  transition: color 0.2s ease, background-size 0.2s ease;
}
.prose a:hover { color: #e3d2ff; background-image: linear-gradient(var(--orange), var(--orange)); }
.prose ul, .prose ol { margin: 0 0 1.35em; padding-left: 1.4em; }
.prose li { margin: 0.4em 0; }
.prose li::marker { color: var(--violet); }
.prose blockquote {
  margin: 1.8em 0; padding: 0.2em 0 0.2em 1.3em; border-left: 2px solid var(--violet);
  color: var(--ink); font-family: var(--serif); font-style: italic; font-size: 1.15em; line-height: 1.5;
}
.prose figure { margin: 2em 0; }
.prose figure img { border-radius: 14px; border: 1px solid var(--line); width: 100%; }
.prose figcaption { margin-top: 0.6em; color: var(--faint); font-size: 0.85rem; text-align: center; }
.prose hr { border: 0; height: 1px; background: var(--line); margin: 2.4em 0; }

/* --- more / related -------------------------------------------------------- */
.more { margin: clamp(3rem, 8vh, 5rem) 0 0; padding-top: 2.2rem; border-top: 1px solid var(--line); }
.more-title { margin: 0 0 1.3rem; font-family: var(--serif); font-weight: 500; font-size: 1.4rem; color: var(--ink); }
.more-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1.2rem; }
.more-card {
  text-decoration: none; color: inherit; border: 1px solid var(--line); border-radius: 14px;
  overflow: hidden; background: rgba(20, 18, 60, 0.35); transition: border-color 0.3s ease, transform 0.3s ease;
}
.more-card:hover { border-color: rgba(160, 92, 255, 0.5); transform: translateY(-3px); }
.more-media { aspect-ratio: 16 / 9; overflow: hidden; }
.more-media img { width: 100%; height: 100%; object-fit: cover; }
.more-h { display: block; padding: 0.85rem 1rem 1.1rem; font-family: var(--serif); font-weight: 500; font-size: 1.06rem; line-height: 1.2; }

/* --- footer ---------------------------------------------------------------- */
.foot {
  max-width: 64rem; margin: clamp(3rem, 8vh, 5rem) auto 0; padding-top: 1.6rem;
  border-top: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: 1rem;
  color: var(--faint); font-size: 0.88rem;
}
.foot a { display: inline-flex; align-items: center; gap: 0.4rem; color: var(--faint); text-decoration: none; transition: color 0.25s ease; }
.foot a:hover { color: var(--violet); }

/* --- responsive ------------------------------------------------------------ */
@media (max-width: 720px) {
  .cards { grid-template-columns: 1fr; }
  .card:first-child .card-media, .card-media { aspect-ratio: 16 / 9; }
  .more-grid { grid-template-columns: 1fr; }
  .prose.has-dropcap > p:first-child::first-letter { font-size: 3em; }
  .foot { flex-direction: column; gap: 0.6rem; }
}

@media (max-width: 460px) {
  .topbar { gap: 0.6rem; padding-left: 1.1rem; padding-right: 1.1rem; }
  .brand { gap: 0.4rem; min-width: 0; }
  .brand-mark, .brand-sub { white-space: nowrap; }
  .masthead-title { font-size: clamp(2.9rem, 17vw, 4rem); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .card { opacity: 1; transform: none; animation: none; }
  .card-link, .card-media img, .card-cue, .more-card { transition: none; }
}
