/* =========================================================
   thecamerononeill.com
   Dark "observatory" theme: deep navy, drifting light-blue
   particles, luminous cyan accents. Minimalist-corporate ×
   engineer/scientist. Adjust the tokens below to re-skin.
   ========================================================= */
:root {
  --bg:        #0a1120;   /* deep navy base */
  --bg-2:      #101a2e;   /* panels / cards */
  --bg-3:      #0d1526;   /* sticky header */
  --text:      #c4d4ec;   /* body text (light blue-grey) */
  --heading:   #e8f1ff;   /* headings (near white-blue) */
  --muted:     #7e8fac;   /* secondary text */
  --line:      rgba(140, 175, 225, 0.16);  /* hairlines */
  --line-2:    rgba(140, 175, 225, 0.32);  /* stronger lines */
  --accent:    #6db8ff;   /* light blue accent */
  --accent-2:  #8fd0ff;   /* brighter hover */
  --glow:      0 0 24px rgba(109, 184, 255, 0.25);

  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI",
    Roboto, Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "JetBrains Mono", "Roboto Mono",
    Menlo, Consolas, "Liberation Mono", monospace;

  --maxw: 1160px;
  --pad: clamp(1rem, 3vw, 2rem);
  --border: 1.5px solid var(--line-2);
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font-sans);
  color: var(--text);
  background:
    radial-gradient(1200px 800px at 70% -10%, rgba(45, 90, 160, 0.25), transparent 60%),
    radial-gradient(900px 700px at 10% 110%, rgba(30, 70, 130, 0.20), transparent 55%),
    var(--bg);
  background-attachment: fixed;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img { max-width: 100%; display: block; }
a { color: inherit; }

/* Drifting-particle canvas (injected by js/main.js) */
#starfield {
  position: fixed; inset: 0; width: 100%; height: 100%;
  z-index: 0; pointer-events: none; display: block;
}
/* Keep all real content above the starfield */
.site-header, main, .site-footer { position: relative; z-index: 1; }

/* ---------- Utilities ---------- */
.container { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: var(--pad); }
.container.narrow { max-width: 760px; }
.mono { font-family: var(--font-mono); }
.eyebrow {
  font-family: var(--font-mono);
  text-transform: uppercase; letter-spacing: 0.14em;
  font-size: 0.72rem; color: var(--accent); margin: 0 0 0.75rem;
}
.sr-only, .skip-link {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link:focus {
  position: fixed; top: 12px; left: 12px; width: auto; height: auto; clip: auto;
  padding: 0.6rem 1rem; background: var(--accent); color: #04070d;
  border-radius: 6px; z-index: 100;
}
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

/* ---------- Brand bar ---------- */
.brandbar { border-bottom: 1px solid var(--line); }
.brandbar-inner {
  display: flex; align-items: center; gap: 0.9rem; min-height: 60px;
}
.brand { display: inline-flex; align-items: center; gap: 0.65rem; text-decoration: none; color: var(--heading); }
.brand-logo { width: 30px; height: 30px; object-fit: contain; }
.brand-name {
  font-family: var(--font-mono); font-weight: 600; font-size: 0.9rem;
  letter-spacing: 0.16em; text-transform: uppercase;
}
.brand-tag {
  margin-left: auto;
  font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.08em;
  color: var(--muted); display: inline-flex; align-items: center; gap: 0.5rem;
}
.brand-tag::before {
  content: ""; width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent); box-shadow: var(--glow);
}

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(13, 21, 38, 0.82);
  backdrop-filter: saturate(160%) blur(10px);
  border-bottom: 1px solid var(--line);
}

/* Hamburger button — opens the drawer */
.nav-toggle {
  flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center;
  width: 42px; height: 42px; border: 1.5px solid var(--line-2); border-radius: 8px;
  background: transparent; color: var(--text); cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.nav-toggle:hover { border-color: var(--accent); box-shadow: var(--glow); }
.nav-toggle-icon { position: relative; width: 18px; height: 12px; display: block; }
.nav-toggle-icon span, .nav-toggle-icon::before, .nav-toggle-icon::after {
  content: ""; position: absolute; left: 0; height: 1.5px; width: 18px; background: currentColor;
  transition: transform 0.2s ease, opacity 0.2s ease;
}
.nav-toggle-icon span { top: 5px; }
.nav-toggle-icon::before { top: 0; }
.nav-toggle-icon::after { top: 10px; }
.nav-toggle[aria-expanded="true"] .nav-toggle-icon span { opacity: 0; }
.nav-toggle[aria-expanded="true"] .nav-toggle-icon::before { transform: translateY(5px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle-icon::after { transform: translateY(-5px) rotate(-45deg); }

/* ---------- Slide-out drawer ---------- */
.drawer-backdrop {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(4, 7, 13, 0.55); backdrop-filter: blur(2px);
  opacity: 0; pointer-events: none; transition: opacity 0.25s ease;
}
.drawer-backdrop.show { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed; top: 0; left: 0; z-index: 70;
  width: min(320px, 84vw); height: 100%;
  display: flex; flex-direction: column;
  padding: 1.1rem 1.1rem 1.5rem;
  background: var(--bg-2); border-right: 1px solid var(--line-2);
  box-shadow: 10px 0 50px rgba(0, 0, 0, 0.45);
  transform: translateX(-100%);
  transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
  overflow-y: auto;
}
.drawer.open { transform: translateX(0); }
.drawer-head {
  display: flex; align-items: center; justify-content: space-between;
  padding-bottom: 0.9rem; margin-bottom: 1rem; border-bottom: 1px solid var(--line);
}
.drawer-title { font-size: 0.72rem; letter-spacing: 0.18em; text-transform: uppercase; color: var(--muted); }
.drawer-close {
  width: 36px; height: 36px; border: 1px solid var(--line-2); border-radius: 8px;
  background: transparent; color: var(--text); font-size: 1.4rem; line-height: 1; cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease;
}
.drawer-close:hover { border-color: var(--accent); color: var(--accent-2); }
.drawer-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.35rem; }
.drawer-list a {
  display: block; padding: 0.8rem 0.9rem; border: 1px solid transparent; border-radius: 8px;
  text-decoration: none; color: var(--text);
  font-family: var(--font-mono); font-size: 0.8rem; letter-spacing: 0.08em; text-transform: uppercase;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
.drawer-list a:hover { background: rgba(140, 175, 225, 0.08); border-color: var(--line-2); color: var(--heading); }
.drawer-list a.is-active { background: var(--accent); border-color: var(--accent); color: #04070d; box-shadow: var(--glow); }
.drawer-foot { margin-top: auto; padding-top: 1.2rem; font-size: 0.7rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
body.nav-open { overflow: hidden; }

/* ---------- Hero (home) ---------- */
.hero { border-bottom: 1px solid var(--line); }
.hero-inner {
  display: grid; grid-template-columns: 1.05fr 0.95fr; gap: clamp(1.5rem, 4vw, 3.5rem);
  align-items: center; padding-block: clamp(1.5rem, 3.5vw, 2.75rem) clamp(2.5rem, 6vw, 4rem);
}
.hero-copy .eyebrow { margin-bottom: 1rem; }
.hero-logo { width: clamp(64px, 9vw, 96px); height: auto; margin-bottom: 1.25rem; }
.hero-title {
  font-size: clamp(2.4rem, 6vw, 4rem); line-height: 1.02; letter-spacing: -0.03em;
  margin: 0 0 1.1rem; color: var(--heading); text-shadow: 0 0 30px rgba(109, 184, 255, 0.18);
}
.hero-lead { font-size: clamp(1.05rem, 1.8vw, 1.25rem); color: var(--muted); max-width: 46ch; margin: 0 0 1.75rem; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; }

.hero-figure { position: relative; margin: 0; border: var(--border); background: var(--bg-2); }
.hero-figure img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.hero-figure figcaption {
  display: flex; justify-content: space-between; gap: 1rem;
  border-top: 1.5px solid var(--line-2); padding: 0.55rem 0.8rem;
  font-family: var(--font-mono); font-size: 0.68rem; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--muted);
}
.hero-figure::before, .hero-figure::after { content: ""; position: absolute; width: 10px; height: 10px; z-index: 2; }
.hero-figure::before { top: -1.5px; left: -1.5px; border-top: 1.5px solid var(--accent); border-left: 1.5px solid var(--accent); }
.hero-figure::after  { top: -1.5px; right: -1.5px; border-top: 1.5px solid var(--accent); border-right: 1.5px solid var(--accent); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 0.5rem;
  padding: 0.7rem 1.3rem; border: var(--border);
  font-family: var(--font-mono); font-size: 0.78rem; font-weight: 500;
  letter-spacing: 0.1em; text-transform: uppercase; text-decoration: none; color: var(--text);
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease, transform 0.1s ease, border-color 0.15s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #04070d; }
.btn-primary:hover { background: var(--accent-2); border-color: var(--accent-2); box-shadow: var(--glow); }
.btn-ghost:hover { background: var(--accent); border-color: var(--accent); color: #04070d; box-shadow: var(--glow); }

/* ---------- Page hero (interior) ---------- */
.page-hero { border-bottom: 1px solid var(--line); padding-block: clamp(1.4rem, 3vw, 2.25rem) clamp(1.6rem, 3.5vw, 2.75rem); }
.page-index { font-family: var(--font-mono); font-size: 0.78rem; letter-spacing: 0.14em; color: var(--accent); margin: 0 0 0.6rem; }
.page-title { font-size: clamp(2rem, 5vw, 3rem); letter-spacing: -0.02em; margin: 0 0 0.75rem; color: var(--heading); }
.page-lead { color: var(--muted); font-size: 1.1rem; max-width: 62ch; margin: 0; }

/* ---------- Sections & content ---------- */
.section { padding-block: clamp(2.5rem, 6vw, 4rem); }
.section + .section { border-top: 1px solid var(--line); }
.section-head { display: flex; align-items: baseline; gap: 0.75rem; margin-bottom: 1.5rem; }
.section-head .idx { font-family: var(--font-mono); font-size: 0.8rem; color: var(--accent); letter-spacing: 0.1em; }
.section-title { font-size: clamp(1.4rem, 3vw, 1.9rem); letter-spacing: -0.02em; margin: 0; color: var(--heading); }
.prose p { max-width: 68ch; color: var(--text); }
.prose p + p { margin-top: 1rem; }
.lead-muted { color: var(--muted); }

.note {
  border: 1px dashed var(--line-2); border-radius: 8px;
  padding: 1.1rem 1.25rem; background: rgba(16, 26, 46, 0.6);
  font-family: var(--font-mono); font-size: 0.85rem; color: var(--muted);
  display: flex; align-items: center; gap: 0.6rem;
}
.note::before { content: "//"; color: var(--accent); font-weight: 700; }

.grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.card {
  border: 1px solid var(--line); border-radius: 10px; padding: 1.25rem;
  background: rgba(16, 26, 46, 0.55);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.12s ease;
}
.card:hover { border-color: var(--accent); box-shadow: var(--glow); transform: translateY(-2px); }
.card .meta {
  font-family: var(--font-mono); font-size: 0.68rem; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--accent); margin: 0 0 0.6rem; display: flex; gap: 0.75rem; flex-wrap: wrap;
}
.card h3 { margin: 0 0 0.4rem; font-size: 1.1rem; letter-spacing: -0.01em; color: var(--heading); }
.card p { margin: 0; color: var(--muted); font-size: 0.95rem; }

.numbered { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.numbered li { display: grid; grid-template-columns: 3rem 1fr; gap: 1rem; padding: 1rem 0; border-bottom: 1px solid var(--line); }
.numbered .n { font-family: var(--font-mono); color: var(--accent); font-size: 0.85rem; }
.numbered h3 { margin: 0 0 0.2rem; font-size: 1.05rem; color: var(--heading); }
.numbered .by { color: var(--muted); font-size: 0.9rem; }

.deflist { display: grid; gap: 0; border-top: 1px solid var(--line); max-width: 620px; }
.deflist div { display: grid; grid-template-columns: 10rem 1fr; gap: 1rem; padding: 0.9rem 0; border-bottom: 1px solid var(--line); align-items: baseline; }
.deflist dt { font-family: var(--font-mono); font-size: 0.75rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.deflist dd { margin: 0; color: var(--text); }
.deflist a { text-decoration: none; border-bottom: 1.5px solid var(--accent); color: var(--accent-2); }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--line-2); margin-top: 2rem; }
.footer-inner {
  display: flex; flex-wrap: wrap; gap: 0.75rem 1.5rem; align-items: center; justify-content: space-between;
  padding-block: 1.75rem; font-family: var(--font-mono); font-size: 0.75rem; letter-spacing: 0.06em;
  color: var(--muted); text-transform: uppercase;
}
.footer-inner a { text-decoration: none; color: var(--muted); }
.footer-inner a:hover { color: var(--accent); }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .hero-inner { grid-template-columns: 1fr; }
  .hero-figure { order: -1; }
}
@media (max-width: 640px) {
  .brand-tag { display: none; }
}

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

/* ---------- Cards that link to a detail page ---------- */
a.card { display: block; color: inherit; text-decoration: none; }
.post-card { padding: 0; overflow: hidden; }
.post-card .post-cover { display: block; }
.post-card .post-cover img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; display: block; }
.post-card .post-body { display: block; padding: 1.15rem 1.25rem 1.25rem; }
.readmore {
  margin-top: 0.8rem !important;
  font-family: var(--font-mono); font-size: 0.78rem; letter-spacing: 0.06em; color: var(--accent-2);
}
a.card:hover .readmore { text-decoration: underline; }
.tag {
  font-family: var(--font-mono); font-size: 0.6rem; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--accent);
  border: 1px solid var(--line-2); border-radius: 999px; padding: 0.1rem 0.5rem;
}

/* Linked card titles (books / papers) */
.card h3 a { color: inherit; text-decoration: none; border-bottom: 1px solid var(--accent); }
.card h3 a:hover { color: var(--accent-2); }

/* ---------- Full blog post ---------- */
.post h2 { color: var(--heading); margin: 2rem 0 0.5rem; font-size: 1.4rem; letter-spacing: -0.01em; }
.post figure { margin: 2rem 0; }
.post figure img { width: 100%; border: 1px solid var(--line); border-radius: 10px; background: var(--bg-2); }
.post figcaption { font-family: var(--font-mono); font-size: 0.72rem; color: var(--muted); margin-top: 0.5rem; text-align: center; }
.post code {
  font-family: var(--font-mono); font-size: 0.85em; color: var(--accent-2);
  background: rgba(140, 175, 225, 0.12); padding: 0.1rem 0.35rem; border-radius: 4px;
}
.post-meta { margin: 0; }
.backlink { text-decoration: none; }
.backlink:hover { color: var(--accent-2); }

/* ---------- Image placement inside posts / detail pages ----------
   Add a class to <figure> to control where an image sits:
     (none)  full content width (default)
     .center centered, natural width
     .small  narrow (max 340px), centered
     .left   float left, text wraps to the right
     .right  float right, text wraps to the left
   Use <div class="img-row"> with two <figure>s for side-by-side.
   Put <p class="clear"></p> after floats if the next block overlaps. */
.post figure.center { text-align: center; }
.post figure.center img { display: inline-block; width: auto; max-width: 100%; }
.post figure.small { max-width: 340px; margin-inline: auto; }
.post figure.left, .post figure.right { max-width: 46%; margin-block: 0.4rem 1rem; }
.post figure.left  { float: left;  margin-right: 1.5rem; }
.post figure.right { float: right; margin-left: 1.5rem; }
.post .clear { clear: both; margin: 0; }
.post .img-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin: 2rem 0; }
.post .img-row figure { margin: 0; }
@media (max-width: 640px) {
  .post figure.left, .post figure.right { float: none; max-width: 100%; margin-inline: 0; }
  .post .img-row { grid-template-columns: 1fr; }
}
