/* The blog (rallix.io/blog): long reading on the site's white, in its Geist
   and ink, after styles.css and legal.css (the head, the contents list and
   --text, #2A2F35, 13.6:1 on white). The index opens on the newest post as
   one night panel, the site's own device: its picture under a scrim, or,
   when it has none, a court drawn as Rallix sees it from behind the back
   glass. A post reads at 680; its pictures break out to 880 and their
   captions keep to the text. Lime stays a fill on white (the ball on the
   drawn court, the night's button); nothing moves but what a pointer asks. */

.blog .footer { margin-top: clamp(96px, 12vw, 144px); }

/* --------------------------------------------------------------- head --- */

.blog-crumbs { display: flex; align-items: center; gap: 14px; }
.blog-crumb {
  display: inline-flex; align-items: center; gap: 14px; padding-block: 9px;
  font-size: 20px; font-weight: 600; letter-spacing: -0.03em; color: var(--slate);
  transition: color 200ms ease;
}
/* The hairline between where you are and what it is part of. */
.blog-crumb::before { content: ""; width: 1px; height: 22px; background: rgba(10, 12, 15, 0.16); }
.blog-crumb:hover, .blog-crumb[aria-current="page"] { color: var(--ink); }

.blog-pill {
  display: inline-flex; align-items: center; gap: 8px; flex: none;
  height: 40px; padding: 0 16px; border-radius: 999px;
  background: var(--ink); color: #FFFFFF;
  font-size: 15px; font-weight: 600; letter-spacing: -0.012em;
  transition: background-color 200ms ease;
}
.blog-pill svg { width: 16px; height: 16px; }
.blog-pill:hover { background: #262A30; }

/* -------------------------------------------------------------- index --- */

.blog-intro { padding: clamp(64px, 10vw, 128px) 0 clamp(40px, 5.5vw, 72px); }
.blog-intro h1 { max-width: 12ch; font-size: clamp(44px, 6.4vw, 88px); line-height: 0.96; text-wrap: balance; }
.blog-intro .lede { margin-top: 28px; max-width: 34em; }
.blog-posts > .btn { margin-top: -8px; }

/* The post a reader meets first: a night, the way the site's chapters are. */
.lead {
  position: relative; isolation: isolate; overflow: hidden;
  display: grid; align-content: end;
  min-height: clamp(460px, 46vw, 620px);
  border-radius: var(--r-panel);
  background: var(--night); color: #FFFFFF;
}
.lead-photo {
  position: absolute; inset: 0; z-index: -2;
  width: 100%; height: 100%; max-width: none; object-fit: cover;
}
.lead.has-photo::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background:
    linear-gradient(180deg, rgba(10, 12, 15, 0) 32%, rgba(10, 12, 15, 0.76) 74%, rgba(10, 12, 15, 0.92) 100%),
    linear-gradient(90deg, rgba(10, 12, 15, 0.6) 0%, rgba(10, 12, 15, 0) 62%);
}
.lead-copy { max-width: 780px; padding: clamp(28px, 4.6vw, 64px); }
.lead .post-meta { color: var(--fog); }                     /* 12.4:1 on night */
.lead-title {
  margin-top: 14px;
  font-size: clamp(32px, 3.9vw, 56px); line-height: 1.02; font-weight: 700; letter-spacing: -0.042em;
  text-wrap: balance;
}
.lead-summary { margin-top: 16px; max-width: 34em; font-size: clamp(17px, 1.5vw, 20px); line-height: 1.5; color: var(--fog); }

/* No picture: the court from behind the glass, under the floodlights. */
.lead:not(.has-photo) {
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); align-content: stretch; align-items: end;
  background: radial-gradient(60% 70% at 74% 30%, rgba(199, 255, 53, 0.08), rgba(199, 255, 53, 0) 70%), var(--night);
}
.lead:not(.has-photo) .court { order: 2; align-self: center; justify-self: center; width: min(58%, 300px); }

/* The court as the app draws a diagram, tilted into the view the phone has
   from behind the back glass: the far end small, the near end wide. */
.court {
  color: rgba(255, 255, 255, 0.42);
  transform: perspective(900px) rotateX(54deg);
  transform-origin: 50% 60%;
}

/* The whole card answers its title's link; the outline is drawn round the card. */
.lead-title a::after, .card-title a::after { content: ""; position: absolute; inset: 0; }
.lead-title a:focus-visible, .card-title a:focus-visible { outline: none; }
.lead:has(a:focus-visible) { outline: 2px solid var(--ink); outline-offset: 4px; }
.card:has(a:focus-visible) { outline: 2px solid var(--ink); outline-offset: 8px; border-radius: 20px; }
.lead:hover .lead-title a, .card:hover .card-title a {
  text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 0.14em;
}

.cards {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(48px, 5vw, 64px) clamp(24px, 2.8vw, 36px);
  margin-top: clamp(48px, 6vw, 80px);
}
.card { position: relative; }
.card-picture {
  display: grid; place-items: center; overflow: hidden;
  aspect-ratio: 3 / 2; border-radius: 20px; background: var(--night);
}
.card-picture img { width: 100%; height: 100%; object-fit: cover; }
.card-picture .court { width: 38%; }
.card .post-meta { margin-top: 20px; }
.card-title { margin-top: 8px; font-size: clamp(21px, 1.8vw, 24px); line-height: 1.18; font-weight: 600; letter-spacing: -0.028em; text-wrap: balance; }
.card-summary {
  margin-top: 10px; font-size: 16px; line-height: 1.5; color: var(--slate);
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; line-clamp: 3; overflow: hidden;
}

/* No posts yet: what to read meanwhile, on chalk. */
.blog-empty {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 32px;
  padding: clamp(28px, 4vw, 48px); border-radius: var(--r-panel); background: var(--chalk);
}
.blog-empty .court { width: 72px; color: rgba(10, 12, 15, 0.4); }
.blog-empty p { max-width: 36em; color: var(--slate); }
.blog-empty strong { display: block; font-size: 19px; letter-spacing: -0.02em; }
.blog-empty .btn-quiet, .blog-empty .btn-quiet:hover { background: var(--paper); }
.blog-empty .btn-quiet:hover { box-shadow: inset 0 0 0 1px rgba(10, 12, 15, 0.16); }

/* Date and reading time: two facts side by side, a hairline between. */
.post-meta { display: flex; flex-wrap: wrap; align-items: center; font-size: 15px; line-height: 1.4; color: var(--ash); }
.post-meta > * + *::before {
  content: ""; display: inline-block; width: 1px; height: 13px; margin: 0 12px;
  background: currentColor; opacity: 0.45; vertical-align: -1px;
}

/* --------------------------------------------------------------- post --- */

/* A column of reading at 680 with room either side: everything sits in the
   text column, and a picture takes the whole width up to 880. */
.measure {
  display: grid;
  grid-template-columns: [full-start] minmax(0, 1fr) [text-start] minmax(0, 680px) [text-end] minmax(0, 1fr) [full-end];
  padding-inline: var(--gutter);
}
.measure > * { grid-column: text; }

.post-head { padding-block: clamp(56px, 9vw, 112px) clamp(36px, 5vw, 56px); }
/* The title may run on to the pictures' right edge; it starts where the text does. */
.post-head h1 {
  grid-column: text-start / full-end; max-width: 840px;
  font-size: clamp(40px, 5.4vw, 72px); line-height: 1; letter-spacing: -0.045em; text-wrap: balance;
}
.post-head .lede { margin-top: 24px; text-wrap: pretty; }
.post-head .post-meta { margin-top: 24px; }

.post-cover img { width: 100%; max-height: 680px; object-fit: cover; border-radius: var(--r-panel); background: var(--chalk); }

.post-main { margin-top: clamp(48px, 6vw, 80px); }
.post-head + .post-main { margin-top: 0; } /* no cover: the text follows the head */
.post-body {
  grid-column: full; grid-row: 1;
  display: grid; grid-template-columns: subgrid; align-content: start;
  font-size: 19px; line-height: 1.6; letter-spacing: -0.012em; color: var(--text);
}
.post-body > * { grid-column: text; }
.post-body > * + * { margin-top: 24px; }

.post-body > :is(figure, blockquote, hr) { margin-top: 48px; }
.post-body > :is(figure, blockquote, hr) + * { margin-top: 48px; }

.post-body > h2 {
  margin-top: 64px; scroll-margin-top: 32px;
  font-size: clamp(26px, 2.6vw, 34px); line-height: 1.15; font-weight: 700; letter-spacing: -0.034em; color: var(--ink);
  text-wrap: balance;
}
.post-body > h3 {
  margin-top: 44px; scroll-margin-top: 32px;
  font-size: 22px; line-height: 1.3; font-weight: 600; letter-spacing: -0.024em; color: var(--ink);
}
.post-body > :is(h2, h3) + :is(p, ul, ol) { margin-top: 14px; }
.post-body > :first-child { margin-top: 0; }

.post-body strong { font-weight: 600; color: var(--ink); }
.post-body a {
  color: var(--ink); text-decoration: underline;
  text-decoration-thickness: 1px; text-underline-offset: 3px; text-decoration-color: rgba(10, 12, 15, 0.35);
  transition: text-decoration-color 160ms ease;
}
.post-body a:hover { text-decoration-color: currentColor; }

.post-body ul { padding-left: 1.25em; list-style: disc; }
.post-body ol { padding-left: 1.4em; list-style: decimal; }
.post-body li { padding-left: 0.3em; }
.post-body li + li { margin-top: 10px; }
.post-body li > :is(ul, ol) { margin-top: 10px; }
.post-body li::marker { color: var(--ash); font-variant-numeric: tabular-nums; }

/* A pull-quote: the author's own line, said larger on chalk. */
.post-body blockquote { margin-inline: 0; margin-bottom: 0; padding: 28px 32px; border-radius: 24px; background: var(--chalk); }
.post-body blockquote p {
  font-size: clamp(21px, 2vw, 24px); line-height: 1.38; font-weight: 600; letter-spacing: -0.024em; color: var(--ink);
  text-wrap: pretty;
}
.post-body blockquote p + p { margin-top: 12px; }

/* The browser centres a rule with auto margins, which in a grid leave it no width. */
.post-body hr { height: 1px; margin-inline: 0; border: 0; background: rgba(10, 12, 15, 0.14); }

.post-body > figure { grid-column: full; justify-self: center; width: min(880px, 100%); }
/* A picture takes its own width up to the figure's, keeping the space its
   width and height attributes give it before it loads, and is never taller
   than the screen: a tall one is fitted inside that height. */
.post-body figure :is(img, video) {
  margin-inline: auto; height: auto; max-height: min(84vh, 920px); object-fit: contain; border-radius: 20px;
}
.post-body figure video { width: 100%; background: var(--night); }
.post-body figcaption {
  max-width: 680px; margin: 14px auto 0;
  font-size: 15px; line-height: 1.45; letter-spacing: -0.008em; color: var(--ash); text-wrap: pretty;
}

/* The contents follow the reader in the margin, where there is one. */
.post-main .toc {
  grid-column: full-start / text-start; grid-row: 1;
  justify-self: end; align-self: start;
  width: 184px; margin-right: 140px;
}
.post-main .toc a { font-size: 15px; }
@media (max-width: 1379px) { .post-main .toc { display: none; } }

/* ---------------------------------------------------- closing and more --- */

.blog-cta-wrap { margin-top: clamp(96px, 12vw, 160px); }
.blog-cta {
  position: relative; isolation: isolate; overflow: hidden;
  display: flex; align-items: flex-end;
  min-height: clamp(480px, 44vw, 600px); padding: clamp(28px, 5vw, 72px);
  border-radius: var(--r-panel); background: var(--night); color: #FFFFFF;
}
.blog-cta-photo {
  position: absolute; inset: 0; z-index: -2;
  width: 100%; height: 100%; max-width: none; object-fit: cover; object-position: 50% 45%;
}
.blog-cta::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background:
    linear-gradient(180deg, rgba(10, 12, 15, 0) 24%, rgba(10, 12, 15, 0.8) 72%, rgba(10, 12, 15, 0.94) 100%),
    linear-gradient(90deg, rgba(10, 12, 15, 0.8) 0%, rgba(10, 12, 15, 0.4) 46%, rgba(10, 12, 15, 0) 76%);
}
.blog-cta h2 { max-width: 14ch; font-size: clamp(34px, 4.2vw, 60px); line-height: 1; letter-spacing: -0.045em; color: #FFFFFF; }
.blog-cta p { margin: 20px 0 32px; max-width: 32em; font-size: clamp(17px, 1.5vw, 19px); line-height: 1.5; color: var(--fog); }

.blog-more { margin-top: clamp(96px, 12vw, 144px); }
.blog-more h2 { font-size: clamp(28px, 3vw, 40px); line-height: 1.08; font-weight: 600; letter-spacing: -0.036em; }
.blog-more .cards { margin-top: 40px; }

/* ------------------------------------------------------------- phone ---- */

@media (max-width: 980px) {
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .blog-more .cards > :nth-child(3) { display: none; }
}
@media (max-width: 760px) {
  .lead:not(.has-photo) { grid-template-columns: 1fr; }
  .lead:not(.has-photo) .court { order: 0; width: min(46%, 200px); margin-top: 40px; }
  .blog-empty { grid-template-columns: 1fr; justify-items: start; gap: 20px; }
  .blog-cta::before { background: linear-gradient(180deg, rgba(10, 12, 15, 0.1) 16%, rgba(10, 12, 15, 0.86) 56%, rgba(10, 12, 15, 0.96) 100%); }
}
@media (max-width: 640px) {
  .cards { grid-template-columns: 1fr; }
  .blog-more .cards > :nth-child(3) { display: block; }
  .lead, .blog-cta { border-radius: 24px; }
  .post-cover img { border-radius: 20px; }
  .post-body { font-size: 18px; }
  .post-body > h2 { margin-top: 52px; }
  .post-body blockquote { padding: 22px 22px; border-radius: 20px; }
  .post-body figure :is(img, video) { border-radius: 16px; }
}
@media (max-width: 560px) {
  .doc-head .brand-name { display: none; }
  .blog-crumb::before { display: none; }
}
@media (max-width: 380px) {
  .blog-pill svg { display: none; }
}
