/* ===== Variables ===== */
:root {
  --bg: #faf8f5;
  --bg-alt: #f1ede6;
  --surface: #ffffff;
  --border: #e2ddd3;
  --text: #201d1a;
  --text-muted: #6b6459;
  --accent: #a1462e;
  --accent-hover: #8a3b28;
  --radius: 10px;
  --radius-photo: 20px;
  --max-width: 1080px;
  --shadow: 0 4px 16px rgba(32, 29, 26, 0.08);
  --shadow-hover: 0 10px 28px rgba(32, 29, 26, 0.14);
  --font-display: "Space Grotesk", "Segoe UI", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

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

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
}

/* ===== Header / Nav ===== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(250, 248, 245, 0.85);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  max-width: var(--max-width);
  margin: 0 auto;
}

.nav-brand {
  display: inline-flex;
  align-items: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--text);
  letter-spacing: 0.5px;
}

.brand-logo {
  height: 28px;
  width: 28px;
  margin-right: 8px;
}

.nav-menu {
  position: relative;
}

.nav-links {
  position: absolute;
  top: calc(100% + 12px);
  right: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 2px;
  list-style: none;
  margin: 0;
  padding: 8px;
  min-width: 180px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-hover);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0s linear 0.2s;
}

.nav-links.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0s linear 0s;
}

.nav-links li a {
  display: block;
  padding: 10px 12px;
  border-radius: 6px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text);
}

.nav-links a:hover,
.nav-links a.active {
  background: var(--bg-alt);
  color: var(--accent);
  text-decoration: none;
}

.nav-links-divider {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid var(--border);
}

.nav-links-divider a {
  color: var(--accent);
}

.nav-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: var(--text);
  font-size: 1.5rem;
  cursor: pointer;
}

/* ===== Hero ===== */
.hero {
  padding: 96px 24px 64px;
  text-align: center;
}

.hero-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 48px;
  flex-wrap: wrap-reverse;
}

.hero-content {
  flex: 1 1 360px;
  text-align: left;
}

.hero-photo-wrap {
  flex: 0 0 auto;
}

.hero-photo {
  width: min(440px, 90vw);
  aspect-ratio: 4 / 3.2;
  object-fit: cover;
  border-radius: var(--radius-photo);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.hero-eyebrow {
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 2px;
  font-size: 0.85rem;
  font-weight: 600;
}

.hero h1 {
  font-family: var(--font-display);
  font-size: clamp(2.25rem, 6vw, 4.25rem);
  line-height: 1.05;
  margin: 16px 0;
}

.hero p {
  color: var(--text-muted);
  max-width: 640px;
  margin: 0 0 32px;
  font-size: 1.1rem;
}

.hero-subhead {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(1.1rem, 2.4vw, 1.4rem);
  color: var(--text-muted);
  max-width: 520px;
}

.hero-actions {
  display: flex;
  gap: 16px;
  justify-content: flex-start;
  flex-wrap: wrap;
}

@media (max-width: 640px) {
  .hero-content {
    text-align: center;
  }

  .hero p {
    margin: 0 auto 32px;
  }

  .hero-actions {
    justify-content: center;
  }
}

.arrow-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--accent);
  font-weight: 600;
  font-size: 0.95rem;
}

.arrow-link span {
  transition: transform 0.15s ease;
}

.arrow-link:hover {
  text-decoration: none;
}

.arrow-link:hover span {
  transform: translate(4px, 4px);
}

/* ===== Intro ===== */
.intro-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 32px;
}

.intro-item h3 {
  font-family: var(--font-display);
  margin: 8px 0;
}

.intro-item p {
  color: var(--text-muted);
  margin: 0;
}

.intro-index {
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--accent);
  margin: 0;
}

@media (max-width: 720px) {
  .intro-grid {
    grid-template-columns: 1fr;
  }
}

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

.tile {
  position: relative;
  display: block;
  aspect-ratio: 4 / 5;
  border-radius: var(--radius-photo);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.tile-portfolio {
  background: #26241f;
}

.tile-music {
  background: #4a2c22;
}

.tile-blog {
  background: #33362b;
}

.tile::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.75), transparent 55%);
}

.tile-caption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 24px;
  color: #fff;
  z-index: 1;
}

.tile-caption h3 {
  font-family: var(--font-display);
  margin: 0 0 4px;
}

.tile-caption p {
  color: rgba(255, 255, 255, 0.85);
  margin: 0 0 12px;
}

.tile-caption .arrow-link {
  color: #fff;
}

.tile:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-hover);
}

@media (max-width: 720px) {
  .tile-grid {
    grid-template-columns: 1fr;
  }
}

/* ===== Buttons ===== */
.btn {
  display: inline-block;
  padding: 12px 24px;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  border: 1px solid transparent;
  transition: transform 0.15s ease, opacity 0.15s ease;
}

.btn:hover {
  transform: translateY(-2px);
  text-decoration: none;
}

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

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

.btn-outline {
  background: transparent;
  border-color: var(--border);
  color: var(--text);
}

/* ===== Sections ===== */
section {
  padding: 64px 0;
}

.section-title {
  font-family: var(--font-display);
  font-size: 2rem;
  margin-bottom: 8px;
}

.section-sub {
  color: var(--text-muted);
  margin-bottom: 36px;
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

/* ===== Cards / Grid ===== */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 24px;
}

.card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.card:hover {
  transform: translateY(-4px);
  border-color: var(--accent);
  box-shadow: var(--shadow-hover);
}

.card h3 {
  margin-top: 0;
  margin-bottom: 8px;
  font-family: var(--font-display);
}

.card p {
  color: var(--text-muted);
  margin-bottom: 12px;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0;
}

.tag {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.75rem;
  padding: 4px 10px;
  border-radius: 999px;
}

.card-links {
  display: flex;
  gap: 16px;
  margin-top: 12px;
  font-size: 0.9rem;
}

/* ===== Music page ===== */
.player-row {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.player-row audio {
  flex: 1;
  min-width: 220px;
}

/* ===== MusicXML viewer ===== */
.picker-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

.picker-row select {
  padding: 10px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-alt);
  color: var(--text);
  font-family: inherit;
  font-size: 0.95rem;
}

.osmd-container {
  background: #ffffff;
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  overflow-x: auto;
}

.transport-row .btn {
  padding: 10px 18px;
}

.transport-row .btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

.bpm-input {
  width: 5em;
  text-align: center;
}

#metronome-toggle[aria-pressed="true"] {
  border-color: var(--accent);
  color: var(--accent);
}

/* ===== Blog ===== */
.post-meta {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-bottom: 8px;
}

/* ===== Contact ===== */
.form-grid {
  display: grid;
  gap: 16px;
  max-width: 560px;
}

label {
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 6px;
  display: block;
}

input,
textarea {
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-alt);
  color: var(--text);
  font-family: inherit;
  font-size: 0.95rem;
}

input:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
}

.form-status {
  font-size: 0.9rem;
  color: var(--accent);
  min-height: 1.2em;
}

.social-links {
  display: flex;
  gap: 16px;
  margin-top: 24px;
}

/* ===== Footer ===== */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 32px 24px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* ===== Page header (non-home pages) ===== */
.page-hero {
  padding: 64px 24px 32px;
  text-align: center;
}

.page-hero h1 {
  font-family: var(--font-display);
  font-size: clamp(2rem, 4.5vw, 3rem);
  margin-bottom: 8px;
}

.page-hero p {
  color: var(--text-muted);
}

.page-hero .btn {
  margin-top: 8px;
}

/* ===== LMU Telemetry Analyzer page ===== */
.install-steps {
  color: var(--text-muted);
  margin: 20px 0 12px;
  padding-left: 20px;
}

.install-steps li {
  margin-bottom: 8px;
}

.install-steps code {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 0.9em;
}

.iframe-embed {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.iframe-embed iframe {
  width: 100%;
  height: 720px;
  border: 0;
  display: block;
}

@media (max-width: 640px) {
  .iframe-embed iframe {
    height: 520px;
  }
}
