/* ==========================================================================
   Design tokens
   ========================================================================== */
:root {
  --ink-navy: #1F3864;
  --mid-blue: #2E75B6;
  --teal: #12766B;
  --amber: #C98A3D;
  --paper: #F6F7F5;
  --paper-raised: #FFFFFF;
  --text: #1B1F23;
  --text-soft: #55606B;
  --line: #DDE3E8;

  --font-display: "Fraunces", Georgia, serif;
  --font-body: "Inter", -apple-system, sans-serif;
  --font-mono: "IBM Plex Mono", monospace;

  --radius: 6px;
  --shadow-card: 0 1px 2px rgba(31,56,100,0.06), 0 8px 24px rgba(31,56,100,0.06);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.wrap {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 24px;
}

a { color: var(--mid-blue); text-decoration: none; }
a:hover { text-decoration: underline; }

:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  color: var(--ink-navy);
  line-height: 1.15;
  margin: 0 0 0.5em;
  font-weight: 600;
}

/* ==========================================================================
   Signature motif: a quiet dot-grid field, echoing hotspot / Getis-Ord maps
   ========================================================================== */
.dotfield {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image: radial-gradient(var(--line) 1px, transparent 1px);
  background-size: 28px 28px;
  opacity: 0.55;
  mask-image: linear-gradient(to bottom, black, transparent 900px);
}

.hotspot-cluster {
  display: inline-grid;
  grid-template-columns: repeat(4, 6px);
  grid-auto-rows: 6px;
  gap: 4px;
}
.hotspot-cluster span { border-radius: 50%; display: block; }

/* ==========================================================================
   Header
   ========================================================================== */
.site-header {
  position: relative;
  z-index: 5;
  background: rgba(246,247,245,0.9);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 72px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink-navy);
}
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--ink-navy);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.5px;
}
.brand-name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.05rem;
  color: var(--ink-navy);
}
.main-nav { display: flex; gap: 28px; }
.main-nav a {
  color: var(--text-soft);
  font-size: 0.92rem;
  font-weight: 500;
  padding: 4px 0;
  border-bottom: 2px solid transparent;
}
.main-nav a:hover { color: var(--ink-navy); text-decoration: none; }
.main-nav a.active { color: var(--ink-navy); border-bottom-color: var(--amber); }

/* ==========================================================================
   Hero
   ========================================================================== */
.hero {
  position: relative;
  z-index: 1;
  padding: 96px 0 64px;
}
.hero-inner {
  display: grid;
  grid-template-columns: 1.3fr 0.9fr;
  gap: 56px;
  align-items: center;
}
.eyebrow {
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.72rem;
  color: var(--teal);
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
}
.hero h1 {
  font-size: clamp(2.2rem, 4.5vw, 3.4rem);
  margin-bottom: 0.3em;
}
.hero h1 .accent { color: var(--mid-blue); }
.hero-lede {
  font-size: 1.12rem;
  color: var(--text-soft);
  max-width: 46ch;
  margin-bottom: 28px;
}
.hero-actions { display: flex; gap: 14px; flex-wrap: wrap; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 22px;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 0.92rem;
  border: 1px solid transparent;
  cursor: pointer;
  font-family: var(--font-body);
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--ink-navy); color: #fff; }
.btn-primary:hover { background: #16294c; }
.btn-ghost { background: transparent; color: var(--ink-navy); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--ink-navy); background: rgba(31,56,100,0.04); }
.btn-danger { background: #fff; color: #B3261E; border-color: #E7C7C4; }
.btn-danger:hover { background: #FBEEED; }
.btn-sm { padding: 8px 14px; font-size: 0.82rem; }

/* Hero stat panel - the signature element: a hotspot map rendered from real numbers */
.hero-panel {
  background: var(--paper-raised);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 26px;
  box-shadow: var(--shadow-card);
}
.hero-photo {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  overflow: hidden;
  border: 3px solid var(--amber);
  margin-bottom: 18px;
  box-shadow: 0 2px 8px rgba(31,56,100,0.15);
}
.hero-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.hero-panel-title {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-soft);
  margin-bottom: 14px;
}
.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}
.stat {
  border-left: 3px solid var(--amber);
  padding-left: 12px;
}
.stat .n {
  font-family: var(--font-mono);
  font-size: 1.5rem;
  color: var(--ink-navy);
  display: block;
}
.stat .l {
  font-size: 0.78rem;
  color: var(--text-soft);
}

/* ==========================================================================
   Sections
   ========================================================================== */
.section {
  position: relative;
  z-index: 1;
  padding: 56px 0;
}
.section-alt {
  background: var(--paper-raised);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 32px;
  gap: 16px;
  flex-wrap: wrap;
}
.section-head h2 { font-size: 1.7rem; margin: 0; }
.section-kicker {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--teal);
  display: block;
  margin-bottom: 8px;
}

/* ==========================================================================
   Cards
   ========================================================================== */
.grid { display: grid; gap: 24px; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }

.card {
  background: var(--paper-raised);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-card); }
.card-img {
  aspect-ratio: 16/10;
  background: linear-gradient(135deg, #EAF0F7, #F6F7F5);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.card-img img { width: 100%; height: 100%; object-fit: cover; }
.card-img .placeholder-dots {
  display: grid;
  grid-template-columns: repeat(6, 8px);
  grid-auto-rows: 8px;
  gap: 6px;
}
.card-img .placeholder-dots span { border-radius: 50%; background: var(--mid-blue); opacity: 0.25; }
.card-body { padding: 20px 20px 22px; flex: 1; display: flex; flex-direction: column; }
.card-body h3 { font-size: 1.15rem; margin-bottom: 8px; }
.card-body p { color: var(--text-soft); font-size: 0.92rem; margin: 0 0 14px; }
.card-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; padding-top: 8px; }
.tag {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  background: #EAF0F7;
  color: var(--mid-blue);
  padding: 3px 9px;
  border-radius: 100px;
}
.card-link { margin-top: 14px; font-weight: 600; font-size: 0.88rem; }

.post-row {
  display: flex;
  gap: 20px;
  padding: 22px 0;
  border-bottom: 1px solid var(--line);
}
.post-row:last-child { border-bottom: none; }
.post-row-date {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-soft);
  min-width: 92px;
  padding-top: 4px;
}
.post-row h3 { font-size: 1.15rem; margin-bottom: 6px; }
.post-row p { color: var(--text-soft); margin: 0; }

/* ==========================================================================
   About / timeline
   ========================================================================== */
.about-grid {
  display: grid;
  grid-template-columns: 0.9fr 1.4fr;
  gap: 48px;
}
.pillar-list { list-style: none; padding: 0; margin: 0; }
.pillar-list li {
  padding: 14px 0 14px 26px;
  border-bottom: 1px solid var(--line);
  position: relative;
}
.pillar-list li::before {
  content: "";
  position: absolute; left: 0; top: 20px;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--teal);
}
.timeline { border-left: 2px solid var(--line); padding-left: 24px; margin-left: 4px; }
.timeline-item { position: relative; padding-bottom: 30px; }
.timeline-item::before {
  content: "";
  position: absolute; left: -29px; top: 4px;
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--amber);
  border: 2px solid var(--paper);
}
.timeline-item h4 { margin-bottom: 2px; font-size: 1.05rem; }
.timeline-item .when {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  color: var(--text-soft);
  display: block;
  margin-bottom: 6px;
}
.timeline-item p { margin: 0; color: var(--text-soft); font-size: 0.94rem; }

.skill-cloud { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 8px; }
.skill-pill {
  font-size: 0.85rem;
  padding: 7px 14px;
  border-radius: 100px;
  border: 1px solid var(--line);
  background: var(--paper-raised);
  color: var(--text);
}

/* ==========================================================================
   Forms
   ========================================================================== */
.form-card {
  background: var(--paper-raised);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 32px;
  max-width: 640px;
}
label { display: block; font-weight: 600; font-size: 0.88rem; margin-bottom: 6px; margin-top: 18px; }
label:first-child { margin-top: 0; }
input[type=text], input[type=email], input[type=password], input[type=url], textarea, select {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-size: 0.95rem;
  background: #fff;
  color: var(--text);
}
textarea { min-height: 140px; resize: vertical; }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--mid-blue); box-shadow: 0 0 0 3px rgba(46,117,182,0.15); }
.checkbox-row { display: flex; align-items: center; gap: 8px; margin-top: 18px; }
.checkbox-row input { width: auto; }
.checkbox-row label { margin: 0; }
.field-hint { font-size: 0.78rem; color: var(--text-soft); margin-top: 4px; }
.form-actions { margin-top: 26px; display: flex; gap: 12px; }

.flash-wrap { padding-top: 20px; }
.flash { padding: 12px 16px; border-radius: var(--radius); font-size: 0.9rem; margin-bottom: 12px; }
.flash-success { background: #E8F3EF; color: #12664F; border: 1px solid #BEE0D3; }
.flash-error { background: #FBEEED; color: #9A2E22; border: 1px solid #E7C7C4; }

/* ==========================================================================
   Admin
   ========================================================================== */
.admin-shell { position: relative; z-index: 1; padding: 40px 0 80px; }
.admin-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 30px; }
.admin-header h1 { font-size: 1.6rem; margin: 0; }
.admin-tabs { display: flex; gap: 8px; margin-bottom: 28px; flex-wrap: wrap; }
.admin-tabs a {
  padding: 9px 16px;
  border-radius: 100px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-soft);
  border: 1px solid var(--line);
  background: var(--paper-raised);
}
.admin-tabs a:hover, .admin-tabs a.active { color: #fff; background: var(--ink-navy); border-color: var(--ink-navy); text-decoration: none; }

.summary-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin-bottom: 36px; }
.summary-card {
  background: var(--paper-raised);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 22px;
}
.summary-card .n { font-family: var(--font-mono); font-size: 2rem; color: var(--ink-navy); display: block; }
.summary-card .l { color: var(--text-soft); font-size: 0.85rem; }

.data-table { width: 100%; border-collapse: collapse; background: var(--paper-raised); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.data-table th, .data-table td { text-align: left; padding: 14px 16px; border-bottom: 1px solid var(--line); font-size: 0.9rem; }
.data-table th { font-family: var(--font-mono); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-soft); background: #FAFBFB; }
.data-table tr:last-child td { border-bottom: none; }
.row-actions { display: flex; gap: 10px; }
.badge { font-family: var(--font-mono); font-size: 0.7rem; padding: 3px 9px; border-radius: 100px; }
.badge-on { background: #E8F3EF; color: #12664F; }
.badge-off { background: #F1F2F3; color: var(--text-soft); }

.login-shell { max-width: 400px; margin: 90px auto; position: relative; z-index: 1; }
.login-shell h1 { text-align: center; font-size: 1.6rem; }
.login-shell .sub { text-align: center; color: var(--text-soft); margin-bottom: 24px; font-size: 0.9rem; }

.empty-state {
  border: 1px dashed var(--line);
  border-radius: 10px;
  padding: 48px 24px;
  text-align: center;
  color: var(--text-soft);
}
.empty-state h3 { color: var(--ink-navy); margin-bottom: 8px; }

/* ==========================================================================
   Detail pages
   ========================================================================== */
.detail-hero { padding: 56px 0 20px; position: relative; z-index: 1; }
.detail-hero .eyebrow-row { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.detail-cover { width: 100%; border-radius: 12px; overflow: hidden; margin: 26px 0 36px; border: 1px solid var(--line); }
.detail-cover img { width: 100%; display: block; }
.prose { max-width: 72ch; font-size: 1.02rem; color: var(--text); }
.prose p { margin: 0 0 1.2em; white-space: pre-line; }
.meta-row { display: flex; gap: 22px; color: var(--text-soft); font-size: 0.88rem; margin: 18px 0 6px; font-family: var(--font-mono); }

/* ==========================================================================
   Footer
   ========================================================================== */
.site-footer {
  position: relative; z-index: 1;
  border-top: 1px solid var(--line);
  padding: 36px 0;
  margin-top: 40px;
}
.footer-inner { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 16px; }
.footer-inner p { margin: 4px 0 0; color: var(--text-soft); font-size: 0.85rem; }
.footer-mark { font-family: var(--font-mono); color: var(--ink-navy); font-weight: 600; }
.footer-links { display: flex; gap: 20px; font-size: 0.85rem; }

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 860px) {
  .hero-inner, .about-grid { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: 1fr 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
  .main-nav { gap: 16px; }
  .summary-grid { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .grid-3 { grid-template-columns: 1fr; }
  .header-inner { height: 64px; }
  .main-nav { font-size: 0.82rem; gap: 12px; }
  .brand-name { display: none; }
  .hero { padding: 56px 0 40px; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
}
