:root {
  --bg: #f5efe6;
  --paper: #fffaf5;
  --paper-strong: #efe2d1;
  --ink: #1c2b45;
  --muted: #526177;
  --line: rgba(28, 43, 69, 0.14);
  --accent: #b95c3b;
  --accent-deep: #8c3e22;
  --accent-soft: #ead2c4;
  --shadow: 0 10px 30px rgba(34, 32, 28, 0.05);
  --radius-xl: 24px;
  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 999px;
  --max-width: 1080px;
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Manrope", "Avenir Next", "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    linear-gradient(180deg, #fbf7f2 0%, var(--bg) 100%);
}

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

.site-shell {
  width: min(calc(100% - 2rem), var(--max-width));
  margin: 0 auto;
  padding: 1.5rem 0 4rem;
}

.site-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.site-header {
  margin-bottom: 2rem;
  padding: 0.75rem 0 1.25rem;
  border-bottom: 1px solid var(--line);
}

.brand {
  font-size: 0.84rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  flex-wrap: wrap;
}

.site-nav a {
  padding: 0.72rem 0.88rem;
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-weight: 600;
}

.site-nav a[aria-current="page"] {
  background: rgba(28, 43, 69, 0.06);
  color: var(--ink);
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(260px, 0.78fr);
  gap: 2rem;
  align-items: start;
  padding: 3rem 0 2rem;
}

.hero-main {
  max-width: 48rem;
}

.hero h1,
.page-hero h1,
.section h2,
.mosaic-card h3,
.project-card h2 {
  margin: 0;
  font-family: "Instrument Serif", Georgia, serif;
  font-weight: 400;
  letter-spacing: -0.03em;
}

.hero h1 {
  font-size: clamp(4rem, 9vw, 6.4rem);
  line-height: 0.95;
  white-space: nowrap;
}

.hero-lead,
.page-lead,
.mosaic-card p,
.project-card p,
.note-list li {
  color: var(--muted);
  font-size: 1.06rem;
  line-height: 1.85;
}

.hero-lead {
  max-width: 43rem;
  margin: 1.75rem 0 0;
  font-size: 1.06rem;
}

.hero-actions {
  display: flex;
  gap: 0.9rem;
  flex-wrap: wrap;
  margin-top: 2rem;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 3.25rem;
  padding: 0.9rem 1.35rem;
  border-radius: var(--radius-sm);
  font-weight: 700;
  transition: transform 160ms ease, background 160ms ease, border-color 160ms ease;
}

.button:hover,
.site-nav a:hover {
  transform: translateY(-1px);
}

.button-primary {
  background: var(--ink);
  color: #fff;
}

.button-secondary {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.66);
}

.hero-note {
  margin-top: 0.8rem;
  padding: 1.1rem 0 0 1.3rem;
  border-left: 2px solid var(--accent-soft);
}

.section-label,
.project-meta {
  margin: 0 0 0.8rem;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent-deep);
}

.note-list {
  margin: 0;
  padding-left: 1.2rem;
}

.note-list li + li {
  margin-top: 0.7rem;
}

.section,
.page-hero {
  margin-top: 2rem;
}

.section {
  padding: 2.2rem 0;
}

.section-contrast {
  padding: 2rem 0;
  border-top: 1px solid var(--line);
  border-bottom: 0;
}

.section-intro {
  display: grid;
  gap: 0.45rem;
  margin-bottom: 1.5rem;
}

.section h2,
.page-hero h1 {
  font-size: clamp(2.4rem, 5vw, 4rem);
  line-height: 0.98;
  max-width: none;
}

.mosaic-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr;
  gap: 1rem;
}

.mosaic-card {
  position: relative;
  min-height: 12rem;
  padding: 1.25rem;
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.58);
  border: 1px solid var(--line);
  overflow: hidden;
}

.mosaic-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
  pointer-events: none;
}

.mosaic-card > * {
  position: relative;
  z-index: 1;
}

.mosaic-card-tall {
  grid-row: span 2;
}

.mosaic-card-accent {
  background: rgba(185, 92, 59, 0.1);
  border-color: rgba(185, 92, 59, 0.2);
}

.mosaic-card-ml {
  background: #dfe8f4;
}

.mosaic-card-ml::before {
  background-image:
    linear-gradient(180deg, rgba(223, 232, 244, 0.68), rgba(223, 232, 244, 0.86)),
    url("/assets/interest-ml.svg");
  background-size: cover, 74%;
  background-position: center, right bottom;
}

.mosaic-card-imaging {
  background: #dfe9f1;
}

.mosaic-card-imaging::before {
  background-image:
    linear-gradient(180deg, rgba(208, 220, 234, 0.62), rgba(208, 220, 234, 0.86)),
    url("/assets/mri.jpg");
  background-size: cover, cover;
  background-position: center, center;
}

.mosaic-card-bio {
  background: #f3e0d8;
}

.mosaic-card-bio::before {
  background-image:
    linear-gradient(180deg, rgba(243, 224, 216, 0.66), rgba(243, 224, 216, 0.88)),
    url("/assets/interest-bio.svg");
  background-size: cover, 28%;
  background-position: center, calc(100% + 6px) -10px;
}

.mosaic-card-software {
  background: #2a2325;
  border-color: rgba(28, 43, 69, 0.24);
}

.mosaic-card-software::before {
  background-image:
    linear-gradient(180deg, rgba(27, 22, 24, 0.58), rgba(27, 22, 24, 0.82)),
    url("/assets/hacker.jpg");
  background-size: cover, cover;
  background-position: center, center;
}

.mosaic-card-software h3,
.mosaic-card-software p {
  color: #fffaf5;
}

.mosaic-card-robotics {
  background: #dfe4df;
}

.mosaic-card-robotics::before {
  background-image:
    linear-gradient(180deg, rgba(223, 228, 223, 0.44), rgba(223, 228, 223, 0.78)),
    url("/assets/i-robot.jpg");
  background-size: cover, 135%;
  background-position: center, 44% 38%;
}

.mosaic-card-robotics h3,
.mosaic-card-robotics p {
  color: #14253f;
  text-shadow: 0 1px 8px rgba(255, 248, 240, 0.16);
}

.mosaic-card-imaging p {
  color: #39495f;
  font-weight: 700;
}

.mosaic-card-personal {
  min-height: 8.5rem;
  background: rgba(255, 250, 244, 0.72);
}

.mosaic-card-break {
  margin-top: 0.9rem;
}

.mosaic-card-personal:not(.mosaic-card-yoga):not(.mosaic-card-bouldering):not(.mosaic-card-tv)::before {
  background-image: none;
}

.mosaic-card-personal h3 {
  font-size: 1.7rem;
}

.mosaic-card-personal p {
  max-width: 18rem;
}

.mosaic-card-yoga {
  background: #efe2d8;
}

.mosaic-card-yoga::before {
  background-image:
    linear-gradient(180deg, rgba(244, 236, 228, 0.52), rgba(244, 236, 228, 0.76)),
    url("/assets/yoga.jpg");
  background-size: cover, 122%;
  background-position: center, 88% center;
}

.mosaic-card-bouldering {
  background: #eadfd3;
}

.mosaic-card-bouldering::before {
  background-image:
    linear-gradient(180deg, rgba(236, 227, 217, 0.54), rgba(236, 227, 217, 0.7)),
    url("/assets/bouldering.jpg");
  background-size: cover, cover;
  background-position: center, center;
}

.mosaic-card-yoga p,
.mosaic-card-bouldering p {
  color: #24344c;
  font-weight: 500;
  text-shadow: 0 1px 10px rgba(255, 248, 240, 0.16);
}

.mosaic-card-tv {
  background: #e6dde8;
}

.mosaic-card-tv::before {
  background-image:
    linear-gradient(180deg, rgba(230, 221, 232, 0.22), rgba(230, 221, 232, 0.4)),
    url("/assets/tv_icon.png");
  background-size: cover, 54px;
  background-position: center, calc(100% - 16px) 10px;
  background-repeat: no-repeat;
}

.mosaic-card h3 {
  font-size: 2rem;
  margin-bottom: 0.8rem;
}

.project-card {
  padding: 1.45rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.55);
  box-shadow: var(--shadow);
}

.project-card {
  display: grid;
  gap: 1rem;
  align-content: start;
}

.project-card-link {
  text-decoration: none;
}

.project-card h2 {
  font-size: 2rem;
  margin-bottom: -1rem;
}

.page-hero {
  padding: 2rem 0 1.5rem;
}

.home-contact {
  margin-top: 2.5rem;
  padding-top: 1.4rem;
  border-top: 1px solid var(--line);
}

.home-contact .section-label {
  font-family: "Instrument Serif", Georgia, serif;
  font-size: clamp(2.1rem, 4vw, 3rem);
  font-weight: 400;
  letter-spacing: -0.03em;
  text-transform: none;
  color: var(--ink);
  margin-bottom: 0.7rem;
}

.home-contact-row {
  display: flex;
  align-items: baseline;
  gap: 0.9rem;
  flex-wrap: wrap;
}

.home-contact-email,
.home-contact-links {
  font-family: "Instrument Serif", Georgia, serif;
  font-size: clamp(0.98rem, 1.58vw, 1.35rem);
  font-weight: 400;
  letter-spacing: -0.01em;
  line-height: 1.3;
}

.home-contact-links {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.project-stack {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.project-image-frame {
  min-height: 220px;
  border-radius: 16px;
  border: 1px solid var(--line);
  overflow: hidden;
}

.project-image {
  display: block;
  width: 100%;
  height: 220px;
  object-fit: cover;
  object-position: center;
}

.project-image-life {
  background: #ffffff;
  object-fit: contain;
}

.project-image-robocop {
  object-position: center 10%;
}

.project-image-dinomaze {
  background: #dbe5db;
  object-fit: contain;
  object-position: center 10%;
}

.project-image-heartreach {
  background: #d7e4e6;
  object-fit: contain;
}

.project-image-splitbill {
  object-fit: contain;
  object-position: 56% center;
  transform: scale(1.06);
}

@media (max-width: 960px) {
  .hero,
  .mosaic-grid,
  .project-stack {
    grid-template-columns: 1fr;
  }

  .hero {
    align-items: start;
  }

  .hero h1 {
    white-space: normal;
  }

  .mosaic-card,
  .mosaic-card-tall {
    min-height: auto;
    grid-row: auto;
  }

  .mosaic-card-personal {
    min-height: clamp(8.5rem, 24vw, 10rem);
  }
}

@media (max-width: 640px) {
  .site-shell {
    width: min(calc(100% - 1rem), var(--max-width));
    padding-top: 0.75rem;
  }

  .site-header {
    margin-bottom: 1rem;
  }

  .hero {
    padding-top: 2rem;
  }

  .hero h1 {
    font-size: clamp(3.4rem, 18vw, 5rem);
  }

  .section-contrast {
    padding: 1.3rem;
  }

  .button {
    width: 100%;
  }

  .hero-actions {
    flex-direction: column;
  }
}
