/* ===== Variables ===== */

:root {
  /* Colors */
  --color-white: #fff;

  /* Spacing scale */
  --space-sm: 0.5rem;
  --space-md: 0.75rem;
  --space-lg: 1rem;
  --space-xl: 2rem;
}

/* ===== Global layout ===== */

html,
body {
  height: 100%;
}

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

  background: #2c3e50;
  color: #f4f4f4;
  font-family: "Helvetica", Arial, sans-serif;
  line-height: 1.6;
}

.future-font {
  font-family: "Orbitron", sans-serif;
  letter-spacing: 0.2em;
}

main {
  flex: 1;
}

/* ===== Global typography and spacing ===== */

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

.main-title,
.section-title {
  color: var(--color-white);
}

.main-title {
  margin-bottom: var(--space-lg);
}

.introduction p + p,
section p + p {
  margin-top: var(--space-lg);
}

.intro {
  margin-bottom: var(--space-xl);
}

.section-title {
  margin-block: var(--space-xl) var(--space-lg);
}

.subheading {
  color: var(--color-white);
  font-size: 1.25rem;
  margin-block: 1.5rem var(--space-md);
}

p {
  text-align: justify;
  font-size: 1.125rem;
  hyphens: auto;
}

a {
  color: #1abc9c;
  text-decoration: none;
}

a:hover {
  color: #16a085;
  text-decoration: underline;
}

ul {
  list-style: none;
  padding: 0;
}

section + section {
  margin-top: var(--space-xl);
}

/* ===== Containers ===== */

.main-index {
  margin: 0 auto;
  max-width: 43.75rem;
  padding: var(--space-xl);
}

footer p {
  margin: 0 auto;
  max-width: 40ch;
  text-align: center;
}

footer {
  background-color: #1a252f;
  padding: 1rem;
}

/* ===== Only for all posts ===== */

.main-content {
  margin: var(--space-lg) 3.75rem;
}

.post-list li {
  margin-top: var(--space-md);
}

.post-list li:last-child {
  margin-bottom: var(--space-lg);
}

/* ===== Only for homepage ===== */

.hero-identity {
  margin-bottom: var(--space-lg);
}

.avatar {
  border-radius: 50%;
}

.latest-posts .section-title {
  padding: var(--space-lg) 0 var(--space-sm);
}

.post-grid ul {
  display: grid;
  gap: 1.5rem;
  grid-template-columns: 1fr;
  margin-top: var(--space-lg);
}

.post-card {
  background-color: #fdfdfd;
  border: 1px solid #ddd;
  border-radius: 12px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
  color: black;
  padding: var(--space-lg);
  transition: transform 0.2s ease;
}

.post-card:hover {
  transform: translateY(-4px);
}

.post-title {
  font-size: 1.25rem;
  margin-bottom: var(--space-sm);
}

.post-date {
  color: #000;
  font-size: 0.875rem;
}

/* ===== FIX: Prevent justify bug ===== */
.post-description {
  margin: var(--space-sm) 0 var(--space-sm) var(--space-lg);
}

.read-more {
  color: #ff4500;
  font-weight: bold;
  text-decoration: none;
}

.view-posts {
  display: inline-block;
  padding-top: var(--space-md);
}

/* ===== Specific post styling ===== */

.problems-section .subheading {
  color: #ccc;
  font-weight: 600;
}

ul.tools-list {
  list-style: disc;
  padding-left: 1.5rem;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.4rem 2rem;
  align-items: start;
}

/* ===== Mobile Styles ===== */

@media (max-width: 396px) {
  body {
    font-size: 1rem;
  }

  .main-title {
    font-size: 1.75rem;
    line-height: 1.2;
  }

  .section-title {
    font-size: 1.5rem;
    line-height: 1.3;
  }

  .subheading {
    font-size: 1.125rem;
  }

  p {
    font-size: 1rem;
    line-height: 1.5;
  }

  .post-description {
    text-align: left;
  }

  .post-title,
  .index-subheading {
    font-size: 1.125rem;
  }

  .post-date,
  .meta-date {
    font-size: 0.875rem;
  }

  .main-index,
  .main-content {
    padding: var(--space-lg);
    margin: 0 auto;
  }

  .post-card {
    padding: var(--space-md);
  }

  .view-posts {
    font-size: 1rem;
  }

  footer p {
    font-size: 0.9375rem;
  }
}

@media (max-width: 333px) {
  footer p {
    font-size: 0.875rem;
    line-height: 1.4;
    padding-inline: var(--space-sm);
  }

  .main-title {
    font-size: 1.5rem;
    line-height: 1.2;
  }

  .section-title {
    font-size: 1.25rem;
    line-height: 1.3;
  }

  .subheading {
    font-size: 1rem;
  }

  p {
    font-size: 0.9375rem;
    line-height: 1.5;
  }
}
