/* ==========================================================================
   Enfonica Blog stylesheet
   1. Tokens & reset
   2. Shared UI (buttons, pills, search, chips)
   3-4. Site header, mobile menu and footer: see chrome.css (shared with the www repo)
   5. Blog hero, archive heads, listings, cards, pager
   6. Article page + prose typography
   7. Utilities & responsive tweaks
   ========================================================================== */

/* 1. Tokens & reset ------------------------------------------------------- */
:root {
  --font-ui: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-body: Mulish, Arial, Helvetica, sans-serif;

  --c-bg: #fafafa;
  --c-surface: #ffffff;
  --c-ink: #2e2f33;
  --c-text: #45464b;
  --c-muted: #94979e;
  --c-line: #ececec;
  --c-brand-dark: #1a1b20;
  --c-black: #0a0a0a;
  --c-accent: #f4bf18;
  --c-accent-ink: #ffffff;
  --c-callout: #e9f6fe;

  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.06), 0 1px 3px rgba(0, 0, 0, 0.04);
  --shadow-hover: 0 12px 32px rgba(0, 0, 0, 0.1), 0 2px 6px rgba(0, 0, 0, 0.05);

  --nav-h: var(--chrome-h, 80px); /* header height, owned by chrome.css */
  --container: 1200px;
  --gutter: 16px;
}

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-h) + 16px);
}

body {
  margin: 0;
  background: var(--c-bg);
  color: var(--c-text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.site-main {
  flex: 1 0 auto;
  /* Breathing room before the shared footer (which carries no top margin of its own). */
  padding-bottom: clamp(64px, 8vw, 104px);
}

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

/* Links in running text: the text's own colour with a thin, faint underline that turns
   solid on hover (same rule as enfonica.com, src/styles/10-base.css in the www repo).
   Components (cards, crumbs, nav) set their own styles. */
a {
  color: inherit;
  text-decoration-line: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.22em;
  text-decoration-color: rgba(128, 128, 128, 0.45);
  text-decoration-color: color-mix(in srgb, currentColor 32%, transparent);
  transition: text-decoration-color 0.15s ease, color 0.15s ease;
}

a:hover {
  text-decoration-color: currentColor;
}

button {
  font: inherit;
  color: inherit;
}

ul[class],
ol[class] {
  list-style: none;
  margin: 0;
  padding: 0;
}

.container {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding-left: var(--gutter);
  padding-right: var(--gutter);
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.skip-link {
  position: absolute;
  left: 8px;
  top: -60px;
  z-index: 1000;
  padding: 10px 16px;
  background: var(--c-accent);
  color: var(--c-ink);
  border-radius: 999px;
  font-weight: 700;
}

.skip-link:focus {
  top: 8px;
}

:focus-visible {
  outline: 3px solid var(--c-accent);
  outline-offset: 2px;
}

/* 2. Shared UI -------------------------------------------------------------- */
.button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 14px 26px;
  border-radius: 999px;
  border: 0;
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

.button--dark {
  background: var(--c-black);
  color: #fff;
}

.button--dark:hover {
  background: #2a2b30;
  transform: translateY(-1px);
}

.button--accent {
  background: var(--c-accent);
  color: var(--c-ink);
}

.pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 800;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
}

.pill--category {
  background: var(--c-accent);
  color: var(--c-accent-ink);
  transition: background-color 0.15s ease;
}

.pill--category:hover {
  background: #e0ae0f;
}

.pill--time {
  background: var(--c-surface);
  color: var(--c-muted);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.search {
  display: flex;
  align-items: stretch;
  width: 100%;
  max-width: 420px;
  background: var(--c-surface);
  border: 1px solid var(--c-line);
  border-radius: 999px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.search__input {
  flex: 1;
  min-width: 0;
  border: 0;
  padding: 12px 20px;
  font: inherit;
  font-size: 15px;
  background: transparent;
  color: var(--c-ink);
}

.search__input:focus {
  outline: none;
}

.search__input::-webkit-search-decoration {
  -webkit-appearance: none;
}

.search__button {
  border: 0;
  background: var(--c-black);
  color: #fff;
  padding: 0 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
}

.search__button:hover {
  background: #2a2b30;
}

.search--inline {
  margin-top: 20px;
}

.chips__list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  display: inline-block;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--c-line);
  background: var(--c-surface);
  color: var(--c-text);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.chip:hover {
  background: var(--c-black);
  border-color: var(--c-black);
  color: #fff;
}

.section-title {
  margin: 0 0 24px;
  font-size: 28px;
  font-weight: 800;
  color: var(--c-ink);
}

/* Products mega menu (desktop only; opens on hover or click/keyboard) */

/* Mobile menu overlay */

body.menu-open {
  overflow: hidden;
}

/* 5. Blog hero, archives, listings, cards ---------------------------------- */
.blog-hero {
  padding: 40px 0 8px;
}

.blog-hero__row {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-bottom: 20px;
}

.blog-hero__title {
  margin: 0 0 6px;
  font-size: 34px;
  font-weight: 800;
  line-height: 1.1;
  color: var(--c-ink);
}

.blog-hero__tagline {
  margin: 0;
  color: var(--c-muted);
  font-size: 16px;
}

.archive-head {
  padding: 40px 0 8px;
}

.archive-head__crumb {
  margin: 0 0 8px;
  font-size: 14px;
  font-weight: 700;
  color: var(--c-muted);
}

.archive-head__crumb a {
  color: var(--c-muted);
  text-decoration: none;
}

.archive-head__crumb a:hover {
  color: var(--c-ink);
}

.archive-head__title {
  margin: 0 0 8px;
  font-size: 34px;
  font-weight: 800;
  line-height: 1.1;
  color: var(--c-ink);
}

.archive-head__text {
  margin: 0 0 16px;
  max-width: 720px;
  color: var(--c-muted);
}

.listing {
  padding-top: 24px;
}

.listing__empty {
  padding: 40px 0;
  font-size: 18px;
}

.listing__more {
  margin: 32px 0 0;
  text-align: center;
}

.post-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 30px;
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--c-surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.card:hover {
  box-shadow: var(--shadow-hover);
  transform: translateY(-2px);
}

.card__media {
  display: block;
  aspect-ratio: 3 / 2;
  background: #eee;
  overflow: hidden;
}

.card__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card__body {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  flex: 1;
  padding: 0 28px 28px;
}

.card__pills {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  margin-top: -16px;
  margin-bottom: 18px;
  position: relative;
  z-index: 1;
}

.card__title {
  margin: 0 0 12px;
  font-size: 24px;
  font-weight: 800;
  line-height: 1.25;
  color: var(--c-ink);
}

.card__title a {
  color: inherit;
  text-decoration: none;
}

.card__title a:hover {
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}

.card__meta {
  margin: 0 0 14px;
  font-size: 14px;
  font-weight: 700;
  color: var(--c-muted);
}

.card__by {
  font-weight: 400;
}

.card__author {
  color: #6c5b7b;
  text-decoration: none;
}

.card__author:hover {
  text-decoration: underline;
}

.card__sep {
  margin: 0 4px;
}

.card__excerpt {
  margin: 0 0 22px;
  font-size: 15px;
  line-height: 1.6;
  color: var(--c-muted);
}

.card__more {
  margin-top: auto;
}

.card--featured .card__media {
  aspect-ratio: 16 / 9;
}

.card--featured .card__body {
  padding: 28px;
}

.card--featured .card__pills {
  margin-top: 0;
}

.card--featured .card__title {
  font-size: 30px;
  margin-bottom: 8px;
}

.card--featured .card__meta {
  margin-bottom: 0;
}

.card--featured {
  margin-bottom: 30px;
}

/* Pagination */
.pager {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 48px 0 0;
}

.pager__pages {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pager__page {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  height: 40px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--c-surface);
  color: var(--c-text);
  box-shadow: var(--shadow);
  font-size: 14px;
  font-weight: 800;
  text-decoration: none;
}

.pager__page:hover {
  background: #eee;
}

.pager__page--current {
  background: var(--c-black);
  color: #fff;
}

.pager__gap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  height: 40px;
  color: var(--c-muted);
  font-weight: 800;
}

.pager__nav {
  display: inline-flex;
  align-items: center;
  height: 40px;
  padding: 0 20px;
  border-radius: 999px;
  background: var(--c-accent);
  color: var(--c-ink);
  font-size: 14px;
  font-weight: 800;
  text-decoration: none;
}

.pager__nav:hover {
  background: #e0ae0f;
}

/* 6. Article page ------------------------------------------------------------ */
.post {
  padding-top: 24px;
}

.post__card {
  background: var(--c-surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.post__hero {
  margin: 0;
  background: #eee;
}

.post__hero img {
  width: 100%;
  height: auto;
}

.post__inner {
  max-width: 820px;
  margin: 0 auto;
  padding: 24px 20px 32px;
}

.post__crumbs ol {
  list-style: none;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 6px;
  margin: 0 0 18px;
  font-size: 13px;
  font-weight: 700;
  color: var(--c-muted);
}

.post__crumbs li + li::before {
  content: "›";
  margin-right: 6px;
}

.post__crumbs a {
  color: var(--c-muted);
  text-decoration: none;
}

.post__crumbs a:hover {
  color: var(--c-ink);
}

.post__pills {
  margin: 0 0 20px;
}

.post__title {
  margin: 0 0 14px;
  font-size: 34px;
  font-weight: 800;
  line-height: 1.15;
  color: var(--c-ink);
  letter-spacing: -0.01em;
}

.post__meta {
  margin: 0 0 8px;
  font-size: 15px;
  font-weight: 700;
  color: var(--c-muted);
}

.post__updated {
  font-weight: 400;
}

.post__content {
  margin-top: 28px;
}

.post__footer {
  margin-top: 40px;
  padding-top: 24px;
  border-top: 1px solid var(--c-line);
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag {
  display: inline-block;
  padding: 6px 12px;
  border-radius: 6px;
  background: #f5f5f5;
  color: var(--c-text);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
}

.tag:hover {
  background: #e9e9e9;
}

.share {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.share__label {
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--c-muted);
}

.share__list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.share__link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 999px;
  background: var(--c-black);
  color: #fff;
  cursor: pointer;
  transition: transform 0.15s ease, background-color 0.15s ease;
}

.share__link:hover {
  transform: translateY(-2px);
  background: #2a2b30;
}

.share__link--copy.is-copied {
  background: #2e9e5b;
}

.share__mobile-only {
  display: none;
}

@media (pointer: coarse) {
  .share__mobile-only {
    display: block;
  }
}

.related {
  margin-top: 56px;
}

/* Prose: the article body written by authors in article.html */
.prose {
  font-size: 17px;
  line-height: 1.75;
  color: var(--c-text);
  overflow-wrap: break-word;
}

.prose > :first-child {
  margin-top: 0;
}

.prose p,
.prose ul,
.prose ol,
.prose blockquote,
.prose figure,
.prose pre,
.prose .table-wrap {
  margin: 0 0 1.4em;
}

.prose h2,
.prose h3,
.prose h4,
.prose h5 {
  color: var(--c-ink);
  font-weight: 800;
  line-height: 1.25;
  margin: 2em 0 0.7em;
  scroll-margin-top: calc(var(--nav-h) + 16px);
}

.prose h2 {
  font-size: 28px;
}

.prose h3 {
  font-size: 23px;
}

.prose h4 {
  font-size: 19px;
}

.prose h5 {
  font-size: 17px;
}

.prose strong {
  font-weight: 800;
  color: var(--c-ink);
}

.prose ul,
.prose ol {
  padding-left: 1.5em;
}

.prose li {
  margin-bottom: 0.45em;
}

.prose li > ul,
.prose li > ol {
  margin: 0.45em 0 0;
}

.prose img {
  border-radius: var(--radius-sm);
  margin-left: auto;
  margin-right: auto;
}

.prose figure {
  text-align: center;
}

.prose figcaption {
  margin-top: 0.6em;
  font-size: 14px;
  color: var(--c-muted);
}

.prose blockquote {
  padding: 4px 0 4px 20px;
  border-left: 4px solid var(--c-accent);
  color: var(--c-ink);
  font-style: italic;
}

.prose .callout {
  padding: 20px 24px;
  border-radius: var(--radius-sm);
  background: var(--c-callout);
  color: var(--c-ink);
}

.prose hr {
  border: 0;
  border-top: 1px solid var(--c-line);
  margin: 2.5em 0;
}

.prose code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.9em;
  background: #f1f1f1;
  color: #2e2f33;
  padding: 0.15em 0.4em;
  border-radius: 4px;
}

.prose pre {
  position: relative;
  border-radius: var(--radius-sm);
  background: #22272e;
  overflow: auto;
}

.prose pre code {
  display: block;
  padding: 20px 22px;
  background: transparent;
  color: #e6edf3;
  font-size: 14px;
  line-height: 1.6;
  border-radius: 0;
  tab-size: 4;
}

.prose pre .code-copy {
  position: absolute;
  top: 10px;
  right: 10px;
  padding: 5px 10px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
  color: #e6edf3;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.prose pre:hover .code-copy,
.prose pre .code-copy:focus-visible,
.prose pre .code-copy.is-copied {
  opacity: 1;
}

.prose .table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--c-line);
  border-radius: var(--radius-sm);
}

.prose table {
  width: 100%;
  min-width: 480px;
  border-collapse: collapse;
  font-size: 15px;
}

.prose th,
.prose td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--c-line);
  text-align: left;
  vertical-align: top;
}

.prose thead th,
.prose tbody tr:first-child th {
  background: #f7f7f7;
  color: var(--c-ink);
  font-weight: 800;
}

.prose tr:last-child td {
  border-bottom: 0;
}

.prose iframe,
.prose video {
  width: 100%;
  border: 0;
  border-radius: var(--radius-sm);
}

.prose iframe {
  aspect-ratio: 16 / 9;
  height: auto;
}

.prose .align-center {
  text-align: center;
}

.prose .text-center {
  text-align: center;
}

.prose .text-right {
  text-align: right;
}

.prose .small {
  font-size: 0.875em;
}

/* 7. Utilities & responsive ----------------------------------------------- */
.back-to-top {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 50;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 999px;
  background: var(--c-accent);
  color: var(--c-ink);
  box-shadow: var(--shadow-hover);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.back-to-top[hidden] {
  display: none;
}

.back-to-top:hover {
  transform: translateY(-2px);
}

@media (min-width: 640px) {
  :root {
    --gutter: 24px;
  }

  .post-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .blog-hero__row {
    flex-direction: row;
    align-items: flex-end;
    justify-content: space-between;
  }

  .blog-hero__title,
  .archive-head__title {
    font-size: 40px;
  }

  .post__inner {
    padding: 32px 40px 40px;
  }

  .post__title {
    font-size: 42px;
  }

  .post__footer {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }

  .card--featured .card__media {
    aspect-ratio: 2 / 1;
  }

  .card--featured .card__title {
    font-size: 38px;
  }
}

@media (min-width: 992px) {

  .post__inner {
    padding: 40px 56px 48px;
  }

  .prose {
    font-size: 18px;
  }
}

@media (min-width: 1060px) {

  .post-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media print {
  .site-footer, .share, .related, .back-to-top {
    display: none !important;
  }

  .post__card {
    box-shadow: none;
  }
}

/* The shared footer (chrome.css) is identical to enfonica.com's; the blog only adds room
   so the floating back-to-top button never covers the legal links. */
.site-footer__bottom {
  padding-right: 64px;
}
