*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { touch-action: manipulation; overflow-wrap: break-word; }
h1, h2, h3 { text-wrap: balance; }
p, li { text-wrap: pretty; }

/* Accessibility */
.skip-link { position: absolute; left: 16px; top: -100px; z-index: 10; padding: 12px 18px; background: var(--tfl-button-bg); color: var(--tfl-button-text); font-weight: 600; }
.skip-link:focus { top: 16px; }
:focus-visible { outline: 3px solid var(--tfl-accent); outline-offset: 3px; }
main:focus { outline: none; }
a { text-underline-offset: 0.2em; }
.content a, .subscribe a, .not-found a, .site-footer a { text-decoration: underline; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; } }

/* Header */
.site-header { display: flex; align-items: center; gap: 1rem; padding: 20px var(--tfl-gutter); border-bottom: 1px solid var(--tfl-line); }
.logo, .footer-logo { display: inline-flex; }
.site-header img { display: block; height: 32px; width: auto; }
.site-tagline { margin: 0 0 0 auto; }
.theme-toggle { display: none; place-items: center; width: 44px; height: 44px; background: none; border: 1px solid var(--tfl-line); border-radius: 50%; color: var(--tfl-text); cursor: pointer; transition: color .15s, border-color .15s; }
.js .theme-toggle { display: grid; }
.theme-toggle:hover { color: var(--tfl-accent); border-color: var(--tfl-accent); }
.site-header .logo-light, .site-footer .logo-light, .i-moon { display: none; }
:root[data-theme="light"] .logo-light, :root[data-theme="light"] .i-moon { display: block; }
:root[data-theme="light"] .logo-dark, :root[data-theme="light"] .i-sun { display: none; }
@media (prefers-color-scheme: light) {
  :root:not([data-theme]) .logo-light { display: block; }
  :root:not([data-theme]) .logo-dark { display: none; }
}

/* Layout */
.tfl-frame { min-height: 100vh; display: flex; flex-direction: column; }
main { flex: 1; padding: 48px var(--tfl-gutter); }
main > article, main > .list-title, main > .post-list, main > .not-found { max-width: var(--tfl-measure); margin-left: auto; margin-right: auto; }
.home-hero, .home-posts { max-width: none; }

/* Home */
.home-hero { margin: -48px calc(var(--tfl-gutter) * -1) 48px; padding: 96px var(--tfl-gutter) 80px; border-bottom: 1px solid var(--tfl-line); }
.home-hero > * { max-width: 780px; margin-left: auto; margin-right: auto; }
.home-hero h1 { margin-top: 0; margin-bottom: 24px; }
.home-hero__lede { font-size: 22px; color: var(--tfl-text-body); margin-bottom: 0; }
.home-posts { max-width: var(--tfl-measure); margin: 0 auto 64px; }
.home-posts > h2 { margin: 0; font-size: 12px; font-weight: 500; letter-spacing: .12em; text-transform: uppercase; }

/* Lists */
.post-list { list-style: none; padding: 0; margin-top: 8px; }
.post-list li { display: flex; gap: 1.25rem; align-items: center; padding: 1.1rem 0; border-bottom: 1px solid var(--tfl-line); }
.post-list a { color: var(--tfl-text); }
.post-list a:hover { color: var(--tfl-accent); text-decoration: underline; }
.post-list .thumb img { display: block; width: 96px; height: 64px; object-fit: cover; }
.item-text { flex: 1; min-width: 0; display: flex; justify-content: space-between; gap: 1rem; align-items: baseline; }
.item-text > a { font-family: var(--tfl-font-display); font-size: 22px; font-weight: 600; line-height: 1.2; }
.item-text time { white-space: nowrap; }
.list-title { margin-top: 0; }

/* Article */
article > h1 { margin-top: 0; margin-bottom: 12px; }
.meta { margin: 0 0 1.5rem; }
.hero { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; margin: 0 0 2rem; }
.content { color: var(--tfl-text-body); }
.content h2 { color: var(--tfl-text); margin-top: 2.5rem; }
.content img { max-width: 100%; height: auto; }
.content blockquote { margin: 1.5rem 0; padding: 0 0 0 1.25rem; border-left: 2px solid var(--tfl-accent); font-family: var(--tfl-font-display); font-style: italic; }
.content pre, .content table { max-width: 100%; overflow-x: auto; display: block; }
.not-found h1 { margin-top: 8px; }

/* Subscribe band */
.subscribe { margin: 0 calc(var(--tfl-gutter) * -1) -48px; padding: 72px var(--tfl-gutter); }
main > article + .subscribe { margin-top: 72px; }
.subscribe__inner { max-width: var(--tfl-measure); margin: 0 auto; }
.subscribe h2 { margin: 0 0 12px; }
.subscribe p { margin: 0 0 24px; color: var(--tfl-text-body); }
.subscribe .tfl-button { text-decoration: none; }
.subscribe .subscribe__note { margin: 20px 0 0; }
.subscribe__note a { color: var(--tfl-muted); }

/* Footer */
.site-footer { display: flex; flex-direction: column; align-items: center; gap: 20px; padding: 40px var(--tfl-gutter); border-top: 1px solid var(--tfl-line); text-align: center; }
.site-footer ul { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 24px; margin: 0; padding: 0; list-style: none; }
.site-footer nav a { display: inline-block; padding: 8px 0; font-size: 16px; }
.site-footer .footer-logo img { width: 32px; height: 32px; }
.site-footer p { margin: 0; }

@media (max-width: 640px) {
  :root { --tfl-gutter: 20px; }
  body { font-size: 17px; }
  .site-tagline { display: none; }
  .theme-toggle { margin-left: auto; }
  .home-hero { padding: 64px var(--tfl-gutter) 56px; }
  .home-hero__lede { font-size: 19px; }
  .post-list li { flex-direction: column; align-items: stretch; gap: .75rem; }
  .post-list .thumb img { width: 100%; height: auto; aspect-ratio: 16 / 9; }
  .item-text { flex-direction: column; gap: .35rem; }
}
