/* ============================================================================
   Cochabamba Guide -- stylesheet
   Palette borrows from the valley itself: terracotta rooftops, andean teal,
   and the warm sand of the adobe walls.
   ========================================================================= */

/* --- Design tokens ------------------------------------------------------
   Everything below refers to these names instead of hard-coded colors, so
   changing the whole site's look means editing this one block. */
:root {
  --bg:          #fbf7f1;   /* warm paper */
  --surface:     #ffffff;   /* cards sit slightly above the page */
  --border:      #e7ddd0;
  --text:        #2c2622;
  --text-muted:  #7a6f65;
  --accent:      #c05621;   /* terracotta */
  --accent-soft: #fceee4;
  --teal:        #1f6f6b;

  --radius: 10px;
  --shadow: 0 1px 2px rgba(44, 38, 34, 0.05),
            0 4px 14px rgba(44, 38, 34, 0.05);
  --font-body: "Source Serif 4", Georgia, "Times New Roman", serif;
  --font-ui:   ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
}

/* Readers who prefer a dark UI get the same palette after dusk. */
@media (prefers-color-scheme: dark) {
  :root {
    --bg:          #1a1715;
    --surface:     #242019;
    --border:      #3a332c;
    --text:        #ece5dc;
    --text-muted:  #a89c8f;
    --accent:      #e8834a;
    --accent-soft: #33241a;
    --teal:        #62b3ad;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3),
              0 4px 14px rgba(0, 0, 0, 0.25);
  }
}

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

body {
  font-family: var(--font-body);
  font-size: 1.05rem;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  max-width: 760px;
  margin: 0 auto;
  padding: 0 1.25rem 4rem;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-underline-offset: 2px; }
a:hover { color: var(--teal); }

h1, h2, h3 {
  font-family: var(--font-ui);
  line-height: 1.2;
  letter-spacing: -0.015em;
}
h1 { font-size: 2.15rem; margin: 0 0 0.5rem; }
h2 { font-size: 1.3rem; }

/* --- Header -------------------------------------------------------------- */
header {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.5rem;
  justify-content: space-between;
  align-items: baseline;
  padding: 1.75rem 0 1.25rem;
  margin-bottom: 2.5rem;
  border-bottom: 1px solid var(--border);
}
.site-title {
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
  text-decoration: none;
  color: var(--text);
}
.site-title:hover { color: var(--accent); }
header nav {
  display: flex;
  gap: 1.25rem;
  font-family: var(--font-ui);
  font-size: 0.9rem;
}
header nav a {
  text-decoration: none;
  color: var(--text-muted);
  padding-bottom: 2px;
  border-bottom: 2px solid transparent;
}
header nav a:hover { color: var(--text); border-bottom-color: var(--accent); }

/* --- Home page ----------------------------------------------------------- */
.hero { margin-bottom: 2.5rem; }
.hero .tagline {
  font-size: 1.15rem;
  color: var(--text-muted);
  margin: 0;
}
.hero .kicker {
  font-family: var(--font-ui);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 0.5rem;
}

.sections {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 1rem;
  margin-top: 2rem;
}
.section-card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem;
  text-decoration: none;
  color: inherit;
  transition: transform 0.15s ease, border-color 0.15s ease;
}
.section-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  color: inherit;
}
.section-card h2 { margin: 0 0 0.35rem; font-size: 1.1rem; }
.section-card .count {
  font-family: var(--font-ui);
  font-size: 0.8rem;
  color: var(--text-muted);
  margin: 0;
}

/* --- Listing pages ------------------------------------------------------- */
.listing { list-style: none; padding: 0; margin: 2rem 0 0; }
.listing li {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1rem 1.25rem;
  margin-bottom: 0.85rem;
  transition: border-color 0.15s ease;
}
.listing li:hover { border-color: var(--accent); }
.listing .entry-title {
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: 1.05rem;
  text-decoration: none;
  color: var(--text);
}
.listing .entry-title:hover { color: var(--accent); }
.listing .summary {
  margin: 0.4rem 0 0;
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* --- Badges (rating, price, taxonomy terms) ------------------------------ */
.badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.6rem;
}
.badge {
  font-family: var(--font-ui);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  text-decoration: none;
  white-space: nowrap;
}
.badge--price { background: transparent; color: var(--teal); border: 1px solid var(--teal); }
.badge--term  { background: transparent; color: var(--text-muted); border: 1px solid var(--border); }
a.badge:hover { border-color: var(--accent); color: var(--accent); }

/* --- Single pages -------------------------------------------------------- */
article header { display: block; border: 0; margin: 0; padding: 0; }

.back-link {
  display: inline-block;
  font-family: var(--font-ui);
  font-size: 0.85rem;
  text-decoration: none;
  color: var(--text-muted);
  margin-bottom: 1rem;
}
.back-link:hover { color: var(--accent); }

dl.meta {
  display: grid;
  grid-template-columns: minmax(7rem, auto) 1fr;
  gap: 0.5rem 1.25rem;
  margin: 1.75rem 0;
  padding: 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  font-size: 0.95rem;
}
dl.meta dt {
  font-family: var(--font-ui);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  align-self: center;
}
dl.meta dd { margin: 0; align-self: center; }

/* --- Footer -------------------------------------------------------------- */
footer {
  margin-top: 4rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  font-family: var(--font-ui);
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* --- Small screens ------------------------------------------------------- */
@media (max-width: 480px) {
  h1 { font-size: 1.75rem; }
  dl.meta { grid-template-columns: 1fr; gap: 0.15rem; padding: 1rem; }
  dl.meta dd { margin-bottom: 0.6rem; }
}

/* --- Photos --------------------------------------------------------------
   Every <img> carries width/height attributes from Hugo, so the browser
   reserves the right amount of space before the file arrives and the text
   below it doesn't jump around while the page loads. */
.figure { margin: 1.75rem 0; }
.figure img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
}
.figure-link { display: block; cursor: zoom-in; }
.figure figcaption {
  font-family: var(--font-ui);
  font-size: 0.82rem;
  line-height: 1.45;
  color: var(--text-muted);
  margin-top: 0.5rem;
}

/* Video clips reuse the figure frame so they line up with the photos. */
.figure--video video {
  display: block;
  width: 100%;
  height: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: #000;
}

/* The lead photo sits a little tighter under the badges. */
.figure.is-lead { margin: 1.5rem 0 0.5rem; }

/* --- Galleries ----------------------------------------------------------- */
.gallery-section { margin-top: 2.5rem; }
.gallery-title {
  font-size: 1.05rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}
.gallery-note {
  font-family: var(--font-ui);
  font-size: 0.82rem;
  color: var(--text-muted);
  margin: -0.25rem 0 0;
}
.gallery {
  display: grid;
  gap: 1rem;
  margin-top: 1.25rem;
}
/* The minimums are tuned to the 760px content column so each grid actually
   lands on the number of columns it asks for, then drops to fewer as the
   screen narrows. */
.gallery[data-columns="2"] { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.gallery[data-columns="3"] { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }

/* Inside a grid the photos are cropped to a common shape, so a mix of
   portrait and landscape shots still lines up into tidy rows. */
.gallery .figure { margin: 0; }
.gallery .figure img {
  aspect-ratio: 4 / 5;
  object-fit: cover;
  transition: opacity 0.15s ease;
}
.gallery .figure-link:hover img { opacity: 0.85; }
.gallery .figure figcaption { font-size: 0.75rem; margin-top: 0.35rem; }

/* --- Lightbox ------------------------------------------------------------ */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: rgba(20, 16, 14, 0.92);
  cursor: zoom-out;
}
.lightbox[hidden] { display: none; }
.lightbox-img {
  max-width: 100%;
  max-height: 100%;
  border-radius: var(--radius);
  object-fit: contain;
}
.lightbox-close {
  position: absolute;
  top: 0.75rem;
  right: 1rem;
  font-size: 2rem;
  line-height: 1;
  padding: 0.25rem 0.6rem;
  color: #fff;
  background: transparent;
  border: 0;
  border-radius: var(--radius);
  cursor: pointer;
}
.lightbox-close:hover { background: rgba(255, 255, 255, 0.12); }

@media (prefers-reduced-motion: reduce) {
  .figure img, .gallery .figure-link:hover img, .section-card { transition: none; }
}

/* --- About page ----------------------------------------------------------- */
.about-header { margin-bottom: 2rem; }
.about-intro {
  font-size: 1.2rem;
  line-height: 1.55;
  color: var(--text-muted);
  margin: 0.5rem 0 0;
}

/* Portrait beside the facts on a wide screen, stacked on a phone. */
.about-card {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  align-items: flex-start;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem;
  margin-bottom: 2.5rem;
}
.about-portrait { flex: 0 0 200px; }
.about-portrait .figure { margin: 0; }
.about-portrait .figure img { aspect-ratio: 1 / 1; object-fit: cover; }

.about-facts {
  flex: 1 1 260px;
  display: grid;
  grid-template-columns: minmax(6rem, auto) 1fr;
  gap: 0.5rem 1.25rem;
  margin: 0;
  font-size: 0.95rem;
}
.about-facts dt {
  font-family: var(--font-ui);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  align-self: center;
}
.about-facts dd { margin: 0; align-self: center; }

.about-body h2 {
  margin-top: 2.25rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--border);
}

.about-links { margin-top: 2.5rem; }
.about-links h2 {
  font-size: 1.05rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}
.about-links ul {
  list-style: none;
  padding: 0;
  margin: 1rem 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.about-links a {
  display: inline-block;
  font-family: var(--font-ui);
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  padding: 0.4rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text);
}
.about-links a:hover { border-color: var(--accent); color: var(--accent); }

@media (max-width: 560px) {
  .about-card { padding: 1.25rem; }
  .about-portrait { flex: 0 0 100%; max-width: 200px; }
  .about-facts { grid-template-columns: 1fr; gap: 0.15rem; }
  .about-facts dd { margin-bottom: 0.6rem; }
}

/* --- Dropdown nav --------------------------------------------------------
   Only devices that actually have a pointer get the hover menu. On a touch
   screen the parent stays an ordinary link to /other/, which lists the same
   pages -- so nothing is unreachable without a hover state. */
.nav-group { position: relative; display: inline-flex; align-items: center; }
.nav-parent { display: inline-flex; align-items: center; gap: 0.25rem; }
/* No dropdown without a pointer, so don't advertise one with a caret. */
.nav-caret { display: none; font-size: 0.6em; opacity: 0.7; }
.nav-dropdown { display: none; }

@media (hover: hover) {
  .nav-caret { display: inline; }

  .nav-dropdown {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: 100%;
    left: -0.75rem;
    min-width: 11rem;
    padding: 0.4rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    z-index: 20;
    /* Hidden but still focusable-adjacent; opacity+visibility keeps it out of
       the way without knocking it out of the layout on open. */
    opacity: 0;
    visibility: hidden;
    transform: translateY(-4px);
    transition: opacity 0.12s ease, transform 0.12s ease, visibility 0.12s;
  }
  /* A small invisible bridge so the menu doesn't close while the pointer
     travels from the parent down into it. */
  .nav-group::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    height: 0.6rem;
  }
  .nav-group:hover .nav-dropdown,
  .nav-group:focus-within .nav-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
  }
  .nav-dropdown a {
    padding: 0.35rem 0.6rem;
    border-radius: 6px;
    border-bottom: 0;
    white-space: nowrap;
  }
  .nav-dropdown a:hover { background: var(--accent-soft); color: var(--accent); }
}

@media (prefers-reduced-motion: reduce) {
  .nav-dropdown { transition: none; }
}

/* Shown when a section has no entries in it yet. */
.empty-note {
  font-family: var(--font-ui);
  font-size: 0.9rem;
  color: var(--text-muted);
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-top: 1.5rem;
}
