/* ==========================================================================
   artemkrachulov.dev — stylesheet (v6, minimal single screen, light green)
   Huge condensed name + italic serif accent, arch portrait, hairline cells.
   ========================================================================== */

@font-face {
  font-family: "Archivo";
  src: url("../fonts/archivo-var.woff2") format("woff2");
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-display: swap;
}
@font-face {
  font-family: "Manrope";
  src: url("../fonts/manrope-var.woff2") format("woff2");
  font-weight: 200 800;
  font-display: swap;
}
@font-face {
  font-family: "Instrument Serif";
  src: url("../fonts/instrument-serif-italic.woff2") format("woff2");
  font-style: italic;
  font-weight: 400;
  font-display: swap;
}

/* ---------- Tokens ---------- */
:root {
  --sage: #cfe5c6;        /* top of the gradient */
  --mist: #f4f8f1;        /* page base */
  --ink: #12261b;         /* deep green-black text */
  --green: #3e7a52;       /* serif accent */
  --lime: #c9ef9a;        /* highlights */
  --muted: rgba(18, 38, 27, 0.64);
  --line: rgba(18, 38, 27, 0.16);

  --font-display: "Archivo", "Arial Narrow", Impact, sans-serif;
  --font: "Manrope", -apple-system, "Helvetica Neue", Helvetica, Arial, sans-serif;
  --font-serif: "Instrument Serif", Georgia, "Times New Roman", serif;

  --bar: 68px;
  --pad: clamp(20px, 3vw, 40px);
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
  .status::before { box-shadow: 0 0 0 4px rgba(55, 184, 98, 0.2); }
}
body {
  margin: 0;
  min-height: 100svh;
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  background:
    linear-gradient(180deg, var(--sage) 0%, #e3efdc 38%, var(--mist) 72%) fixed,
    var(--mist);
}
img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
p, h1, h2 { margin: 0; }
:focus-visible { outline: 2px solid var(--green); outline-offset: 3px; border-radius: 4px; }

/* ---------- Frame ---------- */
.page {
  max-width: 1360px;
  margin-inline: auto;
  height: 100svh;
  min-height: 600px;
  display: flex;
  flex-direction: column;
  border-inline: 1px solid var(--line);
}

.bar {
  flex: none;
  height: var(--bar);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding-inline: var(--pad);
  border-bottom: 1px solid var(--line);
  font-size: 14px;
  font-weight: 500;
}
.brand { display: inline-flex; align-items: center; gap: 12px; font-weight: 700; }
.mark {
  display: inline-grid; place-items: center;
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--ink);
  color: var(--lime);
  font-family: var(--font-display);
  font-weight: 900; font-stretch: 85%;
  font-size: 13px; letter-spacing: -0.02em;
}
.bar__links { display: flex; align-items: center; gap: 22px; }
.bar__links a:not(.pill):hover { color: var(--green); }
.pill {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 18px;
  border-radius: 999px;
  border: 1px solid var(--ink);
  font-weight: 600;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.pill:hover { background: var(--ink); color: var(--lime); }

/* ---------- Main: text left, portrait right ---------- */
.main {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 1.25fr 1fr;
  grid-template-rows: minmax(0, 1fr) auto;
  grid-template-areas:
    "hello portrait"
    "cells cells";
}
.main > * { min-width: 0; }

.hello {
  grid-area: hello;
  min-height: 0;
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: var(--pad);
}
.status {
  display: inline-flex; align-items: center; gap: 10px;
  font-size: 13px; font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 18px;
}
.status::before {
  content: "";
  width: 9px; height: 9px; border-radius: 50%;
  background: #37b862;
  box-shadow: 0 0 0 0 rgba(55, 184, 98, 0.55);
  animation: pulse 2s ease-out infinite;
}
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 rgba(55, 184, 98, 0.55); }
  70%  { box-shadow: 0 0 0 9px rgba(55, 184, 98, 0); }
  100% { box-shadow: 0 0 0 0 rgba(55, 184, 98, 0); }
}
.name {
  font-family: var(--font-display);
  font-weight: 800;
  font-stretch: 68%;
  text-transform: uppercase;
  letter-spacing: -0.01em;
  line-height: 0.84;
  font-size: min(8.6vw, 16vh, 140px);
}
.name span { display: block; }
.role {
  display: block;
  margin-top: 0.1em;
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 400;
  font-size: min(4.4vw, 7.4vh, 76px);
  line-height: 1;
  color: var(--green);
  text-align: right;
  padding-right: 0.2em;
}

/* latest post link under the name */
.latest {
  align-self: flex-start;
  display: inline-flex; align-items: center; gap: 10px;
  margin-top: clamp(18px, 3vh, 32px);
  padding: 6px 16px 6px 6px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.6);
  font-size: 14px; font-weight: 600;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}
.latest:hover { background: #fff; border-color: var(--green); }
.latest__tag {
  white-space: nowrap;
  padding: 3px 10px; border-radius: 999px;
  background: var(--ink); color: var(--lime);
  font-size: 11.5px; font-weight: 700; letter-spacing: 0.03em; text-transform: uppercase;
}

/* hairline cells: about | contact */
.cells {
  grid-area: cells;
  display: grid;
  grid-template-columns: 1.25fr 1fr;  /* same split as the row above */
  border-top: 1px solid var(--line);
}
.cell {
  padding: 24px var(--pad) 28px;
  min-width: 0;
}
.cell + .cell { border-left: 1px solid var(--line); }
.cell h2 {
  font-family: var(--font-display);
  font-weight: 800;
  font-stretch: 75%;
  text-transform: uppercase;
  font-size: 14px;
  letter-spacing: 0.02em;
  margin-bottom: 10px;
}
.cell p { font-size: 14.5px; line-height: 1.6; }
.facts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
}
.facts li {
  padding: 5px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--line);
  font-size: 12.5px;
  font-weight: 600;
}
.facts b { font-weight: 800; }

.contact p { color: var(--muted); }
.btn {
  display: inline-flex; align-items: center; gap: 10px;
  margin-top: 14px;
  padding: 12px 20px;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  font-size: 14px; font-weight: 600; line-height: 1;
  transition: transform 0.15s ease, color 0.15s ease;
  max-width: 100%;
}
.btn:hover { transform: translateY(-1px); color: var(--lime); }
.btn svg { width: 16px; height: 16px; flex: none; }
.link {
  display: inline-block;
  margin-top: 12px;
  margin-left: 14px;
  font-size: 14px; font-weight: 600;
  border-bottom: 1.5px solid var(--green);
}
.link:hover { color: var(--green); }

/* portrait */
.portrait {
  grid-area: portrait;
  margin: 0;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--pad);
  overflow: hidden;
  container-type: size;
}
.portrait img {
  /* always a 3:4.2 portrait, as large as the column allows either way */
  width: min(100cqw, 100cqh * 3 / 4.2);
  height: auto;
  aspect-ratio: 3 / 4.2;
  object-fit: cover;
  object-position: 50% 45%;
  border-radius: 24px;
  box-shadow: 0 30px 60px -30px rgba(18, 38, 27, 0.45);
}

/* ---------- Narrower desktops ---------- */
@media (max-width: 1100px) {
  .main, .cells { grid-template-columns: 1.4fr 1fr; }
  .cell { padding-block: 18px 20px; }
}

/* ---------- Phones: stack and scroll ---------- */
@media (max-width: 760px) {
  body { background: linear-gradient(180deg, var(--sage) 0, var(--mist) 520px) no-repeat, var(--mist); }
  .page { height: auto; min-height: 0; border-inline: 0; }
  .bar__links a[rel="me"] { display: none; }
  .main {
    grid-template-columns: 1fr;
    grid-template-rows: auto;
    grid-template-areas: "hello" "portrait" "cells";
  }
  .hello { border-right: 0; padding-bottom: 8px; }
  .portrait { padding-top: 16px; container-type: normal; }
  .cells { grid-template-columns: 1fr; }
  .cell + .cell { border-left: 0; border-top: 1px solid var(--line); }
  .portrait { justify-content: center; }
  .portrait img { height: auto; width: 100%; max-width: 360px; aspect-ratio: 3 / 4; }
  /* sized from measured text width: KRACHULOV ≈ 4.66em, role ≈ 6.95em */
  .name { font-size: calc((100vw - 56px) / 4.8); }
  .role { font-size: calc((100vw - 56px) / 7.4); }
  .link { margin-left: 0; display: block; width: fit-content; }
}

/* ==========================================================================
   Blog: list page + article. Scrolling pages, same palette and type.
   ========================================================================== */
:root {
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  --paper: #fbfaf7;           /* matches the diagrams' own background */
}

.page--doc { height: auto; min-height: 100svh; }
.bar__links a[aria-current="page"] { color: var(--green); font-weight: 700; }

.doc-foot {
  margin-top: auto;
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px;
  padding: 22px var(--pad) 26px;
  border-top: 1px solid var(--line);
  font-size: 13px;
  color: var(--muted);
}
.doc-foot a:hover { color: var(--green); }

/* ---------- blog list ---------- */
.blog__head {
  padding: clamp(40px, 7vh, 88px) var(--pad) clamp(28px, 4vh, 48px);
  border-bottom: 1px solid var(--line);
}
.blog__head .name { font-size: clamp(72px, 13vw, 180px); }
.blog__head .role { text-align: left; font-size: clamp(28px, 3.6vw, 52px); margin-top: 0.15em; }

.post-list { list-style: none; margin: 0; padding: 0; }
.post-list li + li { border-top: 1px solid var(--line); }
.post-row {
  display: grid;
  grid-template-columns: 160px 1fr minmax(0, 360px);
  gap: clamp(20px, 3vw, 48px);
  align-items: center;
  padding: 32px var(--pad);
  border-bottom: 1px solid var(--line);
  transition: background-color 0.15s ease;
}
.post-row:hover { background: rgba(255, 255, 255, 0.45); }
.post-row:hover .post-row__title { color: var(--green); }
.post-row__meta { align-self: start; padding-top: 6px; font-size: 13px; font-weight: 600; color: var(--muted); line-height: 1.6; }
.post-row__text { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.post-row__title {
  font-family: var(--font-display);
  font-weight: 800; font-stretch: 80%;
  font-size: clamp(28px, 3.2vw, 44px);
  line-height: 1.02; letter-spacing: -0.01em;
  transition: color 0.15s ease;
}
.post-row__dek { font-size: 16px; color: var(--muted); }
.post-row__tags { font-size: 12.5px; font-weight: 600; color: var(--green); text-transform: uppercase; letter-spacing: 0.04em; }
.post-row__cover {
  width: 100%; aspect-ratio: 16 / 10; object-fit: cover; object-position: left center;
  border-radius: 16px; border: 1px solid var(--line); background: var(--paper);
}

/* ---------- article ---------- */
.article__head {
  max-width: 1000px;
  margin: 0 auto;
  padding: clamp(28px, 5vh, 56px) var(--pad) 40px;
}
.back { display: inline-block; font-size: 14px; font-weight: 600; color: var(--muted); margin-bottom: 28px; }
.back:hover { color: var(--green); }
.tags { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; margin: 0 0 18px; padding: 0; }
.tags li {
  padding: 4px 12px; border-radius: 999px;
  background: rgba(255, 255, 255, 0.7); border: 1px solid var(--line);
  font-size: 12.5px; font-weight: 600;
}
.article__title {
  font-family: var(--font-display);
  font-weight: 800; font-stretch: 72%;
  text-transform: uppercase;
  font-size: clamp(46px, 7.4vw, 104px);
  line-height: 0.9; letter-spacing: -0.01em;
}
.article__dek {
  margin-top: 16px;
  font-family: var(--font-serif); font-style: italic;
  font-size: clamp(24px, 2.8vw, 36px); line-height: 1.15;
  color: var(--green);
}
.byline { display: flex; align-items: center; gap: 14px; margin-top: 28px; font-size: 14px; color: var(--muted); line-height: 1.45; }
.byline strong { color: var(--ink); }
.byline img, .author img { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; flex: none; }

.prose {
  max-width: 720px;
  margin: 0 auto;
  padding: 8px var(--pad) 40px;
  font-size: 17.5px;
  line-height: 1.75;
}
.prose > * + * { margin-top: 1.1em; }
.prose h2 {
  margin-top: 2.2em;
  font-family: var(--font-display);
  font-weight: 800; font-stretch: 85%;
  font-size: clamp(26px, 2.6vw, 34px);
  line-height: 1.1; letter-spacing: -0.01em;
  scroll-margin-top: 20px;
}
.prose h2 + * { margin-top: 0.7em; }
.prose a { color: var(--green); text-decoration: underline; text-underline-offset: 3px; }
.prose ul, .prose ol { padding-left: 1.3em; }
.prose li + li { margin-top: 0.45em; }
.prose li::marker { color: var(--green); font-weight: 700; }
.prose { overflow-wrap: break-word; }
.prose :not(pre) > code {
  overflow-wrap: anywhere;
  font-family: var(--mono); font-size: 0.86em;
  padding: 0.1em 0.38em; border-radius: 6px;
  background: rgba(62, 122, 82, 0.1); color: #1f4d33;
}

.fig { margin: 2em 0; }
.fig img {
  width: 100%; height: auto;
  border-radius: 16px; border: 1px solid var(--line);
  background: var(--paper);
  box-shadow: 0 18px 40px -28px rgba(18, 38, 27, 0.4);
}
/* diagrams are wider than the text column: let them breathe on big screens */
@media (min-width: 1000px) {
  .fig { margin-inline: -120px; }
}
.fig figcaption { margin-top: 10px; font-size: 13px; color: var(--muted); text-align: center; }

.code { position: relative; margin: 1.6em 0; }
.code .code__lang + pre { padding-top: 40px; }   /* beats the .code pre padding below */
.code__lang {
  position: absolute; top: 12px; left: 22px;
  font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  color: rgba(201, 239, 154, 0.7);
}
.code pre {
  margin: 0;
  padding: 20px 22px;
  border-radius: 16px;
  background: var(--ink);
  color: #e3eee0;
  font-family: var(--mono);
  font-size: 14px; line-height: 1.6;
  overflow-x: auto;
}
.code .k { color: var(--lime); }
.code .s { color: #f3c98b; }
.code .c { color: #8fb39a; font-style: italic; }

.author {
  max-width: 720px;
  margin: 8px auto 64px;
  padding: 24px;
  display: flex; gap: 18px; align-items: flex-start;
  border: 1px solid var(--line); border-radius: 20px;
  background: rgba(255, 255, 255, 0.55);
}
@media (min-width: 761px) { .author { margin-inline: auto; } }
.author p { font-size: 15.5px; }
.author__links { margin-top: 4px; display: flex; align-items: center; flex-wrap: wrap; gap: 4px; }
.author .btn { margin-top: 10px; }

@media (max-width: 760px) {
  .post-row { grid-template-columns: 1fr; gap: 14px; padding-block: 26px; }
  .post-row__cover { order: -1; }
  .post-row__meta { padding-top: 0; }
  .prose { font-size: 17px; }
  .code pre { font-size: 13px; padding: 16px; border-radius: 12px; }
  .author { margin: 8px 16px 48px; flex-direction: column; }
}
