/* Afternoon Grind. Cool grays, near black and one blue accent. Light and dark themes. */

@font-face {
  font-family: 'Libre Franklin';
  src: url('/fonts/libre-franklin.woff2') format('woff2');
  font-weight: 500 800;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Source Sans 3';
  src: url('/fonts/source-sans-3.woff2') format('woff2');
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Source Sans 3';
  src: url('/fonts/source-sans-3-italic.woff2') format('woff2');
  font-weight: 400 700;
  font-style: italic;
  font-display: swap;
}

/* Light theme (default) */
:root,
:root[data-theme='light'] {
  --bg: #ffffff;
  --bg-2: #f3f5f7;
  --bg-3: #e9edf1;
  --ink: #0f1419;
  --ink-2: #3c4651;
  --muted: #66717d;
  --rule: #dfe4e9;
  --accent: #1d5fc2;
  --accent-ink: #174f9f;
  --accent-soft: #e8f0fc;
  --on-accent: #ffffff;
  --shadow: 0 1px 2px rgba(15, 20, 25, 0.06);
  color-scheme: light;
}
/* Dark theme, by choice or by system setting when no choice was made */
:root[data-theme='dark'] {
  --bg: #0d1117;
  --bg-2: #151b23;
  --bg-3: #1d2530;
  --ink: #e6ebf0;
  --ink-2: #b3bdc8;
  --muted: #8692a0;
  --rule: #26303b;
  --accent: #6aa3ff;
  --accent-ink: #8db8ff;
  --accent-soft: #15233a;
  --on-accent: #0d1117;
  --shadow: none;
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --bg: #0d1117;
    --bg-2: #151b23;
    --bg-3: #1d2530;
    --ink: #e6ebf0;
    --ink-2: #b3bdc8;
    --muted: #8692a0;
    --rule: #26303b;
    --accent: #6aa3ff;
    --accent-ink: #8db8ff;
    --accent-soft: #15233a;
    --on-accent: #0d1117;
    --shadow: none;
    color-scheme: dark;
  }
}

:root {
  --sans: 'Source Sans 3', -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --head: 'Libre Franklin', 'Helvetica Neue', Arial, sans-serif;
  --gutter: clamp(1rem, 4vw, 2.5rem);
  --text: 42rem;
  --wide: 72rem;
  --radius: 10px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.125rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.2s, color 0.2s;
}
img {
  max-width: 100%;
  height: auto;
  display: block;
}
a {
  color: var(--accent-ink);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}
a:hover {
  color: var(--accent);
}
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}
.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.skip {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--ink);
  color: var(--bg);
  padding: 0.5rem 1rem;
  z-index: 10;
}
.skip:focus {
  left: 1rem;
}

.wrap,
.wrap-wide {
  width: min(100% - 2 * var(--gutter), var(--wide));
  margin-inline: auto;
}
.wrap-text {
  width: min(100% - 2 * var(--gutter), var(--text));
  margin-inline: auto;
}

h1,
h2,
h3,
h4 {
  font-family: var(--head);
  line-height: 1.18;
  letter-spacing: -0.015em;
  text-wrap: balance;
  color: var(--ink);
}

/* Small labels */
.label,
.kicker,
.crumbs,
.meta,
.row-num {
  font-family: var(--head);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.kicker {
  color: var(--accent-ink);
  text-decoration: none;
}
.kicker:hover {
  text-decoration: underline;
}

/* Masthead */
.masthead {
  background: var(--bg);
  border-bottom: 1px solid var(--rule);
  position: sticky;
  top: 0;
  z-index: 5;
}
.masthead-row {
  display: flex;
  align-items: center;
  gap: 1rem 2rem;
  padding-block: 0.85rem;
  flex-wrap: wrap;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  color: var(--ink);
  text-decoration: none;
  font-family: var(--head);
  font-weight: 800;
  font-size: 1.3rem;
  letter-spacing: -0.02em;
  line-height: 1;
  margin-right: auto;
}
.brand:hover {
  color: var(--ink);
}
.mark {
  width: 1.55rem;
  height: 1.55rem;
  color: var(--accent);
  flex: none;
}
.nav ul {
  display: flex;
  gap: 0.25rem 1.35rem;
  list-style: none;
  margin: 0;
  padding: 0;
  flex-wrap: wrap;
}
.nav a {
  font-size: 0.98rem;
  font-weight: 600;
  color: var(--ink-2);
  text-decoration: none;
  padding-block: 0.35rem;
  border-bottom: 2px solid transparent;
}
.nav a:hover,
.nav a[aria-current='page'] {
  color: var(--ink);
  border-bottom-color: var(--accent);
}
.theme-toggle {
  display: inline-grid;
  place-items: center;
  width: 2.35rem;
  height: 2.35rem;
  border: 1px solid var(--rule);
  border-radius: 8px;
  background: var(--bg);
  color: var(--ink-2);
  cursor: pointer;
  padding: 0;
  flex: none;
}
.theme-toggle:hover {
  color: var(--ink);
  border-color: var(--muted);
}
.theme-toggle svg {
  width: 1.15rem;
  height: 1.15rem;
}
.icon-sun {
  display: none;
}
:root[data-theme='dark'] .icon-sun {
  display: block;
}
:root[data-theme='dark'] .icon-moon {
  display: none;
}
@media (max-width: 760px) {
  .masthead-row {
    padding-block: 0.75rem 0;
    gap: 0.75rem;
  }
  .nav {
    order: 3;
    width: 100%;
    overflow-x: auto;
    scrollbar-width: none;
    border-top: 1px solid var(--rule);
  }
  .nav::-webkit-scrollbar {
    display: none;
  }
  .nav ul {
    flex-wrap: nowrap;
    padding-block: 0.5rem;
  }
  .nav li {
    flex: none;
  }
}

/* Headlines sized to fit one line where the screen allows */
.fit {
  --avail: min(100vw - 2 * var(--gutter), var(--text));
  font-size: clamp(1.7rem, calc(var(--avail) / var(--w) * 0.97), 2.9rem);
  font-weight: 800;
  margin: 0.4rem 0 0.85rem;
}
.hub-title {
  --avail: min(100vw - 2 * var(--gutter), var(--wide));
  font-size: clamp(2rem, calc(var(--avail) / var(--w) * 0.97), 3.6rem);
}
.display {
  --avail: min(100vw - 2 * var(--gutter), var(--wide));
  font-size: clamp(2rem, calc(var(--avail) / var(--w) * 0.95), 4.6rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.04;
  margin: 0.5rem 0 1.1rem;
}
.display em {
  font-style: normal;
  color: var(--accent);
}

/* Home */
.intro {
  padding-block: clamp(2.5rem, 7vw, 4.75rem) clamp(2rem, 4vw, 3rem);
}
.intro .label {
  color: var(--accent-ink);
  margin: 0;
}
.intro-dek {
  max-width: 40rem;
  font-size: clamp(1.15rem, 2vw, 1.3rem);
  color: var(--ink-2);
  margin: 0;
}
.lead {
  display: grid;
  grid-template-columns: 1.25fr 1fr;
  gap: clamp(1.5rem, 4vw, 3.25rem);
  align-items: center;
  padding: clamp(1.25rem, 3vw, 2rem);
  background: var(--bg-2);
  border-radius: calc(var(--radius) + 4px);
}
.lead-media img {
  width: 100%;
  aspect-ratio: 3 / 2;
  object-fit: cover;
  border-radius: var(--radius);
}
.lead-text .label {
  margin: 0 0 0.9rem;
}
.lead-title {
  font-size: clamp(1.6rem, 3vw, 2.25rem);
  font-weight: 800;
  margin: 0.4rem 0 0.75rem;
}
.lead-title a,
.row-title a,
.topic-name a,
.topic li a,
.guides a {
  color: var(--ink);
  text-decoration: none;
}
.lead-title a:hover,
.row-title a:hover,
.topic li a:hover {
  color: var(--accent);
}
.dek {
  font-size: 1.2rem;
  color: var(--ink-2);
  margin: 0 0 1rem;
  line-height: 1.5;
}
.more-link {
  font-weight: 700;
  font-size: 0.98rem;
  text-decoration: none;
}
.more-link:hover {
  text-decoration: underline;
}
.block {
  padding-block: clamp(2.5rem, 5vw, 3.5rem) 0;
}
.section-title {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink);
  margin: 0 0 0.5rem;
  padding-bottom: 0.7rem;
  border-bottom: 1px solid var(--rule);
}
@media (max-width: 760px) {
  .lead {
    grid-template-columns: 1fr;
  }
}

/* Post lists */
.rows {
  list-style: none;
  margin: 0 0 1.5rem;
  padding: 0;
}
.row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
  padding-block: 1.25rem;
  border-bottom: 1px solid var(--rule);
}
.row.has-thumb {
  grid-template-columns: 1fr 9rem;
}
.row-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin: 0.25rem 0 0.35rem;
}
.row-dek {
  margin: 0;
  color: var(--ink-2);
  font-size: 1.02rem;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.row-media img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 8px;
}
.rows-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: clamp(1.5rem, 4vw, 3rem);
}
.rows-ledger .row {
  padding-block: 0.95rem;
}
.rows-ledger .row-text {
  display: grid;
  grid-template-columns: 5rem 1fr;
  column-gap: 1rem;
}
.rows-ledger .row-num {
  grid-row: span 3;
  padding-top: 0.3rem;
}
.rows-ledger .row-title {
  font-size: 1.15rem;
}
@media (max-width: 760px) {
  .rows-grid {
    grid-template-columns: 1fr;
  }
  .row.has-thumb {
    grid-template-columns: 1fr 6.25rem;
    gap: 1rem;
  }
  .row-title {
    font-size: 1.15rem;
  }
  .rows-ledger .row-text {
    grid-template-columns: 1fr;
  }
  .rows-ledger .row-num {
    grid-row: auto;
    padding: 0;
  }
}

/* Topic blocks on the home page */
.topics {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
  gap: 1rem;
  margin-top: 1.25rem;
}
.topic {
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 1.15rem 1.25rem 1.1rem;
  background: var(--bg);
  box-shadow: var(--shadow);
}
.topic-name {
  font-size: 1.2rem;
  font-weight: 800;
  margin: 0 0 0.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.count {
  font-family: var(--head);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
  background: var(--bg-2);
  border-radius: 999px;
  padding: 0.1rem 0.55rem;
}
.topic ul {
  list-style: none;
  margin: 0 0 0.75rem;
  padding: 0;
}
.topic li {
  padding-block: 0.32rem;
  line-height: 1.35;
  font-size: 1.02rem;
  border-top: 1px solid var(--rule);
}
.topic li:first-child {
  border-top: 0;
}

.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(2rem, 5vw, 4rem);
}
@media (max-width: 760px) {
  .split {
    grid-template-columns: 1fr;
  }
}
.guides {
  list-style: none;
  margin: 0;
  padding: 0;
}
.guides li {
  border-bottom: 1px solid var(--rule);
}
.guides a {
  display: block;
  padding-block: 0.85rem;
}
.guide-title {
  display: block;
  font-family: var(--head);
  font-size: 1.12rem;
  font-weight: 700;
}
.guide-dek {
  display: block;
  color: var(--ink-2);
  font-size: 1rem;
  line-height: 1.45;
  margin-top: 0.15rem;
}
.guides a:hover .guide-title {
  color: var(--accent);
}

/* FAQ accordions */
.faq details,
.prose details {
  border-bottom: 1px solid var(--rule);
}
.faq {
  margin-bottom: 1rem;
}
details summary {
  list-style: none;
  cursor: pointer;
  padding: 0.85rem 2.25rem 0.85rem 0;
  position: relative;
  font-weight: 600;
  font-size: 1.08rem;
  line-height: 1.4;
}
details summary::-webkit-details-marker {
  display: none;
}
details summary::after {
  content: '+';
  position: absolute;
  right: 0.2rem;
  top: 0.6rem;
  width: 1.5rem;
  height: 1.5rem;
  display: grid;
  place-items: center;
  border-radius: 6px;
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-weight: 700;
}
details[open] summary::after {
  content: '\2212';
}
details > :not(summary) {
  margin-top: 0;
  color: var(--ink-2);
}
details[open] {
  padding-bottom: 0.4rem;
}

/* Post and page */
.post-head {
  padding-block: clamp(2rem, 6vw, 3.5rem) 1.5rem;
}
.crumbs {
  display: flex;
  gap: 0.5rem;
  margin: 0;
}
.crumbs a {
  color: var(--muted);
  text-decoration: none;
}
.crumbs a:hover {
  color: var(--accent);
}
.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.4rem;
  margin: 0;
  padding-top: 0.9rem;
  border-top: 1px solid var(--rule);
}
.post-hero {
  margin-block: 0 2.25rem;
}
.post-hero img {
  width: 100%;
  max-height: 34rem;
  object-fit: cover;
  border-radius: calc(var(--radius) + 4px);
}
.disclosure {
  font-size: 0.95rem;
  color: var(--ink-2);
  background: var(--bg-2);
  border-left: 3px solid var(--accent);
  border-radius: 0 8px 8px 0;
  padding: 0.7rem 1rem;
  margin: 0 0 1.75rem;
}

.prose {
  font-size: 1.15rem;
  line-height: 1.7;
}
.prose > * {
  margin-block: 0 1.15em;
}
.prose h2 {
  font-size: 1.6rem;
  font-weight: 800;
  margin: 2.1em 0 0.6em;
}
.prose h3 {
  font-size: 1.28rem;
  font-weight: 700;
  margin: 1.8em 0 0.5em;
}
.prose h4 {
  font-size: 1.1rem;
  margin: 1.5em 0 0.4em;
}
.prose strong {
  font-weight: 700;
}
.prose ul,
.prose ol {
  padding-left: 1.3em;
}
.prose li {
  margin-bottom: 0.35em;
}
.prose li::marker {
  color: var(--accent);
}
.prose blockquote {
  margin-inline: 0;
  padding: 0.9rem 1.2rem;
  border-left: 3px solid var(--accent);
  background: var(--bg-2);
  border-radius: 0 8px 8px 0;
  font-size: 1.2rem;
  color: var(--ink);
}
.prose blockquote > :last-child {
  margin-bottom: 0;
}
.prose hr {
  border: 0;
  height: 1px;
  background: var(--rule);
  margin-block: 2.5rem;
}
.prose img {
  margin-inline: auto;
  border-radius: 8px;
}
.prose figure {
  margin-inline: 0;
}
figcaption {
  font-size: 0.9rem;
  color: var(--muted);
  margin-top: 0.5rem;
  line-height: 1.45;
}
.table-wrap {
  overflow-x: auto;
}
.prose table {
  border-collapse: collapse;
  width: 100%;
  font-size: 1rem;
}
.prose td,
.prose th {
  border: 1px solid var(--rule);
  padding: 0.5rem 0.65rem;
  text-align: left;
}
.cta {
  margin-block: 1.75rem;
}
.button {
  display: inline-block;
  font-weight: 700;
  font-size: 1.02rem;
  text-decoration: none;
  color: var(--on-accent);
  background: var(--accent);
  padding: 0.8rem 1.25rem;
  border-radius: 8px;
  line-height: 1.35;
}
.button:hover {
  color: var(--on-accent);
  filter: brightness(1.08);
}

/* Video, loaded only when someone presses play */
.video {
  margin-block: 2rem;
}
.video-play {
  position: relative;
  display: block;
  aspect-ratio: 16 / 9;
  background: #000;
  overflow: hidden;
  color: #fff;
  text-decoration: none;
  border-radius: var(--radius);
}
.video-play img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.85;
  transition: opacity 0.2s;
}
.video-play:hover img {
  opacity: 1;
}
.video-button {
  position: absolute;
  inset: 50% auto auto 50%;
  width: 4.2rem;
  height: 4.2rem;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: #1d5fc2;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
}
.video-button::after {
  content: '';
  position: absolute;
  left: 54%;
  top: 50%;
  transform: translate(-50%, -50%);
  border-style: solid;
  border-width: 0.65rem 0 0.65rem 1.05rem;
  border-color: transparent transparent transparent #fff;
}
.video-label {
  position: absolute;
  left: 0.9rem;
  bottom: 0.75rem;
  font-size: 0.85rem;
  font-weight: 600;
  background: rgba(0, 0, 0, 0.62);
  padding: 0.25rem 0.6rem;
  border-radius: 6px;
}
.video iframe {
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 0;
  display: block;
  border-radius: var(--radius);
}

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr));
  gap: 1rem;
  margin-block: 2rem;
}
.gallery figure {
  margin: 0;
}
.gallery img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

/* Old comments */
.comments {
  margin-top: 3.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--rule);
}
.comments h2 {
  font-size: 1.4rem;
  margin: 0 0 0.25rem;
}
.note {
  color: var(--muted);
  margin: 0 0 1.25rem;
}
.comments ol {
  list-style: none;
  margin: 0;
  padding: 0;
}
.comment {
  padding: 1rem 1.1rem;
  margin-bottom: 0.75rem;
  background: var(--bg-2);
  border-radius: var(--radius);
}
.comment ol {
  margin-top: 0.75rem;
}
.comment ol .comment {
  background: var(--bg);
  border: 1px solid var(--rule);
  margin-bottom: 0;
}
.comment-author {
  font-weight: 700;
  margin: 0 0 0.3rem;
}
.comment-author .label {
  margin-left: 0.5rem;
  color: var(--accent-ink);
}
.comment-body p {
  margin: 0 0 0.5rem;
  color: var(--ink-2);
}
.comment-body p:last-child {
  margin-bottom: 0;
}

/* Related and hubs */
.more {
  margin-top: 3.5rem;
}
.hub-head {
  padding-block: clamp(2rem, 6vw, 3.5rem) 1rem;
}
.hub-head .dek {
  max-width: 42rem;
}
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  list-style: none;
  padding: 0;
  margin: 1.25rem 0 0;
}
.chips a {
  display: inline-block;
  font-size: 0.92rem;
  font-weight: 600;
  text-decoration: none;
  color: var(--ink);
  border: 1px solid var(--rule);
  border-radius: 999px;
  padding: 0.3rem 0.8rem;
}
.chips a span {
  color: var(--muted);
  margin-left: 0.25rem;
}
.chips a:hover {
  border-color: var(--accent);
  color: var(--accent-ink);
}

/* Footer */
.site-footer {
  margin-top: clamp(3.5rem, 8vw, 5rem);
  border-top: 1px solid var(--rule);
  background: var(--bg-2);
  font-size: 1rem;
}
.footer-grid {
  display: grid;
  grid-template-columns: 1.6fr repeat(4, 1fr);
  gap: 2rem;
  padding-block: 2.5rem 2rem;
}
.footer-grid ul {
  list-style: none;
  margin: 0;
  padding: 0;
}
.footer-grid li {
  padding-block: 0.2rem;
}
.footer-grid a {
  color: var(--ink-2);
  text-decoration: none;
}
.footer-grid a:hover {
  color: var(--accent);
  text-decoration: underline;
}
.footer-grid .label {
  margin: 0 0 0.6rem;
  color: var(--ink);
}
.footer-about p {
  color: var(--ink-2);
  max-width: 20rem;
}
.footer-base {
  border-top: 1px solid var(--rule);
  padding-block: 1.1rem 1.5rem;
}
.footer-base p {
  margin: 0 0 0.35rem;
  font-size: 0.9rem;
  color: var(--muted);
}
@media (max-width: 900px) {
  .footer-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .footer-about {
    grid-column: 1 / -1;
  }
}

/* Ads injected by AdSense get room to breathe */
ins.adsbygoogle {
  margin-block: 2rem;
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
  }
}
