/* tadhatfield.com — hand-written styles. Colors carried over from the Ghost dark theme. */

:root {
  --bg: #282c35;
  --surface: #2f343e;
  --inset: #21252c;
  --border: #434957;
  --text: #d4d7dd;
  --muted: #9aa0ab;
  --heading: #ffffff;
  --accent: #6cc5b5;
  --accent-strong: #93dccf;
  --accent-ink: #0f2a27;

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --radius: 10px;
  --gutter: 16px;
  --max: 1120px;
  --narrow: 720px;

  color-scheme: dark;
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.65;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

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

a { color: var(--accent); text-underline-offset: 0.18em; }
a:hover { color: var(--accent-strong); }

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

h1, h2, h3 { color: var(--heading); line-height: 1.2; letter-spacing: -0.015em; text-wrap: balance; }
h1 { font-size: clamp(2rem, 1.5rem + 2.2vw, 2.75rem); margin: 0 0 0.5rem; }
h2 { font-size: 1.5rem; margin: 2.25rem 0 0.75rem; }
h3 { font-size: 1.25rem; margin: 1.75rem 0 0.5rem; }

.container {
  width: 100%;
  max-width: calc(var(--max) + 2 * var(--gutter));
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.container.narrow { max-width: calc(var(--narrow) + 2 * var(--gutter)); }

.skip-link {
  position: absolute;
  left: var(--gutter);
  top: -100px;
  background: var(--accent);
  color: var(--accent-ink);
  padding: 0.5rem 0.9rem;
  border-radius: 6px;
  font-weight: 600;
  z-index: 10;
}
.skip-link:focus { top: 0.75rem; }

.icon { width: 20px; height: 20px; display: block; }
.icon-sm { width: 14px; height: 14px; display: inline-block; vertical-align: -1px; }

/* ---------- Header ---------- */

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

.header-inner {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem 2rem;
}

.logo img { height: 40px; width: auto; border-radius: 4px; }

.site-nav { flex: 1; }
.site-nav ul,
.social,
.footer-links {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
}
.site-nav ul { gap: 0.25rem 1.5rem; }

.site-nav a {
  color: var(--heading);
  font-weight: 600;
  text-decoration: none;
  padding-block: 0.25rem;
  border-bottom: 2px solid transparent;
}
.site-nav a:hover { color: var(--accent-strong); }
.site-nav a[aria-current="page"] { border-bottom-color: var(--accent); }

.social { gap: 0.25rem; }
.social a {
  color: var(--muted);
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
}
.social a:hover { color: var(--heading); background: var(--surface); }

/* ---------- Main ---------- */

.site-main { flex: 1; padding-block: 2.5rem 4rem; }

.page-header { margin-bottom: 2rem; }
.page-header h1 { margin-top: 0; }

.lede { font-size: 1.2rem; color: var(--text); margin: 0.5rem 0 0; }
.meta { color: var(--muted); font-size: 0.875rem; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; margin: 0 0 0.5rem; }

/* :where() keeps these low-specificity so components inside .prose (book grid, cards) win. */
.prose > :first-child { margin-top: 0; }
.prose :where(p, ul, ol) { margin: 0 0 1.25rem; }
.prose :where(li + li) { margin-top: 0.35rem; }
.prose :where(hr) { border: 0; border-top: 1px solid var(--border); margin: 2.5rem 0; }
.prose :where(blockquote) { margin: 1.5rem 0; padding-left: 1.25rem; border-left: 3px solid var(--accent); color: var(--muted); }
.prose :where(code) { background: var(--inset); padding: 0.1em 0.35em; border-radius: 4px; font-size: 0.9em; }
.prose :where(img) { border-radius: var(--radius); margin-block: 1.5rem; }

.button {
  display: inline-block;
  padding: 0.65rem 1.15rem;
  border-radius: 8px;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 650;
  text-decoration: none;
  border: 1px solid var(--accent);
}
.button:hover { background: var(--accent-strong); border-color: var(--accent-strong); color: var(--accent-ink); }
.button-ghost { background: transparent; color: var(--heading); border-color: var(--border); }
.button-ghost:hover { background: var(--surface); border-color: var(--muted); color: var(--heading); }

/* ---------- Home ---------- */

.hero {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 2.5rem;
  padding-block: 1.5rem 1rem;
}
.hero-mark { width: 148px; height: 148px; border-radius: 22px; box-shadow: 0 10px 30px rgb(0 0 0 / 0.35); }
.hero h1 { margin: 0 0 0.75rem; }
.hero .lede { max-width: 38rem; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin: 1.5rem 0 0; }

.section { margin-top: 3.5rem; }
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.75rem;
  margin-bottom: 1.5rem;
}
.section-head h2 { margin: 0; font-size: 1.25rem; }
.section-head a { font-weight: 600; text-decoration: none; white-space: nowrap; }

/* ---------- Post cards ---------- */

.post-list { display: grid; gap: 1.5rem; }

.post-card {
  position: relative;
  display: grid;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color 0.15s ease;
}
.post-card:hover { border-color: var(--accent); }
.post-card.has-image { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); }

.post-card-image { display: block; background: var(--inset); }
.post-card-image img { width: 100%; height: 100%; aspect-ratio: 16 / 10; object-fit: cover; }

.post-card-body { padding: 1.5rem 1.75rem; align-self: center; }
.post-card-title { margin: 0 0 0.6rem; font-size: 1.45rem; }
.post-card-title a { color: var(--heading); text-decoration: none; }
/* Make the whole card clickable via the title link. */
.post-card-title a::after { content: ""; position: absolute; inset: 0; }
.post-card-body p:not(.meta) { margin: 0 0 1rem; color: var(--text); }
.post-card .more { font-weight: 600; text-decoration: none; }

/* ---------- Single post ---------- */

.post-cover { margin-block: 0 2.5rem; }
.post-cover img { width: 100%; max-height: 560px; object-fit: cover; border-radius: var(--radius); background: var(--inset); }
.post-cover figcaption { color: var(--muted); font-size: 0.875rem; text-align: center; margin-top: 0.6rem; }
.post-cover figcaption a { color: inherit; }

.post-footer { margin-top: 3rem; padding-top: 1.5rem; border-top: 1px solid var(--border); }
.post-footer a { font-weight: 600; text-decoration: none; }

/* Break out of the narrow text column, e.g. for maps. */
.full-bleed {
  width: min(1500px, calc(100vw - 2 * var(--gutter)));
  margin-inline: calc(50% - min(1500px, calc(100vw - 2 * var(--gutter))) / 2);
}
.map-embed arcgis-embedded-map {
  display: block;
  width: 100%;
  height: min(640px, 80vh);
  min-height: 420px;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--inset);
}
.prose .map-link { margin-top: 0.75rem; font-weight: 600; text-align: right; }
.map-link a { text-decoration: none; }

/* ---------- Books ---------- */

.book-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 2rem 1.5rem;
}
.book-grid-compact { grid-template-columns: repeat(6, minmax(0, 1fr)); }

.book { margin: 0; }
.book-cover {
  aspect-ratio: 2 / 3;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  margin-bottom: 0.75rem;
}
.book-cover img {
  max-height: 100%;
  width: auto;
  object-fit: contain;
  border-radius: 4px;
  box-shadow: 0 8px 22px rgb(0 0 0 / 0.4);
}
.book-title { color: var(--heading); font-weight: 600; font-style: italic; line-height: 1.3; margin: 0; font-size: 0.975rem; }
.book-author { color: var(--muted); font-size: 0.875rem; margin: 0.2rem 0 0; }

/* ---------- Footer ---------- */

.site-footer { border-top: 1px solid var(--border); background: var(--inset); padding-block: 1.75rem; }
.footer-inner { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem 1.5rem; }
.copyright { margin: 0; color: var(--muted); font-size: 0.925rem; }
.footer-links { gap: 1.25rem; flex: 1; font-size: 0.925rem; }
.footer-links a { color: var(--text); text-decoration: none; }
.footer-links a:hover { color: var(--accent-strong); }

/* ---------- Small screens ---------- */

@media (max-width: 760px) {
  .header-inner { justify-content: space-between; }
  .site-nav { order: 3; flex-basis: 100%; }
  .site-nav ul { gap: 0.25rem 1.25rem; }
  .site-header .social { margin-right: -8px; }

  .site-main { padding-top: 1.5rem; }

  .hero { grid-template-columns: 1fr; gap: 1.25rem; padding-top: 0.5rem; }
  .hero-mark { display: none; } /* the header logo is right above it */

  .post-card.has-image { grid-template-columns: 1fr; }
  .post-card-image img { height: auto; }
  .post-card-body { padding: 1.25rem; }
  .post-card-title { font-size: 1.25rem; }

  .book-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.75rem 1rem; }
  .book-grid-compact { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .book-grid-compact .book-title { font-size: 0.875rem; }
  .book-grid-compact .book-author { font-size: 0.8rem; }

  .footer-inner { flex-direction: column; align-items: flex-start; }
}

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