/* ==========================================================================
   Pieter Kubben — The Digital Neurosurgeon
   ALTERNATE DESIGN: modern terminal / macOS-app aesthetic.
   Plain CSS, mobile-first, no build step. Light + dark via [data-theme].
   ========================================================================== */

/* -----------------------------
   Custom properties — dark is the base theme
   ----------------------------- */
:root {
  --bg: #0B0E14;
  --bg-panel: #12161D;
  --bg-panel-2: #171B23;
  --fg: #E3E6EA;
  --fg-muted: #7C8794;
  --border: rgba(255, 255, 255, 0.10);
  --border-strong: rgba(255, 255, 255, 0.16);
  --accent: #D97757;
  --accent-strong: #F2A278;
  --accent-contrast: #1A1006;
  --green: #6FCF97;
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  --traffic-red: #FF5F57;
  --traffic-yellow: #FEBC2E;
  --traffic-green: #28C840;

  --font-mono: ui-monospace, "SF Mono", "JetBrains Mono", "Fira Code", Menlo, Consolas, "Liberation Mono", monospace;
  --max-width: 1000px;
  --radius: 10px;
}

/* No-JS fallback only — once JS runs, data-theme is set immediately and wins */
@media (prefers-color-scheme: light) {
  :root {
    --bg: #FBFAF8;
    --bg-panel: #F1EFEA;
    --bg-panel-2: #EAE7E1;
    --fg: #20242B;
    --fg-muted: #666F7A;
    --border: rgba(0, 0, 0, 0.10);
    --border-strong: rgba(0, 0, 0, 0.18);
    --accent: #B44E29;
    --accent-strong: #8F3D20;
    --accent-contrast: #FFF7F1;
    --green: #237A56;
    --shadow: 0 8px 20px rgba(20, 20, 15, 0.08);
  }
}

:root[data-theme="dark"] {
  --bg: #0B0E14;
  --bg-panel: #12161D;
  --bg-panel-2: #171B23;
  --fg: #E3E6EA;
  --fg-muted: #7C8794;
  --border: rgba(255, 255, 255, 0.10);
  --border-strong: rgba(255, 255, 255, 0.16);
  --accent: #D97757;
  --accent-strong: #F2A278;
  --accent-contrast: #1A1006;
  --green: #6FCF97;
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

:root[data-theme="light"] {
  --bg: #FBFAF8;
  --bg-panel: #F1EFEA;
  --bg-panel-2: #EAE7E1;
  --fg: #20242B;
  --fg-muted: #666F7A;
  --border: rgba(0, 0, 0, 0.10);
  --border-strong: rgba(0, 0, 0, 0.18);
  --accent: #B44E29;
  --accent-strong: #8F3D20;
  --accent-contrast: #FFF7F1;
  --green: #237A56;
  --shadow: 0 8px 20px rgba(20, 20, 15, 0.08);
}

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

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

body {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 15.5px;
  line-height: 1.65;
  color: var(--fg);
  background-color: var(--bg);
  display: flex;
  min-height: 100vh;
  flex-direction: column;
  transition: background-color 0.2s ease, color 0.2s ease;
}

@media (min-width: 768px) {
  body {
    font-size: 16px;
  }
}

main {
  flex: 1 0 auto;
}

h1, h2, h3, h4, h5, h6 {
  margin-top: 0;
  line-height: 1.25;
  color: var(--fg);
  font-weight: 700;
  letter-spacing: -0.01em;
}

h1 { font-size: 1.9rem; line-height: 1.2; }
h2 { font-size: 1.4rem; line-height: 1.25; }
h3 { font-size: 1.1rem; line-height: 1.3; }
h4 { font-size: 1rem; }

/* Prompt-style prefix on section headings, like a command about to run */
h2::before {
  content: "❯ ";
  color: var(--accent);
}

p {
  margin-top: 0;
  margin-bottom: 1rem;
}

a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: var(--border-strong);
  text-underline-offset: 3px;
}

a:hover,
a:focus {
  color: var(--accent-strong);
  text-decoration-color: currentColor;
}

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

ul, ol {
  padding-left: 1.25rem;
}

hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2rem 0;
}

button {
  font-family: inherit;
}

em {
  color: var(--fg-muted);
  font-style: italic;
}

strong {
  color: var(--fg);
}

/* -----------------------------
   Layout: container
   ----------------------------- */
.container {
  max-width: var(--max-width);
  margin-inline: auto;
  padding-inline: 1.25rem;
}

/* -----------------------------
   macOS-style window chrome (sticky, wraps title bar + nav)
   ----------------------------- */
.term-chrome {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: rgba(18, 22, 29, 0.78);
  border-bottom: 1px solid var(--border);
}

:root[data-theme="light"] .term-chrome {
  background-color: rgba(241, 239, 234, 0.82);
}

@media (prefers-color-scheme: light) {
  .term-chrome {
    background-color: rgba(241, 239, 234, 0.78);
  }
}

@supports (backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px)) {
  .term-chrome {
    -webkit-backdrop-filter: blur(14px) saturate(160%);
    backdrop-filter: blur(14px) saturate(160%);
  }
}

.term-titlebar {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.65rem 1.25rem;
  max-width: var(--max-width);
  margin-inline: auto;
}

.term-lights {
  display: flex;
  gap: 7px;
  flex: 0 0 auto;
}

.term-lights span {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  display: block;
}

.term-lights span:nth-child(1) { background-color: var(--traffic-red); }
.term-lights span:nth-child(2) { background-color: var(--traffic-yellow); }
.term-lights span:nth-child(3) { background-color: var(--traffic-green); }

.term-title {
  flex: 1 1 auto;
  min-width: 0;
  text-align: center;
  font-size: 0.8rem;
  color: var(--fg-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.term-title strong {
  color: var(--fg);
  font-weight: 600;
}

/* Theme toggle button, sits in the title bar */
.theme-toggle {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid var(--border-strong);
  border-radius: 7px;
  background-color: transparent;
  color: var(--fg-muted);
  cursor: pointer;
}

.theme-toggle:hover,
.theme-toggle:focus {
  color: var(--fg);
  border-color: var(--accent);
}

.theme-toggle svg {
  width: 15px;
  height: 15px;
}

.theme-toggle .icon-moon { display: none; }
:root[data-theme="light"] .theme-toggle .icon-sun { display: none; }
:root[data-theme="light"] .theme-toggle .icon-moon { display: block; }

/* Second row: nav styled as a command / breadcrumb line */
.term-navbar {
  border-top: 1px solid var(--border);
  padding: 0.5rem 0;
}

.term-navbar .container {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.term-navbar .prompt-symbol {
  color: var(--green);
  font-weight: 700;
  flex: 0 0 auto;
}

.nav-toggle {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 34px;
  height: 30px;
  padding: 0;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  background-color: transparent;
  cursor: pointer;
  margin-left: auto;
}

.nav-toggle span {
  display: block;
  width: 16px;
  height: 2px;
  background-color: var(--fg-muted);
  border-radius: 2px;
}

.nav-toggle:hover {
  border-color: var(--accent);
}

.site-nav {
  display: none;
  flex-direction: column;
  width: 100%;
  gap: 0.15rem;
  order: 3;
}

.site-nav.nav-open {
  display: flex;
}

.site-nav a {
  display: block;
  padding: 0.45rem 0.35rem;
  color: var(--fg-muted);
  text-decoration: none;
  font-size: 0.92rem;
  border-radius: 5px;
}

.site-nav a::before {
  content: "./";
  color: var(--border-strong);
}

.site-nav a:hover,
.site-nav a:focus {
  color: var(--fg);
  background-color: var(--bg-panel);
}

.site-nav a.active {
  color: var(--accent);
  font-weight: 700;
}

@media (min-width: 768px) {
  .term-navbar .container {
    flex-wrap: nowrap;
  }

  .nav-toggle {
    display: none;
  }

  .site-nav {
    display: flex;
    flex-direction: row;
    align-items: center;
    width: auto;
    gap: 1.4rem;
    order: 0;
    margin-left: 0.25rem;
  }

  .site-nav a {
    padding: 0.15rem 0;
  }
}

/* Logo used inline in the title bar text, and as a fallback link target */
.logo {
  color: inherit;
  text-decoration: none;
}

/* -----------------------------
   Hero
   ----------------------------- */
.hero {
  padding-block: 3rem;
  background-color: var(--bg-panel);
  border-bottom: 1px solid var(--border);
}

.hero .prompt-line {
  font-size: 0.95rem;
  color: var(--green);
  margin-bottom: 1rem;
}

.hero .prompt-line .path {
  color: var(--fg-muted);
}

.hero h1 {
  margin-bottom: 0.75rem;
  font-size: 1.35rem;
}

.hero p {
  max-width: 60ch;
  color: var(--fg-muted);
}

.cursor-blink {
  display: inline-block;
  width: 0.55em;
  height: 1.1em;
  background-color: var(--accent);
  vertical-align: text-bottom;
  margin-left: 0.15em;
  animation: blink 1.1s steps(1) infinite;
}

@keyframes blink {
  0%, 49% { opacity: 1; }
  50%, 100% { opacity: 0; }
}

@media (min-width: 768px) {
  .hero {
    padding-block: 4rem;
  }

  .hero h1 {
    font-size: 2.1rem;
  }
}

/* Inner-page (non-hero) plain header block */
.page-header {
  padding-block: 2rem;
  background-color: var(--bg-panel);
  border-bottom: 1px solid var(--border);
}

.page-header h1 {
  margin-bottom: 0.4rem;
}

/* -----------------------------
   Sections
   ----------------------------- */
.section {
  padding-block: 2.75rem;
}

.section-alt {
  padding-block: 2.75rem;
  background-color: var(--bg-panel);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

@media (min-width: 768px) {
  .section,
  .section-alt {
    padding-block: 3.5rem;
  }
}

/* -----------------------------
   Card grid — styled like small file/tool cards
   ----------------------------- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.25rem;
  margin-top: 2rem;
}

@media (min-width: 600px) {
  .card-grid {
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  }
}

.card {
  background-color: var(--bg-panel-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.35rem;
  box-shadow: var(--shadow);
}

.card h3 {
  margin-bottom: 0.5rem;
}

.card p:last-child {
  margin-bottom: 0;
}

/* -----------------------------
   About page intro (headshot + bio)
   ----------------------------- */
.about-intro {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
  margin-top: 2rem;
  align-items: start;
}

@media (min-width: 600px) {
  .about-intro {
    grid-template-columns: minmax(200px, 260px) 1fr;
  }
}

.about-intro img {
  border: 1px solid var(--border-strong);
}

/* -----------------------------
   Muted / caption text
   ----------------------------- */
.muted {
  color: var(--fg-muted);
  font-size: 0.9rem;
}

/* -----------------------------
   Tag — shown like a CLI flag
   ----------------------------- */
.tag {
  display: inline-block;
  background-color: var(--bg-panel-2);
  border: 1px solid var(--border-strong);
  color: var(--accent);
  border-radius: 5px;
  padding: 0.1rem 0.55rem;
  font-size: 0.78rem;
  font-weight: 600;
  text-decoration: none;
  line-height: 1.6;
}

.tag::before {
  content: "--";
  color: var(--fg-muted);
}

/* -----------------------------
   Buttons — bracketed, terminal-key style
   ----------------------------- */
.btn {
  display: inline-block;
  background-color: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 7px;
  padding: 0.55rem 1.1rem;
  font-family: var(--font-mono);
  font-size: 0.95rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.btn::before {
  content: "> ";
  opacity: 0.7;
}

.btn:hover,
.btn:focus {
  background-color: var(--accent);
  color: var(--accent-contrast);
  box-shadow: 0 0 0 3px rgba(217, 119, 87, 0.18);
}

.btn-primary {
  background-color: var(--accent);
  color: var(--accent-contrast);
}

.btn-primary:hover,
.btn-primary:focus {
  background-color: var(--accent-strong);
  color: var(--accent-contrast);
}

.btn-secondary {
  background-color: transparent;
  color: var(--fg);
  border: 1px solid var(--border-strong);
}

.btn-secondary:hover,
.btn-secondary:focus {
  background-color: var(--bg-panel-2);
  color: var(--fg);
  box-shadow: none;
}

/* -----------------------------
   Image row (LynxMove gallery)
   ----------------------------- */
.img-row {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: 1.5rem;
}

.img-row img {
  max-width: 100%;
  height: auto;
  border-radius: 6px;
  border: 1px solid var(--border);
  flex: 1 1 150px;
}

/* -----------------------------
   Timeline — styled like `git log --oneline`
   ----------------------------- */
.timeline {
  margin-top: 1.75rem;
  list-style: none;
  padding-left: 0;
}

.timeline-item {
  position: relative;
  padding: 0.5rem 0 0.5rem 1.1rem;
  border-left: 2px solid var(--border-strong);
  font-size: 0.95rem;
}

.timeline-item::before {
  content: "";
  position: absolute;
  left: -5px;
  top: 1rem;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--accent);
}

.timeline-item strong {
  color: var(--green);
  font-weight: 700;
  margin-right: 0.5rem;
}

.timeline-item p {
  display: inline;
  margin: 0;
  color: var(--fg-muted);
}

/* -----------------------------
   Publications list — styled like a directory listing
   ----------------------------- */
.pub-list {
  list-style: none;
  padding-left: 0;
  margin-top: 1.75rem;
}

.pub-item {
  padding: 1.1rem 0;
  border-bottom: 1px solid var(--border);
}

.pub-item:first-child {
  padding-top: 0;
}

.pub-item:last-child {
  border-bottom: none;
}

.pub-item > p:first-of-type::before {
  content: "▸ ";
  color: var(--green);
}

.pub-item strong {
  color: var(--fg);
}

.pub-item strong a,
.pub-item p:first-of-type a {
  color: var(--fg);
  text-decoration: none;
}

.pub-item strong a:hover,
.pub-item p:first-of-type a:hover {
  color: var(--accent);
}

.pub-meta {
  color: var(--fg-muted);
  font-size: 0.85rem;
  margin-top: 0.15rem;
  margin-bottom: 0.5rem;
}

.pub-meta::before {
  content: "# ";
  color: var(--border-strong);
}

.pub-links {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.pub-links a,
.pub-chip {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  text-decoration: none;
  color: var(--fg-muted);
  background-color: var(--bg-panel-2);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 0.1rem 0.5rem;
}

.pub-links a:hover,
.pub-links a:focus,
.pub-chip:hover,
.pub-chip:focus {
  border-color: var(--accent);
  color: var(--accent);
}

/* -----------------------------
   Footer — styled like an idle shell prompt
   ----------------------------- */
.site-footer {
  background-color: var(--bg-panel);
  color: var(--fg-muted);
  border-top: 1px solid var(--border);
  padding-block: 1.75rem;
  margin-top: auto;
  font-size: 0.9rem;
}

.footer-inner {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1rem;
}

.footer-prompt {
  color: var(--green);
}

.footer-prompt .path {
  color: var(--fg-muted);
}

.site-footer p {
  margin: 0;
  color: var(--fg-muted);
}

.site-footer a {
  color: var(--fg-muted);
  text-decoration: underline;
  text-decoration-color: var(--border-strong);
}

.site-footer a:hover,
.site-footer a:focus {
  color: var(--accent);
}

.social-links {
  display: flex;
  gap: 1.1rem;
  flex-wrap: wrap;
}

.social-links a::before {
  content: "./";
  color: var(--border-strong);
}

@media (min-width: 600px) {
  .footer-inner {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}
