:root {
  color-scheme: light;
  --bg: #f3f0e8;
  --surface: #fffdf7;
  --text: #17211b;
  --muted: #5f6b63;
  --line: #c8cec6;
  --accent: #e4572e;
  --accent-soft: #f3c5b5;
  --green: #235347;
  --shadow: 0 18px 50px rgb(23 33 27 / 9%);
  --max-width: 1120px;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #101713;
  --surface: #17201b;
  --text: #f2eee4;
  --muted: #a7b1aa;
  --line: #3c4840;
  --accent: #ff805b;
  --accent-soft: #653322;
  --green: #9bc7b8;
  --shadow: 0 18px 50px rgb(0 0 0 / 25%);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at 8% 5%, color-mix(in srgb, var(--accent) 12%, transparent), transparent 24rem),
    var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.65;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  color: inherit;
  font: inherit;
}

.site-header,
main,
footer {
  width: min(calc(100% - 40px), var(--max-width));
  margin-inline: auto;
}

.site-header {
  display: flex;
  align-items: center;
  gap: 36px;
  min-height: 88px;
}

.wordmark {
  margin-right: auto;
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.08em;
}

.wordmark span {
  color: var(--accent);
}

nav {
  display: flex;
  gap: 28px;
  color: var(--muted);
  font-size: 0.9rem;
}

nav a,
.text-link,
.contact-links a {
  transition: color 160ms ease;
}

nav a:hover,
.text-link:hover,
.contact-links a:hover {
  color: var(--accent);
}

.theme-toggle {
  display: grid;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  place-items: center;
}

.hero {
  position: relative;
  min-height: 660px;
  padding: 140px 0 120px;
  overflow: hidden;
}

.eyebrow,
.section-number,
.project-meta,
.music-graph small {
  color: var(--accent);
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  max-width: 800px;
  margin-bottom: 24px;
  font-size: clamp(4rem, 10vw, 8.5rem);
  line-height: 0.9;
  letter-spacing: -0.075em;
}

.hero-copy {
  max-width: 710px;
  margin-bottom: 36px;
  color: var(--muted);
  font-size: clamp(1.1rem, 2vw, 1.35rem);
}

.hero-links {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.button {
  display: inline-flex;
  align-items: center;
  min-height: 48px;
  padding: 0 20px;
  border: 1px solid var(--text);
  border-radius: 999px;
  font-weight: 700;
}

.button.primary {
  border-color: var(--text);
  background: var(--text);
  color: var(--bg);
}

.button.secondary:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.doodle {
  position: absolute;
  right: 7%;
  bottom: 60px;
  width: 230px;
  height: 150px;
  opacity: 0.75;
  transform: rotate(-7deg);
}

.node,
.edge {
  position: absolute;
  display: block;
}

.node {
  z-index: 1;
  width: 18px;
  height: 18px;
  border: 3px solid var(--accent);
  border-radius: 50%;
  background: var(--bg);
}

.node-a { left: 5px; top: 70px; }
.node-b { left: 95px; top: 15px; }
.node-c { right: 15px; top: 65px; }
.node-d { left: 105px; bottom: 5px; }

.edge {
  height: 2px;
  background: var(--accent);
  transform-origin: left center;
}

.edge-a { left: 20px; top: 75px; width: 95px; transform: rotate(-31deg); }
.edge-b { left: 110px; top: 29px; width: 112px; transform: rotate(25deg); }
.edge-c { left: 118px; top: 38px; width: 100px; transform: rotate(84deg); }

.section {
  border-top: 1px solid var(--line);
  padding: 100px 0;
}

.intro {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 80px;
}

h2 {
  font-size: clamp(2.3rem, 5vw, 4.5rem);
  line-height: 1;
  letter-spacing: -0.055em;
}

.prose {
  max-width: 700px;
  color: var(--muted);
  font-size: 1.18rem;
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 40px;
  margin-bottom: 48px;
}

.section-heading > p {
  max-width: 420px;
  color: var(--muted);
}

.project-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px;
}

.project {
  min-height: 360px;
  padding: 32px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: color-mix(in srgb, var(--surface) 78%, transparent);
  box-shadow: var(--shadow);
}

.project.featured {
  background: var(--green);
  color: var(--bg);
}

:root[data-theme="dark"] .project.featured {
  background: #d4eadd;
  color: #17211b;
}

.project.featured .project-meta,
.project.featured .text-link {
  color: var(--accent-soft);
}

:root[data-theme="dark"] .project.featured .project-meta,
:root[data-theme="dark"] .project.featured .text-link {
  color: #a33f23;
}

.project-meta {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 70px;
}

.project h3 {
  margin-bottom: 16px;
  font-size: 1.8rem;
  line-height: 1.1;
  letter-spacing: -0.035em;
}

.project p {
  color: var(--muted);
}

.project.featured p {
  color: inherit;
  opacity: 0.8;
}

.text-link {
  display: inline-block;
  margin-top: 8px;
  color: var(--accent);
  font-weight: 750;
}

code {
  font-size: 0.9em;
}

.music-graph {
  margin-top: 18px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.music-graph summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 30px 32px;
  cursor: pointer;
  font-size: 1.2rem;
  font-weight: 750;
  list-style: none;
}

.music-graph summary::-webkit-details-marker {
  display: none;
}

.music-graph small {
  display: block;
  margin-bottom: 3px;
}

.summary-action {
  color: var(--accent);
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 0.8rem;
}

.music-graph[open] .summary-action {
  font-size: 0;
}

.music-graph[open] .summary-action::after {
  content: "cerrar −";
  font-size: 0.8rem;
}

.graph-content {
  padding: 0 32px 32px;
  color: var(--muted);
}

.graph-frame {
  height: min(65vh, 620px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: white;
}

.graph-frame img {
  display: block;
  width: auto;
  max-width: none;
  height: 100%;
}

.contact {
  text-align: center;
}

.contact h2 {
  max-width: 850px;
  margin: 0 auto 50px;
}

.contact-links {
  display: flex;
  justify-content: center;
  gap: 32px;
}

.contact-links a {
  padding-bottom: 4px;
  border-bottom: 1px solid var(--line);
  font-weight: 750;
}

.contact-links span {
  color: var(--accent);
}

footer {
  display: flex;
  justify-content: space-between;
  gap: 30px;
  padding: 32px 0;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.82rem;
}

footer p {
  margin: 0;
}

@media (max-width: 760px) {
  .site-header,
  main,
  footer {
    width: min(calc(100% - 28px), var(--max-width));
  }

  nav {
    display: none;
  }

  .hero {
    min-height: auto;
    padding: 100px 0;
  }

  h1 {
    font-size: clamp(3.8rem, 20vw, 6.2rem);
  }

  .doodle {
    display: none;
  }

  .section {
    padding: 72px 0;
  }

  .intro,
  .project-grid {
    grid-template-columns: 1fr;
  }

  .intro {
    gap: 24px;
  }

  .section-heading {
    display: block;
  }

  .section-heading > p {
    margin-top: 24px;
  }

  .project {
    min-height: 0;
    padding: 26px;
  }

  .project-meta {
    margin-bottom: 48px;
  }

  .music-graph summary {
    padding: 24px;
  }

  .graph-content {
    padding: 0 24px 24px;
  }

  .contact-links {
    flex-direction: column;
    align-items: center;
    gap: 16px;
  }

  footer {
    flex-direction: column;
    gap: 8px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  * {
    transition: none !important;
  }
}
