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

:root {
  --text-main: #1d1d1f;
  --text-muted: #6e6e73;
  --bg-main: #ffffff;
  --bg-alt: #f5f5f7;
  --border-soft: #e5e5ea;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text",
               "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--text-main);
  background: var(--bg-main);
  line-height: 1.6;

  /* Sticky footer fix */
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

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

main {
  flex: 1;
}

.wrap {
  max-width: 880px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

section {
  padding: 2rem 0;
}

.section-divider {
  height: 1px;
  max-width: 880px;
  margin: 0 auto;
  background: linear-gradient(
    to right,
    transparent,
    var(--border-soft),
    transparent
  );
}

/* =========================
   Typography
   ========================= */

h1 {
  font-size: 3rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 0 0 0.6rem;
}

h2 {
  font-size: 2rem;
  font-weight: 600;
  margin-bottom: 1.25rem;
}

h3 {
  font-size: 1.25rem;
  margin: 0.5rem 0;
}

.meta {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.subtitle,
.muted {
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* =========================
   Buttons / Actions
   ========================= */

.button,
.site-nav a,
.actions a,
.project-info a,
.discord-button,
.lang-switch,
.back-button {
  display: inline-block;
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 500;
  padding: 0.45rem 0.9rem;
  border-radius: 999px;
  border: 1px solid var(--border-soft);
  background: var(--bg-alt);
  color: var(--text-main);
  transition: all 0.2s ease;
}

.button:hover,
.site-nav a:hover,
.actions a:hover,
.project-info a:hover,
.discord-button:hover,
.lang-switch:hover,
.back-button:hover {
  background: var(--bg-main);
  border-color: var(--text-muted);
  box-shadow: 0 6px 12px rgba(0,0,0,0.08);
  transform: translateY(-1px);
}

.button:active,
.site-nav a:active,
.actions a:active,
.project-info a:active,
.lang-switch:active,
.back-button:active {
  transform: translateY(0);
  box-shadow: 0 3px 6px rgba(0,0,0,0.06);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1rem;
}

.actions.vertical {
  flex-direction: column;
}

/* =========================
   Navigation / Utility UI
   ========================= */

.site-nav {
  display: flex;
  gap: 1rem;
  margin-top: 2rem;
}

.lang-switch {
  position: fixed;
  top: 1.25rem;
  right: calc((100vw - 880px) / 2 + 1.5rem);
  z-index: 1000;
}

.back-button {
  position: fixed;
  top: 1.25rem;
  left: calc((100vw - 880px) / 2 + 1.5rem);
  z-index: 1000;
}

/* =========================
   MAIN PAGE
   ========================= */

.hero {
  padding: 3rem 0 2rem;
}

#projects {
  background: var(--bg-alt);
  padding-bottom: 3rem;
}

.projects-grid {
  display: grid;
  gap: 2.5rem;
}

.project {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 1.75rem;
  background: #fff;
  border-radius: 18px;
  padding: 1.75rem;
  box-shadow: 0 20px 40px rgba(0,0,0,0.04);
}

/* =========================
   Center media vertically
   ========================= */

.project-media,
.project-hero-media {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%; /* takes full grid row height */
}

.project-layout > .project-media,
.project-hero-layout > .project-hero-media {
  align-self: center; /* vertical center in grid cell */
}

.project-media img,
.project-hero-media img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.project-info {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-top: 1rem;
}

/* =========================
   PROJECT PAGES
   ========================= */

.project-hero {
  background: linear-gradient(
    to bottom,
    var(--bg-alt) 85%,
    rgba(245,245,247,0)
  );
  padding-bottom: 2rem;
}

.project-hero-layout {
  display: grid;
  grid-template-columns: 1fr 240px;
  gap: 2rem;
}

.project-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 2rem;
}

.project-meta {
  font-size: 0.9rem;
  position: sticky;
  top: 1rem;
  align-self: start;
}

.project-meta ul {
  list-style: none;
  padding: 0;
  margin: 0 0 1rem;
}

.project-meta li {
  margin-bottom: 0.4rem;
}

.meta-block {
  margin-bottom: 1rem;
}

.warning {
  font-size: 0.85rem;
  color: #8a1f1f;
}

.project-content section {
  margin-bottom: 2rem;
}

/* =========================
   Footer
   ========================= */

.site-footer {
  padding: 3rem 0;
  font-size: 0.85rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border-soft);
  background: linear-gradient(
    to bottom,
    var(--bg-main),
    var(--bg-alt)
  );
}

/* =========================
   Responsive Fixes
   ========================= */

@media (max-width: 768px) {

  h1 {
    font-size: 2.2rem;
  }

  .lang-switch,
  .back-button {
    top: 0.75rem;
    padding: 0.4rem 0.8rem;
    font-size: 0.75rem;
  }

  .project,
  .project-layout,
  .project-hero-layout {
    grid-template-columns: 1fr;
  }

  .project-media,
  .project-hero-media {
    order: -1; /* image on top for mobile */
    align-self: auto; /* remove vertical centering for single column */
  }

  .project-meta {
    position: static;
    background: var(--bg-alt);
    padding: 1rem;
    border-radius: 14px;
  }

  section {
    padding: 1.75rem 0;
  }
}

@media (max-width: 768px) {
  .lang-switch {
    right: 1rem;
    left: auto;
  }
}


@media (max-width: 768px) {
  .back-button {
    left: 1rem;
    right: auto;
  }
}

/* =========================
   Archive tweaks
   ========================= */

.archive .project-content p {
  max-width: 60ch;
}

.archive .project-content h2 {
  margin-top: 2.5rem;
}
