:root {
  --bg: #fbfbfa;
  --surface: #ffffff;
  --text: #1c1d1f;
  --muted: #6b6f76;
  --border: #e6e6e3;
  --accent: #105ed6;
  --accent-soft: #e8f0fc;
  --on-accent: #ffffff;
  --code-bg: #f3f3f1;
  --radius: 14px;
  --max: 64rem;
  color-scheme: light;
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 1.0625rem/1.7 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

a { color: var(--accent); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }

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

h1, h2, h3 { line-height: 1.25; letter-spacing: -0.02em; font-weight: 700; }
h1 { font-size: clamp(1.9rem, 4vw + 1rem, 2.6rem); margin: 0 0 .5rem; }
h2 { font-size: 1.45rem; margin: 2.2rem 0 .6rem; }
h3 { font-size: 1.15rem; margin: 1.8rem 0 .5rem; }

.wrap { width: 100%; max-width: var(--max); margin: 0 auto; padding: 0 1.25rem; }

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--accent);
  box-shadow: 0 1px 12px rgb(16 94 214 / 0.25);
}
.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  height: 4rem;
}
.brand {
  display: flex;
  align-items: center;
  gap: .65rem;
  color: var(--on-accent);
  text-decoration: none;
  font-weight: 650;
  letter-spacing: -0.01em;
}
.brand img { width: 34px; height: 34px; border-radius: 50%; }

.nav { display: flex; gap: .25rem; list-style: none; margin: 0; padding: 0; }
.nav a {
  display: block;
  padding: .4rem .7rem;
  border-radius: 999px;
  color: rgb(255 255 255 / 0.85);
  text-decoration: none;
  font-size: .95rem;
}
.nav a:hover { color: var(--on-accent); background: rgb(255 255 255 / 0.12); }
.nav a[aria-current="page"] { color: var(--accent); background: var(--on-accent); }

.menu-toggle { display: none; }

@media (max-width: 680px) {
  .menu-toggle {
    display: grid;
    place-items: center;
    width: 2.5rem;
    height: 2.5rem;
    border: 1px solid rgb(255 255 255 / 0.35);
    border-radius: 10px;
    background: transparent;
    color: var(--on-accent);
    cursor: pointer;
  }
  .nav {
    display: none;
    position: absolute;
    top: 4rem;
    left: 0;
    right: 0;
    flex-direction: column;
    padding: .5rem 1rem 1rem;
    background: var(--accent);
    box-shadow: 0 8px 16px rgb(16 94 214 / 0.25);
  }
  .nav.open { display: flex; }
  .nav a { padding: .7rem .9rem; border-radius: 10px; }
}

/* Main */
main { flex: 1; padding: 3.5rem 0 4rem; }

.hero { display: flex; align-items: center; gap: 1.5rem; margin-bottom: 3.5rem; }
.hero img { width: 96px; height: 96px; border-radius: 50%; flex-shrink: 0; }
.hero p { margin: 0; color: var(--muted); font-size: 1.1rem; }
@media (max-width: 520px) { .hero { flex-direction: column; align-items: flex-start; } }

.eyebrow {
  font-size: .8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--muted);
  margin: 0 0 1rem;
}

.post-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 1rem; }
.post-card {
  position: relative;
  padding: 1.4rem 1.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color .15s, transform .15s;
}
.post-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.post-card h2 { font-size: 1.2rem; margin: .2rem 0 .4rem; }
.post-card h2 a { color: var(--text); text-decoration: none; }
.post-card h2 a::after { content: ""; position: absolute; inset: 0; }
.post-card p { margin: 0; color: var(--muted); font-size: .98rem; }

time, .meta { color: var(--muted); font-size: .88rem; }

.page-head { margin-bottom: 2rem; }
.page-head p { color: var(--muted); margin: 0; }

.prose > :first-child { margin-top: 0; }
.prose p, .prose ul, .prose ol { margin: 0 0 1.2rem; }

code { font: .9em/1.6 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
:not(pre) > code { background: var(--code-bg); padding: .15em .4em; border-radius: 6px; }
pre {
  margin: 0 0 1.4rem;
  padding: 1.1rem 1.25rem;
  overflow-x: auto;
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: .92rem;
}

.back { display: inline-block; margin-top: 2.5rem; text-decoration: none; }

/* Portfolio */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 19rem), 1fr)); gap: 1.25rem; }
.grid figure { margin: 0; }
.grid a { display: block; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); background: var(--surface); }
.grid img { display: block; width: 100%; aspect-ratio: 1050 / 615; object-fit: cover; transition: transform .3s; }
.grid a:hover img { transform: scale(1.03); }
.grid figcaption { margin-top: .5rem; font-size: .95rem; font-weight: 600; }

/* Geocaching */
#map {
  height: min(70vh, 34rem);
  margin: 1.5rem 0;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  z-index: 0;
}
.badges { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; }
.legend { display: flex; flex-wrap: wrap; gap: 1rem; font-size: .9rem; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: .4rem; }

/* Contact */
.contact-form { display: grid; gap: 1.1rem; margin-bottom: 1rem; }
.field label { display: block; font-weight: 600; font-size: .95rem; margin-bottom: .35rem; }
.field input, .field textarea {
  width: 100%;
  padding: .75rem .9rem;
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  transition: border-color .15s, box-shadow .15s;
}
.field textarea { resize: vertical; min-height: 9rem; }
.field input:focus, .field textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.field [aria-invalid] { border-color: #d64545; }
.field-error { margin: .3rem 0 0; font-size: .85rem; color: #d64545; }
.field-error:empty { display: none; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.turnstile { min-height: 65px; }
.contact-form button {
  justify-self: start;
  padding: .75rem 1.5rem;
  font: inherit;
  font-weight: 600;
  color: var(--on-accent);
  background: var(--accent);
  border: 0;
  border-radius: 999px;
  cursor: pointer;
}
.contact-form button:hover { filter: brightness(1.08); }
.contact-form button:disabled { opacity: .6; cursor: progress; }
.form-status { margin: 0; font-size: .95rem; }
.form-status[data-kind="ok"] { color: #2e9e4f; }
.form-status[data-kind="error"] { color: #d64545; }
.form-status[data-kind="pending"] { color: var(--muted); }

.social { display: flex; flex-wrap: wrap; gap: .75rem; list-style: none; padding: 0; margin: 1.5rem 0 0; }
.social a {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .7rem 1.1rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
}
.social a:hover { border-color: var(--accent); color: var(--accent); }

.icon { width: 1.1em; height: 1.1em; fill: currentColor; flex-shrink: 0; }

/* Footer */
.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 2.5rem;
  text-align: center;
}
.stats[hidden] { display: none; }
.stats div { padding: 1rem; border-radius: var(--radius); background: var(--accent-soft); }
.stats strong { display: block; font-size: 1.8rem; line-height: 1.1; color: var(--accent); }
.stats span { font-size: .82rem; color: var(--muted); }

.site-footer { border-top: 1px solid var(--border); padding: 2.5rem 0 3rem; font-size: .9rem; color: var(--muted); }
.footer-row { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 1rem; }
.footer-icons { display: flex; gap: .4rem; list-style: none; margin: 0; padding: 0; }
.footer-icons a { display: grid; place-items: center; width: 2.25rem; height: 2.25rem; border-radius: 50%; color: var(--muted); }
.footer-icons a:hover { color: var(--accent); background: var(--accent-soft); }
.footer-icons .icon { width: 1.1rem; height: 1.1rem; }
