:root {
  color-scheme: light;
  --background: #f3f4ee;
  --ink: #0b0d09;
  --muted: rgba(11, 13, 9, 0.66);
  --marker: #3b4b30;
  --paper-edge: rgba(59, 75, 48, 0.12);
  --warm: rgba(202, 130, 56, 0.18);
}

[data-theme="dark"] {
  color-scheme: dark;
  --background: #141414;
  --ink: #ffffff;
  --muted: rgba(255, 255, 255, 0.55);
  --marker: rgba(255, 255, 255, 0.35);
  --paper-edge: rgba(255, 255, 255, 0.08);
  --warm: rgba(202, 130, 56, 0.32);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
  background: var(--background);
  transition: background 0.35s ease, color 0.35s ease;
}

body {
  overflow: hidden;
  font-family: "DM Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
  font-weight: 400;
  letter-spacing: 0;
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  text-rendering: geometricPrecision;
}

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

a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

p {
  margin: 0;
}

.page {
  position: relative;
  width: 100%;
  height: 100svh;
  min-height: 560px;
  overflow: hidden;
  background: var(--background);
  transition: background 0.35s ease;
}

[data-theme="dark"] .sandstone-logo {
  box-shadow:
    0 0 0 1px var(--paper-edge),
    0 18px 44px rgba(0, 0, 0, 0.5),
    0 0 72px var(--warm);
  filter: saturate(1.1) contrast(1.05);
}

[data-theme="dark"] .sandstone-logo::after {
  box-shadow: inset 0 0 30px rgba(20, 20, 20, 0.5);
}

.topbar {
  position: absolute;
  top: 24px;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  gap: 32px;
  line-height: 1.6;
  color: var(--muted);
  font-size: 12.3px;
  white-space: nowrap;
}

.mark-stage {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
}

.sandstone-logo {
  --logo-y: -12px;
  position: relative;
  width: clamp(96px, 8vw, 132px);
  aspect-ratio: 1;
  overflow: hidden;
  border-radius: 16px;
  transform: translateY(var(--logo-y));
  background: #d8cdb9;
  box-shadow:
    0 0 0 1px var(--paper-edge),
    0 18px 44px rgba(59, 75, 48, 0.1),
    0 0 54px var(--warm);
  filter: saturate(0.84) contrast(1.02);
  animation: image-logo-breathe 7.2s ease-in-out infinite;
}

.sandstone-logo::after {
  position: absolute;
  inset: 0;
  box-shadow: inset 0 0 30px rgba(243, 244, 238, 0.42);
  content: "";
  pointer-events: none;
}

.sandstone-logo img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 18%;
  transform: scale(1.18);
  opacity: 0.9;
  animation: image-logo-drift 11s ease-in-out infinite;
}

.center-link {
  position: absolute;
  left: 24px;
  right: 24px;
  bottom: calc(100svh * 0.145);
  display: flex;
  justify-content: center;
  line-height: 1.6;
  color: var(--ink);
  font-size: 12.3px;
}

.center-link a {
  position: relative;
}

.footer-grid {
  position: absolute;
  left: 80px;
  right: 80px;
  bottom: 24px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  line-height: 1.6;
  color: var(--muted);
  font-size: 12.3px;
}

.footer-grid p:nth-child(2) {
  text-align: center;
}

.footer-grid p:nth-child(3) {
  text-align: right;
}

/* Info page: topbar + footer dim while body content animates in, then restore */
.info-page .topbar,
.info-page .footer-grid {
  animation: dimRestore 1.8s ease forwards;
}

/* Info page: body content staggered reveal */
.info-page .info-copy > * {
  opacity: 0;
  animation: fadeInUp 0.5s ease both;
}

.info-page .info-copy > *:nth-child(1) { animation-delay: 0.2s; }
.info-page .info-copy > *:nth-child(2) { animation-delay: 0.4s; }
.info-page .info-copy > *:nth-child(3) { animation-delay: 0.6s; }
.info-page .info-copy > *:nth-child(4) { animation-delay: 0.8s; }

.info-page .center-link {
  opacity: 0;
  animation: fadeInUp 0.5s ease both;
  animation-delay: 0.85s;
}

/* Home page: staggered reveal on load / back navigation */
.home .topbar {
  opacity: 0;
  animation: fadeInUp 0.5s ease both;
  animation-delay: 0.1s;
}

.home .mark-stage {
  opacity: 0;
  animation: fadeInUp 0.6s ease both;
  animation-delay: 0.3s;
}

.home .center-link {
  opacity: 0;
  animation: fadeInUp 0.5s ease both;
  animation-delay: 0.6s;
}

.home .footer-grid {
  opacity: 0;
  animation: fadeInUp 0.5s ease both;
  animation-delay: 0.8s;
}

.info-copy {
  position: absolute;
  top: 50%;
  left: 50%;
  width: min(640px, calc(100% - 48px));
  transform: translate(-50%, -50%);
  color: var(--ink);
  font-size: 12.3px;
  line-height: 1.5;
}

.info-copy p + p {
  margin-top: 24px;
}

.info-copy a {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 3px;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes dimRestore {
  0%   { opacity: 0.2; }
  60%  { opacity: 0.2; }
  100% { opacity: 1; }
}

@keyframes image-logo-breathe {
  0%,
  100% {
    transform: translateY(var(--logo-y)) scale(0.985);
    box-shadow:
      0 0 0 1px var(--paper-edge),
      0 18px 44px rgba(59, 75, 48, 0.1),
      0 0 42px rgba(202, 130, 56, 0.12);
  }

  50% {
    transform: translateY(calc(var(--logo-y) - 3px)) scale(1.025);
    box-shadow:
      0 0 0 1px rgba(59, 75, 48, 0.18),
      0 22px 52px rgba(59, 75, 48, 0.14),
      0 0 64px rgba(202, 130, 56, 0.22);
  }
}

@keyframes image-logo-drift {
  0%,
  100% {
    object-position: 50% 18%;
    transform: scale(1.18);
  }

  50% {
    object-position: 52% 14%;
    transform: scale(1.24);
  }
}

@media (max-width: 760px) {
  body {
    overflow: auto;
  }

  .page {
    min-height: 640px;
  }

  .topbar {
    top: 28px;
    gap: 24px;
  }

  .sandstone-logo {
    --logo-y: -24px;
    width: 112px;
  }

  .center-link {
    bottom: 120px;
  }

  .footer-grid {
    left: 20px;
    right: 20px;
    bottom: 20px;
    grid-template-columns: 1fr;
    gap: 9px;
  }

  .footer-grid p,
  .footer-grid p:nth-child(2),
  .footer-grid p:nth-child(3) {
    text-align: center;
  }

  .info-copy {
    top: 47%;
    width: min(640px, calc(100% - 40px));
    font-size: 15px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .sandstone-logo,
  .sandstone-logo img {
    animation: none;
  }
}
