/* ====================================================
   1. Base font for headings, links, and paragraphs
==================================================== */
h1,
h2,
h3,
a,
textarea,
p {
  font-family: sans-serif;
}

html,
body {
  height: 100%;
  margin: 0;
  padding: 0;
}

body {
  display: flex;
  flex-direction: column;
}

main {
  flex: 1 0 auto; /* grow to fill any available vertical space */
}

/* ====================================================
   2. App gallery styles (desktop: 3-per-row, centered)
==================================================== */
.site-header {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center; /* center the .header-title horizontally */
  padding: 10px 5px; /* give enough vertical padding */
  background-color: #fafafa;
  border-bottom: 1px solid #ddd;
  min-height: 70px; /* ensure there's room for the title */
}

/* Avatar sits on the very left */
.header-avatar {
  width: 60px;
  height: 60px;
  border-radius: 20%;
  position: absolute;
  left: 5px; /* inside padding of 5px */
  top: 50%;
  transform: translateY(-50%);
}

/* Title block remains centered */
.header-title {
  text-align: center;
  z-index: 1; /* sit above any background */
}

.header-title h1 {
  margin: 0;
  font-size: 1.25rem;
}

.header-title p {
  margin: 2px 0 0;
  font-size: 1rem;
  color: #555;
}

.app-gallery {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem; /* space between items */
  justify-content: center; /* center the row of items */
  margin: 2rem auto 0; /* top margin, auto‐center */
  max-width: calc(3 * 200px + 2 * 1.5rem); /* exactly 3 items @200px + 2 gaps */
}

.app-item {
  width: 200px;
  text-align: center;
}

.app-item img {
  width: 100%;
  height: auto;
  border-radius: 8px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.app-item h3 {
  margin: 0.5rem 0 0;
  font-size: 1.1rem;
  color: #004080;
}

.profile-image {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  margin: 0;
}

/* ====================================================
   3. Footer (pinned to bottom on desktop)
==================================================== */
footer {
  position: relative;
  text-align: center;
  margin-top: 1rem; /* space above footer */
}

footer p {
  text-align: center;
  font-size: 0.9rem;
  color: #666;
  margin-top: 2rem;
}

/* ====================================================
   4. Contact form styles (desktop)
==================================================== */
.contact-form {
  max-width: 480px;
  margin: 2rem auto;
  display: flex;
  flex-direction: column;
  font-family: sans-serif;
}

.contact-form label {
  margin-bottom: 0.5rem;
  font-size: 1rem;
}

.contact-form input[type="text"],
.contact-form input[type="email"],
.contact-form textarea {
  margin-bottom: 1rem;
  padding: 0.5rem;
  font-size: 1rem;
  border: 1px solid #ccc;
  border-radius: 4px;
}

.contact-form textarea {
  resize: vertical; /* allow vertical resize if needed */
}

.contact-form button[type="submit"] {
  background: #007acc;
  color: white;
  border: none;
  padding: 0.75rem 1rem;
  font-size: 1rem;
  cursor: pointer;
  border-radius: 4px;
}

.contact-form button[type="submit"]:hover {
  background: #005fa3;
}

/* ====================================================
   5. Responsive breakpoints
==================================================== */

/* --- Tablet & small desktop (≤768px) --- */
@media (max-width: 768px) {
  /* Collapse gallery to 2 columns */
  .app-gallery {
    max-width: calc(2 * 200px + 1 * 1.5rem); /* 2 items @200px + 1 gap */
  }

  /* Keep .app-item at 200px, so two items fit */
  .app-item {
    width: 200px;
  }

  /* Contact form: full width but with side padding */
  .contact-form {
    max-width: 100%;
    padding: 0 1rem;
  }
}

/* --- Mobile (≤480px) --- */
@media (max-width: 480px) {
  .site-header {
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 10px 5px;
    min-height: auto; /* let content define height */
  }

  .header-avatar {
    position: static;
    transform: none;
    margin-bottom: 5px;
  }

  .header-title {
    position: static;
  }
  /* Collapse gallery to 1 column */
  .app-gallery {
    max-width: 100%; /* let the container fill the width */
    gap: 1rem; /* slightly smaller gaps */
    margin: 1.5rem auto 0; /* reduce top margin on very small screens */
  }

  /* Each .app-item takes full available width (minus gaps) */
  .app-item {
    width: 100%;
    max-width: 360px; /* optional: prevent it from growing too wide */
  }

  /* Contact form: stack full width */
  .contact-form {
    max-width: 100%;
    padding: 0 1rem;
    margin: 1.5rem auto;
  }

  .contact-form input[type="text"],
  .contact-form input[type="email"],
  .contact-form textarea {
    font-size: 0.95rem;
  }

  .contact-form button[type="submit"] {
    font-size: 0.95rem;
    padding: 0.6rem 0.8rem;
  }
}
