/*
 * Shared look for muelly.com and michael.muelly.com, carried over from
 * mhub's "Hub Blue" (dev/mhub frontend/src/index.css and
 * internal/brand/mfo-brand-spec.md): navy, royal and sky on blue-white,
 * Red Hat Display for tracked uppercase titles and the wordmark, Red Hat
 * Text for body text, 8px radius, white cards with a border-blue line.
 * Fonts are self-hosted (no requests to Google).
 *
 * mhub has no dark theme; the dark one here uses its Imaging viewer's
 * near-black navies with sky for links, and the reversed monogram.
 */

@font-face {
  font-family: 'Red Hat Display';
  font-style: normal;
  font-display: swap;
  font-weight: 300 900;
  src: url('fonts/red-hat-display-latin-wght-normal.woff2') format('woff2-variations');
}
@font-face {
  font-family: 'Red Hat Text';
  font-style: normal;
  font-display: swap;
  font-weight: 300 700;
  src: url('fonts/red-hat-text-latin-wght-normal.woff2') format('woff2-variations');
}
@font-face {
  font-family: 'Red Hat Text';
  font-style: italic;
  font-display: swap;
  font-weight: 300 700;
  src: url('fonts/red-hat-text-latin-wght-italic.woff2') format('woff2-variations');
}

:root {
  color-scheme: light dark;

  --navy: #00308d;
  --royal: #0246ca;
  --royal-80: #356bd5;
  --sky: #3887f6;
  --sky-10: #ebf3fe;

  --page: #f5f9ff; /* sky-5 */
  --card: #ffffff;
  --ink: #13224a;
  --heading: var(--navy);
  --muted: #5474b3;
  --border: #dfe6f3;
  --link: var(--royal);
  --link-hover: var(--royal-80);
  --code-bg: var(--sky-10);
  --radius: 0.5rem;

  --font-sans: 'Red Hat Text', 'Montserrat', ui-sans-serif, system-ui, sans-serif;
  --font-display: 'Red Hat Display', 'Montserrat', ui-sans-serif, sans-serif;
  --font-mono: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --page: #050b1c;
    --card: #0b1633;
    --ink: #dbe4f5;
    --heading: #ffffff;
    --muted: #8fa6d6;
    --border: #1c2b55;
    --link: #6ea8f8;
    --link-hover: #afcffb;
    --code-bg: #12204a;
  }
  .monogram-light {
    display: none;
  }
}
@media not (prefers-color-scheme: dark) {
  .monogram-dark {
    display: none;
  }
}

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

html {
  background: var(--page);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 100%;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: clip;
}
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  /* The brand's 2px sky rule at the top of every page. */
  border-top: 2px solid var(--sky);
}

a {
  color: var(--link);
  text-underline-offset: 0.18em;
  text-decoration-thickness: 1px;
}
a:hover {
  color: var(--link-hover);
}
:focus-visible {
  outline: 2px solid var(--sky);
  outline-offset: 2px;
  border-radius: 2px;
}

.wrap {
  width: 100%;
  max-width: 44rem;
  margin-inline: auto;
  padding-inline: 1rem;
}

/* Header: monogram + wordmark left, a few links right. */
.site-header {
  padding-block: 1.25rem;
}
.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
}
.brand img {
  width: 2rem;
  height: 2rem;
}
.wordmark {
  font-family: var(--font-display);
  text-transform: uppercase;
  letter-spacing: 0.26em;
  font-weight: 600;
  color: var(--heading);
  white-space: nowrap;
}
.brand .wordmark {
  font-size: 0.875rem;
}
.site-nav {
  display: flex;
  gap: 1.25rem;
}
.site-nav a,
.label {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--link);
}

main {
  flex: 1;
  padding-block: 1rem 3rem;
}

/* Page titles: tracked uppercase (brand spec). */
.title {
  font-family: var(--font-display);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 600;
  color: var(--heading);
  font-size: 1.125rem;
  line-height: 1.4;
  margin: 0 0 1rem;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
}
@media (min-width: 40rem) {
  .card {
    padding: 2rem 2.5rem;
  }
}

.muted {
  color: var(--muted);
}
time,
.meta {
  color: var(--muted);
  font-size: 0.875rem;
  font-variant-numeric: tabular-nums;
}

.site-footer {
  border-top: 1px solid var(--border);
  padding-block: 1.25rem 2rem;
  font-size: 0.8125rem;
  color: var(--muted);
}
.site-footer .wrap {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.site-footer a {
  color: var(--muted);
}

/* Post lists. */
.post-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.post-list li {
  padding-block: 1rem;
  border-top: 1px solid var(--border);
}
.post-list li:first-child {
  border-top: 0;
  padding-top: 0;
}
.post-list li:last-child {
  padding-bottom: 0;
}
.post-list a.post-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.125rem;
  color: var(--heading);
  text-decoration: none;
}
.post-list a.post-title:hover {
  color: var(--link);
}
.post-list p {
  margin: 0.25rem 0 0;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}
.tags a {
  display: inline-block;
  padding: 0.125rem 0.625rem;
  border-radius: 999px;
  background: var(--code-bg);
  color: var(--link);
  font-size: 0.75rem;
  font-weight: 500;
  text-decoration: none;
}

/* Post body: sentence-case headings in Red Hat Display, no tracking. */
.prose {
  font-size: 1.0625rem;
  overflow-wrap: break-word;
}
.prose h1,
.prose h2,
.prose h3,
.prose h4 {
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--heading);
  line-height: 1.3;
  margin: 2rem 0 0.75rem;
}
.prose h1 {
  font-size: 1.875rem;
  margin-top: 0;
}
.prose h2 {
  font-size: 1.375rem;
}
.prose h3 {
  font-size: 1.125rem;
}
.prose p,
.prose ul,
.prose ol,
.prose blockquote,
.prose pre,
.prose table,
.prose figure {
  margin: 0 0 1.1rem;
}
.prose img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius);
}
.prose blockquote {
  margin-inline: 0;
  padding-left: 1rem;
  border-left: 3px solid var(--royal);
  color: var(--muted);
}
.prose code {
  font-family: var(--font-mono);
  font-size: 0.875em;
  background: var(--code-bg);
  border-radius: 0.25rem;
  padding: 0.1em 0.3em;
}
.prose pre {
  overflow-x: auto;
  padding: 1rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--code-bg) !important;
  font-size: 0.875rem;
  line-height: 1.5;
}
.prose pre code {
  background: none;
  padding: 0;
}
.prose hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 2rem 0;
}
.prose table {
  border-collapse: collapse;
  display: block;
  overflow-x: auto;
}
.prose th,
.prose td {
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
}
.prose th {
  font-weight: 600;
  color: var(--heading);
}
.post-header {
  margin-bottom: 1.5rem;
}
.post-header h1 {
  margin-bottom: 0.25rem;
}

/* A link as mhub's primary button: royal, 8px radius. */
a.button {
  display: inline-block;
  padding: 0.5rem 1.25rem;
  border-radius: var(--radius);
  background: var(--royal);
  color: #fff;
  font-weight: 600;
  font-size: 0.9375rem;
  text-decoration: none;
}
a.button:hover {
  background: var(--royal-80);
  color: #fff;
}
