/* ============================================================
   Matthias Tech House — shared site styles
   Used by both the index page and the article detail page.
   Sections marked "(index)" or "(article)" only have effect
   on that page; both pages link to the same stylesheet so the
   brand stays in sync.
   ============================================================ */

:root {
  --ink: #232f3e;
  --ink-soft: #36475c;
  --orange: #ff9900;
  --orange-deep: #ec7211;
  --blue: #2f6bff;
  --paper: #f7f8fa;
  --card: #ffffff;
  --line: #e7eaf0;
  --line-soft: #eef1f6;
  --slate: #5a6676;
  --muted: #8b95a4;

  --cat-compute:  #ff9900;
  --cat-storage:  #1f9d6b;
  --cat-ai:       #2f6bff;
  --cat-security: #e0484d;
  --cat-database: #8b5cf6;
  --cat-network:  #16a6a6;

  --maxw: 1200px;
  --radius: 16px;
  --shadow:       0 1px 2px rgba(35,47,62,.04), 0 6px 22px rgba(35,47,62,.06);
  --shadow-hover: 0 2px 6px rgba(35,47,62,.06), 0 18px 44px rgba(35,47,62,.12);

  --f-head: 'Space Grotesk', -apple-system, BlinkMacSystemFont, sans-serif;
  --f-body: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --f-mono: 'IBM Plex Mono', ui-monospace, Menlo, monospace;
}

/* ---- Base ---- */
* { box-sizing: border-box; }
html { -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; scroll-behavior: smooth; }
body { margin: 0; font-family: var(--f-body); color: var(--ink); background: var(--paper); line-height: 1.6; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 32px; }

.eyebrow {
  font-family: var(--f-mono);
  font-size: 11px; letter-spacing: 0.22em;
  text-transform: uppercase; color: var(--muted);
}

/* ---- Category tag (both pages) ---- */
.tag {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--f-mono); font-size: 11px; font-weight: 500;
  letter-spacing: 0.08em; text-transform: uppercase;
  padding: 5px 10px; border-radius: 6px;
  background: color-mix(in srgb, var(--c, var(--blue)) 12%, white);
  color: color-mix(in srgb, var(--c, var(--blue)) 72%, var(--ink));
}
.tag::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--c, var(--blue)); }
.tag.compute  { --c: var(--cat-compute); }
.tag.storage  { --c: var(--cat-storage); }
.tag.ai       { --c: var(--cat-ai); }
.tag.security { --c: var(--cat-security); }
.tag.database { --c: var(--cat-database); }
.tag.network  { --c: var(--cat-network); }

/* ---- Reading progress (article) ---- */
.progress {
  position: fixed; top: 0; left: 0; height: 3px; width: 0;
  background: linear-gradient(90deg, var(--orange), var(--blue));
  z-index: 60; transition: width .1s;
}

/* ---- Header / brand (both pages) ---- */
.site-head {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--paper) 82%, transparent);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--line);
}
.site-head__inner {
  display: flex; align-items: center; justify-content: space-between;
  height: 76px; gap: 16px;
}
.brand { display: inline-flex; align-items: center; gap: 14px; }
.brand__mark { width: 46px; height: 38px; flex: none; }
.brand img { height: 40px; width: auto; max-width: 120px; object-fit: contain; flex: none; display: block; }
.brand img + .brand__mark { display: none; }
.brand__name {
  font-family: var(--f-head); font-size: 19px; font-weight: 700;
  letter-spacing: -0.01em; color: var(--ink); line-height: 1; display: block;
}
.brand__tag {
  font-family: var(--f-mono); font-size: 9px; letter-spacing: 0.22em;
  text-transform: uppercase; color: var(--muted); margin-top: 5px; display: block;
}
.header-stat {
  font-size: 13px; color: var(--muted); font-family: var(--f-mono);
  letter-spacing: .03em; white-space: nowrap;
}
.header-stat b { color: var(--orange-deep); font-weight: 600; }

.back-link {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 14px; font-weight: 500; color: var(--slate);
  padding: 9px 14px; border-radius: 9px; transition: .15s;
}
.back-link:hover { color: var(--ink); background: var(--line-soft); }

/* Site nav (right side of the header) */
.site-nav { display: inline-flex; align-items: center; gap: 6px; }
.nav-link {
  font-size: 14px; font-weight: 500; color: var(--slate);
  padding: 9px 14px; border-radius: 9px; transition: .15s;
}
.nav-link:hover { color: var(--ink); background: var(--line-soft); }
.nav-link--active { color: var(--ink); background: var(--line-soft); }

/* ---- About page (about) ---- */
.about-page {
  max-width: 720px;
  margin: 56px auto 0;
  padding-bottom: 80px;
}
.about-header {
  display: flex; flex-direction: column; align-items: center;
  margin-bottom: 36px;
}
.about-avatar {
  width: 144px; height: 144px;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: var(--shadow);
  border: 4px solid var(--card);
  background: var(--card);
}
.about-avatar-fallback {
  width: 144px; height: 144px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--orange), var(--orange-deep));
  display: grid; place-items: center;
  font-family: var(--f-head); font-weight: 700; font-size: 48px;
  color: #fff;
  box-shadow: var(--shadow);
}
.about-page .prose { margin-top: 0; }
.about-page .prose h1 {
  font-family: var(--f-head); font-weight: 700;
  font-size: clamp(28px, 4vw, 38px);
  letter-spacing: -0.028em; line-height: 1.15;
  margin: 0 0 16px; text-align: center;
  color: var(--ink);
}
.about-page .prose > p:first-of-type {
  font-size: 18px; line-height: 1.6; color: var(--slate);
  text-align: center; margin: 0 auto 32px; max-width: 56ch;
}

/* ---- Breadcrumb (article) ---- */
.crumbs {
  display: flex; align-items: center; gap: 9px; font-size: 13px; color: var(--muted);
  font-family: var(--f-mono); letter-spacing: .03em; margin: 36px 0 0;
  flex-wrap: wrap;
}
.crumbs a:hover { color: var(--ink); }
.crumbs svg { opacity: .5; flex: none; }
.crumbs__current { color: var(--ink-soft); }

/* ---- Page top (index) ---- */
.page-top { padding: 56px 0 12px; }
.page-top__eyebrow { margin-bottom: 14px; }
.page-top h1 {
  font-family: var(--f-head); font-weight: 700;
  font-size: clamp(34px, 5vw, 52px); line-height: 1.04;
  letter-spacing: -0.025em; margin: 0; max-width: 22ch;
}
.page-top p { color: var(--slate); font-size: 17px; max-width: 60ch; margin: 18px 0 0; }

/* ---- Featured (index) ---- */
.featured {
  display: grid; grid-template-columns: 1.15fr 1fr;
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow); margin-top: 40px;
}
.featured__media { position: relative; min-height: 320px; }
.featured__body { padding: 40px; display: flex; flex-direction: column; }
.featured__meta { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.featured h2 {
  font-family: var(--f-head); font-weight: 700; font-size: 30px;
  line-height: 1.18; letter-spacing: -0.02em; margin: 0;
}
.featured h2 a:hover { color: var(--orange-deep); }
.featured__excerpt { color: var(--slate); font-size: 15.5px; margin: 16px 0 0; line-height: 1.6; }
.featured__foot {
  margin-top: auto; padding-top: 26px; display: flex; align-items: center; gap: 12px;
  font-size: 13.5px; color: var(--muted);
}

/* ---- Avatar + dot ---- */
.avatar {
  width: 34px; height: 34px; border-radius: 50%; flex: none;
  background: linear-gradient(135deg, var(--blue), #6f97ff);
  display: grid; place-items: center; color: #fff; font-weight: 700;
  font-family: var(--f-head); font-size: 13px;
}
.dot { width: 3px; height: 3px; border-radius: 50%; background: var(--muted); }

/* ---- Decorative media placeholders (index cards) ---- */
.media {
  position: relative; overflow: hidden;
  background:
    radial-gradient(120% 120% at 100% 0%, rgba(255,255,255,.18), transparent 60%),
    var(--mg, linear-gradient(135deg, #232f3e, #36475c));
}
.media::after {
  content: ""; position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.07) 1px, transparent 1px);
  background-size: 26px 26px;
  mask-image: radial-gradient(120% 90% at 50% 0%, #000, transparent 75%);
  -webkit-mask-image: radial-gradient(120% 90% at 50% 0%, #000, transparent 75%);
}
.media__glyph {
  position: absolute; right: 22px; bottom: 18px;
  font-family: var(--f-mono); font-size: 12px; letter-spacing: .12em;
  color: rgba(255,255,255,.78);
}
.media__cube { position: absolute; left: 36px; top: 50%; transform: translateY(-50%); opacity: .9; }
.mg-compute  { --mg: linear-gradient(135deg, #b65a08, #ff9900); }
.mg-storage  { --mg: linear-gradient(135deg, #0e6b48, #1f9d6b); }
.mg-ai       { --mg: linear-gradient(135deg, #1e3fb0, #2f6bff); }
.mg-security { --mg: linear-gradient(135deg, #9c2d31, #e0484d); }
.mg-database { --mg: linear-gradient(135deg, #5a37a6, #8b5cf6); }
.mg-network  { --mg: linear-gradient(135deg, #0c6f6f, #16a6a6); }

/* ---- Index controls + filters ---- */
.row-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  margin: 72px 0 22px; gap: 24px; flex-wrap: wrap;
}
.row-head h3 {
  font-family: var(--f-head); font-weight: 700; font-size: 24px;
  letter-spacing: -0.02em; margin: 0;
}
.search-input {
  flex: 0 1 320px;
  background: var(--card); border: 1px solid var(--line);
  border-radius: 11px; padding: 10px 14px 10px 38px;
  font-family: var(--f-body); font-size: 14px; color: var(--ink);
  outline: none; transition: .15s;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='15' height='15' viewBox='0 0 24 24' fill='none' stroke='%238b95a4' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'><circle cx='11' cy='11' r='7'/><path d='m21 21-4.3-4.3'/></svg>");
  background-repeat: no-repeat;
  background-position: 13px center;
}
.search-input::placeholder { color: var(--muted); }
.search-input:focus { border-color: var(--ink); }

.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 26px; }
.chip {
  font-family: var(--f-body); font-size: 13px; font-weight: 500;
  color: var(--slate); background: var(--card);
  border: 1px solid var(--line); border-radius: 999px;
  padding: 7px 15px; cursor: pointer; transition: .15s;
}
.chip:hover { border-color: var(--ink-soft); color: var(--ink); }
.chip.active { background: var(--ink); border-color: var(--ink); color: #fff; }

/* ---- Card grid (index) ---- */
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 26px; }
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow); display: flex; flex-direction: column;
  transition: transform .18s, box-shadow .18s, border-color .18s;
}
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow-hover); border-color: transparent; }
.card__media { height: 184px; display: block; }
.card__body { padding: 22px 22px 24px; display: flex; flex-direction: column; flex: 1; }
.card__meta { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.card h4 {
  font-family: var(--f-head); font-weight: 600; font-size: 18.5px;
  line-height: 1.28; letter-spacing: -0.015em; margin: 0;
}
.card:hover h4 { color: var(--orange-deep); }
.card__excerpt {
  color: var(--slate); font-size: 14px; margin: 10px 0 0; line-height: 1.55;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.card__foot {
  margin-top: auto; padding-top: 20px; display: flex; align-items: center; gap: 9px;
  font-size: 12.5px; color: var(--muted); font-family: var(--f-mono); letter-spacing: .02em;
}

/* ---- Empty / pagination (index) ---- */
.empty { text-align: center; padding: 80px 20px; color: var(--muted); }
.empty h4 { font-family: var(--f-head); font-size: 18px; color: var(--ink); margin: 0 0 8px; }

.pagination {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  margin-top: 64px; flex-wrap: wrap;
}
.pagination button, .pagination a {
  min-width: 42px; height: 42px; padding: 0 12px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 11px; border: 1px solid var(--line); background: var(--card);
  font-family: var(--f-body); font-size: 14.5px; font-weight: 600; color: var(--slate);
  cursor: pointer; transition: .15s;
}
.pagination button:hover:not(:disabled), .pagination a:hover { border-color: var(--ink); color: var(--ink); }
.pagination .current { background: var(--ink); border-color: var(--ink); color: #fff; }
.pagination .gap { border: none; background: none; cursor: default; min-width: 24px; color: var(--muted); }
.pagination .nav-btn { gap: 7px; font-weight: 600; }
.pagination button:disabled { opacity: .4; cursor: not-allowed; }

/* ---- Article shell (article) ---- */
.article { max-width: 760px; margin: 22px auto 0; }

.a-head__meta { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; flex-wrap: wrap; }
.a-head h1 {
  font-family: var(--f-head); font-weight: 700;
  font-size: clamp(30px, 4.4vw, 46px);
  line-height: 1.1; letter-spacing: -0.028em; margin: 0;
}
.a-head__dek {
  font-size: 19px; line-height: 1.55; color: var(--slate);
  margin: 20px 0 0; max-width: 62ch;
}

.byline {
  display: flex; align-items: center; gap: 13px; margin: 28px 0 0;
  padding-bottom: 30px; border-bottom: 1px solid var(--line);
}
.byline .avatar {
  width: 44px; height: 44px;
  font-size: 15px;
}
.byline__name { font-weight: 600; font-size: 15px; }
.byline__sub {
  font-size: 13px; color: var(--muted); font-family: var(--f-mono);
  letter-spacing: .02em; margin-top: 2px;
}

/* ---- Diagram block (article) ---- */
.diagram-block {
  margin: 40px 0;
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow);
}
.diagram-block .section-head {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 22px; border-bottom: 1px solid var(--line);
  font-family: var(--f-mono); font-size: 11px; font-weight: 500;
  letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--orange-deep); background: var(--line-soft);
  margin: 0;
}
.diagram-block .section-head svg { color: var(--orange-deep); flex: none; }

.diagram-image {
  background: var(--paper);
  padding: 28px 24px;
  display: flex; align-items: center; justify-content: center;
}
.diagram-image img {
  max-width: 100%; height: auto;
  border-radius: 8px;
  box-shadow: 0 2px 6px rgba(35,47,62,.08);
}
.diagram-caption {
  padding: 18px 22px; border-top: 1px solid var(--line);
  font-size: 14.5px; color: var(--slate); line-height: 1.55;
  background: var(--card);
}
.diagram-caption-text { margin: 0 0 10px; color: var(--ink-soft); }
.diagram-caption-text:last-child { margin-bottom: 0; }
.diagram-copyright {
  font-family: var(--f-mono); font-size: 11.5px;
  letter-spacing: .02em; color: var(--muted); margin: 0;
}
.diagram-copyright a {
  color: var(--blue); font-weight: 500;
  box-shadow: inset 0 -1px 0 color-mix(in srgb, var(--blue) 35%, transparent);
  word-break: break-all;
}
.diagram-copyright a:hover { box-shadow: inset 0 -2px 0 var(--blue); }

/* legacy draw.io viewer */
.mxgraph { width: 100%; min-height: 380px; background: #ffffff; }
.diagram-dl {
  padding: 14px 22px; border-top: 1px solid var(--line);
  font-size: 13px; color: var(--slate); margin: 0;
}
.diagram-dl a {
  color: var(--blue); font-weight: 500;
  box-shadow: inset 0 -1px 0 color-mix(in srgb, var(--blue) 35%, transparent);
}
.diagram-dl a:hover { box-shadow: inset 0 -2px 0 var(--blue); }

/* ---- Prose (article markdown) ---- */
.prose { font-size: 17px; line-height: 1.72; color: #2b3442; margin-top: 40px; }
.prose > p { margin: 0 0 24px; }
.prose h2 {
  font-family: var(--f-head); font-weight: 700; font-size: 26px;
  letter-spacing: -0.02em; line-height: 1.22; margin: 46px 0 16px;
  color: var(--ink);
}
.prose h3 {
  font-family: var(--f-head); font-weight: 600; font-size: 20px;
  letter-spacing: -0.015em; margin: 36px 0 12px; color: var(--ink);
}
.prose h4 {
  font-family: var(--f-head); font-weight: 600; font-size: 17px;
  margin: 30px 0 10px; color: var(--ink);
}
.prose strong { font-weight: 600; color: var(--ink); }
.prose em { font-style: italic; }
.prose a {
  color: var(--blue); font-weight: 500;
  box-shadow: inset 0 -1px 0 color-mix(in srgb, var(--blue) 35%, transparent);
}
.prose a:hover { box-shadow: inset 0 -2px 0 var(--blue); }
.prose ul, .prose ol { margin: 0 0 24px; padding-left: 22px; }
.prose li { margin-bottom: 9px; }
.prose blockquote {
  margin: 24px 0; padding: 18px 22px;
  background: color-mix(in srgb, var(--orange) 8%, white);
  border-left: 3px solid var(--orange);
  border-radius: 0 10px 10px 0; color: var(--ink-soft);
}
.prose blockquote p:last-child { margin-bottom: 0; }
.prose code {
  font-family: var(--f-mono); font-size: 0.88em;
  background: var(--line-soft); border: 1px solid var(--line);
  color: var(--ink); padding: 1px 7px; border-radius: 5px;
}
.prose pre {
  background: var(--ink); color: #d7dee8;
  border-radius: 14px; padding: 22px 24px; margin: 28px 0;
  overflow-x: auto; box-shadow: var(--shadow); line-height: 1.65;
}
.prose pre code {
  background: transparent; border: none; color: #d7dee8;
  padding: 0; font-size: 13.5px;
}
.prose hr { border: none; border-top: 1px solid var(--line); margin: 40px 0; }
.prose table {
  width: 100%; border-collapse: collapse; margin: 24px 0;
  font-size: 14.5px; box-shadow: var(--shadow);
  border-radius: 10px; overflow: hidden; background: var(--card);
}
.prose th {
  text-align: left; padding: 12px 16px;
  background: var(--line-soft); border-bottom: 1px solid var(--line);
  font-family: var(--f-mono); font-size: 11px; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--muted); font-weight: 600;
}
.prose td { padding: 12px 16px; border-bottom: 1px solid var(--line); }
.prose tr:last-child td { border-bottom: none; }

/* ---- Source + article footer (article) ---- */
.source-block {
  margin-top: 56px; padding: 22px 26px;
  background: var(--card); border: 1px solid var(--line);
  border-left: 3px solid var(--orange);
  border-radius: 12px; box-shadow: var(--shadow);
}
.source-label {
  font-family: var(--f-mono); font-size: 11px;
  letter-spacing: .18em; text-transform: uppercase;
  color: var(--orange-deep); margin: 0 0 8px;
}
.source-block a {
  color: var(--blue); font-size: 14.5px; word-break: break-all;
  box-shadow: inset 0 -1px 0 color-mix(in srgb, var(--blue) 35%, transparent);
}
.source-block a:hover { box-shadow: inset 0 -2px 0 var(--blue); }

.a-foot {
  display: flex; justify-content: space-between; align-items: center;
  flex-wrap: wrap; gap: 12px; margin-top: 44px; padding-top: 28px;
  border-top: 1px solid var(--line);
  font-size: 14px; color: var(--muted); font-family: var(--f-mono); letter-spacing: .02em;
}
.a-foot a { color: var(--slate); display: inline-flex; align-items: center; gap: 7px; }
.a-foot a:hover { color: var(--ink); }

/* ---- Site footer (both pages) ---- */
.site-foot {
  border-top: 1px solid var(--line);
  margin-top: 80px; padding: 40px 0 30px;
  background: var(--ink); color: #cfd6e0;
}
.site-foot a { color: #cfd6e0; }
.site-foot a:hover { color: #fff; }
.foot-inner {
  display: flex; justify-content: space-between; align-items: center;
  flex-wrap: wrap; gap: 14px;
}
.foot-brand__name { font-family: var(--f-head); font-size: 18px; color: #fff; font-weight: 700; }
.foot-brand p { font-size: 13px; color: #94a0b0; margin: 4px 0 0; }
.foot-meta { font-size: 13px; color: #94a0b0; font-family: var(--f-mono); letter-spacing: .02em; }

/* ---- Responsive ---- */
@media (max-width: 980px) {
  .grid { grid-template-columns: repeat(2, 1fr); }
  .featured { grid-template-columns: 1fr; }
  .featured__media { min-height: 220px; }
  .brand__tag { display: none !important; }
}
@media (max-width: 600px) {
  .wrap { padding: 0 20px; }
  .grid { grid-template-columns: 1fr; }
  .row-head { flex-direction: column; align-items: stretch; }
  .search-input { flex: 1; }
  .featured__body { padding: 28px; }
  .a-head h1 { font-size: 28px; }
  .prose { font-size: 16px; }
}