/* =============================================================================
   Knowledge Channels Technologies — site stylesheet
   Pure white, magazine layout. Two typefaces with distinct jobs:
     Outfit          headlines, nav, dates, topics, buttons, captions, footer
     Source Serif 4  all running text and summaries
   Colour: the logo's own teal + purple at rest; one same-hue step brighter on hover.
   No gradient text, no decorative rules beyond section dividers.
   (App pages under /apps/ use their own themeable system: apps/_shared/app-page.css.)
   ============================================================================ */

:root {
  --paper:    #ffffff;
  --ink:      #1f1f1f;
  --muted:    #5e5e5e;
  --rule:     #e3e3e3;
  --wash:     #f4f7f7;   /* code blocks */

  --teal:     #008080;   /* logo teal */
  --teal-h:   #009999;   /* hover */
  --purple:   #660066;   /* logo purple */
  --purple-h: #800080;   /* hover */

  --display: 'Outfit', system-ui, sans-serif;
  --text:    'Source Serif 4', Georgia, serif;
  --code:    ui-monospace, 'SF Mono', Menlo, Consolas, monospace;

  --wrap:    1200px;
  --measure: 680px;      /* article text column, ~70 characters */
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
  background: var(--paper); color: var(--ink);
  font-family: var(--text); font-size: 17px; line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
a:focus-visible { outline: 2px solid var(--teal); outline-offset: 3px; border-radius: 2px; }
img { max-width: 100%; height: auto; }
.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 40px; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ── Masthead ─────────────────────────────────────────────── */
.mast { border-bottom: 1px solid var(--rule); }
.mast .wrap { display: flex; align-items: center; justify-content: space-between; gap: 24px; height: 84px; }
.brand { display: flex; align-items: center; gap: 14px; text-decoration: none; }
.brand img { width: 42px; height: 42px; display: block; }
.brand-name { font-family: var(--display); font-weight: 700; font-size: 20px; line-height: 1.05; letter-spacing: -0.01em; display: block; }
.brand-sub  { font-family: var(--display); font-weight: 600; font-size: 13px; color: var(--muted); display: block; }
.mast nav { display: flex; gap: 32px; }
.mast nav a { font-family: var(--display); font-weight: 600; font-size: 16px; text-decoration: none; }
.mast nav a:hover, .mast nav a[aria-current] { color: var(--purple); }

/* Home intro — matches the masthead's "Technologies" line, so it reads as part of the name */
.standfirst {
  font-family: var(--display); font-weight: 600; font-size: 16px; line-height: 1.5;
  color: var(--muted); max-width: 44em; padding-top: 24px;
}

/* ── Shared bits ──────────────────────────────────────────── */
.meta, .platform, footer, figcaption { font-family: var(--display); }
.meta { display: flex; flex-wrap: wrap; gap: 14px; align-items: baseline; margin-bottom: 14px; font-size: 14px; }
.topic { font-weight: 700; color: var(--teal); }
.date  { color: var(--muted); }
.draft-flag {
  font-weight: 700; color: #fff; background: #b35900;
  padding: 1px 8px; border-radius: 4px;
}
/* Section headings: heavy rule above, like a magazine section flag */
.section-h {
  font-family: var(--display); font-weight: 800; font-size: 20px;
  border-top: 4px solid var(--ink); padding-top: 18px;
}

/* ── Home: lead article + more articles ───────────────────── */
.front {
  display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 4fr);
  gap: 72px; padding: 56px 0 88px;
}
.front-solo { grid-template-columns: minmax(0, 1fr); }
.front-solo .lead { max-width: 900px; }

.lead-title {
  font-family: var(--display); font-weight: 800;
  font-size: clamp(44px, 6vw, 80px); line-height: 0.98; letter-spacing: -0.035em;
  color: var(--purple);
}
.lead.has-img .lead-title { font-size: clamp(38px, 4.6vw, 62px); line-height: 1.02; }
.lead-title a { text-decoration: none; transition: color 0.15s; }
.lead-title a:hover { color: var(--purple-h); }
.lead p { font-size: 21px; line-height: 1.5; max-width: 30em; margin-top: 28px; }
.lead-img { margin-bottom: 26px; }
.lead-img img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; display: block; border-radius: 6px; }
.read {
  display: inline-block; margin-top: 30px;
  font-family: var(--display); font-weight: 700; font-size: 17px;
  color: var(--purple); text-underline-offset: 0.2em; text-decoration-thickness: 2px;
}
.read:hover { color: var(--purple-h); }

.more .section-h { margin-bottom: 8px; }
.more ol, .article-list, .next ol { list-style: none; }
.more li, .article-list li { padding: 22px 0; border-bottom: 1px solid var(--rule); }
.more li .meta, .article-list li .meta, .next li .meta { margin-bottom: 6px; }
a.t {
  font-family: var(--display); font-weight: 700; font-size: 23px; line-height: 1.18;
  letter-spacing: -0.015em; text-decoration: none; display: block;
}
a.t:hover { color: var(--purple-h); }
.more li p, .article-list li p, .next li p { font-size: 16px; color: var(--muted); margin-top: 8px; }
li.has-thumb { display: grid; grid-template-columns: minmax(0, 1fr) 88px; gap: 18px; align-items: start; }
.thumb { width: 88px; height: 88px; object-fit: cover; border-radius: 6px; display: block; margin-top: 28px; }
.all { display: inline-block; margin-top: 22px; font-family: var(--display); font-weight: 700; font-size: 16px; color: var(--purple); }
.all:hover { color: var(--purple-h); }

/* ── Home: apps ───────────────────────────────────────────── */
.apps { padding-bottom: 96px; }
.apps-first { padding-top: 56px; }
.app {
  display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
  gap: 72px; align-items: center; margin-top: 48px;
}
.app + .app { margin-top: 96px; }
.app-head { display: flex; align-items: center; gap: 20px; }
.app-head img { width: 64px; height: 64px; display: block; }
.app-name {
  font-family: var(--display); font-weight: 800; font-size: clamp(48px, 5.4vw, 72px);
  line-height: 1; letter-spacing: -0.03em; color: var(--teal);
}
.app-name a { text-decoration: none; transition: color 0.15s; }
.app-name a:hover { color: var(--teal-h); }
.app-tag { font-family: var(--display); font-weight: 600; font-size: 22px; margin-top: 26px; line-height: 1.3; }
.app-desc { margin-top: 14px; font-size: 18px; max-width: 28em; }
.platform { margin-top: 10px; font-size: 14px; color: var(--muted); }
.app-links { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 30px; }
.btn {
  font-family: var(--display); font-weight: 700; font-size: 16px; text-decoration: none;
  padding: 13px 22px; border-radius: 8px; border: 2px solid var(--ink);
}
.btn-solid { background: var(--ink); color: #fff; }
.btn-solid:hover { background: var(--teal); border-color: var(--teal); }
.btn:not(.btn-solid):hover { border-color: var(--teal); color: var(--teal); }
.shots { display: grid; grid-template-columns: repeat(2, minmax(0, 280px)); justify-content: end; gap: 24px; }
.shots img {
  width: 100%; height: auto; display: block;   /* each app's own screenshot shape, never cropped */
  border-radius: 14px; border: 1px solid var(--rule);
}
.shots img:nth-child(2) { transform: translateY(-28px); }

/* ── Home: contact ────────────────────────────────────────── */
.contact { padding-bottom: 88px; }
.contact-line {
  font-family: var(--display); font-weight: 600;
  font-size: clamp(20px, 1.9vw, 26px); line-height: 1.3; letter-spacing: -0.01em;
  margin-top: 28px; max-width: 30em;
}
.contact-line a { color: var(--teal); text-decoration-thickness: 2px; text-underline-offset: 0.16em; }
.contact-line a:hover { color: var(--teal-h); }

/* ── Articles list page ───────────────────────────────────── */
.list-head { padding: 64px 0 24px; border-bottom: 4px solid var(--ink); max-width: 820px; }
.list-head h1 {
  font-family: var(--display); font-weight: 800; font-size: clamp(40px, 5vw, 64px);
  line-height: 1; letter-spacing: -0.03em; color: var(--purple);
}
.article-list { max-width: 820px; padding-bottom: 96px; }
.empty { font-size: 19px; color: var(--muted); padding: 40px 0 120px; }

/* ── Article page ─────────────────────────────────────────── */
.post-head { padding: 64px 0 44px; max-width: 900px; }
.post-head .meta { margin-bottom: 18px; }
.post-head h1 {
  font-family: var(--display); font-weight: 800;
  font-size: clamp(40px, 5.4vw, 68px); line-height: 1.02; letter-spacing: -0.03em;
  color: var(--purple);
}
.dek { font-size: 22px; line-height: 1.45; max-width: 32em; margin-top: 26px; }

.prose { max-width: var(--measure); font-size: 20px; line-height: 1.72; padding-bottom: 40px; }
.prose > * + * { margin-top: 1.1em; }
.prose h2 {
  font-family: var(--display); font-weight: 700; font-size: 30px; line-height: 1.15;
  letter-spacing: -0.02em; margin-top: 2em;
}
.prose h3 { font-family: var(--display); font-weight: 700; font-size: 22px; line-height: 1.25; margin-top: 1.7em; }
.prose h2 + *, .prose h3 + * { margin-top: 0.6em; }
.prose a { color: var(--purple); text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
.prose a:hover { color: var(--purple-h); }
.prose strong { font-weight: 700; }
.prose ul, .prose ol { padding-left: 1.3em; }
.prose li + li { margin-top: 0.4em; }
.prose li::marker { color: var(--teal); }
.prose hr { border: 0; border-top: 1px solid var(--rule); margin: 2em 0; }
.prose blockquote {
  border-left: 4px solid var(--teal);
  padding: 2px 0 2px 24px;
  font-size: 22px; line-height: 1.5; font-style: italic;
}
.prose blockquote > * + * { margin-top: 0.8em; }
.prose img { border-radius: 6px; display: block; }

/* Figures break out wider than the text column */
.prose figure { width: min(900px, calc(100vw - 80px)); margin-top: 2em; margin-bottom: 2em; }
.prose > figure:first-child { margin-top: 0; }
.prose figure img { width: 100%; }
figcaption { font-size: 15px; color: var(--muted); margin-top: 12px; max-width: var(--measure); }

/* Code */
.prose code {
  font-family: var(--code); font-size: 0.84em;
  background: var(--wash); padding: 0.12em 0.36em; border-radius: 4px;
}
.prose pre {
  background: var(--wash); border-radius: 8px;
  padding: 20px 22px; overflow-x: auto;
  font-size: 15px; line-height: 1.6;
}
.prose pre code { background: none; padding: 0; font-size: inherit; }
.token.keyword, .token.builtin, .token.important { color: var(--purple); font-weight: 600; }
.token.string, .token.number, .token.boolean, .token.char { color: var(--teal); }
.token.comment, .token.prolog, .token.doctype { color: var(--muted); font-style: italic; }
.token.function, .token.class-name { color: var(--ink); font-weight: 600; }
.token.punctuation, .token.operator { color: #444; }

/* Footnotes */
.prose .footnote-ref a { text-decoration: none; font-weight: 700; font-size: 0.72em; padding: 0 1px; }
.prose .footnote-ref { line-height: 0; }
.prose .notes { border-top: 1px solid var(--rule); padding-top: 26px; margin-top: 2.4em; font-size: 16px; }
.prose .notes h2 { font-size: 18px; margin-top: 0; margin-bottom: 12px; }
.prose .notes ol { color: var(--muted); }
.prose .notes li + li { margin-top: 8px; }
.prose .notes p { display: inline; }

.update { max-width: var(--measure); font-size: 15px; color: var(--muted); font-family: var(--display); }
.update b { color: var(--ink); font-weight: 700; }

/* More articles, below an article */
.next { margin-top: 88px; padding-bottom: 88px; }
.next .section-h { margin-bottom: 8px; }
.next ol { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 40px; }
.next li { padding-top: 22px; }

/* ── 404 ──────────────────────────────────────────────────── */
.not-found { padding: 88px 0 120px; max-width: 640px; }
.not-found h1 {
  font-family: var(--display); font-weight: 800; font-size: clamp(40px, 5.4vw, 68px);
  line-height: 1.02; letter-spacing: -0.03em; color: var(--purple);
}
.not-found > p:not(.meta) { font-size: 20px; line-height: 1.55; margin-top: 22px; }
.not-found-links { display: flex; flex-wrap: wrap; gap: 28px; font-family: var(--display); font-weight: 700; }
.not-found-links a { color: var(--purple); text-underline-offset: 0.2em; text-decoration-thickness: 2px; }
.not-found-links a:hover { color: var(--purple-h); }

/* ── Footer ───────────────────────────────────────────────── */
footer { border-top: 1px solid var(--rule); }
footer .wrap { display: flex; justify-content: space-between; gap: 16px; padding-top: 26px; padding-bottom: 30px; font-size: 14px; color: var(--muted); }
.foot-bar { display: grid; grid-template-columns: 1fr 1fr; height: 6px; }
.foot-bar::before { content: ''; background: var(--teal); }
.foot-bar::after  { content: ''; background: var(--purple); }

/* ── Tablet ───────────────────────────────────────────────── */
@media (max-width: 900px) {
  .front { grid-template-columns: 1fr; gap: 56px; }
  .app { grid-template-columns: 1fr; gap: 48px; }
  .next ol { grid-template-columns: 1fr; gap: 0; }
  .next li { border-bottom: 1px solid var(--rule); padding-bottom: 22px; }
}

/* ── Mobile ───────────────────────────────────────────────── */
@media (max-width: 640px) {
  .wrap { padding: 0 20px; }
  .mast .wrap { height: 68px; }
  .brand img { width: 34px; height: 34px; }
  .brand-name { font-size: 17px; }
  .brand-sub { display: none; }
  .mast nav { gap: 18px; }
  .mast nav a { font-size: 15px; }
  .standfirst { font-size: 15px; padding-top: 18px; }
  .front { padding: 36px 0 64px; }
  .apps-first { padding-top: 36px; }
  .lead p { font-size: 18px; margin-top: 20px; }
  a.t { font-size: 21px; }
  .apps { padding-bottom: 72px; }
  .app { margin-top: 32px; }
  .app-head img { width: 52px; height: 52px; }
  .shots { gap: 10px; }
  .shots img:nth-child(2) { transform: none; }
  .contact { padding-bottom: 64px; }
  .list-head { padding: 40px 0 18px; }
  .post-head { padding: 40px 0 32px; }
  .dek { font-size: 19px; }
  .prose { font-size: 18px; }
  .prose h2 { font-size: 25px; }
  .prose blockquote { font-size: 19px; padding-left: 18px; }
  .prose pre { font-size: 14px; padding: 16px; margin-left: -20px; margin-right: -20px; border-radius: 0; }
  .prose figure { width: 100%; }
  footer .wrap { flex-direction: column; }
}
