/* =============================================================
   Chrono Log — design system
   Tokens mirror chrono-os.com (IBM Plex, sharp 2px corners,
   Chrono Blue #2563EB on grayscale).
   ============================================================= */

:root {
  /* Color */
  --bg: #ffffff;
  --fg: #0a0a0a;
  --body: #484848;
  --muted: #737373;
  --surface: #f5f5f5;
  --surface-hover: #ebebeb;
  --border: #ebebeb;
  --chrono: #2563eb;
  --chrono-hover: #1d4ed8;

  /* Dark surface (footer) */
  --dark-bg: #0a0a0a;
  --dark-text: #b0b0b0;
  --dark-muted: #737373;
  --dark-border: #1a1a1a;

  /* Type scale */
  --font-sans: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  --font-mono: 'IBM Plex Mono', 'SF Mono', Consolas, monospace;

  /* Layout */
  --content-width: 960px;
  --text-width: 720px;
  --pad: 2rem;

  /* Radius (sharp) */
  --radius: 2px;
  --radius-pill: 9999px;
}

/* =============================================================
   Reset / base
   ============================================================= */

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--body);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img, video, svg { max-width: 100%; height: auto; display: block; }

a {
  color: var(--fg);
  text-decoration: none;
  transition: color 0.2s ease;
}
a:hover { color: var(--chrono); }

hr { border: 0; border-top: 1px solid var(--border); margin: 3rem 0; }

::selection { background: var(--chrono); color: #fff; }

/* =============================================================
   Typography
   ============================================================= */

h1, h2, h3, h4, h5, h6 {
  color: var(--fg);
  font-weight: 700;
  line-height: 1.2;
  margin: 2.5rem 0 1rem;
  letter-spacing: -0.02em;
}
h1 { font-size: 2.25rem; letter-spacing: -0.03em; }
h2 { font-size: 1.625rem; font-weight: 600; }
h3 { font-size: 1.25rem; font-weight: 600; letter-spacing: -0.01em; }
h4 { font-size: 1.05rem; font-weight: 600; }
h5, h6 { font-size: 1rem; font-weight: 600; }

p { margin: 0 0 1.25rem; font-size: 1rem; }

strong, b { font-weight: 600; color: var(--fg); }

blockquote {
  margin: 2rem 0;
  padding: 0.25rem 0 0.25rem 1.5rem;
  border-left: 2px solid var(--chrono);
  color: var(--fg);
  font-style: normal;
}
blockquote p { margin: 0.5rem 0; }

code, kbd, samp, pre {
  font-family: var(--font-mono);
  font-size: 0.92em;
}
code {
  background: var(--surface);
  padding: 0.15em 0.4em;
  border-radius: var(--radius);
}
pre {
  background: var(--surface);
  padding: 1rem 1.25rem;
  border-radius: var(--radius);
  overflow-x: auto;
  line-height: 1.5;
  margin: 1.5rem 0;
}
pre code { background: none; padding: 0; }

ul, ol { padding-left: 1.5rem; margin: 0 0 1.25rem; }
li { margin: 0.4rem 0; }

/* Mono utility — inherited from chrono-os.com */
.mono-label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

/* =============================================================
   Layout
   ============================================================= */

.container {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 0 var(--pad);
}

.text-container {
  max-width: var(--text-width);
  margin: 0 auto;
  padding: 0 var(--pad);
}

main { min-height: 60vh; }

/* =============================================================
   Header / nav
   ============================================================= */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.site-header-inner {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 0 var(--pad);
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.site-logo {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--fg);
  letter-spacing: -0.01em;
}
.site-logo:hover { color: var(--fg); }
.site-logo .dot {
  width: 8px;
  height: 8px;
  border-radius: var(--radius-pill);
  background: var(--chrono);
  display: inline-block;
}
.site-logo .chrono { font-weight: 700; color: var(--fg); }
.site-logo .os { font-weight: 400; color: #999; margin-left: 0.05rem; }

.site-nav {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}
.site-nav ul {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  list-style: none;
  margin: 0;
  padding: 0;
}
.site-nav li { margin: 0; padding: 0; }
.site-nav li::marker { content: ''; }
.site-nav a {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--fg);
  position: relative;
  transition: all 0.2s ease;
}
.site-nav a:hover {
  font-weight: 600;
  color: var(--fg);
}

.site-nav .cta {
  display: inline-flex;
  align-items: center;
  height: 36px;
  padding: 0 1.5rem;
  background: var(--fg);
  color: #fff;
  font-size: 0.875rem;
  font-weight: 600;
  transition: background 0.15s ease;
}
.site-nav .cta:hover { background: #2a2a2a; color: #fff; }

@media (max-width: 640px) {
  .site-nav { gap: 0.75rem; }
  .site-nav a:not(.cta) { display: none; }
}

/* =============================================================
   Homepage / archive
   ============================================================= */

.intro {
  max-width: var(--text-width);
  margin: 4rem auto 3rem;
  padding: 0 var(--pad);
  text-align: left;
}
.intro h1 {
  font-size: 2.25rem;
  margin: 0 0 0.75rem;
  letter-spacing: -0.03em;
}
.intro .tagline {
  color: var(--body);
  font-size: 1.05rem;
  margin: 0 0 0.5rem;
}
.intro .signoff {
  font-family: var(--font-mono);
  color: var(--muted);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-top: 0.75rem;
}

.post-feed {
  max-width: var(--text-width);
  margin: 0 auto;
  padding: 0 var(--pad) 5rem;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.post-card {
  display: block;
  padding: 2rem 0;
  border-top: 1px solid var(--border);
  color: inherit;
  transition: opacity 0.15s ease;
}
.post-card:first-child { border-top: 0; padding-top: 0; }
.post-card:hover { opacity: 0.7; color: inherit; }

.post-card-meta {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.5rem;
}

.post-card-title {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--fg);
  margin: 0 0 0.5rem;
  line-height: 1.25;
}

.post-card-excerpt {
  color: var(--body);
  font-size: 0.98rem;
  margin: 0;
}

/* =============================================================
   Single post
   ============================================================= */

.post-header {
  max-width: var(--text-width);
  margin: 4rem auto 2rem;
  padding: 0 var(--pad);
}

.post-meta {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.75rem;
}

.post-title {
  font-size: 2.5rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--fg);
  margin: 0 0 1rem;
  line-height: 1.15;
}

.post-excerpt {
  color: var(--body);
  font-size: 1.125rem;
  font-weight: 400;
  margin: 0;
}

.post-feature-image {
  max-width: var(--content-width);
  margin: 2rem auto 3rem;
  padding: 0 var(--pad);
}

.post-content {
  max-width: var(--text-width);
  margin: 0 auto 4rem;
  padding: 0 var(--pad);
  font-size: 1.06rem;
  line-height: 1.7;
}
.post-content > * + h1,
.post-content > * + h2 { margin-top: 3rem; }
.post-content > * + h3 { margin-top: 2.5rem; }
.post-content img,
.post-content figure { margin: 2rem 0; }

/* Ghost Koenig editor card widths */
.kg-width-wide,
.gh-content .kg-width-wide {
  position: relative;
  width: 85vw;
  max-width: 1200px;
  margin-left: 50%;
  transform: translateX(-50%);
}
.kg-width-full,
.gh-content .kg-width-full {
  position: relative;
  width: 100vw;
  max-width: 100vw;
  margin-left: 50%;
  transform: translateX(-50%);
}
.kg-width-full img { width: 100%; }

/* Bookmark / embed cards */
.kg-card { margin: 2rem 0; }
.kg-bookmark-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
}
.kg-bookmark-container {
  display: flex;
  width: 100%;
  text-decoration: none;
  color: inherit;
}
.kg-bookmark-content { padding: 1rem 1.25rem; flex: 1; }
.kg-bookmark-title { font-weight: 600; color: var(--fg); font-size: 0.95rem; margin-bottom: 0.25rem; }
.kg-bookmark-description { color: var(--muted); font-size: 0.85rem; }
.kg-bookmark-thumbnail { flex-basis: 30%; }
.kg-bookmark-thumbnail img { width: 100%; height: 100%; object-fit: cover; }
.post-content figcaption {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  text-align: center;
  margin-top: 0.5rem;
}

.post-byline {
  max-width: var(--text-width);
  margin: 3rem auto 0;
  padding: 2rem var(--pad) 0;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.post-byline .author-avatar {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-pill);
  background: var(--surface);
  object-fit: cover;
}
.post-byline .author-name {
  font-weight: 600;
  color: var(--fg);
  font-size: 0.95rem;
}
.post-byline .author-bio {
  color: var(--muted);
  font-size: 0.85rem;
}

/* =============================================================
   Subscribe / CTA blocks
   ============================================================= */

.subscribe-block {
  max-width: var(--text-width);
  margin: 4rem auto;
  padding: 2rem var(--pad);
  background: var(--surface);
  border-radius: var(--radius);
}
.subscribe-block h3 {
  margin: 0 0 0.5rem;
  font-size: 1.25rem;
}
.subscribe-block p {
  color: var(--body);
  margin: 0 0 1.25rem;
  font-size: 0.95rem;
}
.subscribe-block button,
.subscribe-block .btn {
  display: inline-flex;
  align-items: center;
  height: 40px;
  padding: 0 1.75rem;
  background: var(--fg);
  color: #fff;
  border: 0;
  font-family: var(--font-sans);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease;
  border-radius: var(--radius);
}
.subscribe-block button:hover,
.subscribe-block .btn:hover { background: #2a2a2a; }

/* =============================================================
   Footer
   ============================================================= */

.site-footer {
  background: var(--dark-bg);
  color: var(--dark-text);
  padding: 4rem 0 3rem;
  margin-top: 5rem;
}
.site-footer-inner {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 0 var(--pad);
}
.site-footer .logo {
  margin-bottom: 1rem;
}
.site-footer .logo .chrono { color: #fff; }
.site-footer .logo .os { color: #777; }
.site-footer .tagline {
  color: var(--dark-text);
  font-size: 0.9rem;
  font-weight: 500;
  margin: 0 0 0.25rem;
}
.site-footer .signoff {
  color: var(--dark-muted);
  font-size: 0.85rem;
  margin: 0 0 2rem;
}
.site-footer-bottom {
  padding-top: 1.5rem;
  border-top: 1px solid var(--dark-border);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 1rem;
  font-size: 0.8rem;
  color: var(--dark-muted);
}
.site-footer-bottom a {
  color: var(--dark-muted);
  transition: color 0.15s ease;
}
.site-footer-bottom a:hover { color: var(--dark-text); }

/* =============================================================
   Pagination
   ============================================================= */

.pagination {
  max-width: var(--text-width);
  margin: 0 auto;
  padding: 2rem var(--pad) 4rem;
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  border-top: 1px solid var(--border);
}
.pagination a, .pagination span {
  font-family: var(--font-mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  font-size: 0.78rem;
}
.pagination a:hover { color: var(--fg); }

/* =============================================================
   Error
   ============================================================= */

.error-content {
  max-width: var(--text-width);
  margin: 6rem auto;
  padding: 0 var(--pad);
  text-align: center;
}
.error-code {
  font-family: var(--font-mono);
  font-size: 4rem;
  color: var(--chrono);
  margin: 0 0 0.5rem;
  letter-spacing: -0.02em;
  font-weight: 600;
}

/* =============================================================
   Members / portal — Ghost native overrides
   ============================================================= */

[data-portal] { font-family: var(--font-sans) !important; }

.gh-portal-button {
  border-radius: var(--radius) !important;
}

/* =============================================================
   Responsive tweaks
   ============================================================= */

@media (max-width: 640px) {
  .post-title { font-size: 1.875rem; }
  h1 { font-size: 1.875rem; }
  h2 { font-size: 1.4rem; }
  .intro { margin-top: 2.5rem; }
}
