/* ---------------------------------------------------------------------------
   Astmation public pages (articles)
   ---------------------------------------------------------------------------
   Tokens and component recipes are copied from the live marketing page,
   app/views/homes/astmation.html.erb, which inlines its own <style> block and
   is the single source of truth for the brand. Nothing here is shared with
   app/assets/stylesheets/app.css — that file still dresses the CV/bio pages
   and its light theme would fight every rule below, so the public layout
   (app/views/layouts/public.html.erb) deliberately does not load it.

   Site tokens:
     --bg    #010313   --purple #761cff
     --text  #f7f8ff   --blue   #247dff
     --muted #a5a9bf   --cyan   #09d9d0
     --line  rgba(92, 104, 170, 0.24)
   ------------------------------------------------------------------------- */
:root {
  --bg: #010313;
  --bg-soft: #05071a;
  --text: #f7f8ff;
  --muted: #a5a9bf;
  --line: rgba(92, 104, 170, 0.24);
  --purple: #761cff;
  --blue: #247dff;
  --cyan: #09d9d0;
  --panel: rgba(5, 9, 29, 0.72);
  --card: linear-gradient(145deg, rgba(10, 13, 39, 0.96), rgba(4, 13, 29, 0.96));
  --gradient: linear-gradient(105deg, #7618ff, #4d55ff 50%, #05cfc9);
  --radius: 7px;
  --max-width: 1400px;
  --header-height: 72px;
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  /* The same radial wash the marketing page paints behind its hero. */
  background: radial-gradient(circle at 50% -10%, rgba(44, 30, 130, 0.13), transparent 34%),
              var(--bg);
  color: var(--text);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--cyan);
  text-decoration: none;
  cursor: pointer;
}

a:hover {
  color: var(--blue);
}

img {
  max-width: 100%;
}

.container {
  width: min(calc(100% - 48px), var(--max-width));
  margin-inline: auto;
}

/* Header ------------------------------------------------------------------ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  height: var(--header-height);
  background: rgba(1, 3, 19, 0.86);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.header-inner {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  color: var(--text);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.brand:hover {
  color: #fff;
}

.brand img {
  width: 48px;
  height: 48px;
  object-fit: contain;
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 36px;
  margin-left: auto;
}

.main-nav > a:not(.nav-cta) {
  position: relative;
  color: #e8e9f3;
  font-size: 14px;
  font-weight: 500;
  transition: color 180ms ease;
}

/* The underline sweeps in from the centre, as on the marketing nav. */
.main-nav > a:not(.nav-cta)::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -8px;
  height: 2px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--purple), var(--cyan));
  transform: scaleX(0);
  transform-origin: center;
  transition: transform 180ms ease;
}

.main-nav > a:not(.nav-cta):hover {
  color: #fff;
}

.main-nav > a:not(.nav-cta):hover::after,
.main-nav > a.is-active:not(.nav-cta)::after {
  transform: scaleX(1);
}

.main-nav > a.is-active:not(.nav-cta) {
  color: #fff;
}

.nav-cta {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 22px;
  border-radius: 9px;
  background: linear-gradient(110deg, #7518ff 0%, #445cff 50%, #00cfc8 100%);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.nav-cta:hover {
  color: #fff;
  transform: translateY(-2px);
  box-shadow: 0 7px 25px rgba(78, 43, 255, 0.25);
}

/* Page head --------------------------------------------------------------- */
.page-main {
  flex: 1 0 auto;
  padding: 34px 0 56px;
}

.page-head {
  margin-bottom: 26px;
  padding-bottom: 20px;
  border-bottom: 1px solid rgba(53, 71, 122, 0.2);
}

.eyebrow {
  display: block;
  margin-bottom: 7px;
  color: #9349ff;
  font-size: 18px;
  line-height: 1;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.page-title {
  margin: 0 0 8px;
  font-size: 34px;
  line-height: 1.2;
  font-weight: 800;
}

/* The marketing hero clips a gradient to the headline; reused here. */
.page-title .gradient {
  background: linear-gradient(90deg, #8a35ff, #197cff 55%, #14d3d0);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.page-lede {
  margin: 0;
  max-width: 70ch;
  color: var(--muted);
  font-size: 15px;
}

/* Flash ------------------------------------------------------------------- */
.flash {
  position: relative;
  margin-bottom: 18px;
  padding: 12px 44px 12px 16px;
  border: 1px solid var(--line);
  border-left-width: 3px;
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--text);
  font-size: 14px;
}

.flash--notice { border-left-color: var(--cyan); }
.flash--alert  { border-left-color: #ff5f6d; }

.flash__close {
  position: absolute;
  top: 6px;
  right: 10px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

.flash__close:hover {
  color: var(--text);
}

/* Article cards ----------------------------------------------------------- */
.article-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 14px;
}

.article-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  /* The cover bleeds to the padding edge with a negative margin; without this
     its square-ish inner corners peek past the card's rounded ones. */
  overflow: hidden;
  background: var(--card);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.015);
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.article-card:hover {
  transform: translateY(-3px);
  border-color: rgba(105, 119, 200, 0.55);
}

/* Cover image. The source is a remote URL of unknown dimensions, so it is
   painted as a background on a fixed 16:9 box rather than an <img>: the grid
   keeps its rhythm regardless of what comes back, and a 404 leaves the panel
   colour showing instead of a broken-image glyph. */
.article-card__media {
  display: block;
  aspect-ratio: 16 / 9;
  margin: -18px -18px 0;
  border-radius: var(--radius) var(--radius) 0 0;
  background-color: var(--panel);
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
  transition: opacity 0.2s ease;
}

.article-card__media:hover {
  opacity: 0.88;
}

/* No image: the Astmation logo sits centred at a modest size on the panel
   colour, so it reads as a placeholder rather than a stretched photo. */
.article-card__media--fallback {
  background-size: 42% auto;
  background-color: rgba(9, 12, 38, 0.85);
}

/* Visually hidden but still announced — the media link has no text of its own. */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.article-card__title {
  margin: 0;
  font-size: 19px;
  line-height: 1.35;
  font-weight: 700;
}

.article-card__title a {
  color: var(--text);
  transition: color 180ms ease;
}

.article-card__title a:hover {
  color: var(--cyan);
}

.article-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.article-meta__label {
  color: #7f8499;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-size: 11px;
}

/* Breaks long source URLs instead of letting them widen the card. */
.article-meta__value {
  overflow-wrap: anywhere;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: auto;
}

/* Chip recipe lifted from the marketing page's technology tabs. */
.tag {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  color: #aeb3c8;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  transition: color 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.tag:hover {
  color: #f5f6ff;
  border-color: rgba(92, 130, 235, 0.5);
  transform: translateY(-1px);
}

/* Empty state ------------------------------------------------------------- */
.empty-state {
  padding: 48px 24px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--muted);
  text-align: center;
}

/* Article detail ---------------------------------------------------------- */
.article-detail {
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  overflow: hidden; /* see .article-card */
}

.article-detail__title {
  margin: 0 0 16px;
  font-size: 28px;
  line-height: 1.3;
  font-weight: 800;
}

/* Detail cover: wider aspect than the cards so it does not dominate the page,
   and pulled out to the card edges the same way. */
.article-detail__media {
  aspect-ratio: 21 / 9;
  margin: -26px -26px 22px;
  border-radius: var(--radius) var(--radius) 0 0;
  background-color: var(--panel);
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
}

.article-detail__media--fallback {
  background-size: 26% auto;
  background-color: rgba(9, 12, 38, 0.85);
}

.article-detail__meta {
  display: grid;
  gap: 8px;
  padding-bottom: 18px;
  margin-bottom: 22px;
  border-bottom: 1px solid rgba(53, 71, 122, 0.2);
}

/* Rich text body: ActionText output, so every element is styled defensively. */
.article-prose {
  font-size: 15.5px;
  line-height: 1.75;
  color: #dfe2f0;
  overflow-wrap: anywhere;
}

.article-prose h1,
.article-prose h2,
.article-prose h3,
.article-prose h4 {
  margin: 28px 0 10px;
  color: var(--text);
  line-height: 1.3;
  font-weight: 700;
}

.article-prose h1 { font-size: 26px; }
.article-prose h2 { font-size: 22px; }
.article-prose h3 { font-size: 19px; }

.article-prose p,
.article-prose ul,
.article-prose ol {
  margin: 0 0 14px;
}

.article-prose ul,
.article-prose ol {
  padding-left: 22px;
}

.article-prose li {
  margin-bottom: 6px;
}

.article-prose blockquote {
  margin: 18px 0;
  padding: 2px 18px;
  border-left: 3px solid var(--purple);
  color: var(--muted);
}

.article-prose code {
  padding: 2px 6px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #050a1d;
  color: var(--cyan);
  font-size: 0.9em;
}

.article-prose pre {
  padding: 14px 16px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #050a1d;
}

.article-prose pre code {
  padding: 0;
  border: 0;
  background: none;
  color: #dfe2f0;
}

.article-prose img {
  height: auto;
  border-radius: var(--radius);
}

.article-prose table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 16px;
}

.article-prose th,
.article-prose td {
  padding: 8px 10px;
  border: 1px solid var(--line);
  text-align: left;
}

.article-prose th {
  background: var(--panel);
  color: var(--cyan);
}

/* Buttons ----------------------------------------------------------------- */
.button {
  min-height: 42px;
  padding: 0 22px;
  border-radius: var(--radius);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 600;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.button:hover {
  transform: translateY(-2px);
}

.button--primary {
  color: #fff;
  background: var(--gradient);
  box-shadow: 0 7px 25px rgba(78, 43, 255, 0.25);
}

.button--primary:hover {
  color: #fff;
}

.button--secondary {
  color: #fff;
  border: 1px solid rgba(220, 226, 255, 0.55);
  background: rgba(4, 7, 24, 0.55);
}

.button--secondary:hover {
  color: #fff;
  border-color: #16d5d2;
}

/* A row of buttons closing a page. Only the top margin is its job — the
   buttons bring their own size — so it stays a layout wrapper and nothing
   else. */
.page-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 28px;
}

/* Pagination (Kaminari's default markup) ---------------------------------- */
.pagination {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 7px;
  margin-top: 30px;
}

.pagination span {
  display: inline-flex;
}

.pagination span > a,
.pagination span.current,
.pagination span.gap {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  color: #aeb3c8;
  font-size: 13px;
  font-weight: 600;
  transition: color 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.pagination span > a:hover {
  color: #f5f6ff;
  border-color: rgba(92, 130, 235, 0.5);
  transform: translateY(-1px);
}

.pagination span.current {
  color: #fff;
  border-color: rgba(118, 32, 255, 0.7);
  background: linear-gradient(105deg,
              rgba(118, 32, 255, 0.2),
              rgba(40, 124, 255, 0.12),
              rgba(0, 214, 207, 0.08));
  box-shadow: 0 5px 20px rgba(76, 42, 255, 0.12);
}

.pagination span.gap {
  border-color: transparent;
  background: none;
}

/* Footer ------------------------------------------------------------------ */
.site-footer {
  flex-shrink: 0;
  border-top: 1px solid var(--line);
  background: rgba(2, 4, 20, 0.72);
}

.footer-inner {
  min-height: 90px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 24px;
}

.footer-brand {
  font-size: 19px;
}

.footer-brand img {
  width: 43px;
  height: 43px;
}

.copyright {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.social-links {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 14px;
}

.social-links a {
  width: 35px;
  height: 35px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(164, 171, 205, 0.42);
  border-radius: var(--radius);
  color: #b9bdd0;
  font-size: 20px;
  font-weight: 700;
  transition: color 180ms ease, border-color 180ms ease, transform 180ms ease;
}

.social-links a:hover {
  color: #fff;
  border-color: var(--cyan);
  transform: translateY(-2px);
}

/* Responsive -------------------------------------------------------------- */
@media (max-width: 860px) {
  .main-nav {
    gap: 18px;
  }

  .main-nav > a:not(.nav-cta) {
    font-size: 13px;
  }

  .page-title {
    font-size: 27px;
  }

  .footer-inner {
    grid-template-columns: 1fr;
    justify-items: center;
    padding: 20px 0;
    gap: 14px;
  }

  .social-links {
    justify-content: center;
  }
}

@media (max-width: 640px) {
  .container {
    width: calc(100% - 28px);
  }

  .nav-cta {
    display: none;
  }

  .article-list {
    grid-template-columns: 1fr;
  }

  .article-detail {
    padding: 18px;
  }
}
