/* ===============================
   GLOBAL STYLES FILE — MOBILE FIRST
   =============================== */
/*
  style.css – Base layout, typography, buttons, spinner
  Mobile-first approach
  Shared across all pages
*/

/* ===============================
   1. IMPORTS AND VARIABLES
   =============================== */

@import "./imports/variables.css";
@import "./imports/header.css";
@import "./imports/footer.css";
@import "./imports/alerts.css";
@import "./imports/forms.css";

/* ===============================
   2. RESET & BASE STYLES
   =============================== */

/* Set base font size to 62.5% (10px) so 1rem = 10px */
html {
  font-size: 62.5%;
}

body {
  display: flex; /* Layout utility: ensures footer stays at bottom of viewport on short pages */
  flex-direction: column;
  min-height: 100vh;
  margin: 0;
  background-color: var(--background-color);
  color: var(--text-color-medium);
  font-family: "Merriweather", serif;
  font-size: 1.4rem;
  font-weight: 400;
  line-height: 1.5;
}

main {
  margin: 40px;
  flex-grow: 1; /* Allow main content to grow and push footer down */
}

.nav-left li,
.nav-right li,
.mobile-nav li,
.about-text li,
footer li {
  list-style: none;
}

.mobile-nav ul,
.about-text ul {
  padding: 0;
  margin: 0;
}

/* --------------------------------
   Accessibility Utility Class
   --------------------------------
   Hides elements visually but keeps
   them accessible to screen readers.
   Use for hidden headings.
----------------------------------- */

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ===============================
   3. TYPOGRAPHY & TEXT STYLES
   =============================== */

/* Font family Inter for UI elements */
h1,
h2,
h3,
button,
.edit-button,
#owner-button,
.owner-menu li a,
#mobile-owner-button,
.owner-mobile,
.nav-left li a,
.nav-right li a,
.mobile-nav li a,
.success-message,
.error-message,
.modal p,
input,
textarea,
select,
label,
footer,
.footer-logo p {
  font-family: "Inter", sans-serif;
}

/* Font weights for bold elements */
strong,
button,
.edit-button,
label,
.auth-link a,
.success-message,
.error-message,
.modal p,
#owner-button,
.owner-menu li a,
#mobile-owner-button,
.owner-mobile,
.nav-left li a,
.nav-right li a,
.mobile-nav li a,
footer {
  font-weight: 600;
}

/* Letter spacing */
h1,
h2,
h3,
button,
.edit-button,
#owner-button,
.nav-left li a,
.nav-right li a,
.mobile-nav li a {
  letter-spacing: 0.5px;
}

/* Font sizes */
h1 {
  font-size: 2.6rem;
  text-align: center;
  margin-top: 0;
  margin-bottom: 20px;
}

h2 {
  font-size: 2rem;
}

h3,
#owner-button,
#mobile-owner-button,
.owner-mobile,
.owner-menu li a,
.nav-left li a,
.nav-right li a,
.mobile-nav li a {
  font-size: 1.8rem;
}

input,
textarea,
select,
label,
.modal p {
  font-size: 1.6rem;
}

button,
.edit-button,
.success-message,
.error-message {
  font-size: 1.4rem;
}

small,
footer {
  font-size: 1.2rem;
}

.footer-logo p {
  font-size: 1rem;
}

/* Set color on strong elements */
strong {
  color: var(--text-color-black);
}

/* ===============================
   4. BUTTON STYLES
   =============================== */

/* Shared base styles for buttons */
.primary-button,
.cancel-button,
.delete-button,
.edit-button {
  padding: 10px 20px;
  border-radius: 10px;
  border: 2px solid;
  box-shadow: rgba(0, 0, 0, 0.4) 0 4px 6px;
  cursor: pointer;
  transition: all 0.2s ease-in-out;
}

/* Primary button */
.primary-button {
  background-color: var(--primary-color);
  color: var(--text-color-black);
  border-color: var(--text-color-black);
}

.primary-button:hover {
  background-color: var(--text-color-black);
  color: var(--primary-color);
  border-color: var(--primary-color);
}

/* Cancel and Delete buttons */
.cancel-button,
.delete-button {
  background-color: var(--secondary-color);
  color: var(--text-color-white);
  border-color: var(--text-color-white);
}

.cancel-button:hover,
.delete-button:hover {
  background-color: var(--text-color-white);
  color: var(--secondary-color);
  border-color: var(--secondary-color);
}

/* Edit button - actually an <a> tag styled like a button */
.edit-button {
  background-color: var(--accent-color);
  color: var(--text-color-black);
  border-color: var(--text-color-black);
  padding: 10px 30px;
  text-decoration: none;
}

.edit-button:hover {
  background-color: var(--text-color-black);
  color: var(--accent-color);
  border-color: var(--accent-color);
}

/* ===============================
   5. SPINNER STYLES
   =============================== */

/* Full-page overlay for loading state */
#spinner {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 2000;
  background-color: rgba(255, 255, 255, 0.8);
  justify-content: center;
  align-items: center;
}

/* Spinner styles and animation element */
.loading-spinner {
  width: 60px;
  height: 60px;
  border: 6px solid var(--primary-color);
  border-top: 6px solid var(--secondary-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ===============================
   MEDIA QUERIES
   =============================== */

/* TABLET 768px - 1024px */
@media (min-width: 768px) {
  /* Global */
  body {
    font-size: 1.6rem;
  }

  main {
    margin: 60px;
  }

  /* Typography */
  h1 {
    font-size: 2.8rem;
    margin-bottom: 30px;
  }

  h2 {
    font-size: 2.2rem;
  }

  h3 {
    font-size: 2rem;
  }

  p {
    font-size: 1.6rem;
  }

  small {
    font-size: 1.4rem;
  }

  /* Typography - footer */
  footer {
    font-size: 1.6rem;
  }

  .footer-logo p {
    font-size: 1.4rem;
  }

  /* Buttons */
  button,
  .post-controls .edit-button {
    font-size: 1.6rem;
  }
}

/* DESKTOP (1024px - 1340px) */
@media (min-width: 1024px) {
  /* Global */
  body {
    font-size: 1.8rem;
  }

  main {
    margin: 80px;
  }

  /* Typography */
  h1 {
    font-size: 3.2rem;
    margin-bottom: 40px;
  }

  h2 {
    font-size: 2.4rem;
  }

  h3 {
    font-size: 2.2rem;
  }

  p {
    font-size: 1.8rem;
  }

  /* Typography - header */
  .nav-left a,
  .nav-right a {
    font-size: 2rem;
  }

  /* Buttons */
  button,
  .post-controls .edit-button {
    font-size: 1.8rem;
  }
}
