/* aien.me — screen.css
   Type:   Newsreader (reading) + Instrument Sans (UI/meta)
   Accent: Ghost's brand colour, falling back to the design's #7c3aed
   ------------------------------------------------------- */
:root {
  --bg: #fbfaf8;
  --ink: #16151a;
  --ink-2: #23212a;
  --muted: #57535d;
  --muted-2: #6e6a75;
  --meta: #6e6a75;
  --rule: #e6e3de;
  --rule-2: #ece9e4;
  --wash: #f4f2ef;
  /* Settings -> Design -> Brand -> Accent colour drives this. Ghost injects
     --ghost-accent-color through {{ghost_head}}; the hex is only the fallback
     for when the theme is rendered outside Ghost. */
  --accent: var(--ghost-accent-color, #7c3aed);
  --accent-ink: #fff;
  /* A pale wash of the accent: selection, badges, quote rules, hover borders.
     The literal is the design's violet tint, kept for browsers without
     color-mix(); the second declaration wins everywhere else and tracks
     whatever accent is actually set. */
  --accent-soft: #ddd0fb;
  --accent-soft: color-mix(in srgb, var(--accent) 25%, #fff);
  --sans: 'Instrument Sans', system-ui, -apple-system, sans-serif;
  --serif: Newsreader, Georgia, 'Times New Roman', serif;
  /* Ghost's Settings -> Design -> Typography overrides these when set. */
  --font-heading: var(--gh-font-heading, var(--serif));
  --font-body: var(--gh-font-body, var(--serif));
  --measure: 46rem;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }
a:hover { color: var(--accent); }
p { text-wrap: pretty; }
::selection { background: var(--accent-soft); }

.shell { max-width: var(--measure); margin: 0 auto; padding: 54px 26px 96px; }
.empty { font-family: var(--font-body); font-size: 16px; color: var(--muted-2); padding: 20px 0; }
.eyebrow {
  font-size: 11px; font-weight: 600; letter-spacing: 0.16em;
  text-transform: uppercase; color: var(--meta); margin: 0 0 12px;
}

/* header ------------------------------------------------ */
.site-head {
  display: flex; flex-wrap: wrap; align-items: flex-start;
  justify-content: space-between; gap: 20px 28px; padding-bottom: 34px;
}
.brand { display: flex; align-items: center; gap: 11px; }
.brand-mark {
  display: grid; place-items: center; width: 27px; height: 27px;
  border-radius: 7px; background: var(--accent); color: var(--accent-ink);
  font-size: 14px; font-weight: 600; line-height: 1; flex: none;
}
.brand-mark--icon { object-fit: cover; background: none; }
.brand-name { display: block; font-size: 15px; font-weight: 600; letter-spacing: -0.01em; line-height: 1.25; }
.brand-tag  { display: block; font-size: 12.5px; color: var(--muted-2); line-height: 1.3; }
.site-nav { display: flex; flex-wrap: wrap; align-items: center; gap: 20px; font-size: 13.5px; padding-top: 4px; }
.site-nav a { color: var(--muted-2); display: flex; align-items: center; gap: 6px; }
.site-nav .nav-current { color: var(--ink); }
.site-nav .nav-current::before {
  content: ""; width: 5px; height: 5px; border-radius: 1px; background: var(--accent); flex: none;
}

/* home lede + section labels ---------------------------- */
.lede-title {
  font-family: var(--font-heading); font-size: 28px; font-weight: 400; line-height: 1.28;
  letter-spacing: -0.015em; margin: 0 0 14px; max-width: 30ch;
}
.lede-body {
  font-family: var(--font-body); font-size: 17px; line-height: 1.55;
  color: var(--muted); margin: 0 0 46px; max-width: 56ch;
}
.rule-label { display: flex; align-items: baseline; gap: 14px; margin-bottom: 8px; }
.rule-label h2 {
  font-size: 11px; font-weight: 600; letter-spacing: 0.16em;
  text-transform: uppercase; color: var(--meta); margin: 0;
}
.rule-label::after { content: ""; flex: 1; height: 1px; background: var(--rule); }

/* tag filter -------------------------------------------- */
.tag-filter { display: flex; flex-wrap: wrap; gap: 6px 16px; padding: 14px 0 4px; }
.tag-filter a { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted-2); }
.tag-filter a.is-active { color: var(--ink); }
.tag-filter a.is-active::before {
  content: ""; width: 5px; height: 5px; border-radius: 1px; background: var(--accent); flex: none;
}

/* post list — shared ------------------------------------ */
/* .card is the flex row [ text | thumbnail ]; .card-body carries whichever
   inner layout the variation asks for, so the thumbnail never disturbs it. */
.card { display: flex; gap: 20px; align-items: flex-start; border-bottom: 1px solid var(--rule-2); }
.card-body { flex: 1; min-width: 0; }
.card-thumb {
  flex: none; display: block; overflow: hidden;
  border-radius: 8px; background: var(--wash);
}
.card-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
/* The separator hangs off the reading time so it can be styled on its own. */
.card-read::before { content: "\00b7"; margin: 0 7px; color: var(--meta); }

/* post list — variation A: flowing ---------------------- */
.feed--flowing .card { padding: 19px 0; }
.feed--flowing .card-body {
  display: block;
  font-family: var(--font-body); font-size: 16.5px; line-height: 1.6;
}
.feed--flowing .card-thumb { width: 72px; height: 72px; margin-top: 3px; }
.feed--flowing .card-title { font-weight: 600; letter-spacing: -0.005em; }
/* Three lines: collection / title, then the meta, then the excerpt. */
.feed--flowing .card-meta {
  display: block; margin: 3px 0;
  font-family: var(--sans); font-size: 12px; color: var(--meta);
}
.feed--flowing .card-time::before { content: "\00a0"; }
.feed--flowing .card-read::before { color: var(--accent); }
.feed--flowing .card-excerpt { display: block; color: var(--muted-2); }
.feed--flowing .card-series {
  font-family: var(--sans); font-size: 11px; font-weight: 600; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--accent);
}
.feed--flowing .card-series::after { content: "\00a0/\00a0"; color: var(--rule); }

/* post list — variation B: two-line --------------------- */
.feed--twoline .card { padding: 18px 0; }
.feed--twoline .card-body {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 20px;
}
.feed--twoline .card-thumb { width: 112px; height: 84px; }
.feed--twoline .card-title {
  font-family: var(--font-heading); font-size: 17.5px; font-weight: 600;
  line-height: 1.35; letter-spacing: -0.01em;
}
.feed--twoline .card-meta {
  font-size: 12px; color: var(--meta); white-space: nowrap; padding-top: 5px;
}
/* Archives are date-only; the clock belongs to the flowing list. */
.feed--twoline .card-time { display: none; }
.feed--twoline .card-excerpt {
  grid-column: 1 / -1; font-family: var(--font-body); font-size: 15.5px;
  line-height: 1.55; color: var(--muted-2); max-width: 62ch;
}
/* The series label takes a row of its own above the title. */
.feed--twoline .card-series {
  grid-column: 1 / -1; order: -1; margin-bottom: 2px;
  font-size: 11px; font-weight: 600; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--accent);
}

.more { display: inline-block; margin-top: 26px; font-size: 13px; color: var(--muted-2); }

/* collections on the homepage --------------------------- */
.collections { margin-top: 66px; }
.collection-row {
  display: grid; grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 20px; padding: 18px 0; border-bottom: 1px solid var(--rule-2);
}
.collection-row-title {
  font-family: var(--font-heading); font-size: 17.5px; font-weight: 600;
  line-height: 1.35; letter-spacing: -0.01em;
}
.collection-row-meta { font-size: 12px; color: var(--meta); white-space: nowrap; padding-top: 5px; }
.collection-row-excerpt {
  grid-column: 1 / -1; font-family: var(--font-body); font-size: 15.5px;
  line-height: 1.55; color: var(--muted-2); max-width: 62ch;
}

/* collection landing page ------------------------------- */
.collection-head { margin-bottom: 36px; }
.collection-head .post-title { margin-bottom: 14px; }
.collection-dates { font-size: 12px; color: var(--meta); margin: 14px 0 0; }
.parts { list-style: none; margin: 0; padding: 0; counter-reset: none; }
.part {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 4px 20px; align-items: baseline;
  padding: 20px 0; border-bottom: 1px solid var(--rule-2);
}
.part-number {
  font-size: 12px; font-variant-numeric: tabular-nums; letter-spacing: 0.08em;
  color: var(--accent); font-weight: 600;
}
.part-body { display: block; }
.part-title {
  display: block; font-family: var(--font-heading); font-size: 17.5px; font-weight: 600;
  line-height: 1.35; letter-spacing: -0.01em;
}
.part-excerpt {
  display: block; margin-top: 4px; font-family: var(--font-body); font-size: 15.5px;
  line-height: 1.55; color: var(--muted-2); max-width: 62ch;
}
.part-read { font-size: 12px; color: var(--meta); white-space: nowrap; }
.collection-notes { margin-top: 56px; padding-top: 28px; border-top: 1px solid var(--rule); }

/* projects ---------------------------------------------- */
.projects-head { margin-bottom: 10px; }
.projects-head .lede-body { margin-bottom: 40px; }
.project-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
  gap: 14px; margin-top: 22px;
}
.project {
  display: flex; flex-direction: column; gap: 8px;
  padding: 18px 20px; border: 1px solid var(--rule); border-radius: 8px;
  background: #fff; transition: border-color 0.15s ease;
}
.project:hover { border-color: var(--accent-soft); color: inherit; }
.project-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.project-badge {
  font-size: 10.5px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--accent); background: var(--accent-soft); border-radius: 4px; padding: 3px 7px;
}
.project-url { font-size: 12px; color: var(--meta); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.project-name {
  font-family: var(--font-heading); font-size: 17.5px; font-weight: 600;
  line-height: 1.35; letter-spacing: -0.01em;
}
.project-text {
  font-family: var(--font-body); font-size: 15.5px; line-height: 1.55; color: var(--muted-2);
}
.project-stack {
  margin-top: auto; padding-top: 6px; font-size: 11.5px; color: var(--meta);
}
.projects-notes { margin-top: 56px; padding-top: 28px; border-top: 1px solid var(--rule); }

/* article ----------------------------------------------- */
.back { display: inline-block; font-size: 13px; color: var(--meta); margin-bottom: 34px; }
.part-label {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
  font-size: 11px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--meta); margin: 0 0 14px;
}
.part-label a { color: var(--accent); }
.post-meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
  font-size: 12px; color: var(--meta); margin-bottom: 14px;
}
.post-meta a { color: var(--accent); }
.post-title {
  font-family: var(--font-heading); font-size: 34px; font-weight: 600; line-height: 1.18;
  letter-spacing: -0.02em; margin: 0 0 16px;
}
.post-excerpt {
  font-family: var(--font-body); font-size: 19px; line-height: 1.5;
  color: var(--muted); margin: 0 0 40px; max-width: 60ch;
}
.page-lede {
  margin: 0 0 34px; padding: 2px 0 2px 22px; border-left: 2px solid var(--accent-soft);
  font-family: var(--font-body); font-size: 19px; line-height: 1.5; font-style: italic;
  color: var(--muted); max-width: 58ch;
}
.post-divider { height: 1px; background: var(--rule); margin-bottom: 40px; }
.post-feature { margin: 0 0 40px; }
.post-feature img { border-radius: 8px; }
.post-feature figcaption { font-size: 12.5px; color: var(--meta); margin-top: 8px; }

.post-content {
  font-family: var(--font-body); font-size: 18px; line-height: 1.72;
  color: var(--ink-2); max-width: 68ch;
}
.post-content p, .post-content ul, .post-content ol { margin: 0 0 24px; }
.post-content a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.post-content h2, .post-content h3 {
  font-family: var(--sans); font-size: 13px; font-weight: 600; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--meta); margin: 46px 0 18px;
}
.post-content blockquote {
  margin: 0 0 28px; padding: 2px 0 2px 22px;
  border-left: 2px solid var(--accent-soft); font-style: italic; color: var(--muted);
}
.post-content figure { margin: 0 0 28px; }
.post-content figcaption { font-family: var(--sans); font-size: 12.5px; color: var(--meta); margin-top: 8px; }
.post-content code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.86em;
  background: var(--wash); border: 1px solid var(--rule); border-radius: 4px; padding: 1px 5px;
}
.post-content pre {
  margin: 0 0 28px; padding: 16px 18px; background: var(--wash); border: 1px solid var(--rule);
  border-radius: 8px; overflow-x: auto; font-size: 13.5px; line-height: 1.6; color: var(--ink-2);
}
.post-content pre code { background: none; border: 0; padding: 0; font-size: 13.5px; }
.post-content hr { border: 0; border-top: 1px solid var(--rule); margin: 40px 0; }
.post-content table { width: 100%; border-collapse: collapse; font-family: var(--sans); font-size: 14px; margin: 0 0 28px; }
.post-content th, .post-content td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--rule-2); }

/* next part in a collection ----------------------------- */
.next-card {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  margin-top: 56px; padding: 18px 20px;
  border: 1px solid var(--rule); border-left: 2px solid var(--accent); border-radius: 8px;
  background: #fff;
}
.next-card:hover { border-color: var(--accent-soft); border-left-color: var(--accent); color: inherit; }
.next-card::after { content: "\2192"; color: var(--accent); font-size: 16px; }
.next-card-label {
  display: block; font-size: 11px; font-weight: 600; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--meta); margin-bottom: 6px;
}
.next-card-title {
  display: block; font-family: var(--font-heading); font-size: 17px; font-weight: 600; line-height: 1.35;
}

.post-tags { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 40px; font-size: 12.5px; }
.post-tags a { color: var(--muted-2); }

.post-nav {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
  gap: 14px; margin-top: 56px; padding-top: 28px; border-top: 1px solid var(--rule);
}
.post-nav-label {
  display: block; font-size: 11px; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--meta); margin-bottom: 6px;
}
.post-nav-title {
  display: block; font-family: var(--font-heading); font-size: 16.5px; font-weight: 600; line-height: 1.35;
}

/* about -------------------------------------------------- */
.about-portrait { width: 96px; height: 96px; border-radius: 8px; object-fit: cover; margin: 0 0 32px; }
.about-block { margin-top: 46px; max-width: 68ch; }
.about-block h2 {
  font-size: 13px; font-weight: 600; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--meta); margin: 0 0 14px;
}
.about-stack { font-size: 14px; line-height: 1.9; color: var(--ink-2); margin: 0; }
.about-stack .stack-item {
  display: inline-block; margin: 0 6px 6px 0; padding: 3px 9px;
  border: 1px solid var(--rule); border-radius: 4px; background: #fff;
}
.about-now { font-family: var(--font-body); font-size: 17px; line-height: 1.6; color: var(--ink-2); margin: 0; }
.about-now-date { font-size: 12px; color: var(--meta); margin: 8px 0 0; }
.about-links { font-family: var(--font-body); font-size: 17px; margin: 0; }
.about-links a { color: var(--accent); margin-right: 16px; }

/* author ------------------------------------------------- */
.author-head { display: flex; align-items: flex-start; gap: 18px; }
.author-avatar { width: 64px; height: 64px; border-radius: 8px; object-fit: cover; flex: none; }

/* error --------------------------------------------------- */
.error { padding: 40px 0 60px; }
.error .lede-body { margin-bottom: 8px; }

/* footer ------------------------------------------------ */
.site-foot {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 12px 24px; margin-top: 80px; padding-top: 22px;
  border-top: 1px solid var(--rule); font-size: 12.5px; color: var(--meta);
}
.site-foot a { color: var(--meta); }
.foot-links { display: flex; flex-wrap: wrap; gap: 16px; }

@media (max-width: 540px) {
  .shell { padding: 34px 20px 72px; }
  .post-title { font-size: 28px; }
  .lede-title { font-size: 24px; }
  .part { grid-template-columns: auto minmax(0, 1fr); }
  .part-read { grid-column: 2; }
  .card { gap: 14px; }
  .feed--flowing .card-thumb { width: 60px; height: 60px; }
  .feed--twoline .card-thumb { width: 76px; height: 60px; }
}

/* Koenig editor cards ----------------------------------- */
.post-content :where(.kg-card, figure) { margin: 0 0 28px; }
.post-content .kg-width-wide {
  width: min(calc(100vw - 52px), 56rem);
  max-width: none;
  margin-left: 50%;
  transform: translateX(-50%);
}
.post-content .kg-width-full {
  width: calc(100vw - 52px);
  max-width: none;
  margin-left: 50%;
  transform: translateX(-50%);
}
.post-content .kg-width-wide img,
.post-content .kg-width-full img { width: 100%; border-radius: 8px; }
.post-content .kg-width-full img { border-radius: 0; }
.post-content .kg-image { border-radius: 8px; }
.post-content .kg-embed-card { display: flex; flex-direction: column; align-items: center; }
.post-content .kg-embed-card iframe { max-width: 100%; }
.post-content .kg-gallery-container { display: flex; flex-direction: column; gap: 8px; }
.post-content .kg-gallery-row { display: flex; gap: 8px; }
.post-content .kg-gallery-image img { width: 100%; height: 100%; object-fit: cover; border-radius: 8px; }
.post-content .kg-bookmark-card a.kg-bookmark-container {
  display: flex; text-decoration: none; color: inherit;
  border: 1px solid var(--rule); border-radius: 8px; background: #fff; overflow: hidden;
}
.post-content .kg-bookmark-content { flex: 1; padding: 18px 20px; }
.post-content .kg-bookmark-title { font-family: var(--sans); font-size: 15px; font-weight: 600; }
.post-content .kg-bookmark-description {
  font-family: var(--sans); font-size: 13.5px; line-height: 1.5;
  color: var(--muted-2); margin-top: 6px;
}
.post-content .kg-bookmark-metadata { font-family: var(--sans); font-size: 12px; color: var(--meta); margin-top: 12px; }
.post-content .kg-bookmark-icon { width: 16px; height: 16px; margin-right: 6px; vertical-align: text-bottom; }
.post-content .kg-bookmark-thumbnail { flex: 0 0 33%; }
.post-content .kg-bookmark-thumbnail img { width: 100%; height: 100%; object-fit: cover; }
.post-content .kg-button-card { display: flex; justify-content: center; }
.post-content .kg-btn {
  display: inline-block; font-family: var(--sans); font-size: 14px; font-weight: 600;
  padding: 10px 20px; border-radius: 6px; background: var(--accent);
  color: var(--accent-ink); text-decoration: none;
}
.post-content .kg-callout-card {
  display: flex; gap: 12px; padding: 16px 18px;
  background: var(--wash); border: 1px solid var(--rule); border-radius: 8px;
}
.post-content .kg-toggle-card { border-bottom: 1px solid var(--rule-2); padding-bottom: 16px; }
.post-content .kg-toggle-heading { display: flex; justify-content: space-between; align-items: center; gap: 12px; cursor: pointer; }
.post-content .kg-toggle-card[data-kg-toggle-state="close"] .kg-toggle-content { display: none; }

@media (max-width: 900px) {
  .post-content .kg-width-wide,
  .post-content .kg-width-full { width: 100%; margin-left: 0; transform: none; }
  .post-content .kg-width-full img { border-radius: 8px; }
}
