/*
 * mattcantstop.com
 * A single centered column, serif for reading, sans for the chrome.
 */

:root {
  --bg: #fbfaf7;
  --text: #1c1b19;
  --muted: #6b6760;
  --faint: #e8e5de;
  --surface: #f3f1ec;
  --accent: #b4532a;
  --accent-soft: #f6e7df;

  --serif: "Newsreader", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --measure: 42rem;
  --gutter: clamp(1.25rem, 5vw, 2rem);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #161514;
    --text: #ebe8e2;
    --muted: #9c978e;
    --faint: #2c2a27;
    --surface: #1f1e1c;
    --accent: #e98a5f;
    --accent-soft: #3a261d;
  }
}

/* Base */

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--serif);
  font-size: 1.1875rem;
  line-height: 1.65;
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a {
  color: inherit;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
  transition: color 0.15s ease, text-decoration-color 0.15s ease;
}

a:hover {
  color: var(--accent);
}

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

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

::selection {
  background: var(--accent-soft);
}

/* Layout */

.shell {
  max-width: calc(var(--measure) + 2 * var(--gutter));
  margin: 0 auto;
  padding: 0 var(--gutter);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.content {
  flex: 1;
  padding: 3.5rem 0 4rem;
}

/* Header */

.site-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1.5rem;
  padding: 2rem 0 1.25rem;
  border-bottom: 1px solid var(--faint);
  font-family: var(--sans);
  font-size: 0.9375rem;
}

.site-title {
  font-weight: 600;
  letter-spacing: -0.01em;
  text-decoration: none;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.site-nav a {
  padding: 0.375rem 0.625rem;
  border-radius: 999px;
  color: var(--muted);
  text-decoration: none;
}

.site-nav a:hover,
.site-nav a[aria-current="page"] {
  color: var(--text);
}

.site-nav .nav-app {
  margin-left: 0.375rem;
  padding: 0.375rem 0.875rem;
  background: var(--text);
  color: var(--bg);
  font-weight: 500;
}

.site-nav .nav-app:hover {
  background: var(--accent);
  color: #fff;
}

.site-nav .nav-app span {
  margin-left: 0.2em;
}

/* Footer */

.site-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
  padding: 1.5rem 0 2.5rem;
  border-top: 1px solid var(--faint);
  font-family: var(--sans);
  font-size: 0.8125rem;
  color: var(--muted);
}

.site-footer p {
  margin: 0;
}

.site-footer nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
}

.site-footer a {
  text-decoration: none;
}

/* Home */

.intro {
  margin-bottom: 4rem;
}

.avatar {
  display: block;
  width: 4.5rem;
  height: 4.5rem;
  margin-bottom: 1.5rem;
  border-radius: 50%;
}

.intro-title {
  margin: 0 0 0.75rem;
  font-size: clamp(2.25rem, 6vw, 3rem);
  font-weight: 500;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.intro-text {
  margin: 0;
  max-width: 34rem;
  font-size: 1.3125rem;
  line-height: 1.5;
  color: var(--muted);
}

.section + .section {
  margin-top: 4rem;
}

.section-label {
  margin: 0 0 1.25rem;
  font-family: var(--sans);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.year-group {
  display: grid;
  grid-template-columns: 4rem 1fr;
  gap: 0 1rem;
  padding: 1rem 0;
  border-top: 1px solid var(--faint);
}

.year {
  margin: 0;
  padding-top: 0.2rem;
  font-family: var(--sans);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.post-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.post-link {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 0.3rem 0 0.9rem;
  text-decoration: none;
}

.post-link-title {
  font-size: 1.25rem;
  line-height: 1.35;
}

.post-link:hover .post-link-title {
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

.post-link-date {
  flex-shrink: 0;
  font-family: var(--sans);
  font-size: 0.8125rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.app-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: 1rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.app-card {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  height: 100%;
  padding: 1.125rem 1.25rem;
  border: 1px solid var(--faint);
  border-radius: 0.75rem;
  background: var(--surface);
  text-decoration: none;
  transition: border-color 0.15s ease, transform 0.15s ease;
}

a.app-card:hover {
  border-color: var(--accent);
  color: inherit;
  transform: translateY(-2px);
}

.app-name {
  font-family: var(--sans);
  font-size: 1rem;
  font-weight: 600;
}

a.app-card:hover .app-name {
  color: var(--accent);
}

.app-desc {
  font-size: 1.0625rem;
  line-height: 1.45;
  color: var(--muted);
}

.app-card.is-soon {
  background: transparent;
  border-style: dashed;
}

.badge {
  display: inline-block;
  margin-left: 0.4rem;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  background: var(--faint);
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  vertical-align: 0.15em;
  color: var(--muted);
}

/* Posts and pages */

.post-header {
  margin-bottom: 2.75rem;
}

.post-meta {
  margin: 0 0 1rem;
  font-family: var(--sans);
  font-size: 0.8125rem;
  color: var(--muted);
}

.post-title,
.page-title {
  margin: 0;
  font-size: clamp(2rem, 5.5vw, 2.75rem);
  font-weight: 500;
  line-height: 1.15;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

.page-title {
  margin-bottom: 2.25rem;
}

.post-dek {
  margin: 1.25rem 0 0;
  font-size: 1.3125rem;
  line-height: 1.5;
  font-style: italic;
  color: var(--muted);
}

.prose > :first-child {
  margin-top: 0;
}

.prose p,
.prose ul,
.prose ol,
.prose blockquote,
.prose pre,
.prose table,
.prose figure {
  margin: 0 0 1.5rem;
}

.prose h1,
.prose h2,
.prose h3,
.prose h4,
.prose h5,
.prose h6 {
  margin: 2.75rem 0 1rem;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.01em;
  text-wrap: balance;
}

.prose h1 { font-size: 1.75rem; }
.prose h2 { font-size: 1.5rem; }
.prose h3 { font-size: 1.3125rem; }

.prose h4,
.prose h5,
.prose h6 {
  font-family: var(--sans);
  font-size: 0.9375rem;
  letter-spacing: 0;
}

.prose ul,
.prose ol {
  padding-left: 1.25rem;
}

.prose li {
  margin-bottom: 0.4rem;
}

.prose li::marker {
  color: var(--muted);
}

.prose blockquote {
  padding-left: 1.25rem;
  border-left: 2px solid var(--accent);
  font-style: italic;
  color: var(--muted);
}

.prose blockquote p:last-child {
  margin-bottom: 0;
}

.prose hr {
  margin: 3rem auto;
  width: 4rem;
  border: 0;
  border-top: 1px solid var(--faint);
}

.prose img {
  display: block;
  margin: 2rem auto;
  border-radius: 0.5rem;
}

.prose strong {
  font-weight: 600;
}

.prose code {
  padding: 0.1em 0.3em;
  border-radius: 0.25rem;
  background: var(--surface);
  font-family: var(--mono);
  font-size: 0.85em;
}

.prose pre {
  overflow-x: auto;
  padding: 1rem 1.25rem;
  border-radius: 0.5rem;
  background: var(--surface);
  font-size: 0.875rem;
  line-height: 1.55;
}

.prose pre code {
  padding: 0;
  background: none;
  font-size: inherit;
}

.prose table {
  width: 100%;
  border-collapse: collapse;
  font-size: 1rem;
}

.prose th,
.prose td {
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--faint);
  text-align: left;
}

/* Kept for older posts that wrap images in this class */
.centered-image img {
  display: block;
  margin-left: auto;
  margin-right: auto;
}

/* Previous / next */

.post-pager {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 4rem;
  padding-top: 2rem;
  border-top: 1px solid var(--faint);
}

.post-pager a {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  text-decoration: none;
}

.pager-next {
  grid-column: 2;
  text-align: right;
}

.pager-label {
  font-family: var(--sans);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.pager-title {
  font-size: 1.0625rem;
  line-height: 1.4;
}

/* Small screens */

@media (max-width: 34rem) {
  body {
    font-size: 1.125rem;
  }

  .site-header {
    padding-top: 1.25rem;
  }

  .site-nav a {
    padding-left: 0.5rem;
    padding-right: 0.5rem;
  }

  .site-nav .nav-app {
    margin-left: 0.25rem;
    padding-left: 0.75rem;
    padding-right: 0.75rem;
  }

  .content {
    padding-top: 2.5rem;
  }

  .year-group {
    grid-template-columns: 1fr;
  }

  .year {
    margin-bottom: 0.5rem;
  }

  .post-link {
    flex-direction: column;
    gap: 0.2rem;
  }

  .post-link-title {
    font-size: 1.1875rem;
  }

  .post-pager {
    grid-template-columns: 1fr;
  }

  .pager-next {
    grid-column: 1;
    text-align: left;
  }
}
