/* fblah.com: one small stylesheet, no framework. Mobile first. */

/* ------------------------------------------------------------ tokens */
:root {
  --bg: #fbfaf8;
  --surface: #ffffff;
  --surface-2: #f3f1ee;
  --text: #1d2026;
  --muted: #555c69;
  --border: #e3e0db;
  --accent: #b2382f;        /* coral from the logo, darkened for 5.9:1 contrast */
  --accent-soft: #fbe9e6;
  --accent-contrast: #ffffff;
  --slate: #6b7686;         /* grey from the logo */
  --shadow: 0 1px 2px rgb(20 22 26 / .06), 0 8px 24px rgb(20 22 26 / .06);
  --radius: 14px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Code", Menlo, Consolas, monospace;
  --wrap: 1120px;
  --narrow: 720px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #14161a;
    --surface: #1b1e24;
    --surface-2: #23272f;
    --text: #e9e7e4;
    --muted: #a7aebb;
    --border: #2e333c;
    --accent: #f28b80;
    --accent-soft: #3a2422;
    --accent-contrast: #14161a;
    --slate: #9aa5b5;
    --shadow: 0 1px 2px rgb(0 0 0 / .3), 0 8px 24px rgb(0 0 0 / .25);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #14161a;
  --surface: #1b1e24;
  --surface-2: #23272f;
  --text: #e9e7e4;
  --muted: #a7aebb;
  --border: #2e333c;
  --accent: #f28b80;
  --accent-soft: #3a2422;
  --accent-contrast: #14161a;
  --slate: #9aa5b5;
  --shadow: 0 1px 2px rgb(0 0 0 / .3), 0 8px 24px rgb(0 0 0 / .25);
  color-scheme: dark;
}

/* ------------------------------------------------------------ base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: 5rem; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 1.0625rem/1.7 var(--font);
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  overflow-wrap: break-word;
}
img, svg, video, iframe { max-width: 100%; display: block; }
img { height: auto; }
picture { display: block; }
a { color: var(--accent); text-underline-offset: .18em; text-decoration-thickness: .08em; }
a:hover { text-decoration-thickness: .14em; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
h1, h2, h3, h4 { line-height: 1.2; letter-spacing: -.015em; margin: 0 0 .5em; text-wrap: balance; }
h1 { font-size: clamp(2rem, 1.4rem + 2.6vw, 3rem); font-weight: 800; }
h2 { font-size: clamp(1.4rem, 1.15rem + 1vw, 1.75rem); font-weight: 750; }
h3 { font-size: 1.2rem; font-weight: 700; }
p { margin: 0 0 1.1em; }
hr { border: 0; border-top: 1px solid var(--border); margin: 2.5rem 0; }

.wrap { width: min(100% - 2rem, var(--wrap)); margin-inline: auto; }
.wrap--narrow { width: min(100% - 2rem, var(--narrow)); }
.section { padding-block: clamp(2rem, 1rem + 4vw, 4rem); }
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link { position: absolute; left: 1rem; top: -100px; z-index: 100; background: var(--accent); color: var(--accent-contrast); padding: .6rem 1rem; border-radius: 8px; font-weight: 700; }
.skip-link:focus { top: 1rem; }
main:focus { outline: none; }
.icon { width: 1.25em; height: 1.25em; fill: currentColor; flex: none; }
.eyebrow { color: var(--accent); font-weight: 700; font-size: .8rem; letter-spacing: .12em; text-transform: uppercase; margin-bottom: .6rem; }
.count { color: var(--muted); font-size: .85em; font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------ buttons */
.button {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .7rem 1.15rem; border-radius: 999px; border: 1px solid transparent;
  background: var(--accent); color: var(--accent-contrast);
  font: 600 1rem/1.2 var(--font); text-decoration: none; cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease, background-color .15s ease;
}
.button:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.button--ghost { background: transparent; color: var(--text); border-color: var(--border); }
.button[disabled] { opacity: .6; cursor: progress; transform: none; }

/* ------------------------------------------------------------ header */
.site-header {
  position: sticky; top: 0; z-index: 10;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--border);
}
.header-inner { display: flex; align-items: center; gap: .75rem; min-height: 4rem; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: .6rem; color: var(--text); text-decoration: none; font-weight: 800; letter-spacing: -.01em; margin-right: auto; }
.brand img { width: 40px; height: 40px; border-radius: 10px; background: #fff; }
.brand img.logo-dark { background: none; }
/* Swap to the light-grey logo with the same selectors as the dark tokens */
.logo-dark { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .logo-light { display: none; }
  :root:not([data-theme="light"]) .logo-dark { display: block; }
}
:root[data-theme="dark"] .logo-light { display: none; }
:root[data-theme="dark"] .logo-dark { display: block; }
.brand-name { font-size: 1.1rem; }
.site-nav ul { display: flex; gap: .15rem; list-style: none; margin: 0; padding: 0; }
.site-nav a { display: block; padding: .45rem .7rem; border-radius: 8px; color: var(--muted); font-weight: 600; font-size: .95rem; text-decoration: none; }
.site-nav a:hover { color: var(--text); background: var(--surface-2); }
.site-nav a[aria-current="page"] { color: var(--text); background: var(--surface-2); }
.theme-toggle {
  display: inline-grid; place-items: center; width: 2.5rem; height: 2.5rem;
  border-radius: 50%; border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer;
}
.theme-toggle[hidden] { display: none; }
.theme-toggle .icon-moon { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .icon-sun { display: none; }
  :root:not([data-theme="light"]) .theme-toggle .icon-moon { display: block; }
}
@media (max-width: 599px) {
  .site-nav { order: 3; width: 100%; overflow-x: auto; margin: 0 -.5rem .4rem; }
  .brand-name { font-size: 1rem; }
}

/* ------------------------------------------------------------ hero */
.hero { border-bottom: 1px solid var(--border); background:
  radial-gradient(60rem 30rem at 85% -10%, var(--accent-soft), transparent 60%), var(--bg); }
.hero-inner { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1.75rem; padding-block: clamp(2.5rem, 1rem + 6vw, 5rem); align-items: center; }
.hero-photo { width: 132px; height: 132px; border-radius: 50%; object-fit: cover; box-shadow: var(--shadow); border: 4px solid var(--surface); }
.hero-intro { color: var(--muted); font-size: 1.1rem; max-width: 62ch; }
.hero-intro p:last-child { margin-bottom: 0; }
.hero-actions { display: flex; flex-wrap: wrap; gap: .6rem; margin: 1.5rem 0 0; }
@media (min-width: 760px) {
  .hero-inner { grid-template-columns: auto minmax(0, 1fr); gap: 2.5rem; }
  .hero-photo { width: 168px; height: 168px; }
}

/* ------------------------------------------------------------ cards */
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.section-head h2 { margin: 0; }
.more { font-weight: 600; }
.cards { display: grid; gap: 1.25rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease; }
.card:hover, .card:focus-within { transform: translateY(-3px); box-shadow: var(--shadow); border-color: color-mix(in srgb, var(--accent) 35%, var(--border)); }
.card-link { display: flex; flex-direction: column; height: 100%; color: inherit; text-decoration: none; }
.card-link:focus-visible { outline-offset: -3px; border-radius: var(--radius); }
.card-media { aspect-ratio: 16 / 9; background: var(--surface-2); overflow: hidden; }
.card-media picture, .card-media img { width: 100%; height: 100%; object-fit: cover; }
.card-media--none { display: block; width: 100%; height: 100%; background: linear-gradient(135deg, var(--accent-soft), var(--surface-2)); }
.card-body { padding: 1rem 1.15rem 1.25rem; }
.card-title { font-size: 1.15rem; margin-bottom: .35rem; }
.card-link:hover .card-title { color: var(--accent); }
.card-meta { color: var(--muted); font-size: .85rem; margin-bottom: .5rem; }
.card-excerpt { color: var(--muted); font-size: .95rem; margin: 0; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

/* ------------------------------------------------------------ tags */
.tag-cloud, .tags { display: flex; flex-wrap: wrap; gap: .5rem; list-style: none; padding: 0; margin: 0; }
.tag-cloud a, .tags a {
  display: inline-block; padding: .3rem .75rem; border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font-size: .9rem; text-decoration: none;
}
.tag-cloud a:hover, .tags a:hover { border-color: var(--accent); color: var(--accent); }

/* ------------------------------------------------------------ posts */
.post-header { padding-top: clamp(2rem, 1rem + 4vw, 4rem); }
.post-meta { color: var(--muted); font-size: .95rem; display: flex; flex-wrap: wrap; gap: .4rem; }
.post-meta a { color: var(--muted); }
.post-hero { margin: 1.5rem auto 2rem; }
.post-hero img { width: 100%; border-radius: var(--radius); box-shadow: var(--shadow); }
.prose { font-size: 1.0625rem; }
.prose > * + * { margin-top: 0; }
.prose h2 { margin-top: 2.2em; }
.prose h3 { margin-top: 1.8em; }
.prose ul, .prose ol { padding-left: 1.3em; margin: 0 0 1.1em; }
.prose li + li { margin-top: .3em; }
.prose img { border-radius: 10px; margin: 1.5rem auto; }
.prose blockquote { margin: 1.5rem 0; padding: .25rem 0 .25rem 1.1rem; border-left: 4px solid var(--accent); color: var(--muted); }
.prose code { font: .9em var(--mono); background: var(--surface-2); padding: .12em .35em; border-radius: 5px; }
.prose pre { background: var(--surface-2); padding: 1rem; border-radius: 10px; overflow-x: auto; }
.prose pre code { background: none; padding: 0; }
.prose table { border-collapse: collapse; width: 100%; display: block; overflow-x: auto; }
.prose th, .prose td { border: 1px solid var(--border); padding: .5rem .75rem; text-align: left; }
.prose a { word-break: break-word; }
.post-footer { padding-bottom: 4rem; }
.post-footer .tags { margin: 2rem 0; }
.post-nav { display: grid; gap: 1rem; grid-template-columns: 1fr; margin: 2rem 0; }
.post-nav a { display: block; padding: 1rem 1.15rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text); text-decoration: none; font-weight: 650; }
.post-nav a:hover { border-color: var(--accent); }
.post-nav span { display: block; color: var(--muted); font-size: .8rem; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; margin-bottom: .2rem; }
.post-nav .next { text-align: right; }
@media (min-width: 640px) { .post-nav { grid-template-columns: 1fr 1fr; } }

/* ------------------------------------------------------------ bio */
.bio { display: grid; grid-template-columns: auto 1fr; gap: 1.1rem; align-items: start; padding: 1.25rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.bio-photo { width: 72px; height: 72px; border-radius: 50%; object-fit: cover; }
.bio-name { font-size: 1.1rem; margin-bottom: .3rem; }
.bio p { color: var(--muted); font-size: .95rem; margin-bottom: .6rem; }
@media (max-width: 479px) { .bio { grid-template-columns: 1fr; } }
@media (min-width: 640px) { .bio-photo { width: 96px; height: 96px; } }

/* ------------------------------------------------------------ social */
.social { display: flex; flex-wrap: wrap; gap: .4rem; list-style: none; margin: 0; padding: 0; }
.social a { display: inline-grid; place-items: center; width: 2.4rem; height: 2.4rem; border-radius: 50%; color: var(--muted); border: 1px solid var(--border); background: var(--surface); }
.social a:hover { color: var(--accent); border-color: var(--accent); }

/* ------------------------------------------------------------ YouTube facade */
.yt { margin: 1.75rem 0; }
.yt-facade { position: relative; display: block; aspect-ratio: 16 / 9; border-radius: 12px; overflow: hidden; background: #000; color: #fff; }
.yt-facade picture, .yt-facade img, .yt-thumb { width: 100%; height: 100%; object-fit: cover; margin: 0; border-radius: 0; transition: opacity .2s ease, transform .3s ease; }
.yt-thumb--none { display: block; background: linear-gradient(135deg, #2b2f37, #121418); }
.yt-facade:hover img { opacity: .85; transform: scale(1.02); }
.yt-play { position: absolute; inset: 0; display: grid; place-items: center; }
.yt-play svg { width: 68px; height: 48px; filter: drop-shadow(0 2px 8px rgb(0 0 0 / .4)); }
.yt-play-bg { fill: #212121; fill-opacity: .85; transition: fill .15s ease; }
.yt-facade:hover .yt-play-bg, .yt-facade:focus-visible .yt-play-bg { fill: #f00; fill-opacity: 1; }
.yt iframe { width: 100%; height: 100%; border: 0; }
.yt figcaption { color: var(--muted); font-size: .85rem; margin-top: .5rem; }

/* ------------------------------------------------------------ lists, archives, pagination */
.list-header { margin-bottom: 2rem; }
.list-count { color: var(--muted); }
.pagination { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-top: 2.5rem; color: var(--muted); }
.pagination a { font-weight: 650; }
.archive-grid { display: grid; gap: 2rem; }
@media (min-width: 700px) { .archive-grid { grid-template-columns: 1fr 1fr; } }
.archive-list { list-style: none; padding: 0; margin: 0 0 2rem; }
.archive-list li { padding: .4rem 0; border-bottom: 1px solid var(--border); }

/* ------------------------------------------------------------ forms */
.contact-form { display: grid; gap: 1.1rem; margin-top: 1.5rem; }
.form-note { color: var(--muted); font-size: .9rem; margin: 0; }
.field { display: grid; gap: .35rem; }
.field label { font-weight: 650; font-size: .95rem; }
input[type="text"], input[type="email"], input[type="search"], textarea {
  width: 100%; padding: .75rem .9rem; font: inherit; color: var(--text);
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
}
input:focus-visible, textarea:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 45%, transparent); outline-offset: 1px; border-color: var(--accent); }
textarea { resize: vertical; min-height: 10rem; }
.field[data-invalid] input, .field[data-invalid] textarea { border-color: var(--accent); }
.field-error { color: var(--accent); font-size: .9rem; font-weight: 600; }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.form-status { padding: .8rem 1rem; border-radius: 10px; margin: 0; background: var(--surface-2); }
.form-status--ok { background: color-mix(in srgb, #2f9e5c 16%, var(--surface)); }
.form-status--error { background: var(--accent-soft); }
.form-privacy { color: var(--muted); font-size: .9rem; margin-top: 1.5rem; }
.cf-turnstile { min-height: 65px; }
.contact-result ul { color: var(--muted); }
.search-form { display: flex; gap: .6rem; margin: 1rem 0 1.5rem; }
.search-form input { flex: 1; }
.search-results { list-style: none; padding: 0; margin: 0; }
.search-results li { padding: 1rem 0; border-bottom: 1px solid var(--border); }
.search-results h2 { font-size: 1.15rem; margin: 0 0 .25rem; }
.search-results p { margin: 0; color: var(--muted); font-size: .95rem; }
.search-results mark { background: var(--accent-soft); color: inherit; border-radius: 3px; padding: 0 .1em; }
.search-status { color: var(--muted); }

/* ------------------------------------------------------------ footer */
.site-footer { border-top: 1px solid var(--border); padding-block: 2rem; background: var(--surface); }
.footer-inner { display: flex; flex-wrap: wrap; gap: 1rem; align-items: center; justify-content: space-between; }
.footer-meta { color: var(--muted); font-size: .9rem; margin: 0; }
.footer-meta a { color: var(--muted); }
.error-page h1 { margin-bottom: .75rem; }

/* ------------------------------------------------------------ first-visit loader */
/* Shown only when theme-init.js sets html[data-loading] (first page of a session,
   JS on, no reduced motion). The 4s animation is a fail-safe if site.js never runs. */
.site-loader { display: none; }
html[data-loading] .site-loader {
  display: grid; place-items: center; position: fixed; inset: 0; z-index: 100;
  background: radial-gradient(circle at 50% 50%, var(--surface) 0, var(--bg) 65%);
  animation: loader-out .5s ease 4s forwards;
}
html[data-loading] .site-loader.is-done { animation: loader-out .55s cubic-bezier(.7, 0, .3, 1) forwards; }
.loader-mark { position: relative; width: 144px; height: 144px; display: grid; place-items: center; }
.loader-mark::before {
  content: ""; position: absolute; inset: 22px; border-radius: 50%;
  background: var(--accent); filter: blur(30px); opacity: .35;
  animation: loader-breathe 1.8s ease-in-out infinite;
}
.loader-mark img {
  position: relative; width: 96px; height: 96px;
  animation: loader-pop .6s cubic-bezier(.2, .9, .3, 1.4) both, loader-breathe 1.8s ease-in-out .6s infinite;
}
.loader-ring {
  position: absolute; inset: 0; border-radius: 50%;
  background: conic-gradient(from 0deg, transparent 0 50%, var(--slate) 75%, var(--accent) 100%);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 4px), #000 calc(100% - 3px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 4px), #000 calc(100% - 3px));
  animation: loader-spin .9s linear infinite;
}
.site-loader.is-done .loader-mark { animation: loader-zoom .55s cubic-bezier(.7, 0, .3, 1) forwards; }
@keyframes loader-spin { to { transform: rotate(1turn); } }
@keyframes loader-pop { from { transform: scale(.5); opacity: 0; } }
@keyframes loader-breathe { 50% { transform: scale(1.06); } }
@keyframes loader-zoom { to { transform: scale(1.4); opacity: 0; } }
@keyframes loader-out { to { opacity: 0; visibility: hidden; } }

/* ------------------------------------------------------------ motion & print */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
@media print {
  .site-header, .site-footer, .post-nav, .bio, .theme-toggle, .skip-link { display: none !important; }
  body { background: #fff; color: #000; }
  a { color: #000; }
}
