:root {
  --bg: #050505;
  --bg-soft: #0b0b0c;
  --panel: #111113;
  --panel-strong: #17171a;
  --text: #f4f4f5;
  --muted: #b8b8bd;
  --muted-strong: #dedee2;
  --line: rgba(255, 255, 255, 0.13);
  --line-strong: rgba(243, 176, 31, 0.46);
  --accent: #F3B01F;
  --accent-2: #CD202B;
  --success: #63e6be;
  --radius: 8px;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.38);
  --shadow-soft: 0 10px 28px rgba(0, 0, 0, 0.24);
  --space-page: clamp(1.25rem, 3vw, 2.5rem);
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
}

body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  font-family: 'Roboto Mono', monospace;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(243, 176, 31, 0.09), transparent 34rem),
    radial-gradient(circle at 85% 10%, rgba(205, 32, 43, 0.1), transparent 30rem),
    linear-gradient(180deg, #050505 0%, #0b0b0c 52%, #050505 100%);
  line-height: 1.6;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.028) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.45), transparent 70%);
}

.container {
  width: min(1200px, calc(100% - 2rem));
  margin: 0 auto;
  padding: var(--space-page) 0 6rem;
}

header {
  padding: var(--space-page) 1rem 0;
}

h1,
header h1 {
  margin: 0 0 1.25rem;
  color: var(--text);
  font-size: clamp(2rem, 5vw, 3.5rem);
  line-height: 1.05;
  letter-spacing: 0;
  border-bottom: 2px solid var(--accent);
  padding-bottom: 0.45rem;
  text-shadow: 0 0 28px rgba(243, 176, 31, 0.16);
}

h2 {
  color: var(--text);
  font-size: clamp(1.25rem, 3vw, 1.7rem);
  line-height: 1.2;
  margin: 2.5rem 0 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--line);
}

p,
li,
label,
figcaption,
.caption,
.meta {
  color: var(--muted);
}

p {
  max-width: 80ch;
}

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

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

li + li {
  margin-top: 0.35rem;
}

a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 0.18em;
  border: 0;
  padding: 0;
  margin-top: 0;
  display: inline;
  transition: color 0.18s ease, border-color 0.18s ease, background 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}

a:hover {
  color: var(--text);
  background: transparent;
}

a:focus-visible,
button:focus-visible,
input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}

.buttons a,
.link-buttons a,
.project > a,
.container > a,
.container a[href="projects.html"],
a[href="index.html"].back-button,
a[href="arduino_stuff.html"],
body > a[href="projects.html"],
.back-button,
p > a[href^="https://youtu"],
p > a[href="arduino_code.html"] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.75rem;
  margin-top: 1.25rem;
  padding: 0.58rem 0.95rem;
  color: var(--text);
  text-decoration: none;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(243, 176, 31, 0.12), rgba(205, 32, 43, 0.04));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.buttons a:hover,
.link-buttons a:hover,
.project > a:hover,
.container > a:hover,
.container a[href="projects.html"]:hover,
a[href="index.html"].back-button:hover,
a[href="arduino_stuff.html"]:hover,
body > a[href="projects.html"]:hover,
.back-button:hover,
p > a[href^="https://youtu"]:hover,
p > a[href="arduino_code.html"]:hover {
  color: #0b0b0c;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent) 68%, var(--accent-2) 100%);
  border-color: var(--accent);
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(243, 176, 31, 0.2), 0 0 24px rgba(205, 32, 43, 0.1);
}

a.floating-back-link {
  position: fixed;
  left: 1.25rem;
  top: 1.25rem;
  z-index: 50;
  max-width: calc(100vw - 2rem);
  margin: 0;
  min-height: 2.45rem;
  padding: 0.45rem 0.75rem;
  font-size: 0.9rem;
  background: rgba(12, 12, 13, 0.88);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(12px);
}

a.floating-back-link:hover {
  color: #0b0b0c;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent) 68%, var(--accent-2) 100%);
  border-color: var(--accent);
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(243, 176, 31, 0.2), 0 0 24px rgba(205, 32, 43, 0.1);
}

.inline-link,
.inline-code-link,
.container p a,
.container li a {
  color: var(--accent);
  display: inline;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  text-decoration: underline;
  text-underline-offset: 0.18em;
  box-shadow: none;
}

.inline-link:hover,
.inline-code-link:hover,
.container p a:hover,
.container li a:hover {
  color: var(--text);
  background: transparent;
  box-shadow: none;
  transform: none;
}

.inline-code-link {
  font-family: 'Roboto Mono', monospace;
  word-break: break-word;
  border-bottom: 1px solid rgba(243, 176, 31, 0.42);
  text-decoration: none;
}

.inline-code-link:hover {
  border-bottom-color: var(--text);
}

.container p > a[href^="https://youtu"],
.container p > a[href="arduino_code.html"] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.75rem;
  margin-top: 1.25rem;
  padding: 0.58rem 0.95rem;
  color: var(--text);
  text-decoration: none;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(243, 176, 31, 0.12), rgba(205, 32, 43, 0.04));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.container p > a[href^="https://youtu"]:hover,
.container p > a[href="arduino_code.html"]:hover {
  color: #0b0b0c;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent) 68%, var(--accent-2) 100%);
  border-color: var(--accent);
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(243, 176, 31, 0.2), 0 0 24px rgba(205, 32, 43, 0.1);
}

.buttons,
.link-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1rem;
}

.buttons a,
.link-buttons a {
  margin-right: 0;
}

.grid {
  width: min(1100px, calc(100% - 2rem));
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.25rem;
}

.project {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.01)),
    var(--panel);
  box-shadow: var(--shadow-soft);
}

.grid > .project {
  padding: 1.25rem;
  text-align: left;
  min-height: 170px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.project:hover {
  border-color: var(--line-strong);
  box-shadow: var(--shadow), 0 0 0 1px rgba(205, 32, 43, 0.12);
}

.project h2 {
  margin-top: 0;
  margin-bottom: 0.75rem;
  border-bottom: 0;
  padding-bottom: 0;
  font-size: 1.15rem;
}

.project p {
  margin-top: 0;
}

.grid > .project > a {
  margin-top: auto;
}

.section,
.media,
.video,
.video-wrap,
.image-grid,
pre {
  position: relative;
}

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

.headshot,
.media img,
.grid img,
.section img,
figure img {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow-soft);
}

.headshot {
  max-width: 420px;
  justify-self: end;
}

.media img {
  max-width: 900px;
}

.video,
.video-wrap {
  width: 100%;
  max-width: 920px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: #050505;
  box-shadow: var(--shadow-soft);
}

.video iframe,
.video-wrap iframe {
  display: block;
}

pre {
  color: #f0f0f2;
  background: #0b0b0c;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
}

code {
  color: #f0f0f2;
}

.email-box {
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--panel);
}

.email-box input {
  color: var(--text);
  background: var(--panel);
}

.email-box button {
  color: var(--text);
  background: var(--panel-strong);
  border-left: 1px solid var(--line);
}

.email-box button:hover {
  color: #0b0b0c;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent) 68%, var(--accent-2) 100%);
}

.copy-confirm {
  color: var(--success);
}

figcaption,
.caption {
  color: var(--muted);
}

/* Minimal guardrails for the older steer-drive layout. */
div[style*="top: -18rem"] {
  top: 0 !important;
  margin-top: 1.5rem;
}

p[style*="margin-top: -24rem"] {
  margin-top: 1rem !important;
  margin-left: 0 !important;
}

@media (max-width: 900px) {
  body {
    background:
      radial-gradient(circle at top left, rgba(243, 176, 31, 0.08), transparent 24rem),
      radial-gradient(circle at bottom right, rgba(205, 32, 43, 0.08), transparent 24rem),
      linear-gradient(180deg, #050505 0%, #0b0b0c 100%);
  }

  .container {
    width: min(100% - 1.25rem, 1200px);
    padding: 1.25rem 0 5.5rem;
  }

  .container,
  .grid,
  .section,
  div[style*="grid-template-columns"] {
    grid-template-columns: 1fr !important;
  }

  .grid {
    width: min(100% - 1.25rem, 1100px);
    padding: 1.25rem 0;
  }

  .section {
    display: grid;
  }

  .headshot {
    justify-self: start;
  }

  h1,
  header h1 {
    font-size: clamp(2rem, 11vw, 2.8rem);
  }

  .buttons a,
  .link-buttons a,
  .project > a,
  .container > a,
  .container a[href="projects.html"],
  a[href="index.html"].back-button,
  a[href="arduino_stuff.html"],
  body > a[href="projects.html"],
  .back-button,
  p > a[href^="https://youtu"],
  p > a[href="arduino_code.html"] {
    width: 100%;
  }

  a.floating-back-link {
    left: 1rem;
    top: 1rem;
    max-width: calc(100vw - 2rem);
    width: auto;
    transform: none;
  }

  a.floating-back-link:hover {
    transform: translateY(-1px);
  }
}
