/* Shared styles for kushniarou.com */

:root {
  --fg: #1a1a1a;
  --muted: #6b6b6b;
  --bg: #fdfdfd;
  --accent: #1f4ed8;
  --rule: #e6e6e6;

  /* Code blocks. The border is deliberately a step darker than --rule: a code
     block is a panel that has to read as one at a glance, where --rule only
     has to separate two pieces of text. The fill is lighter than the border,
     which is what makes the edge visible at all — the other way round and the
     box reads as a flat grey slab with no outline. */
  --code-bg: #fbfbfb;
  --code-border: #d8d8d8;
  --code-fg: #24292f;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --fg: #e8e8e8;
    --muted: #9a9a9a;
    --bg: #111;
    --accent: #8aa6ff;
    --rule: #2a2a2a;

    /* github-dark's own background and foreground, since that is the theme
       pygments.css highlights with in the dark. */
    --code-bg: #0d1117;
    --code-border: #30363d;
    --code-fg: #e6edf3;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", system-ui, sans-serif;
  font-size: 17px;
  line-height: 1.6;
  color: var(--fg);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
main {
  max-width: 680px;
  margin: 0 auto;
  padding: 72px 28px 56px;
}
a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid transparent;
}
a:hover { border-bottom-color: var(--accent); }

/* Back link */
.back {
  display: inline-block;
  margin-bottom: 28px;
  font-size: 14px;
  color: var(--muted);
}
.back:hover { border-bottom-color: var(--muted); }

/* Hero */
.hero {
  display: flex;
  align-items: center;
  gap: 28px;
  margin-bottom: 40px;
}
.hero img {
  width: 112px;
  height: 112px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}
.hero h1 {
  margin: 0 0 4px;
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.hero .tagline {
  margin: 0 0 4px;
  color: var(--fg);
}
.hero .location {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
}

/* Sections */
section { margin-bottom: 36px; }
section p { margin: 0 0 12px; }
section p:last-child { margin-bottom: 0; }

h2 {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin: 0 0 14px;
}
h2.section-title { margin: 0 0 8px; }

.lead {
  margin: 0 0 28px;
  color: var(--fg);
}
.lead a { color: var(--muted); border-bottom-color: var(--rule); }
.lead a:hover { color: var(--accent); border-bottom-color: var(--accent); }

/* The way back out of a tag or category listing. Muted like the rest of the
   lead it would read as part of the sentence, so it keeps the site's link
   colour: it is somewhere to go, not a note. */
.lead .show-all { color: var(--accent); border-bottom-color: transparent; }
.lead .show-all:hover { border-bottom-color: var(--accent); }

/* Link list */
.links-group { margin-bottom: 22px; }
.links-group:last-child { margin-bottom: 0; }
.links-group h3 {
  font-size: 15px;
  font-weight: 600;
  margin: 0 0 6px;
  color: var(--fg);
}
.links-group .row {
  display: flex;
  gap: 12px;
  padding: 2px 0;
  color: var(--muted);
}
.links-group .row .label { flex: 1; }
.links-group .row .arrow { color: var(--muted); }

/* Featured list */
.featured ul {
  list-style: none;
  padding: 0;
  margin: 0;
}
.featured li {
  padding: 4px 0;
  color: var(--fg);
}
.featured li::before {
  content: "— ";
  color: var(--muted);
}

/* Dashboards */
.dashboards { margin-bottom: 8px; }
.dashboard {
  padding: 22px 0;
  border-top: 1px solid var(--rule);
}
.dashboard:first-of-type { border-top: none; padding-top: 0; }
.dashboard h3 {
  font-size: 18px;
  font-weight: 600;
  margin: 0 0 8px;
  letter-spacing: -0.01em;
}
.dashboard h3 .arrow {
  color: var(--muted);
  font-weight: 400;
  font-size: 15px;
}
.dashboard p {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
}

/* Articles — floated thumbnail, text wraps around (like sellerflux.com/articles) */
.articles { margin-bottom: 8px; }
.article-card {
  padding: 22px 0;
  border-top: 1px solid var(--rule);
}
.article-card:first-of-type { border-top: none; padding-top: 0; }
.article-meta {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 13px;
}
.article-card h3 {
  font-size: 18px;
  font-weight: 600;
  margin: 0 0 10px;
  line-height: 1.35;
  letter-spacing: -0.01em;
}
.article-card h3 .arrow {
  color: var(--muted);
  font-weight: 400;
  font-size: 15px;
}
.article-thumb { border-bottom: none; }
.article-image {
  float: left;
  width: 150px;
  height: auto;
  margin: 3px 18px 8px 0;
  border-radius: 8px;
  display: block;
}
.article-desc {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
}
/* clear the float so the next card's separator sits below the image */
.article-body::after { content: ""; display: table; clear: both; }

@media (max-width: 520px) {
  .article-image { width: 112px; margin: 2px 14px 6px 0; }
}

/* Tags and filter chips ---------------------------------------------------- */
.tag-row {
  margin: 10px 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.tag {
  font-size: 12.5px;
  line-height: 1;
  padding: 5px 9px;
  border-radius: 999px;
  border: 1px solid var(--rule);
  color: var(--muted);
}
.tag:hover { color: var(--accent); border-color: var(--accent); }

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: 0 0 28px;
}
.chip {
  font-size: 13px;
  line-height: 1;
  padding: 7px 11px;
  border-radius: 999px;
  border: 1px solid var(--rule);
  color: var(--fg);
}
.chip span { color: var(--muted); font-size: 11.5px; margin-left: 3px; }
.chip:hover { border-color: var(--accent); color: var(--accent); }
.chip--on { border-color: var(--accent); color: var(--accent); }

.badge {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid var(--rule);
}

/* Article page ------------------------------------------------------------- */
.draft-banner {
  margin: 0 0 24px;
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid var(--rule);
  background: color-mix(in srgb, var(--accent) 8%, transparent);
  font-size: 14px;
  color: var(--muted);
}

/* Article page ------------------------------------------------------------- *
 * Laid out after Medium: a 680px column of large serif body text, a sans-serif
 * title well above it in scale, and pictures given room to breathe.
 *
 * `main` is 680px wide *including* its padding everywhere else, which leaves
 * ~624px of text. A reading column is 680px of text, so this one is that much
 * wider. The listing pages are untouched.
 */
.main--read { max-width: calc(680px + 56px); }

/* The rule under the byline is the header's bottom edge — it is what makes the
   article start, rather than the text simply continuing after a gap. */
.post-head {
  margin-bottom: 44px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--rule);
}
.tag-row--top { margin: 0 0 18px; }
.post-head h1 {
  margin: 0 0 14px;
  font-size: 42px;
  line-height: 1.16;
  font-weight: 700;
  letter-spacing: -0.024em;
}
.byline {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 12px;
  font-size: 14px;
  color: var(--muted);
}
.byline img {
  width: 40px; height: 40px;
  border-radius: 50%;
  object-fit: cover;
  margin-right: -2px;
}
.byline__name { color: var(--fg); }
/* Pushed to its own line before it would ever collide with the name. */
.byline__meta { flex: 1 1 auto; }

/* Rendered article body ---------------------------------------------------- */
.prose {
  /* Charter ships with macOS and iOS, Georgia everywhere else — a serif body is
     the single thing that most makes long text read like Medium. Headings stay
     on the site's sans, which is what Medium does too. */
  font-family: Charter, "Bitstream Charter", "Sitka Text", Cambria, Georgia, serif;
  font-size: 21px;
  line-height: 1.58;
  letter-spacing: -0.003em;
}
.prose > *:first-child { margin-top: 0; }
.prose p { margin: 0 0 30px; }
.prose h2, .prose h3, .prose h4 {
  font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", system-ui, sans-serif;
  color: var(--fg);
  text-transform: none;
  letter-spacing: -0.019em;
  /* Far more space above than below, so a heading belongs to what follows it
     rather than floating between two sections. */
  margin: 52px 0 10px;
}
.prose h2 { font-size: 30px; font-weight: 700; line-height: 1.22; }
.prose h3 { font-size: 24px; font-weight: 700; line-height: 1.28; }
.prose h4 { font-size: 20px; font-weight: 600; }

.prose ul, .prose ol { margin: 0 0 30px; padding-left: 26px; }
.prose li { margin-bottom: 8px; }
.prose li > ul, .prose li > ol { margin: 8px 0 0; }
.prose .checklist { list-style: none; padding-left: 0; }
.prose .task::before { content: "☐ "; color: var(--muted); }
.prose .task[data-checked="1"]::before { content: "☑ "; }

.prose a { border-bottom-color: color-mix(in srgb, var(--accent) 35%, transparent); }
.prose code {
  font-size: 0.86em;
  padding: 2px 5px;
  border-radius: 4px;
  background: color-mix(in srgb, var(--fg) 8%, transparent);
  font-family: var(--mono);
}
.prose mark { background: color-mix(in srgb, #ffd54f 55%, transparent); color: inherit; padding: 0 2px; }

/* Code blocks. render.py wraps Pygments' .highlight > pre > code in a
   .codeblock and, where the author named a language, puts its label in
   data-lang; pygments.css colours the tokens inside. */
.prose .codeblock {
  position: relative;
  margin: 32px 0;
}
.prose .highlight {
  margin: 0;
  padding: 16px 20px;
  border: 1px solid var(--code-border);
  border-radius: 6px;
  background: var(--code-bg);
  /* Text no lexer gave a token to — most of a shell session — takes this. */
  color: var(--code-fg);
  overflow-x: auto;

  /* The type has to be set here, on the block, and not on the <code> inside
     it. A line's height is the taller of its content and its containing
     block's strut, and the strut comes from <pre> — which, left alone,
     inherits the 21px serif body: 21 × 1.58 = 33px of leading around 14px
     code, which is what made these blocks read as double-spaced. */
  font-family: var(--mono);
  /* 14px against the 21px body is Medium's ratio, and it is what keeps an
     80-column line inside 680px. */
  font-size: 14px;
  line-height: 1.5;
  /* The body's tracking is set for a serif at 21px and is inherited here,
     where it makes a monospace face look loose. */
  letter-spacing: normal;
  tab-size: 4;
}
.prose .highlight pre { margin: 0; font: inherit; }
.prose .highlight code {
  font: inherit;
  padding: 0;
  background: none;
  border-radius: 0;
}

/* The language, in the top-right corner. Opaque and drawn over the block, so
   a long first line scrolls underneath it rather than through it. */
.prose .codeblock[data-lang]::after {
  content: attr(data-lang);
  position: absolute;
  top: 1px;
  right: 1px;
  padding: 5px 11px;
  border-radius: 0 6px 0 6px;
  background: var(--code-bg);
  color: var(--muted);
  font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", system-ui, sans-serif;
  font-size: 10.5px;
  font-weight: 500;
  line-height: 1;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  pointer-events: none;
}
/* …which needs the headroom, or it sits on the first line of code. Only just
   enough: any more and a two-line block reads as top-heavy. */
.prose .codeblock[data-lang] .highlight { padding-top: 25px; }

.prose blockquote {
  margin: 40px 0;
  padding: 2px 0 2px 24px;
  border-left: 3px solid var(--fg);
  color: var(--fg);
}
.prose blockquote p { margin: 0; font-size: 24px; line-height: 1.4; font-style: italic; }
.prose blockquote cite {
  display: block;
  margin-top: 8px;
  font-size: 14px;
  font-style: normal;
}
.prose .delimiter {
  border: none;
  margin: 48px 0;
  text-align: center;
}
.prose .delimiter::before {
  content: "* * *";
  letter-spacing: 0.5em;
  color: var(--muted);
}

/* Images: centred, captioned, optionally breaking out of the text column.
 *
 * A picture gets far more room than a paragraph — the gap is what separates it
 * from the text either side and stops the column reading as a scrapbook. Equal
 * above and below, because a picture belongs to the passage, not to the
 * paragraph that happens to precede it. */
.prose .figure { margin: 48px auto; }
.prose .figure img {
  display: block;
  /* Bounded on both axes, not just width. A portrait photo constrained only by
     width grows as tall as its aspect ratio demands — a 1600x2842 phone shot in
     an 860px column comes out 1497px tall, twice the height of a laptop screen,
     and can never be seen whole. Capping the height fits it to the screen
     instead; `width: auto` then narrows it to match, so nothing is distorted
     and nothing is upscaled past its own resolution. */
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: min(760px, 78vh);
  margin: 0 auto;
  border-radius: 8px;
}
/* The editor's "stretch" toggle. Medium sets pictures at the text width and
   this stays close to that: a deliberate step out, not a different layout.
   It was 1000px, half again the column, which read as a separate page element
   rather than part of the article. */
.prose .figure--wide {
  width: min(92vw, 860px);
  margin-left: 50%;
  transform: translateX(-50%);
}
.prose .figure--bordered img { border: 1px solid var(--rule); }
/* The editor's "with background" toggle: a mat around the picture. It goes on
   the figure, not the img — padding on a replaced element with `width: 100%`
   shrinks the picture inside its own box instead of framing it, which is why
   this used to render as a crop rather than a border. */
.prose .figure--padded {
  padding: 24px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--fg) 4%, transparent);
}
.prose .figure--padded img { border-radius: 6px; }
.prose .figure--padded figcaption { margin-bottom: -4px; }
.prose figcaption {
  margin-top: 12px;
  text-align: center;
  font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.4;
  color: var(--muted);
}
/* A heading right after a picture would otherwise stack 48px onto its own 52px. */
.prose .figure + h2,
.prose .figure + h3,
.prose .figure + h4 { margin-top: 8px; }

.prose .embed { margin: 48px auto; }
.prose .embed iframe {
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 0;
  border-radius: 10px;
  display: block;
}

.prose .table-wrap { overflow-x: auto; margin: 0 0 26px; }
.prose table { border-collapse: collapse; width: 100%; font-size: 15px; }
.prose th, .prose td {
  border: 1px solid var(--rule);
  padding: 8px 12px;
  text-align: left;
}
.prose th { font-weight: 600; background: color-mix(in srgb, var(--fg) 4%, transparent); }

/* Article footer ----------------------------------------------------------- */
.post-foot {
  margin-top: 40px;
  padding-top: 22px;
  border-top: 1px solid var(--rule);
}
.also-on { margin: 14px 0 0; font-size: 15px; }

.post-nav {
  display: flex;
  gap: 16px;
  margin-top: 32px;
}
.post-nav__item {
  flex: 1;
  padding: 14px 16px;
  border: 1px solid var(--rule);
  border-radius: 10px;
  font-size: 15px;
  line-height: 1.35;
  color: var(--fg);
}
.post-nav__item:hover { border-color: var(--accent); }
.post-nav__item span {
  display: block;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
  margin-bottom: 4px;
}
.post-nav__item--right { text-align: right; }

@media (max-width: 640px) {
  /* Everything comes down a step, but the body text only a little: 20px of
     serif on a phone is still comfortable, and Medium keeps it there too. */
  .post-head h1 { font-size: 32px; letter-spacing: -0.02em; }
  .prose { font-size: 20px; line-height: 1.56; }
  .prose p { margin: 0 0 26px; }
  .prose h2 { font-size: 25px; margin-top: 42px; }
  .prose h3 { font-size: 21px; margin-top: 40px; }
  .prose h4 { font-size: 18px; }
  .prose blockquote p { font-size: 20px; }
  .prose .figure, .prose .embed { margin: 36px auto; }
  .prose .figure--wide { width: 100%; margin-left: 0; transform: none; }
  .post-nav { flex-direction: column; }
  .post-nav__item--right { text-align: left; }
}

/* Footer */
footer {
  margin-top: 56px;
  padding-top: 20px;
  border-top: 1px solid var(--rule);
  font-size: 14px;
  color: var(--muted);
}

/* Mobile */
@media (max-width: 520px) {
  main { padding: 48px 22px 40px; }
  .hero { gap: 18px; }
  .hero img { width: 80px; height: 80px; }
  .hero h1 { font-size: 22px; }
  footer { text-align: center; }
}

/* Lightbox ----------------------------------------------------------------- *
 * Built and destroyed by the script in article.html; nothing here exists until
 * a picture is clicked. */
.zoomable { cursor: zoom-in; }
.zoomable:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 32px;
  cursor: zoom-out;
  /* Medium's own values, read off its lightbox: an almost invisible tint and a
     small blur. The separation comes from the blur, not from darkness — the
     article stays legible-shaped behind the picture, just out of focus, so this
     reads as the page stepping back rather than a new screen. Raising the tint
     defeats it: at any real opacity the blur stops registering and it becomes a
     plain dark overlay again. */
  background: rgb(0 0 0 / 7%);
  backdrop-filter: blur(10px);
  animation: lightbox-in 0.12s ease-out;
}
.lightbox img {
  max-width: 100%;
  /* Subtracted rather than a round vh figure: the padding, the gap and the
     caption all have to fit on the same screen. */
  max-height: calc(100vh - 130px);
  width: auto;
  height: auto;
  object-fit: contain;
  /* Nothing drawn around the edge — no radius, no shadow — so what is on screen
     is exactly the file. */
}
.lightbox__cap {
  margin: 0;
  max-width: 680px;
  text-align: center;
  font-size: 14px;
  line-height: 1.4;
  /* Follows the theme, because the backdrop is now the page itself rather than
     a dark sheet — fixed white here would be invisible in the light theme. */
  color: var(--muted);
  /* And for the same reason it needs something to sit on: whatever the caption
     lands over is arbitrary, and grey text on a blurred photograph is not text.
     This is the page's own colour, so over plain background — the usual case —
     it is invisible, and it only shows itself where it is doing work. */
  padding: 5px 14px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
}
@keyframes lightbox-in { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  .lightbox { animation: none; }
}
@media (max-width: 640px) {
  .lightbox { padding: 16px; gap: 12px; }
  .lightbox img { max-height: calc(100vh - 90px); }
}
