/* =========================================================================
 * ai-docs landing page — Figma-reconciled
 * Tokens map to Figma variables in the System Events file
 * (file RhcY7ra5RNoeNlXHFMaEA4, root 6710:6675).
 * ========================================================================= */

:root {
  /* Color — Figma-confirmed (Brivo dark theme) */
  --bg-page: #10171F;                /* surface/page */
  --bg-container: #19232F;           /* surface/container/default */
  --bg-glow-tr: rgba(121, 110, 210, 0.28);  /* upper-right blurred glow */
  --bg-glow-bl: rgba(120, 145, 190, 0.18);  /* lower-left blurred glow */
  --card-bg: #202D3B;                /* surface/container/light-contrast */
  --card-border: #607185;            /* border/default */
  --text-primary: #FAFCFD;           /* text/copy/primary */
  --text-secondary: #A5B4C4;         /* text/copy/secondary */
  --text-muted: #A5B4C4;
  --accent: #7DA6DB;                 /* text/link/default */
  --icon-default: #7D8FA3;           /* surface/icon/default */
  --icon-block-grad-from: rgba(125, 166, 219, 0.35);
  --icon-block-grad-to:   rgba(141, 181, 233, 0);
  --icon-block-grad-base: #A3C6F3;

  /* Type — Figma-confirmed */
  --font-family: "IBM Plex Sans", system-ui, -apple-system, Arial, sans-serif;
  --fs-h1: 2.25rem;        /* 36px — heading/1/size */
  --fs-h2: 1.125rem;       /* 18px — heading/2 SB/size */
  --fs-sub: 1.5rem;        /* 24px — sub-heading/1/size */
  --fs-body-lg: 1rem;      /* 16px — body/1/size */
  --fs-body: 0.875rem;     /* 14px — body/2/size */
  --fs-small: 0.75rem;     /* 12px — body/3/size */
  --fs-micro: 0.6875rem;   /* 11px — body/microcopy/size */
  --lh-h1: 1.2;            /* 43.2/36 */
  --lh-tight: 1.2;         /* 21.6/18 — heading/2 SB line-height */
  --lh-body: 1.5;

  /* Space — Figma 8x scale */
  --space-2xs: 0.125rem;   /* 2px */
  --space-xs: 0.5rem;      /* 8px — theme-spacing(1) */
  --space-sm: 0.75rem;     /* 12px — theme-spacing(1,5) */
  --space-md: 1rem;        /* 16px — size/size3x */
  --space-lg: 1.5rem;      /* 24px — card vertical gap */
  --space-xl: 2rem;
  --space-2xl: 3rem;
  --space-3xl: 4rem;

  /* Layout */
  --max-width: 1200px;
  --card-min: 312px;       /* Figma card width */
  --radius-sm: 4px;        /* border-radius/sm */
  --radius-lg: 16px;       /* corner-radius/lg */
}

/* --- Reset & base --------------------------------------------------------- */

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

html, body { margin: 0; padding: 0; }

body {
  background: var(--bg-page);
  color: var(--text-primary);
  font-family: var(--font-family);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Figma "Dark Gradient": flat page color with two large blurred ellipses
   (purple upper-right, cool-blue lower-left). Anchored to .site-main so
   header/footer keep their solid surfaces. */
.site-main {
  background:
    radial-gradient(ellipse 55% 35% at 100% 8%, var(--bg-glow-tr) 0%, transparent 65%),
    radial-gradient(ellipse 55% 35% at 0% 92%, var(--bg-glow-bl) 0%, transparent 65%);
}

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

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

a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 2px;
}

ul { list-style: none; margin: 0; padding: 0; }

h1, h2, h3 { margin: 0; line-height: var(--lh-tight); }

/* --- Header --------------------------------------------------------------- */

.site-header {
  background: var(--bg-container);
  padding: var(--space-md) var(--space-xl);
  height: 72px;
  width: 100%;
  display: flex;
  align-items: center;
  box-shadow: 0 4px 12px rgba(8, 13, 19, 0.2);
}

.site-header__logo img { height: 24px; width: auto; }

/* --- Main shell ----------------------------------------------------------- */

.site-main {
  flex: 1;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2rem;          /* 32px — page section gap */
  padding: 2rem var(--space-xl) var(--space-3xl);
}

/* --- Footer --------------------------------------------------------------- */

.site-footer {
  margin-top: var(--space-3xl);
}

.site-footer__main {
  background: var(--bg-container);
  padding-block: var(--space-lg);
  padding-inline: max(
    calc(var(--space-xl) + var(--space-md)),
    calc((100% - 1408px) / 2 + var(--space-md))
  );
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2xl);
  justify-content: space-between;
  align-items: flex-start;
}

.site-footer__brand {
  width: 179px;
  display: flex;
  flex-direction: column;
  gap: 17px;
}

.site-footer__brand-mark {
  display: inline-grid;
  grid-template-columns: max-content;
  grid-template-rows: max-content;
  place-items: start;
}

.site-footer__brand-mark img {
  grid-column: 1;
  grid-row: 1;
  height: 33px;
  width: 154px;
  margin: 0;
}

.site-footer__brand-tag {
  grid-column: 1;
  grid-row: 1;
  font-size: var(--fs-micro);
  font-weight: 400;
  color: var(--accent);
  margin: 39px 0 0 42px;
  white-space: nowrap;
}

.site-footer__address {
  font-style: normal;
  font-size: var(--fs-small);
  font-weight: 400;
  color: var(--text-muted);
  line-height: 1.4;
}

.site-footer__email {
  font-size: var(--fs-small);
  color: var(--accent);
}

.site-footer__email:hover { color: var(--text-primary); }

.site-footer__social {
  width: 179px;
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.site-footer__social-title {
  font-size: var(--fs-sub);
  font-weight: 600;
  color: var(--text-secondary);
  line-height: 28.8px;
  margin: 0;
}

.site-footer__social-list {
  display: flex;
  gap: var(--space-md);
}

.site-footer__social-list a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  color: var(--text-primary);
  transition: color 0.15s;
}

.site-footer__social-list a:hover { color: var(--text-primary); }

.site-footer__social-list svg {
  width: 24px;
  height: 24px;
  display: block;
}

.site-footer__social-list svg path {
  fill: currentColor;
}

.site-footer__legal {
  background: var(--bg-page);
  padding: 14px var(--space-xl) 13px;
  text-align: center;
  font-size: var(--fs-body);
  font-weight: 400;
  color: var(--text-muted);
}

/* --- Hero ----------------------------------------------------------------- */

.hero {
  text-align: center;
  width: 100%;
  max-width: 464px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 11px;
}

.hero__mark {
  height: 33px;
  margin: 0;
}

.hero__title {
  font-size: var(--fs-h1);
  font-weight: 600;
  line-height: 43.2px;
  color: var(--text-primary);
  max-width: 430px;
}

.hero__lede {
  font-size: var(--fs-body-lg);
  color: var(--text-secondary);
  margin: 0;
  line-height: 1.5;
}

@media (max-width: 600px) {
  .hero { padding: 0 var(--space-md); }
}

/* --- Cards ---------------------------------------------------------------- */

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(var(--card-min), 1fr));
  gap: var(--space-lg);    /* 24px — fits 4 cards within resource-section */
  width: 100%;
}

.card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  padding: var(--space-md);
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}

.card__icon-block {
  position: relative;
  width: 64px;
  height: 64px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

/* Figma: gradient layer wrapped at opacity 0.35 so icon glyph stays full alpha. */
.card__icon-block::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background:
    linear-gradient(90deg, var(--icon-block-grad-from) 0%, var(--icon-block-grad-from) 100%),
    linear-gradient(135deg, var(--icon-block-grad-base) 0%, var(--icon-block-grad-to) 100%);
  opacity: 0.35;
}

.card__icon {
  width: 24px;
  height: 24px;
  display: block;
  filter: brightness(0) invert(1);
}

.card__text {
  display: flex;
  flex-direction: column;
  gap: 11px;
  flex: 1;
}

.card__title {
  font-size: var(--fs-h2);
  font-weight: 600;
  line-height: 21.6px;
  color: var(--text-primary);
}

.card__body {
  font-size: var(--fs-body);
  color: var(--text-secondary);
  margin: 0;
  line-height: 1.4;
}

.card__drawer {
  border-top: 1px solid var(--card-border);
  padding-top: var(--space-2xs);
  display: flex;
  align-items: center;
}

.card__cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-xs);
  height: 32px;
  min-width: 64px;
  padding: var(--space-xs);
  border-radius: var(--radius-sm);
  font-size: var(--fs-small);
  font-weight: 600;
  color: var(--accent);
  transition: background-color 0.15s, color 0.15s;
}

.card__cta:hover {
  background-color: rgba(125, 166, 219, 0.1);
  color: var(--text-primary);
}

.card__cta-icon {
  width: 16px;
  height: 16px;
  display: inline-block;
  vertical-align: middle;
  background-color: currentColor;
  -webkit-mask: url(../img/icons/card-cta-arrow.svg) center / contain no-repeat;
          mask: url(../img/icons/card-cta-arrow.svg) center / contain no-repeat;
}

/* --- Resource sections (AI Resources, Developer Resources) ----------------- */

.resource-section {
  width: 100%;
  max-width: 1408px;        /* fits 3×440 AI cards or 4×312 dev cards + gaps */
  margin: 0 auto;
  padding: 0 var(--space-md);
}

.resource-section + .resource-section {
  margin-top: var(--space-2xl);
}

.resource-section__label {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  margin: 0 0 var(--space-lg);
  font-family: var(--font-family);
  font-size: var(--fs-h2);
  font-weight: 600;
  line-height: var(--lh-tight);
  color: var(--text-primary);
}

.resource-section__label::before,
.resource-section__label::after {
  content: "";
  flex: 1 1 auto;
  height: 1px;
  background: var(--card-border);
}

.resource-section__label > span {
  flex: 0 0 auto;
  white-space: nowrap;
}

/* Responsive label swap: shorter labels at ≤720px */
@media (max-width: 720px) {
  #ai-resources-heading > span { font-size: 0; }
  #ai-resources-heading > span::after {
    content: "Prompts";
    font-size: var(--fs-h2);
  }
  #dev-resources-heading > span { font-size: 0; }
  #dev-resources-heading > span::after {
    content: "Documentation";
    font-size: var(--fs-h2);
  }
}

/* --- AI Resources cards ---------------------------------------------------- */

.resource-cards--ai {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-lg);
  justify-content: center;
}

.ai-card {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  flex: 1 1 312px;         /* shrink to fit row, grow up to 440 */
  max-width: 440px;
  min-height: 96px;
  padding: var(--space-md);
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  text-decoration: none;
  color: var(--text-primary);
  transition: border-color 120ms ease, transform 120ms ease;
}

.ai-card:hover,
.ai-card:focus-visible {
  border-color: var(--accent);
  transform: translateY(-1px);
}

.ai-card__icon-block {
  flex: 0 0 auto;
  position: relative;
  width: 64px;
  height: 64px;
  border-radius: var(--radius-sm);
  background:
    linear-gradient(to right, rgba(71, 118, 230, 0.35) 1%, rgba(121, 72, 228, 0.35) 75%);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* AI (llms) card: vivid inner gradient circle behind the sparkles icon */
.ai-card--llms .ai-card__icon-block::before {
  content: "";
  position: absolute;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background:
    linear-gradient(to right, #4776e6 1%, #7948e4 75%);
}

.ai-card--llms .ai-card__icon {
  position: relative;
  width: 16px;
  height: 16px;
}

.ai-card__icon {
  width: 24px;
  height: 24px;
  color: var(--text-primary);
  /* SVGs use currentColor — apply via mask if needed: */
  filter: brightness(0) invert(1);
}

.ai-card__text {
  display: flex;
  flex-direction: column;
  gap: var(--space-2xs);
  min-width: 0; /* allow ellipsis if needed */
  font-size: var(--fs-body-lg);
  line-height: var(--lh-tight);
}

.ai-card__title {
  font-size: var(--fs-h2);
  font-weight: 600;
  color: var(--text-primary);
}

.ai-card__sub {
  color: var(--accent);
  font-size: var(--fs-body-lg);
}

.ai-card--llms .ai-card__text {
  color: var(--text-secondary);
}

.ai-card--llms .ai-card__sub {
  color: var(--accent);
  display: inline;
}

/* llms.txt copy card: wrapper for button + view-link sibling */
.ai-card-wrap {
  display: contents;
}

.ai-card-wrap--llms {
  position: relative;
  display: flex;
  flex: 1 1 312px;
  max-width: 440px;
  transition: transform 120ms ease;
}

/* Lift the wrap (button + view-link together) instead of just the button */
.ai-card-wrap--llms:has(button.ai-card:hover),
.ai-card-wrap--llms:has(button.ai-card:focus-visible) {
  transform: translateY(-1px);
}

/* Button reset so <button class="ai-card"> matches anchor cards visually */
button.ai-card {
  background: var(--card-bg);
  font: inherit;
  color: var(--text-primary);
  text-align: left;
  cursor: pointer;
  width: 100%;
  max-width: none;
  flex: 1 1 auto;
}

/* Neutralize the inherited .ai-card hover/focus translate — the wrap moves now */
button.ai-card:hover,
button.ai-card:focus-visible {
  transform: none;
}

button.ai-card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.ai-card__view-link {
  position: absolute;
  bottom: var(--space-2xs);
  right: var(--space-sm);
  font-size: var(--fs-body-sm, 0.75rem);
  color: var(--text-secondary);
  text-decoration: none;
  z-index: 1;
}

.ai-card__view-link:hover,
.ai-card__view-link:focus-visible {
  text-decoration: underline;
  color: var(--accent);
}

/* Responsive: at M (1080–~960), 2 prompt cards row 1 + AI card row 2 */
@media (max-width: 1079px) and (min-width: 720px) {
  .resource-cards--ai .ai-card-wrap--llms,
  .resource-cards--ai .ai-card--llms {
    flex-basis: 100%;
    max-width: 440px;
  }
}

/* Stack at ≤719px */
@media (max-width: 719px) {
  .ai-card,
  .ai-card-wrap--llms {
    width: 100%;
    flex-basis: 100%;
  }
}
