/* FlutLab Blog — shared stylesheet
   Tokens follow the FlutLab design system (colours, type, radii). Do not add colours,
   fonts or shadows that are not listed here. All URLs are root-relative to /blog/. */

:root {
  /* Surfaces */
  --bg: #21252B;
  --bg-deep: #1A1D22;
  --surface: #353A45;        /* DESIGN.md "surface" as rendered on Data Room / New Project */
  --card: #21252B;           /* Residents post card / "Popular hashtags" panel fill (= bg) */
  --blob-blue: #00A2E4;      /* ambient background blobs, copied from flutlab.io/residents */
  --blob-orange: #C77A0C;    /* Residents orange #FF9900 at ~70% brightness, warm enough to sit next to the blue */
  --surface-hover: #424754;
  --surface-2: #262B33;
  --surface-3: #2B323E;
  --overlay: rgba(0, 0, 0, 0.5);

  /* Accent */
  --accent: #00A2E4;
  --accent-strong: #1FBCFD;
  --accent-muted: rgba(0, 162, 228, 0.3);
  --accent-deep: #0885BA;
  --accent-dim: #11658A;

  /* Text */
  --ink: #FFFFFF;
  --ink-body: #DBDBDB;
  --ink-muted: rgba(255, 255, 255, 0.5);
  --ink-faint: #9E9E9E;
  --ink-nav: #BCBEBF;
  --brand-title: #0E9BD9;

  /* Semantic */
  --danger: #F50057;
  --warm: #EC7650;

  /* Lines */
  --line: rgba(255, 255, 255, 0.12);
  --line-strong: rgba(255, 255, 255, 0.2);
  --line-card: #707070;
  --line-footer: rgba(255, 255, 255, 0.12); /* footer top edge + bottom-bar divider */

  /* Code (Monaco vs-dark) */
  --code-keyword: #C586C0;
  --code-type: #4EC9B0;
  --code-string: #CE9178;
  --code-function: #DCDCAA;
  --code-number: #B5CEA8;
  --code-comment: #6A9955;
  --code-plain: #D4D4D4;

  /* Type */
  --font-display: "Montserrat", sans-serif;
  --font-ui: "Roboto", sans-serif;
  --font-reading: "Roboto Slab", serif;
  --font-code: Menlo, Monaco, Consolas, "Courier New", monospace;
  --ls-ui: 0.15px;

  /* Spacing */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-xxl: 48px;
  --space-xxxl: 64px;
  --header-height: 64px;
  --index-max: 1120px;
  --prose-max: 720px;
  --card-gap: 24px;
  --card-padding: 24px;
  --gutter: 24px;

  /* Radii */
  --r-sm: 6px;
  --r-md: 8px;
  --r-lg: 12px;
  --r-xl: 16px;
  --r-card: 24px;
  --r-shot: 16px;   /* article screenshots + hero */
  --r-pill: 32px;

  /* Motion */
  --ease: 180ms ease-out;
}

/* ---------- Fonts (self-hosted, latin subset, SIL OFL — see fonts/LICENSE-*.txt) ---------- */

@font-face { font-family: "Montserrat"; font-style: normal; font-weight: 500; font-display: swap; src: url("/blog/fonts/montserrat-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Montserrat"; font-style: normal; font-weight: 600; font-display: swap; src: url("/blog/fonts/montserrat-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Roboto"; font-style: normal; font-weight: 400; font-display: swap; src: url("/blog/fonts/roboto-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Roboto"; font-style: normal; font-weight: 500; font-display: swap; src: url("/blog/fonts/roboto-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Roboto Slab"; font-style: normal; font-weight: 300; font-display: swap; src: url("/blog/fonts/roboto-slab-latin-300-normal.woff2") format("woff2"); }
@font-face { font-family: "Roboto Slab"; font-style: normal; font-weight: 400; font-display: swap; src: url("/blog/fonts/roboto-slab-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Roboto Slab"; font-style: normal; font-weight: 700; font-display: swap; src: url("/blog/fonts/roboto-slab-latin-700-normal.woff2") format("woff2"); }

/* ---------- Base ---------- */

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

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

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg-deep);
  color: var(--ink);
  font-family: var(--font-ui);
  font-weight: 400;
  font-size: 14px;
  line-height: 1.43;
  letter-spacing: var(--ls-ui);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

body.is-locked { overflow: hidden; }

/* ---------- Ambient background (copied from flutlab.io/residents) ----------
   Two blurred colour blobs drifting along the left and right edges, under a 20% scrim.
   The layer is fixed and sits under header, main and footer (all z-index 1), so the
   solid footer and header cover it. Hidden at ≤1024px like on the live site. */

.ambient {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.ambient__blob {
  position: absolute;
  width: 100px;
  height: 100px;
  border-radius: 50%;
  filter: blur(100px);
  transform: scale(2);
  will-change: transform;   /* only transform animates → compositor only, no layout */
}

.ambient__blob--blue {
  top: -80px;
  left: -50px;
  background: var(--blob-blue);
  animation: ambient-blue 80s ease-in-out infinite;
}

.ambient__blob--orange {
  right: -50px;
  bottom: -220px;
  height: 200px;
  opacity: 0.75;
  background: var(--blob-orange);
  animation: ambient-orange 80s ease-in-out infinite;
}

.ambient__dim {
  position: absolute;
  inset: 0;
  background: rgba(26, 29, 34, 0.2);
}

@keyframes ambient-blue {
  0%   { transform: scale(2) translate3d(0, 0, 0); }
  50%  { transform: scale(2) translate3d(0, 50vh, 0); }   /* scale(2) halves the visual travel: 100vh drift */
  100% { transform: scale(2) translate3d(0, 0, 0); }
}

@keyframes ambient-orange {
  0%   { transform: scale(2) translate3d(0, 0, 0); }
  50%  { transform: scale(2) translate3d(0, -50vh, 0); }
  100% { transform: scale(2) translate3d(0, 0, 0); }
}

@media (max-width: 1024px) {
  .ambient { display: none; }
}

.site-header, main, .site-footer { position: relative; z-index: 1; }

/* header, main and footer are made inert (and hidden from AT) while the lightbox is open */
[inert] { pointer-events: none; }

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

a { color: inherit; }

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

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

main { flex: 1 0 auto; }

/* ---------- Header (shared FlutLab chrome — do not restyle) ---------- */

.site-header {
  height: var(--header-height);
  background: var(--bg);
  border-bottom: 1px solid var(--line-footer);   /* same hairline as the footer */
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
}

.site-header__brand {
  display: inline-flex;
  align-items: center;
  height: 100%;
  text-decoration: none;
}

.site-header__logo {
  width: 42px;
  height: 35px;   /* the mark is 36:30 */
  flex: 0 0 auto;
}

.site-header__product {
  margin-left: 8px;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 24px;
  line-height: 1;
  letter-spacing: 0;
  color: var(--brand-title);
  white-space: nowrap;
}

@media (max-width: 767px) {
  .site-header__logo { width: 36px; height: 30px; }
  .site-header__product { font-size: 20px; }
}

/* ---------- Index ---------- */

.index {
  width: 100%;              /* body is a column flexbox; auto margins would otherwise shrink-wrap the grid */
  max-width: var(--index-max);
  margin: 0 auto;
  padding: 56px var(--gutter) 64px;
}

.index__title {
  margin: 0 0 40px;
  text-align: center;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 40px;
  line-height: 1.2;
  letter-spacing: 0;
  color: var(--ink);
}

.index__intro {
  max-width: 640px;
  margin: -24px auto 40px;
  text-align: center;
  font-family: var(--font-ui);
  font-size: 16px;
  line-height: 1.5;
  color: var(--ink-body);
}

.grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--card-gap);
  align-items: stretch;
}

@media (min-width: 768px) {
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 1200px) {
  /* three 341px columns in the 1120px container; with fewer cards the row stays centred under the title */
  .grid { grid-template-columns: repeat(auto-fit, 340px); justify-content: center; }
}

.card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  position: relative;
  overflow: hidden;
  background: var(--card);
  border-radius: var(--r-card);
  padding: var(--card-padding);
  color: var(--ink);
  text-decoration: none;
  cursor: pointer;
  transition: background-color var(--ease);
}

/* light sweep across the card on hover: one narrow, soft band, 420ms */
.card::after {
  content: "";
  position: absolute;
  top: -20%;
  bottom: -20%;
  left: 0;
  width: 36%;
  background: linear-gradient(100deg, rgba(255,255,255,0) 0%, rgba(255,255,255,0.045) 35%, rgba(255,255,255,0.11) 50%, rgba(255,255,255,0.045) 65%, rgba(255,255,255,0) 100%);
  transform: translateX(-140%) skewX(-8deg);
  opacity: 0;
  pointer-events: none;
  will-change: transform, opacity;
}

.card__cover {
  aspect-ratio: 2 / 1;   /* covers are 1200×600 (Cover Studio) */
  border-radius: var(--r-xl);
  overflow: hidden;
  background: var(--surface);
  flex: 0 0 auto;
  transform: translateZ(0); /* keeps the rounded clip during the zoom */
}

.card__cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(1);
  transition: transform 500ms cubic-bezier(0.2, 0.7, 0.2, 1), filter var(--ease);
}

.card__title {
  margin: 16px 0 0;
  font-family: var(--font-reading);
  font-weight: 400;
  font-size: 18px;
  line-height: 1.35;
  letter-spacing: 0;
  color: var(--ink);
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  overflow-wrap: anywhere;
}

.card__subtitle {
  margin: 8px 0 0;
  font-family: var(--font-ui);
  font-weight: 400;
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink-body);
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  overflow: hidden;
}

.card__meta {
  margin: auto 0 0;
  padding-top: 16px;
  font-family: var(--font-ui);
  font-weight: 400;
  font-size: 12px;
  line-height: 1.4;
  color: var(--ink-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (hover: hover) and (pointer: fine) {
  .card:hover { background: var(--surface); }
  .card:hover .card__meta { color: rgba(255, 255, 255, 0.62); }   /* keeps ≥4.5:1 on the lighter hover fill */
  .card:hover .card__cover img { transform: scale(1.05); filter: brightness(1.06); }
  .card:hover::after { animation: card-sheen 420ms cubic-bezier(0.22, 0.61, 0.36, 1) forwards; }
}

@keyframes card-sheen {
  0%   { transform: translateX(-140%) skewX(-8deg); opacity: 0; }
  15%  { opacity: 1; }
  85%  { opacity: 1; }
  100% { transform: translateX(400%) skewX(-8deg); opacity: 0; }
}

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

@media (max-width: 767px) {
  .index { padding-left: 16px; padding-right: 16px; }
  .index__title { font-size: 28px; }
  .index__intro { font-size: 15px; margin-top: -16px; }
  .index__intro br { display: none; }
  .card { padding: 20px; }
}

/* ---------- Article ---------- */

.article {
  padding: 56px var(--gutter) 64px;
}

.article__header {
  max-width: var(--prose-max);
  margin: 0 auto;
  text-align: center;
}

.article__title {
  margin: 0 auto;
  max-width: 24ch;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 36px;
  line-height: 1.2;
  letter-spacing: 0;
  color: var(--ink);
  overflow-wrap: anywhere;
  text-wrap: balance;
}

.article__meta {
  margin: 20px 0 0;
  font-family: var(--font-ui);
  font-weight: 400;
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink-muted);
}

.article__meta time, .article__end-meta time, .card__meta time { color: inherit; white-space: nowrap; }

.article__disclosure {
  margin: 4px 0 0;
  font-family: var(--font-ui);
  font-weight: 400;
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink-muted);
}

.article__hero {
  max-width: var(--prose-max);
  margin: 32px auto 0;
}

.article__hero img,
.article__body figure img {
  width: 100%;
  border-radius: var(--r-shot);
  border: 1px solid var(--line-strong);
}

.is-zoomable { cursor: zoom-in; }

.article__body {
  max-width: var(--prose-max);
  margin: 40px auto 0;
  overflow-wrap: break-word;
  font-family: var(--font-reading);
  font-weight: 300;
  font-size: 17px;
  line-height: 1.6;
  letter-spacing: 0;
  color: var(--ink);
}

.article__body > * { min-width: 0; }

.article__body p { margin: 0 0 1.25em; }

.article__body h2 {
  text-wrap: balance;
  margin: 1.6em 0 0.6em;
  font-family: var(--font-reading);
  font-weight: 700;
  font-size: 24px;
  line-height: 1.43;
  color: var(--ink);
}

.article__body h3 {
  margin: 2.5em 0 0.75em;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 20px;
  line-height: 1.4;
  color: var(--ink);
}

.article__body strong { font-weight: 700; }

.article__body ul,
.article__body ol {
  margin: 0 0 1.25em;
  padding-left: 1.5em;
}

.article__body li { margin: 0.35em 0; }
.article__body li::marker { color: var(--ink-muted); }

.article__body a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: var(--accent-muted);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

.article__body a:hover { text-decoration-color: var(--accent); }

.article__body blockquote {
  margin: 1.5em 0;
  padding: 0 0 0 16px;
  border-left: 2px solid var(--accent);
  font-weight: 300;
  color: var(--ink-body);
}

.article__body blockquote p { margin: 0; }

.article__body pre {
  margin: 0 0 1.25em;
  padding: 16px 20px;
  background: var(--bg-deep);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.article__body pre code {
  font-family: var(--font-code);
  font-size: 14px;
  line-height: 1.6;
  color: var(--code-plain);
  background: none;
  padding: 0;
  border-radius: 0;
  white-space: pre;
}

.article__body code {
  font-family: var(--font-code);
  font-size: 0.9em;
  background: var(--surface);
  border-radius: var(--r-sm);
  padding: 2px 6px;
  color: var(--code-plain);
  white-space: normal;        /* long paths/commands wrap on phones instead of overflowing */
  overflow-wrap: anywhere;
}

.article__body figure {
  margin: 28px 0;
}

.article__body figure img { background: var(--surface); }   /* box is filled while a lazy image loads */

.article__body .article__about { margin-top: 2.5em; }

.article__body figcaption {
  margin-top: 8px;
  font-family: var(--font-ui);
  font-weight: 400;
  font-size: 12px;
  line-height: 1.5;
  letter-spacing: var(--ls-ui);
  color: var(--ink-muted);
}

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

.article__end {
  max-width: var(--prose-max);
  margin: 40px auto 0;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  font-family: var(--font-ui);
  font-weight: 400;
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink-muted);
}

.article__end-meta { min-width: 0; margin: 0; }

.copy-link {
  appearance: none;
  background: none;
  border: 0;
  margin: 0;
  padding: 0 4px;
  min-height: 44px;
  min-width: 44px;
  display: inline-flex;
  align-items: center;
  font: inherit;
  font-family: var(--font-ui);
  font-weight: 400;
  font-size: 14px;
  letter-spacing: var(--ls-ui);
  color: var(--ink-nav);
  cursor: pointer;
  white-space: nowrap;
  transition: color var(--ease);
  border-radius: var(--r-sm);
}

.copy-link[hidden] { display: none; }
.copy-link:hover { color: var(--ink); }
.copy-link.is-copied { color: var(--ink); }

@media (max-width: 767px) {
  .article { padding-left: 16px; padding-right: 16px; }
  .article__title { font-size: 26px; }
  .article__body { font-size: 16px; }
  .article__body h2 { font-size: 22px; }
  .article__body h3 { font-size: 18px; }
}

/* ---------- Lightbox ---------- */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.82);
  opacity: 0;
  transition: opacity 200ms ease-out;
  -webkit-tap-highlight-color: transparent;
}

.lightbox[hidden] { display: none; }
.lightbox.is-open { opacity: 1; }

.lightbox__img {
  max-width: 92vw;
  max-height: 92vh;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: var(--r-shot);
}

.lightbox__close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--surface);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color var(--ease);
}

.lightbox__close:hover { background: var(--surface-hover); }

/* ---------- Footer (reproduces flutlab.io landing: .f-links / .f-links-c / .f-l-container / .footer) ---------- */

.site-footer {
  border-top: 1px solid var(--line-footer);
  background: var(--bg-deep);
  color: var(--ink-body);
  font-family: var(--font-ui);
  font-size: 14px;
  letter-spacing: var(--ls-ui);
}

/* Live: .f-links { padding: 1rem 0 } .f-links-c { max-width: 80%; margin: auto } → four 20vw cells,
   each holding a 110px left-aligned block centred in its cell */
.site-footer__cols {
  max-width: 80%;
  margin: 0 auto;
  padding: 16px 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.site-footer__col {
  width: 110px;
  max-width: 100%;
  margin: 0 auto;
  text-align: left;
}

.site-footer__title {
  margin: 16px 0;
  font-weight: 500;
  font-size: 16px;
  line-height: 1.43;
  color: var(--ink);
}

.site-footer__list {
  list-style: none;
  margin: 0 0 16px;
  padding: 0;
}

.site-footer__list li { margin: 0 0 14px; line-height: 20px; }
.site-footer__list li:last-child { margin-bottom: 0; }

.site-footer__list a {
  font-weight: 400;
  font-size: 14px;
  color: var(--ink-nav);
  text-decoration: none;
  transition: color var(--ease);
}

.site-footer__list a:hover { color: var(--ink); }

/* Live: .footer { padding: 8px 20px; border-top: 1px solid black } — the divider colour is the one deliberate change */
.site-footer__bar {
  border-top: 1px solid var(--line-footer);
  min-height: 52px;
  padding: 8px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.site-footer__copy {
  margin: 0;
  font-weight: 400;
  font-size: 16px;
  line-height: 1.5;
  color: var(--ink-body);
}

.site-footer__copy strong {
  font-weight: 700;
  color: var(--ink);
  margin-left: 6px;
}

.site-footer__rights { display: none; margin: 0; font-size: 16px; color: var(--ink-body); }

.site-footer__mark { width: 36px; height: 30px; flex: 0 0 auto; }

/* Live ≤960px: two-by-two columns (Grid xs=6), bar centred, © gets 2rem top padding,
   the mark is hidden (Hidden smDown) and "All rights reserved." appears (Hidden mdUp) with 32px bottom padding */
@media (max-width: 960px) {
  .site-footer__cols {
    max-width: 100%;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .site-footer__bar {
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0;
    text-align: center;
  }
  .site-footer__copy { padding-top: 32px; }
  .site-footer__rights { display: block; padding-bottom: 32px; }
  .site-footer__mark { display: none; }
}

/* Live ≤640px: bigger type in the columns and the © line */
@media (max-width: 640px) {
  .site-footer__title { font-size: 18px; }
  .site-footer__list a { font-size: 16px; }
  .site-footer__copy { font-size: 18px; }
}

/* ---------- Reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  .card, .card__cover img, .copy-link,
  .site-footer__list a, .lightbox, .lightbox__close {
    transition: none;
  }
  .card:hover::after { animation: none; }
  .card:hover .card__cover img { transform: none; }
  .ambient__blob { animation: none; }
}
