:root {
  --bg-page: #f6f6f3;
  --text-primary: #1a1a1a;
  --text-secondary: #2a2a2a;
  --text-muted: #32325d;
  --text-muted-hover: #1a1a1a;
  --mono-font: "SF Mono", "Monaco", "Inconsolata", "Roboto Mono", "Courier New", monospace;
  --sans-font: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --serif-font: "Crimson Text", Georgia, "Times New Roman", serif;
  --fade-in-fast: fadeIn 0.6s ease-in;
  --fade-in-base: fadeIn 0.8s ease-in;
  --home-logo-entrance: fadeIn 0.6s ease-in both;
  --home-about-entrance: fadeIn 0.8s ease-in 0.65s both;
  --home-contact-entrance: fadeInContact 0.8s ease-in 0.65s both;
  --error-fade: fadeIn 0.8s ease-in both;
  --logo-width: 180px;
  --logo-width-compact: 160px;
  --about-flow-gap: 2.2rem;
  --logo-to-about-gap: 3rem;
  --about-flow-gap-mobile: 1.8rem;
  --logo-to-about-gap-mobile: 2.5rem;
  --about-flow-gap-compact: 2rem;
  --logo-to-about-gap-compact: 2rem;
  --home-bg-opacity: 0.1;
  --home-logo-filter: drop-shadow(0 0 24px rgba(246, 246, 243, 0.98)) drop-shadow(0 1px 2px rgba(20, 20, 19, 0.2));
  --home-about-color: #222220;
  --home-about-lead-color: #141413;
  --home-about-shadow: 0 0 26px rgba(246, 246, 243, 0.99), 0 0 12px rgba(246, 246, 243, 0.92), 0 1px 1px rgba(246, 246, 243, 0.78);
  --home-contact-color: #2a2a2a;
  --home-contact-shadow: 0 0 22px rgba(246, 246, 243, 0.99), 0 0 10px rgba(246, 246, 243, 0.92), 0 1px 1px rgba(246, 246, 243, 0.78);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background-color: var(--bg-page);
  font-family: var(--sans-font);
  position: relative;
  padding: 2rem 1rem;
  padding-bottom: 5rem;
}

.home-page {
  position: relative;
  min-height: 100vh;
  isolation: isolate;
}

.home-page::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image: url("images/isometric-sketch.jpg");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  mix-blend-mode: multiply;
  opacity: var(--home-bg-opacity);
  z-index: 0;
  pointer-events: none;
}

.home-page .logo-container img {
  filter: var(--home-logo-filter);
  animation: var(--home-logo-entrance);
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes fadeInContact {
  from { opacity: 0; }
  to { opacity: 0.85; }
}

.logo-container {
  text-align: center;
  flex-shrink: 0;
}

.logo-container img {
  width: min(100%, var(--logo-width));
  max-width: var(--logo-width);
  height: auto;
  display: inline-block;
  animation: var(--fade-in-fast);
}

.contact,
.error-page .error-code,
.error-page .error-message,
.error-page .home-link {
  font-family: var(--mono-font);
  color: var(--text-muted);
  letter-spacing: 0.02em;
  font-weight: 400;
}

.contact {
  font-size: 0.95rem;
  text-align: center;
  opacity: 0.85;
  transition: opacity 0.2s ease;
  position: absolute;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
}

.contact:hover {
  opacity: 1;
}

.contact a {
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.2s ease;
}

.contact a:hover {
  color: var(--text-muted-hover);
}

.home-page .content-wrapper {
  max-width: 600px;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--logo-to-about-gap);
  position: relative;
  z-index: 1;
  /* No separate fill — same “paper” as the page. Opaque tints would hide the sketch behind this column. */
  background-color: transparent;
}

.home-page .about {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: var(--about-flow-gap);
  color: var(--home-about-color);
  text-shadow: var(--home-about-shadow);
  line-height: 1.85;
  font-size: 1.25rem;
  letter-spacing: 0.01em;
  font-family: var(--serif-font);
  font-weight: 400;
  animation: var(--home-about-entrance);
}

.home-page .about p {
  margin: 0;
  text-align: left;
}

.home-page .about p:first-of-type {
  line-height: 1.85;
  color: var(--home-about-lead-color);
}

.error-page .logo-container {
  margin-bottom: 2.75rem;
}

.error-page .error-content {
  text-align: center;
  flex-shrink: 0;
}

.home-page .contact {
  color: var(--home-contact-color);
  text-shadow: var(--home-contact-shadow);
  z-index: 1;
  animation: var(--home-contact-entrance);
}

.error-page .error-code,
.error-page .error-message,
.error-page .home-link {
  animation: var(--error-fade);
}

.error-page .error-code {
  font-size: 3rem;
  margin-bottom: 1rem;
  animation-delay: 0.2s;
}

.error-page .error-message {
  font-size: 1rem;
  opacity: 0.85;
  margin-bottom: 2rem;
  animation-delay: 0.4s;
}

.error-page .home-link {
  display: inline-block;
  font-size: 0.95rem;
  text-decoration: none;
  opacity: 0.85;
  transition: opacity 0.2s ease, color 0.2s ease;
  animation-delay: 0.6s;
}

.error-page .home-link:hover {
  opacity: 1;
  color: var(--text-muted-hover);
}

@media (max-width: 768px) {
  .home-page .content-wrapper {
    gap: var(--logo-to-about-gap-mobile);
    max-width: 80%;
  }

  .home-page .about {
    font-size: 1rem;
    line-height: 1.7;
    gap: var(--about-flow-gap-mobile);
  }

  .home-page .about p:first-of-type {
    line-height: 1.75;
  }
}

@media (max-height: 500px) {
  body {
    padding: 1rem;
    padding-bottom: 4rem;
  }

  .logo-container img {
    width: min(100%, var(--logo-width-compact));
    max-width: var(--logo-width-compact);
  }

  .contact {
    bottom: 1rem;
  }

  .home-page .content-wrapper {
    gap: var(--logo-to-about-gap-compact);
  }

  .home-page .about {
    font-size: 0.95rem;
    gap: var(--about-flow-gap-compact);
  }

  .home-page .about p:first-of-type {
    line-height: 1.7;
  }

  .error-page .logo-container {
    margin-bottom: 1rem;
  }

  .error-page .error-code {
    font-size: 2rem;
  }

  .error-page .error-message {
    font-size: 0.9rem;
    margin-bottom: 1rem;
  }
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg-page: #1a1714;
    --text-primary: #e8ddd0;
    --text-secondary: #d6cabd;
    --text-muted: #b7aa9a;
    --text-muted-hover: #e8ddd0;
    --home-bg-opacity: 0.08;
    --home-logo-filter: drop-shadow(0 0 20px rgba(26, 23, 20, 0.95)) drop-shadow(0 1px 2px rgba(232, 221, 208, 0.14));
    --home-about-color: #d9cebf;
    --home-about-lead-color: var(--text-primary);
    /* Fewer shadow layers = less repaint while opacity fades (smoother in dark mode). */
    --home-about-shadow: 0 0 22px rgba(26, 23, 20, 0.96), 0 1px 2px rgba(26, 23, 20, 0.55);
    --home-contact-color: #cabdac;
    --home-contact-shadow: 0 0 18px rgba(26, 23, 20, 0.96), 0 1px 2px rgba(26, 23, 20, 0.55);
    /* Smoother easing + clearer sequence (logo → about → contact) than light mode. */
    --home-logo-entrance: fadeIn 0.5s cubic-bezier(0.22, 1, 0.36, 1) both;
    --home-about-entrance: fadeIn 0.7s cubic-bezier(0.22, 1, 0.36, 1) 0.58s both;
    --home-contact-entrance: fadeInContact 0.55s cubic-bezier(0.22, 1, 0.36, 1) 1.2s both;
  }

  /*
   * One compositing layer for the whole logo+about column (not per child) avoids a faint
   * “card” tone shift vs the rest of the page during the entrance animation.
   */
  .home-page .content-wrapper {
    transform: translateZ(0);
    backface-visibility: hidden;
  }
}

@media (prefers-reduced-motion: reduce) {
  .logo-container img,
  .home-page .logo-container img,
  .home-page .about,
  .home-page .contact,
  .error-page .error-code,
  .error-page .error-message,
  .error-page .home-link {
    animation: none;
  }
}
