/* ==========================================================================
   Final Problem AI — design tokens lifted from acumino.ai
   ========================================================================== */

:root {
  /* Core palette (HSL parts, matching the Acumino design system) */
  --background: 220 20% 4%;
  --foreground: 180 10% 92%;
  --card: 220 18% 8%;
  --card-foreground: 180 10% 92%;
  --muted: 220 15% 12%;
  --muted-foreground: 220 10% 55%;
  --secondary: 220 15% 14%;
  --border: 220 15% 16%;
  --primary: 180 100% 50%;
  --primary-foreground: 220 20% 4%;
  --accent: 180 80% 40%;
  --destructive: 0 84% 60%;

  --bg: hsl(var(--background));
  --fg: hsl(var(--foreground));
  --dim: hsl(var(--muted-foreground));
  --line: hsl(var(--border));
  --cyan: hsl(var(--primary));
  --surface: hsl(var(--card));

  --glow-cyan: 0 0 40px hsl(180 100% 50% / 0.15);
  --glow-cyan-strong: 0 0 60px hsl(180 100% 50% / 0.25);
  --gradient-card: linear-gradient(135deg, hsl(220 18% 10%) 0%, hsl(220 18% 6%) 100%);
  --gradient-dark: linear-gradient(180deg, hsl(220 20% 4%) 0%, hsl(220 18% 7%) 100%);

  --radius: 0.5rem;
  --radius-lg: 0.875rem;
  --font: 'Poppins', system-ui, -apple-system, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --wrap: 1140px;
}

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

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  font-weight: 300;
  font-size: 16px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* Faint cyan engineering grid, as on acumino.ai */
.grid-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image:
    linear-gradient(hsl(180 100% 50% / 0.03) 1px, transparent 1px),
    linear-gradient(90deg, hsl(180 100% 50% / 0.03) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(ellipse 90% 60% at 50% 0%, #000 35%, transparent 78%);
}

a { color: inherit; }
img { max-width: 100%; height: auto; display: block; }

h1, h2, h3, h4 { font-weight: 600; line-height: 1.2; letter-spacing: -0.02em; margin: 0; }

.wrap { width: min(100% - 2.5rem, var(--wrap)); margin-inline: auto; }
.wrap-narrow { width: min(100% - 2.5rem, 760px); }
.section { padding-block: 4rem; }
.ta-right { text-align: right; }

/* ------------------------------- brand mark ------------------------------- */

.logo-mark {
  width: 26px; height: 26px;
  flex: none;
  border-radius: 7px;
  background: var(--gradient-card);
  border: 1px solid hsl(180 100% 50% / 0.35);
  box-shadow: var(--glow-cyan);
  position: relative;
}
.logo-mark::after {
  content: '';
  position: absolute;
  inset: 7px;
  border-radius: 2px;
  background: var(--cyan);
  box-shadow: 0 0 12px var(--cyan);
}
.logo-mark.lg { width: 44px; height: 44px; border-radius: 11px; }
.logo-mark.lg::after { inset: 12px; }

/* --------------------------------- header --------------------------------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: hsl(220 20% 4% / 0.8);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid hsl(var(--border) / 0.7);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  height: 68px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
  font-size: 1.0625rem;
  letter-spacing: -0.01em;
}
.brand-text strong { color: var(--cyan); font-weight: 600; }

.site-nav { display: flex; align-items: center; gap: 1.75rem; }
.site-nav a {
  text-decoration: none;
  font-size: 0.875rem;
  color: var(--dim);
  transition: color 0.2s ease;
  position: relative;
}
.site-nav a:hover { color: var(--fg); }
.site-nav a.is-active { color: var(--cyan); }
.site-nav a.is-active::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: -6px;
  height: 1px;
  background: var(--cyan);
  box-shadow: 0 0 10px var(--cyan);
}
.nav-cta {
  border: 1px solid hsl(180 100% 50% / 0.35);
  border-radius: 999px;
  padding: 0.3rem 0.9rem;
  color: var(--cyan) !important;
  transition: background 0.2s ease, box-shadow 0.2s ease;
}
.nav-cta:hover { background: hsl(180 100% 50% / 0.1); box-shadow: var(--glow-cyan); }

/* Credit line at the foot of a mirrored post. */
.substack-cta {
  margin-bottom: 1.5rem;
  padding: 1rem 1.25rem;
  border: 1px solid hsl(180 100% 50% / 0.22);
  border-radius: var(--radius-lg);
  background: hsl(180 100% 50% / 0.04);
}
.substack-cta p { margin: 0; font-size: 0.9375rem; color: var(--dim); }
.substack-cta a { color: var(--cyan); text-decoration: none; border-bottom: 1px solid hsl(180 100% 50% / 0.35); }
.substack-cta a:hover { border-color: var(--cyan); }

/* ---------------------------------- hero ---------------------------------- */

.hero { padding-block: 5.5rem 3.5rem; }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  margin: 0 0 1.5rem;
  font-family: var(--mono);
  font-size: 0.6875rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--cyan);
}
.dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 10px var(--cyan);
  animation: pulse 2.4s ease-in-out infinite;
}
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }

.hero-title {
  font-size: clamp(2.5rem, 6.5vw, 4.25rem);
  font-weight: 700;
  margin-bottom: 1.5rem;
}
.accent-text {
  color: var(--cyan);
  text-shadow: 0 0 48px hsl(180 100% 50% / 0.35);
}

.hero-lede {
  max-width: 62ch;
  font-size: 1.0625rem;
  color: var(--dim);
  margin: 0 0 2.25rem;
}
.hero-lede a { color: var(--cyan); text-decoration: none; border-bottom: 1px solid hsl(180 100% 50% / 0.3); }
.hero-lede a:hover { border-color: var(--cyan); }

.hero-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; }

/* --------------------------------- buttons -------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.7rem 1.4rem;
  border-radius: 999px;
  border: 1px solid transparent;
  font-family: var(--font);
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }

.btn-primary {
  background: var(--cyan);
  color: hsl(var(--primary-foreground));
  box-shadow: var(--glow-cyan);
}
.btn-primary:hover { box-shadow: var(--glow-cyan-strong); }

.btn-ghost {
  background: hsl(var(--secondary) / 0.5);
  border-color: var(--line);
  color: var(--fg);
}
.btn-ghost:hover { border-color: hsl(180 100% 50% / 0.4); color: var(--cyan); }

.btn-danger {
  background: hsl(var(--destructive) / 0.12);
  border-color: hsl(var(--destructive) / 0.35);
  color: hsl(0 84% 72%);
}
.btn-danger:hover { background: hsl(var(--destructive) / 0.2); }

.btn-sm { padding: 0.4rem 0.9rem; font-size: 0.8125rem; }
.btn-block { width: 100%; }

/* -------------------------------- tag bar --------------------------------- */

.tag-bar { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 2.5rem; }

.tag {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.35rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: hsl(var(--card) / 0.6);
  font-size: 0.8125rem;
  color: var(--dim);
  text-decoration: none;
  transition: all 0.2s ease;
}
.tag:hover { color: var(--fg); border-color: hsl(180 100% 50% / 0.35); }
.tag.is-active {
  color: hsl(var(--primary-foreground));
  background: var(--cyan);
  border-color: var(--cyan);
  box-shadow: var(--glow-cyan);
}
.tag-count { font-family: var(--mono); font-size: 0.6875rem; opacity: 0.7; }

/* ------------------------------- post cards ------------------------------- */

.post-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.25rem;
}

.post-card {
  background: var(--gradient-card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}
.post-card:hover {
  transform: translateY(-3px);
  border-color: hsl(180 100% 50% / 0.35);
  box-shadow: var(--glow-cyan);
}
.post-card.is-featured { grid-column: 1 / -1; }
/* Two-column split only when there is actually a cover image to show. */
.post-card.is-featured .card-link:has(.card-media) { display: grid; grid-template-columns: 1.1fr 1fr; align-items: stretch; }
.post-card.is-featured .card-media { height: 100%; min-height: 260px; }
.post-card.is-featured .card-title { font-size: 1.75rem; }
.post-card.is-featured .card-body { padding: 2rem; }

.card-link { display: block; text-decoration: none; color: inherit; height: 100%; }
.card-media { overflow: hidden; background: hsl(var(--muted)); }
.card-media img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.4s ease; }
.post-card:hover .card-media img { transform: scale(1.03); }

.card-body { padding: 1.5rem; display: flex; flex-direction: column; gap: 0.7rem; height: 100%; }

.card-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--mono);
  font-size: 0.6875rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--dim);
}
.sep { opacity: 0.5; }
.draft-flag { color: hsl(38 92% 62%); }

.card-title { font-size: 1.1875rem; font-weight: 600; }
.card-excerpt { margin: 0; color: var(--dim); font-size: 0.9375rem; }
.card-tags { display: flex; flex-wrap: wrap; gap: 0.4rem; }

.pill {
  padding: 0.2rem 0.65rem;
  border-radius: 999px;
  border: 1px solid hsl(180 100% 50% / 0.22);
  background: hsl(180 100% 50% / 0.07);
  color: var(--cyan);
  font-size: 0.6875rem;
  font-family: var(--mono);
  text-decoration: none;
}
a.pill:hover { background: hsl(180 100% 50% / 0.16); }

.card-cta {
  margin-top: auto;
  padding-top: 0.4rem;
  color: var(--cyan);
  font-size: 0.8125rem;
  font-weight: 500;
}
.post-card:hover .card-cta span { display: inline-block; transform: translateX(4px); transition: transform 0.2s ease; }

/* ------------------------------- pagination ------------------------------- */

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.25rem;
  margin-top: 3rem;
}
.page-indicator { font-family: var(--mono); font-size: 0.75rem; color: var(--dim); }

/* --------------------------------- article -------------------------------- */

.article { padding-block: 3rem 1rem; }

.back-link {
  display: inline-block;
  margin-bottom: 2rem;
  color: var(--dim);
  text-decoration: none;
  font-size: 0.8125rem;
  transition: color 0.2s ease;
}
.back-link:hover { color: var(--cyan); }

.article-header { margin-bottom: 2.5rem; }
.article-title {
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 700;
  margin: 0.9rem 0 1rem;
}
.article-lede { font-size: 1.125rem; color: var(--dim); margin: 0 0 1.25rem; }

.article-cover {
  margin: 0 0 2.5rem;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--line);
  box-shadow: var(--glow-cyan);
}

/* ---------------------------------- prose --------------------------------- */

.prose { font-size: 1.0625rem; color: hsl(180 8% 86%); }
.prose > *:first-child { margin-top: 0; }
.prose p { margin: 0 0 1.4rem; }
.prose .lede { font-size: 1.1875rem; color: var(--fg); }

.prose h1, .prose h2, .prose h3 { margin: 2.75rem 0 1rem; scroll-margin-top: 90px; }
.prose h1 { font-size: 1.875rem; }
.prose h2 { font-size: 1.5rem; }
.prose h3 { font-size: 1.1875rem; color: var(--cyan); }

.prose a { color: var(--cyan); text-decoration: none; border-bottom: 1px solid hsl(180 100% 50% / 0.35); }
.prose a:hover { border-color: var(--cyan); }

.prose ul, .prose ol { margin: 0 0 1.4rem; padding-left: 1.3rem; }
.prose li { margin-bottom: 0.5rem; }
.prose li::marker { color: var(--cyan); }

.prose blockquote {
  margin: 2rem 0;
  padding: 0.4rem 0 0.4rem 1.4rem;
  border-left: 2px solid var(--cyan);
  background: linear-gradient(90deg, hsl(180 100% 50% / 0.05), transparent);
  color: var(--fg);
  font-style: italic;
}

.prose pre, .prose .ql-syntax {
  margin: 0 0 1.6rem;
  padding: 1.15rem 1.3rem;
  background: hsl(220 20% 6%);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 0.8125rem;
  line-height: 1.65;
  color: hsl(180 15% 88%);
  white-space: pre;
}
.prose code {
  font-family: var(--mono);
  font-size: 0.85em;
  padding: 0.15em 0.4em;
  border-radius: 4px;
  background: hsl(180 100% 50% / 0.08);
  border: 1px solid hsl(180 100% 50% / 0.16);
  color: var(--cyan);
}
.prose pre code, .prose .ql-syntax code { background: none; border: 0; padding: 0; color: inherit; }

.prose img { border-radius: var(--radius); border: 1px solid var(--line); margin: 1.75rem 0; }
.prose iframe { width: 100%; aspect-ratio: 16 / 9; height: auto; border: 1px solid var(--line); border-radius: var(--radius); margin: 1.75rem 0; }
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 2.5rem 0; }

.prose table { width: 100%; border-collapse: collapse; margin: 0 0 1.6rem; font-size: 0.9375rem; }
.prose th, .prose td { border: 1px solid var(--line); padding: 0.6rem 0.85rem; text-align: left; }
.prose th { background: hsl(var(--muted)); font-weight: 500; }

/* Quill expresses list indentation as classes on flat siblings, not nesting. */
.prose .ql-indent-1 { margin-left: 2rem; }
.prose .ql-indent-2 { margin-left: 4rem; }
.prose .ql-indent-3 { margin-left: 6rem; }

/* Quill alignment classes survive into the published post */
.ql-align-center { text-align: center; }
.ql-align-right { text-align: right; }
.ql-align-justify { text-align: justify; }

/* ------------------------------ article footer ---------------------------- */

.article-footer { margin-top: 3.5rem; padding-top: 2rem; border-top: 1px solid var(--line); }

.author-card {
  display: flex;
  gap: 1rem;
  padding: 1.5rem;
  background: var(--gradient-card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
}
.author-name { margin: 0 0 0.25rem; font-weight: 600; }
.author-bio { margin: 0; color: var(--dim); font-size: 0.9375rem; }
.author-bio a { color: var(--cyan); text-decoration: none; }

.section-title { font-size: 1.25rem; margin-bottom: 1.25rem; }

/* ------------------------------- misc states ------------------------------ */

.empty-state {
  padding: 4rem 2rem;
  text-align: center;
  border: 1px dashed var(--line);
  border-radius: var(--radius-lg);
  background: hsl(var(--card) / 0.4);
}
.empty-state h2 { margin-bottom: 0.5rem; }
.empty-state p { color: var(--dim); margin: 0 0 1.25rem; }
/* Text links only: this would otherwise out-specify .btn-primary and paint a
   button's label cyan on a cyan background. */
.empty-state a:not(.btn) { color: var(--cyan); }

.center-state { text-align: center; padding-block: 6rem; }
.center-state .hero-actions { justify-content: center; }
.error-code {
  font-family: var(--mono);
  font-size: 4rem;
  font-weight: 500;
  color: var(--cyan);
  margin: 0;
  text-shadow: var(--glow-cyan-strong);
}
.page-title { font-size: clamp(1.875rem, 4vw, 2.5rem); margin-bottom: 1rem; }

.alert {
  padding: 0.85rem 1.1rem;
  border-radius: var(--radius);
  font-size: 0.875rem;
  margin-bottom: 1.5rem;
}
.alert-error { background: hsl(var(--destructive) / 0.12); border: 1px solid hsl(var(--destructive) / 0.35); color: hsl(0 84% 76%); }
.alert-ok { background: hsl(180 100% 50% / 0.08); border: 1px solid hsl(180 100% 50% / 0.3); color: var(--cyan); }

/* --------------------------------- footer --------------------------------- */

.site-footer { margin-top: 4rem; border-top: 1px solid var(--line); background: var(--gradient-dark); }
.footer-inner { padding-block: 2.5rem; display: flex; flex-wrap: wrap; align-items: center; gap: 1.5rem; justify-content: space-between; }
.footer-brand { display: flex; align-items: center; gap: 0.75rem; }
.footer-title { margin: 0; font-weight: 600; font-size: 0.9375rem; }
.footer-sub { margin: 0; color: var(--dim); font-size: 0.8125rem; }
.footer-sub a { color: var(--cyan); text-decoration: none; }
.footer-links { display: flex; flex-wrap: wrap; gap: 1.25rem; }
.footer-links a { color: var(--dim); text-decoration: none; font-size: 0.875rem; }
.footer-links a:hover { color: var(--cyan); }
.footer-legal {
  width: 100%;
  margin: 0;
  padding-top: 1.25rem;
  border-top: 1px solid hsl(var(--border) / 0.6);
  font-family: var(--mono);
  font-size: 0.6875rem;
  letter-spacing: 0.08em;
  color: hsl(var(--muted-foreground) / 0.8);
}

/* ------------------------------- responsive ------------------------------- */

@media (max-width: 820px) {
  .post-card.is-featured .card-link { grid-template-columns: 1fr; }
  .post-card.is-featured .card-media { min-height: 200px; }
  .post-card.is-featured .card-body { padding: 1.5rem; }
  .header-inner { height: 60px; }
  .site-nav { gap: 1.1rem; }
  .site-nav a { font-size: 0.8125rem; }
  .hero { padding-block: 3.5rem 2.5rem; }
  .section { padding-block: 2.5rem; }
}

/* Below this width the brand and nav cannot share one row without wrapping
   mid-word, so the header becomes two centred rows instead. */
@media (max-width: 640px) {
  .header-inner {
    flex-direction: column;
    align-items: center;
    height: auto;
    gap: 0.7rem;
    padding-block: 0.9rem;
  }
  .brand { font-size: 1rem; }
  .brand-text { white-space: nowrap; }
  .site-nav { flex-wrap: wrap; justify-content: center; gap: 1rem; }
  .site-nav a { white-space: nowrap; }
  .hero-title { font-size: clamp(2rem, 9vw, 2.75rem); }
  .footer-inner { flex-direction: column; align-items: flex-start; gap: 1.25rem; }
  .footer-links { gap: 1rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
  html { scroll-behavior: auto; }
}
