/* ============================================
   Les coloCATaires - main stylesheet
   ============================================ */

:root {
  --bg: #fdf6ee;
  --text: #3a2e28;
  --accent: #e8734a;
  --accent-soft: #f7cbb6;
  --card: #ffffff;
  --border: #e9dccf;
  --shadow: 0 4px 14px rgba(58, 46, 40, 0.12);
}

* { box-sizing: border-box; }

/* the menu anchors scroll to their section smoothly */
html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

/* ---------- Header ---------- */

.site-header {
  text-align: center;
  padding: 2.5rem 1rem 1.5rem;
  background: linear-gradient(180deg, var(--accent-soft), var(--bg));
  border-bottom: 3px solid var(--accent);
}

.site-header h1 {
  margin: 0;
  font-size: clamp(2rem, 6vw, 3.2rem);
  letter-spacing: 1px;
}

/* "CAT" in the title: grey, like a cat waiting for food */
.site-header h1 .grey-name {
  color: #8a8a8a;
}

.tagline {
  margin: 0.5rem 0 0;
  font-style: italic;
  opacity: 0.75;
}

/* ---------- Layout ---------- */

main {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 1rem 3rem;
}

.intro {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem 1.5rem;
  margin-top: 2rem;
  box-shadow: var(--shadow);
}

/* one rule for all headings: no top margin, same space below,
   so the gap below "La última" and below "Les colocataires"
   (and below the intro's own heading) is identical everywhere */
h2 {
  color: var(--accent);
  margin: 0 0 0.75rem;
}

.loading { opacity: 0.6; font-style: italic; }

/* "La última" card: the heading above it already provides the
   0.75rem gap (see the h2 rule); the normal .post margin-top
   would add 2rem too many here */
#latest-post .post { margin-top: 0; }

/* ---------- Post of the moment ---------- */

.post {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem 1.5rem;
  margin-top: 2rem;
  box-shadow: var(--shadow);
}

.post-figure {
  margin: 1rem 0;
  text-align: center;
}

.post-figure img {
  max-width: 100%;
  border-radius: 10px;
  box-shadow: var(--shadow);
}

.post-caption {
  font-style: italic;
  margin: 0.5rem 0 0;
}

.post-meta {
  font-size: 0.85rem;
  opacity: 0.7;
  margin: 0;
  border-top: 1px dashed var(--border);
  padding-top: 0.5rem;
}

/* ---------- Cat grid ---------- */

.gallery { margin-top: 2rem; }

.cat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 1.25rem;
}

.cat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem;
  text-align: center;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  box-shadow: var(--shadow);
}

.cat-card:hover,
.cat-card:focus-visible {
  transform: translateY(-4px);
  box-shadow: 0 8px 20px rgba(58, 46, 40, 0.2);
  outline: none;
}

.cat-avatar {
  width: 110px;
  height: 110px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--accent-soft);
  background: var(--accent-soft);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
}

.cat-card h3 {
  margin: 0.6rem 0 0.2rem;
  color: var(--accent);
}

.cat-card .traits {
  font-size: 0.85rem;
  font-style: italic;
  opacity: 0.75;
  margin: 0;
}

.alias { font-style: italic; font-size: 0.85rem; opacity: 0.7; margin: 0.1rem 0; }

.post-count { font-size: 0.8rem; opacity: 0.6; margin: 0.3rem 0 0; }

.badge {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  font-size: 0.72rem;
  font-family: sans-serif;
  border-radius: 999px;
  padding: 0.15rem 0.6rem;
  margin-top: 0.5rem;
  letter-spacing: 0.5px;
}

/* ---------- Modal ---------- */

.modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.modal.hidden { display: none; }

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(58, 46, 40, 0.6);
}

.modal-body {
  position: relative;
  background: var(--card);
  border-radius: 14px;
  padding: 1.5rem 0 0;
  width: min(640px, 94vw);
  height: min(600px, 85vh);
  display: flex;
  flex-direction: column;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
  overflow: hidden;
}

/* The content scrolls, the footer nav stays put */
.modal-scroll {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 0 1.5rem;
}

.modal-footer-nav {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  border-top: 1px solid var(--border);
  background: var(--card);
  padding: 0.6rem 1rem;
}

.modal-close {
  position: absolute;
  top: 0.5rem;
  right: 0.75rem;
  border: none;
  background: none;
  font-size: 1.8rem;
  cursor: pointer;
  color: var(--text);
  line-height: 1;
  z-index: 5;
}

.modal-close:hover { color: var(--accent); }

/* ---------- Lightbox (click on a picture to magnify) ---------- */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox img {
  position: relative;
  max-width: 92vw;
  max-height: 92vh;
  border-radius: 8px;
  cursor: zoom-out;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
}

.modal-bio { font-style: italic; opacity: 0.8; margin-top: 0.25rem; }

/* Current post: picture scaled to fit and centered */
.post-media {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 0.25rem;
  cursor: zoom-in;
}

.post-media img {
  max-width: 100%;
  max-height: 52vh;
  border-radius: 10px;
  box-shadow: var(--shadow);
  object-fit: contain;
}

.post-media-empty {
  font-size: 3rem;
  padding: 2rem 3rem;
  background: var(--bg);
  border: 1px dashed var(--border);
  border-radius: 10px;
  display: inline-block;
}

.post-head {
  margin-top: 0.75rem;
}

.post-head h4 {
  margin: 0.15rem 0 0;
  color: var(--accent);
}

.post-item-meta {
  margin: 0.25rem 0 0;
  font-size: 0.85rem;
  opacity: 0.75;
  font-style: italic;
}

.post-text {
  margin: 0.6rem 0 0;
  white-space: pre-line;
}

.post-keywords {
  margin: 0.6rem 0 0;
  font-size: 0.8rem;
  color: var(--accent);
}

/* Arrows: shared style (used inside the fixed modal footer) */
.modal-nav {
  border: 1px solid var(--border);
  background: var(--bg);
  border-radius: 50%;
  width: 2.2rem;
  height: 2.2rem;
  font-size: 1.2rem;
  cursor: pointer;
}

.modal-nav:hover {
  background: var(--accent-soft);
}

.post-view-counter {
  font-size: 0.85rem;
  opacity: 0.7;
}

.hidden { display: none; }

/* ---------- Footer ---------- */

.site-footer {
  text-align: center;
  padding: 1.5rem 1rem 2.5rem;
  font-size: 0.9rem;
  opacity: 0.7;
}

/* Cat info page inside the modal (no picture) */
.cat-info-traits {
  font-style: italic;
  opacity: 0.8;
  margin: 0.75rem 0 0;
  border-top: 1px dashed var(--border);
  padding-top: 0.75rem;
}

.post-item-hint {
  margin: 0.6rem 0 0;
  font-size: 0.78rem;
  color: var(--accent);
}

/* ---------- Navigation drawer (shoddy-vegetarian style) ---------- */

.nav-toggle {
  position: fixed;
  top: 0.6rem;
  left: 0.6rem;
  /* just below the modal (z-index 100): when a post is open, the
     dark backdrop covers the hamburger, so it does not interfere */
  z-index: 95;
  width: 2.6rem;
  height: 2.6rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  background: var(--card);
  border-radius: 10px;
  box-shadow: var(--shadow);
  cursor: pointer;
  color: var(--text);
}

.nav-toggle:hover { color: var(--accent); }

.nav-scrim {
  position: fixed;
  inset: 0;
  background: rgba(58, 46, 40, 0.5);
  z-index: 305;
}

.nav-drawer {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: min(280px, 80vw);
  z-index: 310;
  background: var(--card);
  border-right: 1px solid var(--border);
  box-shadow: var(--shadow);
  padding: 2.2rem 0 1rem;
  overflow-y: auto;
  transform: translateX(-100%);
  transition: transform 0.25s ease;
}

.nav-drawer.open { transform: translateX(0); }

.nav-close {
  position: absolute;
  top: 0.5rem;
  right: 0.6rem;
  border: none;
  background: none;
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
  color: var(--text);
}

.nav-close:hover { color: var(--accent); }

.nav-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-list li { display: block; }

.nav-list a {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.5rem 1rem;
  color: var(--text);
  text-decoration: none;
}

.nav-list a:hover {
  background: var(--accent-soft);
  color: var(--accent);
}

.nav-heading {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin: 1.1rem 1rem 0.3rem;
  font-size: 0.85rem;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--accent);
}

/* Hamburger drawn in pure CSS: three bars, no icon font needed */
.nav-toggle .burger {
  width: 1.1rem;
  height: 2px;
  border-radius: 2px;
  background: currentColor;
  box-shadow: 0 -6px 0 currentColor, 0 6px 0 currentColor;
}

/* ---------- Big screens: the menu is a permanent column ---------- */

@media (min-width: 1100px) {

  /* no hamburger, no scrim, no close button */
  .nav-toggle,
  .nav-scrim,
  .nav-close { display: none; }

  /* main becomes a grid: the content keeps its 900px column,
     the menu takes a card column on the right, at the same
     height as the intro (same top margin, same card look) */
  main {
    max-width: 1280px;
    display: grid;
    grid-template-columns: minmax(0, 900px) minmax(240px, 300px);
    column-gap: 2.5rem;
    justify-content: center;
    align-items: start;
  }

  /* the whole content is ONE grid item: the menu card cannot
     stretch the content rows (that was the phantom gap below
     the intro when "La última" shared row 1 with the menu) */
  .content-col {
    grid-column: 1;
    grid-row: 1;
    min-width: 0;
  }

  .nav-drawer {
    grid-column: 2;
    grid-row: 1;
    position: static;
    transform: none;
    transition: none;
    margin-top: 2rem;               /* same height as the intro */
    padding: 1.25rem 0.25rem 1rem;  /* same card look as the intro */
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: var(--shadow);
    max-height: calc(100vh - 4rem);
    overflow-y: auto;
  }

  /* links padded inside the card, without touching its edges */
  .nav-drawer .nav-list a {
    margin: 0.15rem 0.75rem;
    padding: 0.4rem 0.75rem;
    border-radius: 8px;
  }

  .nav-drawer .nav-heading { margin: 1.1rem 1rem 0.3rem; }
}
