:root {
  --paper: #f5f3ea;
  --paper-light: #fbfaf5;
  --ink: #26302c;
  --forest: #17463a;
  --blue: #47768a;
  --rust: #ad694d;
  --muted: #68716d;
  --line: rgba(23, 70, 58, 0.2);
  --faint-line: rgba(23, 70, 58, 0.09);
  --max: 1120px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background-color: var(--paper);
  background-image: linear-gradient(90deg, transparent 0, transparent calc(50% - 1px), rgba(23, 70, 58, 0.025) 50%, transparent calc(50% + 1px));
  color: var(--ink);
  font-family: "DM Sans", system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.65;
}
body.nav-open { overflow: hidden; }
a { color: inherit; text-underline-offset: 0.22em; }
p, h1, h2, h3, dl, dd { margin-top: 0; }
h1, h2, h3 { letter-spacing: 0; }
h1, h2 { color: var(--forest); font-weight: 500; line-height: 1.08; }
h1 { max-width: 760px; margin-bottom: 1.25rem; font-size: clamp(2.35rem, 4.3vw, 3.8rem); }
h2 { max-width: 720px; margin-bottom: 0.8rem; font-size: clamp(1.85rem, 3.6vw, 3.25rem); }
h3 { margin-bottom: 0.65rem; color: var(--forest); font-size: 1.2rem; font-weight: 600; line-height: 1.3; }

.skip-link { position: fixed; left: 1rem; top: -5rem; z-index: 30; background: var(--forest); color: white; padding: 0.65rem 0.9rem; }
.skip-link:focus { top: 1rem; }
.prompt { color: #67706d; font-style: italic; }
.hand-note { margin-bottom: 0.45rem; color: var(--rust); font-family: Kalam, cursive; font-size: 1.05rem; transform: rotate(-2deg); }

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  width: 100%;
  min-height: 4.2rem;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid transparent;
  background: rgba(245, 243, 234, 0.88);
  backdrop-filter: blur(14px);
  padding: 0.7rem max(1rem, calc((100% - var(--max)) / 2));
  transition: border-color 180ms ease;
}
.site-header.is-scrolled { border-color: var(--line); }
.brand { color: var(--forest); font-size: 1.05rem; font-weight: 600; text-decoration: none; }
.brand-dot { color: var(--rust); }
.site-nav { display: flex; align-items: center; gap: 1.35rem; }
.site-nav a { position: relative; color: var(--muted); font-size: 0.83rem; font-weight: 500; text-decoration: none; }
.site-nav a::after { position: absolute; right: 0; bottom: -0.22rem; left: 0; height: 1px; background: var(--forest); content: ""; transform: scaleX(0); transform-origin: left; transition: transform 160ms ease; }
.site-nav a:hover, .site-nav a.active { color: var(--forest); }
.site-nav a:hover::after, .site-nav a.active::after { transform: scaleX(1); }
.nav-toggle { display: none; }

.section { width: min(var(--max), calc(100% - 2rem)); margin: 0 auto; padding: clamp(3.75rem, 6.5vw, 6rem) 0; scroll-margin-top: 4rem; }
.section + .section { border-top: 1px solid var(--line); }
.section-heading { display: grid; grid-template-columns: minmax(0, 3fr) minmax(220px, 1fr); column-gap: 3rem; align-items: end; margin-bottom: clamp(2rem, 4vw, 3.4rem); }
.section-heading h2, .section-heading .section-index { grid-column: 1; }
.section-heading > p:last-child { grid-column: 2; grid-row: 1 / span 2; align-self: end; margin-bottom: 0.45rem; color: var(--muted); }
.section-heading.narrow { display: block; max-width: 740px; }
.section-heading.narrow > p:last-child { max-width: 590px; }
.section-heading.spread { grid-template-columns: minmax(0, 1fr) auto; }
.section-heading.spread > div { grid-column: 1; }
.section-heading.spread > a { grid-column: 2; grid-row: 1; align-self: end; }
.section-index, .project-kind, .margin-label, .timeline-type, .fav-category { margin-bottom: 0.75rem; color: var(--blue); font-size: 0.73rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; }

.hero { display: block; min-height: auto; padding-top: 2.5rem; padding-bottom: 3rem; }
.hero h1 { max-width: 670px; margin-bottom: 0.35rem; color: var(--forest); font-size: 1.25rem; font-weight: 500; line-height: 1.45; }
.kicker { margin-bottom: 1.2rem; color: var(--rust); font-family: Kalam, cursive; font-size: 1.25rem; }
.hero-intro { max-width: 670px; color: var(--ink); font-size: 1rem; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 1.5rem; align-items: center; margin-top: 1.5rem; }
.text-link { color: var(--forest); font-weight: 600; text-decoration-color: var(--rust); }
.quiet-link { color: var(--muted); font-size: 0.9rem; }

.projects-equal { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(2rem, 4vw, 3rem); }
.project-entry { display: flex; min-width: 0; flex-direction: column; border-top: 2px solid var(--forest); padding-top: 0.75rem; }
.project-entry h3 { font-size: 1.45rem; }
.project-entry > p:not(.project-kind, .project-tools) { font-size: 0.93rem; }
.project-tools { margin-top: auto; padding-top: 1rem; font-family: ui-monospace, monospace; font-size: 0.7rem; }
.project-link { width: max-content; margin-top: 0.4rem; color: var(--forest); font-size: 0.82rem; font-weight: 600; text-decoration-color: var(--rust); }

.notes { position: relative; }
.notes::after { position: absolute; right: 2%; top: 22%; width: 32%; height: 55%; border-right: 1px solid var(--faint-line); border-bottom: 1px solid var(--faint-line); content: ""; pointer-events: none; }
.question-list { max-width: 880px; margin: 0; padding: 0; list-style: none; counter-reset: questions; }
.question-list li { position: relative; display: grid; min-height: 5.5rem; grid-template-columns: 3rem minmax(0, 1fr) 12rem; gap: 1.5rem; align-items: baseline; border-top: 1px solid var(--line); padding: 1.1rem 0; counter-increment: questions; }
.question-list li::before { color: var(--rust); content: "0" counter(questions); font-family: Kalam, cursive; }
.question-list li > span { color: var(--ink); font-size: 1.14rem; }
.question-list small { font-size: 0.78rem; }

.piano { overflow: hidden; }
.composition-list { border-bottom: 1px solid var(--line); }
.composition { display: grid; grid-template-columns: 2.5rem minmax(0, 1fr) 10rem 10rem; gap: 1.25rem; align-items: center; border-top: 1px solid var(--line); padding: 1.1rem 0; }
.composition h3 { margin-bottom: 0.2rem; font-size: 1.35rem; }
.composition p { margin-bottom: 0; }
.track-mark { color: var(--rust); font-family: Kalam, cursive; font-size: 1.2rem; }
.composition-date { font-family: ui-monospace, monospace; font-size: 0.72rem; }
.recording-state { color: var(--muted); font-size: 0.77rem; }
.recording-state span { display: inline-block; width: 0.5rem; height: 0.5rem; margin-right: 0.4rem; border: 1px solid var(--rust); border-radius: 50%; }
.music-note { width: max-content; margin: 1.4rem 5% 0 auto; }

.outline-button { border: 1px solid var(--forest); color: var(--forest); padding: 0.65rem 0.9rem; font-size: 0.85rem; font-weight: 600; text-decoration: none; transition: background 160ms ease, color 160ms ease; }
.outline-button:hover { background: var(--forest); color: var(--paper-light); }
.timeline { max-width: 940px; margin-left: 0; }
.timeline-row { display: grid; grid-template-columns: 9.5rem 1fr; gap: 1.75rem; border-top: 1px solid var(--line); padding: 1.05rem 0 1.25rem; }
.timeline-date { color: var(--rust); font-family: ui-monospace, monospace; font-size: 0.75rem; white-space: nowrap; }
.timeline-row h3 { margin-bottom: 0.35rem; font-size: 1.16rem; }
.timeline-row p { margin-bottom: 0.5rem; font-size: 0.92rem; }
.timeline-row div > p:last-child { max-width: 610px; }
.skills-row { border-bottom: 1px solid var(--line); }
.course-note { max-width: 560px; margin: 2.5rem 5% 0 auto; border-left: 2px solid var(--rust); padding-left: 1rem; }
.course-note p:last-child { margin-bottom: 0; font-size: 0.92rem; }

.favorite-notes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.75rem 1rem; align-items: start; }
.favorite-note { min-height: 140px; border-top: 1px solid var(--forest); background: rgba(251, 250, 245, 0.4); padding: 0.85rem 0.8rem 1rem; transition: transform 180ms ease, background 180ms ease; }
.favorite-note:hover { background: rgba(251, 250, 245, 0.9); transform: translateY(-3px); }
.favorite-note h3 { text-decoration: underline; text-decoration-color: rgba(173, 105, 77, 0.45); text-decoration-thickness: 1px; text-underline-offset: 0.3em; }
.favorite-note p:last-child { margin-bottom: 0; font-size: 0.9rem; }
.favorite-note.sound, .favorite-note.found, .favorite-note.pizza { margin-top: 0.5rem; }
.fav-category { color: var(--rust); }
.fav-annotations { display: flex; justify-content: space-between; gap: 1.5rem; margin: 1.75rem 8% 0; }
.fav-annotations .hand-note { margin-bottom: 0; }
.fav-annotations .hand-note:last-child { transform: rotate(2deg); }

.contact { padding-bottom: 3.5rem; }
.contact-layout { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 3rem; align-items: end; }
.contact-layout h2 { max-width: none; margin-bottom: 0; font-size: clamp(1.55rem, 2.4vw, 2.15rem); }
.contact-links { display: grid; gap: 0.6rem; justify-items: end; }
.contact-links a { color: var(--forest); font-weight: 500; text-decoration-color: var(--rust); }
.site-footer { display: flex; width: min(var(--max), calc(100% - 2rem)); justify-content: space-between; margin: 0 auto; border-top: 1px solid var(--line); color: var(--muted); padding: 1.5rem 0 2.5rem; font-family: ui-monospace, monospace; font-size: 0.68rem; }

[data-reveal] { opacity: 0; transform: translateY(12px); transition: opacity 500ms ease, transform 500ms ease; }
[data-reveal].visible { opacity: 1; transform: translateY(0); }
:focus-visible { outline: 2px solid var(--rust); outline-offset: 4px; }

@media (max-width: 820px) {
  .nav-toggle { display: grid; width: 2.55rem; height: 2.55rem; place-content: center; gap: 0.3rem; border: 1px solid var(--line); border-radius: 50%; background: var(--paper-light); }
  .nav-toggle span { display: block; width: 1rem; height: 1px; background: var(--forest); }
  .site-nav { position: fixed; inset: 4.2rem 0 auto; display: none; align-items: stretch; border-bottom: 1px solid var(--line); background: var(--paper-light); padding: 1rem; }
  .site-nav.open { display: grid; }
  .site-nav a { padding: 0.65rem; font-size: 1rem; }
  .site-nav a::after { display: none; }
  .hero { min-height: auto; }
  .section-heading { grid-template-columns: 1fr; }
  .section-heading > p:last-child { grid-column: 1; grid-row: auto; max-width: 600px; }
  .projects-equal { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .composition { grid-template-columns: 2rem minmax(0, 1fr) 8rem; }
  .recording-state { grid-column: 2; }
  .favorite-notes { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .favorite-note.sound, .favorite-note.found, .favorite-note.pizza { margin-top: 0; }
}

@media (max-width: 560px) {
  body { background-image: none; }
  h1 { font-size: 2rem; }
  .section { width: calc(100% - 1.5rem); padding: 3.5rem 0; }
  .hero { padding-top: 3rem; }
  .section-heading.spread { display: block; }
  .section-heading.spread .outline-button { display: inline-block; margin-top: 1rem; }
  .projects-equal { grid-template-columns: 1fr; gap: 2.75rem; }
  .question-list li { grid-template-columns: 2rem 1fr; gap: 0.6rem 0.8rem; }
  .question-list small { grid-column: 2; }
  .composition { grid-template-columns: 1.6rem 1fr; gap: 0.6rem; }
  .composition-date, .recording-state { grid-column: 2; }
  .timeline-row { grid-template-columns: 1fr; gap: 0.35rem; }
  .favorite-notes { display: grid; grid-template-columns: 1fr; gap: 1rem; }
  .favorite-note.book, .favorite-note.sound, .favorite-note.tool, .favorite-note.place, .favorite-note.found, .favorite-note.reading, .favorite-note.pizza { grid-column: 1; min-height: 0; margin: 0; }
  .favorite-note:nth-child(even) { margin-left: 8%; }
  .favorite-note:nth-child(odd) { margin-right: 8%; }
  .fav-annotations { flex-wrap: wrap; margin-right: 4%; margin-left: 4%; }
  .contact-layout { grid-template-columns: 1fr; align-items: start; }
  .contact-links { justify-items: start; }
  .site-footer { display: block; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: 0.01ms !important; }
  [data-reveal] { opacity: 1; transform: none; }
}
