:root {
  --bg: #ffffff;
  --text: #111;
  --muted: #666;
  --border: #ddd;
  --accent: #000;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, sans-serif;
}

/* BODY grid: main content + footer fixed */
body {
  display: grid;
  grid-template-rows: 1fr auto;
  min-height: 100vh;
}

/* MAIN content area - centered vertically + horizontally */
main {
  max-width: 900px;
  width: 90vw;
  margin: 0 auto;
  padding: 0 2rem;
  display: grid;
  place-content: center; /* vertical + horizontal centering */
  min-height: calc(100vh - 60px); /* reserve footer space */
  box-sizing: border-box;
}

/* Headings */
h1 {
  margin-bottom: 1rem;
  font-weight: 700;
  font-size: 2.8rem;
  text-align: center;
}

h2 {
  margin: 1.5rem 0 1rem;
  font-size: 1.8rem;
  font-weight: 600;
  text-align: center;
}

.muted {
  color: var(--muted);
  font-size: 1.1rem;
  text-align: center;
}

/* Inputs */
input {
  width: 100%;
  padding: 1.25rem;
  margin-bottom: 1.25rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  font-size: 1.1rem;
  font-weight: 400;
  box-sizing: border-box;
}

/* Buttons */
button.primary {
  margin-top: 1.5rem;
  padding: 1.25rem 3rem;
  border-radius: 999px;
  border: none;
  background: var(--accent);
  color: white;
  font-size: 1.4rem;
  cursor: pointer;
  font-weight: 600;
  justify-self: center;
  display: block;
}

button.primary:hover {
  opacity: 0.9;
}

/* Page logic */
.page {
  display: none;
}

.page.active {
  display: grid;
  grid-template-columns: 1fr;
  justify-items: stretch;
}

/* Footer styles */
footer {
  background: var(--bg);
  border-top: 1px solid var(--border);
  padding: 1.5rem 1rem;
  box-shadow: 0 -2px 5px rgb(0 0 0 / 0.05);
}

/* Footer grid - mobile stack */
.footer-grid {
  max-width: 900px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.5rem;
  font-size: 0.9rem;
  text-align: center;
}

footer a {
  text-decoration: none;
  color: var(--muted);
}

/* Center thank-you message */
.thank-you {
  text-align: center;
  font-size: 1.6rem;
  font-weight: 600;
  margin-top: 2rem;
}

/* Disabled button style */
button.primary:disabled {
  background: #aaa;
  cursor: not-allowed;
  opacity: 0.6;
}


/* ----------- DESKTOP LAYOUT ----------- */
@media (min-width: 768px) {

  /* Keep main container full height minus footer and center content */
  main {
    min-height: calc(100vh - 70px);
    padding: 0 3rem;
  }

  h1 {
    font-size: 3.2rem;
  }

  h2 {
    font-size: 2.2rem;
  }

  .muted {
    font-size: 1.2rem;
  }

  input {
    font-size: 1.2rem;
    padding: 1.5rem;
  }

  button.primary {
    font-size: 1.6rem;
    padding: 1.5rem 4rem;
  }

  /* Footer fixed at bottom with horizontal columns */
  footer {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 1rem 4rem;
    box-shadow: 0 -3px 8px rgb(0 0 0 / 0.12);
    background: var(--bg);
  }

  .footer-grid {
    max-width: 1100px;
    margin: 0 auto;
    grid-template-columns: repeat(3, 1fr);
    text-align: left;
  }
}
