/* =========================================================================
   blog.micali.online — public blog stylesheet.
   Mobile-first; reuses the marketing site's design tokens (colors, fonts,
   radius, shadows, spacing) for a consistent look.
   ========================================================================= */

:root {
  --bg-main: #f7f7fb;
  --bg-card: #ffffff;
  --primary: #2563eb;
  --primary-2: #4f46e5;
  --primary-soft: #e0ecff;
  --text-main: #111827;
  --text-muted: #6b7280;
  --border-soft: #e5e7eb;
  --accent: #10b981;
  --accent-green: #166534;
  --danger: #b91c1c;
  --shadow-soft: 0 18px 45px rgba(15, 23, 42, 0.08);
  --shadow-card: 0 10px 30px rgba(148, 163, 184, 0.16);
  --radius: 16px;
  --radius-lg: 22px;
  --radius-full: 999px;
  --max-width: 1120px;
  --gutter: 1.1rem;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

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

html, body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: radial-gradient(circle at top, #eef3ff 0, #f7f7fb 42%, #fdfdfd 100%);
  color: var(--text-main);
}

body {
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  padding-bottom: env(safe-area-inset-bottom);
}

a { text-decoration: none; color: inherit; }
img { max-width: 100%; display: block; }
ul { list-style: none; }

.page { min-height: 100vh; display: flex; flex-direction: column; }

.wrap {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding-inline: var(--gutter);
}

.blog-main { flex: 1 0 auto; padding-block: 1.6rem 2.6rem; }

/* ---------------------------------------------------------------- buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.8rem 1.35rem;
  border-radius: var(--radius-full);
  border: 1px solid transparent;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  background: transparent;
  text-align: center;
  min-height: 46px;
  transition: background 0.15s ease, transform 0.12s ease,
    box-shadow 0.15s ease, border-color 0.15s ease, color 0.12s ease;
}
.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: #fff;
  box-shadow: 0 16px 38px rgba(37, 99, 235, 0.28);
}
.btn-primary:active { transform: translateY(1px); }
.btn-primary:hover { box-shadow: 0 20px 48px rgba(37, 99, 235, 0.40); }

/* ---------------------------------------------------------------- header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  backdrop-filter: blur(16px);
  background: rgba(247, 247, 251, 0.92);
  border-bottom: 1px solid rgba(229, 231, 235, 0.7);
}
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding-block: 0.6rem;
}
.nav-logo img { height: 30px; width: auto; }
.nav-right { display: flex; align-items: center; gap: 0.75rem; }
.nav-blog-link {
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.95rem;
  transition: color 0.15s ease;
}
.nav-blog-link:hover { color: var(--text-main); }
.nav-cta { padding: 0.55rem 1rem; min-height: 42px; font-size: 0.9rem; }

/* ---------------------------------------------------------------- blog hero */
.blog-hero {
  text-align: center;
  max-width: 44rem;
  margin: 0.6rem auto 1.6rem;
}
.blog-eyebrow {
  font-size: 0.74rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--primary);
  font-weight: 700;
  margin-bottom: 0.5rem;
}
.blog-hero-title {
  font-size: clamp(1.8rem, 7vw, 2.8rem);
  line-height: 1.12;
  letter-spacing: -0.04em;
  margin-bottom: 0.6rem;
}
.blog-hero-sub {
  font-size: 1.05rem;
  color: var(--text-muted);
}

/* ---------------------------------------------------------------- category nav */
.cat-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  margin-bottom: 1.8rem;
}
.cat-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.45rem 0.95rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-soft);
  background: #fff;
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 600;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.cat-pill:hover { border-color: rgba(37, 99, 235, 0.5); color: var(--primary); }
.cat-pill.is-active {
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: #fff;
  border-color: transparent;
}

/* ---------------------------------------------------------------- card grid */
.card-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.2rem;
}
.card {
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid rgba(226, 232, 240, 0.9);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  transition: transform 0.16s ease, box-shadow 0.16s ease;
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-soft); }
.card-media {
  aspect-ratio: 16 / 9;
  background: linear-gradient(135deg, #eef3ff, #f5f3ff);
  overflow: hidden;
}
.card-media img { width: 100%; height: 100%; object-fit: cover; }
.card-media-fallback {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  font-size: 2.6rem; font-weight: 800;
  color: var(--primary);
  background: var(--primary-soft);
}
.card-body { padding: 1.05rem 1.15rem 1.25rem; display: flex; flex-direction: column; gap: 0.5rem; flex: 1; }
.card-title { font-size: 1.15rem; line-height: 1.25; letter-spacing: -0.02em; }
.card-perex {
  font-size: 0.92rem;
  color: var(--text-muted);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-date { font-size: 0.8rem; color: var(--text-muted); margin-top: auto; }

/* ---------------------------------------------------------------- chips / tags */
.chip-row { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 0.9rem; }
.chip {
  display: inline-flex;
  padding: 0.3rem 0.7rem;
  border-radius: var(--radius-full);
  background: var(--primary-soft);
  color: #1d4ed8;
  font-size: 0.78rem;
  font-weight: 600;
  transition: filter 0.12s ease;
}
.chip:hover { filter: brightness(0.96); }

.tag-row { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.9rem; }
.tag {
  display: inline-flex;
  padding: 0.25rem 0.6rem;
  border-radius: var(--radius-full);
  background: #f1f5f9;
  color: #475569;
  font-size: 0.78rem;
  font-weight: 500;
}

/* ---------------------------------------------------------------- article */
.article-wrap { max-width: 46rem; }
.article-back { margin-bottom: 1.1rem; }
.article-back a {
  color: var(--primary);
  font-weight: 600;
  font-size: 0.92rem;
}
.article-back a:hover { text-decoration: underline; }

.article-head { margin-bottom: 1.4rem; }
.article-title {
  font-size: clamp(1.75rem, 6vw, 2.6rem);
  line-height: 1.12;
  letter-spacing: -0.035em;
  margin-bottom: 0.7rem;
}
.article-meta { font-size: 0.9rem; color: var(--text-muted); }

.article-hero-img {
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 1.6rem;
  box-shadow: var(--shadow-soft);
  border: 1px solid rgba(226, 232, 240, 0.9);
}
.article-hero-img img { width: 100%; height: auto; display: block; }

/* Rendered admin HTML (trusted). Sensible defaults for common tags. */
.article-content { font-size: 1.05rem; color: #1f2937; line-height: 1.75; }
.article-content > * + * { margin-top: 1.05rem; }
.article-content h2 {
  font-size: clamp(1.4rem, 4.5vw, 1.9rem);
  line-height: 1.2; letter-spacing: -0.025em;
  margin-top: 2rem; margin-bottom: 0.2rem;
}
.article-content h3 {
  font-size: clamp(1.2rem, 4vw, 1.5rem);
  line-height: 1.25; letter-spacing: -0.02em;
  margin-top: 1.6rem;
}
.article-content h4 { font-size: 1.15rem; margin-top: 1.4rem; }
.article-content p { margin-block: 0; }
.article-content a { color: var(--primary); text-decoration: underline; text-underline-offset: 2px; }
.article-content a:hover { color: var(--primary-2); }
.article-content ul, .article-content ol { padding-left: 1.4rem; }
.article-content ul { list-style: disc; }
.article-content ol { list-style: decimal; }
.article-content li + li { margin-top: 0.4rem; }
.article-content img {
  border-radius: var(--radius);
  margin-block: 1.4rem;
  box-shadow: var(--shadow-card);
}
.article-content blockquote {
  border-left: 4px solid var(--primary);
  background: #f8fafc;
  padding: 0.8rem 1.1rem;
  border-radius: 0 var(--radius) var(--radius) 0;
  color: #374151;
  font-style: italic;
}
.article-content pre {
  background: #0f172a;
  color: #e2e8f0;
  padding: 1rem 1.1rem;
  border-radius: var(--radius);
  overflow-x: auto;
  font-size: 0.9rem;
}
.article-content code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.92em;
  background: #f1f5f9;
  padding: 0.1rem 0.35rem;
  border-radius: 6px;
}
.article-content pre code { background: transparent; padding: 0; }
.article-content table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
  display: block;
  overflow-x: auto;
}
.article-content th, .article-content td {
  border: 1px solid var(--border-soft);
  padding: 0.6rem 0.7rem;
  text-align: left;
}
.article-content th { background: #f9fafb; font-weight: 700; }
.article-content hr { border: none; border-top: 1px solid var(--border-soft); }

/* ---------------------------------------------------------------- more articles */
.more-articles {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border-soft);
}
.more-title {
  font-size: clamp(1.3rem, 4vw, 1.7rem);
  letter-spacing: -0.025em;
  margin-bottom: 1.2rem;
  text-align: center;
}

/* ---------------------------------------------------------------- empty / 404 */
.blog-empty {
  text-align: center;
  max-width: 32rem;
  margin: 2.5rem auto;
  padding: 2.4rem 1.4rem;
  background: #fff;
  border: 1px solid rgba(226, 232, 240, 0.9);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
}
.blog-empty-emoji { font-size: 2.6rem; margin-bottom: 0.6rem; }
.blog-empty h1, .blog-empty h2 {
  font-size: clamp(1.4rem, 5vw, 1.9rem);
  letter-spacing: -0.03em;
  margin-bottom: 0.5rem;
}
.blog-empty p { color: var(--text-muted); margin-bottom: 1.3rem; }
.blog-404 { margin-top: 3rem; }

/* ---------------------------------------------------------------- footer */
.site-footer {
  flex-shrink: 0;
  border-top: 1px solid rgba(229, 231, 235, 0.8);
  padding-block: 1.4rem;
  font-size: 0.84rem;
  color: var(--text-muted);
  padding-bottom: calc(1.4rem + env(safe-area-inset-bottom));
}
.footer-inner { display: flex; flex-direction: column; gap: 0.8rem; }
.footer-links { display: flex; flex-wrap: wrap; gap: 0.4rem 1.2rem; }
.footer-links a {
  text-decoration: underline; text-decoration-style: dotted; text-underline-offset: 3px;
}
.footer-links a:hover { color: var(--text-main); }

/* =========================================================================
   TABLET (>= 700px)
   ========================================================================= */
@media (min-width: 700px) {
  .blog-main { padding-block: 2.2rem 3.2rem; }
  .card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.4rem; }
}

/* =========================================================================
   DESKTOP (>= 1000px)
   ========================================================================= */
@media (min-width: 1000px) {
  .card-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .footer-inner { flex-direction: row; align-items: center; justify-content: space-between; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}
