/* @personizely/releases — public page and in-app embed.
   Theme with --accent and --font from releases.config (injected inline). */

/* Tokens. Every color is light-dark(light, dark); the config overrides them
   inline, and [data-theme] forces a scheme (used by the embed). */
:root {
  color-scheme: light dark;
  --accent: #2f54eb;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --paper: light-dark(#fbfbfa, #121317);
  --surface: light-dark(#ffffff, #1a1b20);
  --ink: light-dark(#17181c, #ececef);
  --ink-2: color-mix(in srgb, var(--ink) 80%, var(--paper));
  --muted: light-dark(#6b6e78, #8d909b);
  --rule: light-dark(#e4e4e1, #2a2c33);
  /* Accent as text: lifted in dark mode so it stays readable. */
  --accent-text: light-dark(var(--accent), color-mix(in srgb, var(--accent) 62%, white));
  --c-new: var(--accent-text);
  --c-improved: light-dark(#0d7f57, #3fc48f);
  --c-fixed: light-dark(#a8530f, #e59a52);
  --radius: 10px;
}
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 16px/1.6 var(--font);
  font-feature-settings: "kern", "tnum" 0;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
a:focus-visible, summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}
img { max-width: 100%; height: auto; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Header ---------- */
.site-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  max-width: 920px;
  margin: 0 auto;
  padding: 20px 24px;
}
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 600; letter-spacing: -0.01em; }
.brand img { display: block; height: var(--logo-h, 28px); width: auto; }
.brand .logo-dark { display: none; }
@media (prefers-color-scheme: dark) {
  .brand .logo-light:has(+ .logo-dark) { display: none; }
  .brand .logo-dark { display: block; }
}
.home-link { color: var(--muted); text-decoration: none; font-size: 15px; }
.home-link:hover { color: var(--ink); }

/* ---------- Layout ---------- */
.wrap { max-width: 920px; margin: 0 auto; padding: 0 24px 96px; }

.intro { padding: 48px 0 40px; max-width: 640px; margin-left: 140px; }
.intro h1 {
  margin: 0 0 12px;
  font-size: clamp(36px, 6vw, 56px);
  line-height: 1.04;
  letter-spacing: -0.035em;
  font-weight: 700;
}
.intro p { margin: 0; color: var(--ink-2); font-size: 18px; max-width: 34em; }

.filters { display: flex; flex-wrap: wrap; gap: 6px 4px; margin-top: 28px; }
.filters a {
  padding: 6px 12px;
  border-radius: 999px;
  color: var(--muted);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
}
.filters a:hover { color: var(--ink); background: color-mix(in srgb, var(--ink) 6%, transparent); }
.filters a[aria-current="page"] { color: var(--ink); background: color-mix(in srgb, var(--ink) 9%, transparent); }
.filters .rss { margin-left: auto; }

/* ---------- Month groups: the one loud typographic element ---------- */
.month { margin-top: 24px; }
.month-label {
  margin: 0 0 8px 140px;
  padding: 40px 0 12px;
  font-size: clamp(28px, 4.2vw, 40px);
  line-height: 1.1;
  font-weight: 300;
  letter-spacing: -0.03em;
  color: var(--muted);
  font-variant-numeric: lining-nums;
}

/* ---------- Timeline ---------- */
.timeline { position: relative; }
.timeline::before {
  /* the rail */
  content: "";
  position: absolute;
  left: 114px;
  top: 6px;
  bottom: 0;
  width: 1px;
  background: var(--rule);
}
.entry {
  position: relative;
  display: grid;
  grid-template-columns: 92px 32px minmax(0, 640px);
  column-gap: 8px;
  padding: 0 0 56px;
}
.entry-date {
  text-align: right;
  padding-top: 2px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}
.entry-date .d { display: block; font-size: 28px; font-weight: 600; color: var(--ink); letter-spacing: -0.02em; line-height: 1; margin-bottom: 4px; }
.entry-node { position: relative; }
.entry-node::after {
  content: "";
  position: absolute;
  /* centred on the rail: rail at 114px (1px wide) minus the node column's 100px offset, minus half the 9px dot */
  left: 10px;
  top: 8px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--paper);
  border: 2px solid var(--c-new);
}
.entry[data-type="improved"] .entry-node::after { border-color: var(--c-improved); }
.entry[data-type="fixed"] .entry-node::after { border-color: var(--c-fixed); }

.type {
  display: inline-block;
  font-size: 13px;
  font-weight: 600;
  color: var(--c-new);
  margin-right: 10px;
}
.type-improved { color: var(--c-improved); }
.type-fixed { color: var(--c-fixed); }
.draft { font-size: 13px; font-weight: 600; color: var(--muted); border: 1px dashed var(--muted); border-radius: 4px; padding: 0 6px; }

.entry-title {
  margin: 4px 0 14px;
  font-size: 24px;
  line-height: 1.25;
  letter-spacing: -0.02em;
  font-weight: 600;
  text-wrap: balance;
}
.entry-title a { text-decoration: none; }
.entry-title a:hover { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 4px; }
h1.entry-title { font-size: clamp(30px, 4.6vw, 40px); line-height: 1.12; letter-spacing: -0.03em; }

.entry-image {
  display: block;
  width: 100%;
  margin: 4px 0 20px;
  border-radius: var(--radius);
  border: 1px solid var(--rule);
  background: var(--surface);
}

/* ---------- Prose ---------- */
.prose { color: var(--ink-2); max-width: 64ch; }
.prose > :first-child { margin-top: 0; }
.prose > :last-child { margin-bottom: 0; }
.prose p, .prose ul, .prose ol, .prose blockquote, .prose pre, .prose table { margin: 0 0 1em; }
.prose h2, .prose h3, .prose h4 { color: var(--ink); line-height: 1.3; letter-spacing: -0.01em; margin: 1.6em 0 0.5em; }
.prose h2 { font-size: 19px; }
.prose h3, .prose h4 { font-size: 16px; }
.prose ul, .prose ol { padding-left: 1.25em; }
.prose li { margin: 0.3em 0; }
.prose li::marker { color: var(--muted); }
.prose strong { color: var(--ink); font-weight: 600; }
.prose a { color: var(--accent-text); text-underline-offset: 3px; text-decoration-thickness: 1px; }
.prose img, .prose video { display: block; border-radius: var(--radius); border: 1px solid var(--rule); margin: 1.2em 0; }
.prose code { font-size: 0.88em; background: color-mix(in srgb, var(--ink) 7%, transparent); padding: 0.1em 0.35em; border-radius: 4px; }
.prose pre { background: var(--surface); border: 1px solid var(--rule); padding: 14px 16px; border-radius: 8px; overflow-x: auto; }
.prose pre code { background: none; padding: 0; }
.prose blockquote { border-left: 3px solid var(--rule); padding-left: 14px; color: var(--muted); }
.prose hr { border: 0; border-top: 1px solid var(--rule); margin: 2em 0; }
.prose table { border-collapse: collapse; width: 100%; font-size: 15px; display: block; overflow-x: auto; }
.prose th, .prose td { border-bottom: 1px solid var(--rule); padding: 8px 10px; text-align: left; }

.tags { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; padding: 0; margin: 18px 0 0; }
.tags li { font-size: 13px; color: var(--muted); border: 1px solid var(--rule); border-radius: 999px; padding: 2px 10px; }

.empty { margin-left: 140px; color: var(--muted); max-width: 40em; }

/* ---------- Single entry ---------- */
.single .back { margin: 32px 0 0 140px; font-size: 15px; }
.single .back a { color: var(--muted); text-decoration: none; }
.single .back a:hover { color: var(--ink); }
.single-date { margin: 28px 0 20px 140px; color: var(--muted); font-size: 15px; }
.single .entry-date { visibility: hidden; }
.single .timeline::before { display: none; }
.single .entry-node { display: none; }
.single .entry { grid-template-columns: 132px minmax(0, 640px); }
.pager {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-left: 140px;
  max-width: 640px;
  padding-top: 28px;
  border-top: 1px solid var(--rule);
}
.pager a { text-decoration: none; font-weight: 600; line-height: 1.35; }
.pager a span { display: block; color: var(--muted); font-size: 13px; font-weight: 500; margin-bottom: 4px; }
.pager a:hover { color: var(--accent); }
.pager .older { text-align: right; grid-column: 2; }

@media (max-width: 720px) {
  .site-head { padding: 16px; }
  .wrap { padding: 0 16px 64px; }
  .intro, .month-label, .empty, .single .back, .single-date, .pager { margin-left: 0; }
  .intro { padding: 24px 0 16px; }
  .filters .rss { margin-left: 0; }
  .timeline::before { left: 4px; }
  .entry { grid-template-columns: 24px minmax(0, 1fr); column-gap: 0; padding-bottom: 44px; }
  .entry-node { grid-row: 1 / span 2; grid-column: 1; }
  .entry-node::after { left: 0; top: 4px; }
  .entry-date { grid-column: 2; text-align: left; padding: 0 0 6px; }
  .entry-date .d { display: inline; font-size: 14px; color: var(--muted); font-weight: 500; }
  .entry-body { grid-column: 2; }
  .single .entry { grid-template-columns: minmax(0, 1fr); }
  .single .entry-date { display: none; }
  .single .entry-body { grid-column: 1; }
  .entry-title { font-size: 21px; }
}

/* ---------- Embed (in-app panel) ---------- */
body.embed { background: var(--surface); font-size: 14px; line-height: 1.55; }
.embed-head {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px 12px;
  background: var(--surface);
  border-bottom: 1px solid var(--rule);
}
.embed-head h1 { margin: 0; font-size: 16px; font-weight: 600; letter-spacing: -0.01em; }
.embed-head a { margin-left: auto; color: var(--muted); font-size: 13px; text-decoration: none; }
.embed-close {
  width: 28px; height: 28px; margin: -6px -8px -6px 0; border: 0; border-radius: 6px;
  background: transparent; color: var(--muted); font-size: 20px; line-height: 1; cursor: pointer;
}
.embed-close:hover { color: var(--ink); background: color-mix(in srgb, var(--ink) 6%, transparent); }
.embed-close:focus-visible { outline: 2px solid var(--accent); outline-offset: 0; }
.embed-head a:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }

.embed-list { list-style: none; margin: 0; padding: 0; }
.embed-item { border-bottom: 1px solid var(--rule); position: relative; }
.embed-item.is-unread::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--accent);
}
.embed-item summary {
  display: block;
  list-style: none;
  cursor: pointer;
  padding: 16px 20px;
}
.embed-item summary::-webkit-details-marker { display: none; }
.embed-item summary:hover { background: color-mix(in srgb, var(--ink) 3%, transparent); }
.embed-item summary:focus-visible { outline-offset: -2px; border-radius: 0; }
.embed-meta { display: flex; align-items: center; gap: 0; font-size: 12px; color: var(--muted); }
.embed-meta .type { font-size: 12px; }
.embed-meta time { font-variant-numeric: tabular-nums; }
.unread-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); margin-left: auto; }
.embed-title { display: block; margin-top: 4px; font-size: 15px; font-weight: 600; line-height: 1.35; color: var(--ink); letter-spacing: -0.005em; }
.embed-summary { display: block; margin-top: 4px; color: var(--ink-2); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
details[open] .embed-summary { display: none; }
.embed-full { padding: 0 20px 20px; }
.embed-full .entry-image { margin-top: 0; }
.embed-full .prose { font-size: 14px; }
.embed-full .prose h2 { font-size: 15px; }
.embed-full .permalink { display: inline-block; margin-top: 14px; color: var(--muted); font-size: 13px; text-underline-offset: 3px; }
body.embed .empty { margin: 0; padding: 32px 20px; }

@media (prefers-reduced-motion: no-preference) {
  .embed-item.is-unread::before { animation: unread-in 400ms ease-out both; }
  @keyframes unread-in { from { transform: scaleY(0); } to { transform: scaleY(1); } }
}

/* Same-day entries: show the date once */
.entry.same-day .entry-date { visibility: hidden; }
@media (max-width: 720px) { .entry.same-day .entry-date { display: none; } }

/* Team preview */
.preview-bar {
  padding: 8px 16px;
  text-align: center;
  font-size: 14px;
  color: var(--ink);
  background: color-mix(in srgb, var(--accent) 14%, var(--paper));
  border-bottom: 1px solid color-mix(in srgb, var(--accent) 30%, var(--paper));
}
.preview-bar a { color: var(--accent-text); font-weight: 600; }
.draft.internal { border-style: solid; }

/* List pagination */
.list-pager {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
  margin: 8px 0 0 140px;
  max-width: 640px;
  padding-top: 24px;
  border-top: 1px solid var(--rule);
  font-size: 15px;
}
.list-pager a { color: var(--accent-text); text-decoration: none; font-weight: 600; }
.list-pager a:hover { text-decoration: underline; text-underline-offset: 3px; }
.list-pager a[rel="next"] { text-align: right; }
.list-pager-count { color: var(--muted); font-size: 14px; }
@media (max-width: 720px) { .list-pager { margin-left: 0; } }
