:root {
  /* ---- Color tokens: "survey chart" palette, light ---- */
  --paper:      #F7F4EE;   /* base background, warm off-white paper */
  --paper-alt:  #FFFFFF;   /* card / panel surface */
  --paper-raised: #F0EBE0; /* hover surface */
  --line:       #DEDACD;   /* hairline dividers / borders */
  --ink:        #1E1B16;   /* primary text, warm charcoal (not pure black) */
  --ink-dim:    #6B6B6B;   /* secondary text, neutral mid-grey */
  --accent:     #1D5C86;   /* single accent: deep chart blue */

  --font-display: Calibri, 'Segoe UI', Candara, 'Trebuchet MS', sans-serif;
  --font-body: Calibri, 'Segoe UI', Candara, 'Trebuchet MS', sans-serif;
  --font-mono: Calibri, 'Segoe UI', Candara, 'Trebuchet MS', sans-serif;

  --radius: 10px;
  --max-width: 1180px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); }

/* subtle paper grain so the flat off-white doesn't feel like plain UI-chrome */
.grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  opacity: 0.025;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---------------- Hero ---------------- */
.hero {
  position: relative;
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--line);
  padding: 5rem 0 4rem;
}

.hero__content {
  position: relative;
  z-index: 2;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 2rem;
  width: 100%;
}

.hero__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 3rem;
}

.hero__text {
  flex: 1;
  min-width: 0;
}

.hero__photo {
  width: 200px;
  height: 260px;
  object-fit: cover;
  border-radius: 16px;
  border: 1px solid var(--line);
  flex-shrink: 0;
}

@media (max-width: 640px) {
  .hero__top { flex-wrap: wrap-reverse; }
  .hero__photo { width: 140px; height: 182px; }
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 0.9rem;
}

.hero h1 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(2.6rem, 6vw, 4.6rem);
  line-height: 1.02;
  margin: 0 0 1.1rem;
  letter-spacing: -0.01em;
}

.hero__tagline {
  font-size: clamp(1.05rem, 2vw, 1.3rem);
  color: var(--ink-dim);
  max-width: 42ch;
  margin: 0 0 1.6rem;
}

.hero__tagline--placeholder {
  display: inline-block;
  color: var(--ink-dim);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  padding: 0.35rem 0.7rem;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  letter-spacing: 0.04em;
}

.hero__meta {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--ink-dim);
  margin-bottom: 1.8rem;
}

.hero__meta .dot { margin: 0 0.5em; color: var(--line); }

.hero__links a {
  display: inline-block;
  margin-right: 1.6rem;
  text-decoration: none;
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 0.9rem;
  border-bottom: 1px solid var(--accent);
  padding-bottom: 2px;
  transition: color 0.15s, border-color 0.15s;
}

.hero__links a:hover {
  color: var(--accent);
}

.pepeha {
  margin: 2.2rem auto 0;
  max-width: 58ch;
  text-align: center;
}

.pepeha__text {
  font-style: italic;
  line-height: 1.85;
  color: var(--ink);
  margin: 0;
}

.pepeha__bio {
  font-size: 0.95rem;
  line-height: 1.65;
  color: var(--ink-dim);
  margin: 1.1rem 0 0;
}

/* ---------------- Current projects ---------------- */
.current {
  position: relative;
  z-index: 2;
  border-bottom: 1px solid var(--line);
}

.current__inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2rem 2rem 2.2rem;
}

.current__label {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink-dim);
  margin: 0 0 1rem;
}

.current__list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.1rem;
}

@media (max-width: 640px) {
  .current__list {
    grid-template-columns: 1fr;
  }
}

.current__card {
  background: var(--paper-alt);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  padding: 1.1rem 1.3rem;
}

.current__card--wide {
  grid-column: span 2;
}

.current__card h3 {
  font-family: var(--font-display);
  font-size: 1.05rem;
  margin: 0 0 0.4rem;
}

.current__card p {
  color: var(--ink-dim);
  font-size: 0.88rem;
  margin: 0 0 0.8rem;
}

.current__skills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.tag--skill {
  border-color: var(--accent);
  color: var(--accent);
}

/* ---------------- Certifications ---------------- */
.certifications {
  position: relative;
  z-index: 2;
  border-bottom: 1px solid var(--line);
}

.certifications__inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 1.6rem 2rem 2rem;
}

.certifications__list {
  list-style: none;
  display: flex;
  flex-direction: column;
  padding: 0;
  margin: 0;
}

.cert {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  column-gap: 0.6rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--line);
}

.cert:last-child {
  border-bottom: none;
}

.cert__name {
  font-size: 0.92rem;
  color: var(--ink);
}

.cert__issuer {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--ink-dim);
}

/* ---------------- Legend nav ---------------- */
.legend {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2rem 2rem 1rem;
  position: relative;
  z-index: 2;
}

.legend__label {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink-dim);
  margin: 0 0 0.8rem;
}

.legend__list {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  padding: 0;
  margin: 0;
}

.legend__item {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  background: var(--paper-alt);
  border: 1px solid var(--line);
  color: var(--ink-dim);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  padding: 0.5rem 0.9rem;
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.legend__item:hover {
  border-color: var(--accent);
  color: var(--ink);
}

.legend__item--active {
  color: var(--ink);
  border-color: var(--accent);
  background: var(--paper-raised);
}

.swatch {
  width: 9px;
  height: 9px;
  border-radius: 1px;
  display: inline-block;
  background: var(--ink-dim);
}

.legend__item--active .swatch {
  background: var(--accent);
}

/* ---------------- Project grid ---------------- */
main {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 1rem 2rem 5rem;
  position: relative;
  z-index: 2;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.1rem;
  margin-top: 1.5rem;
}

.card {
  background: var(--paper-alt);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.4rem;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.15s, background 0.15s, box-shadow 0.15s;
  display: flex;
  flex-direction: column;
}

.card:hover {
  border-color: var(--accent);
  background: var(--paper-raised);
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(30, 27, 22, 0.08);
}

.card__thumb {
  width: 100%;
  height: 150px;
  object-fit: contain;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  margin-bottom: 1rem;
  background: #fff;
}

.card__tags {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin-bottom: 0.9rem;
}

.tag {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.18rem 0.5rem;
  border-radius: 2px;
  border: 1px solid var(--line);
  color: var(--ink-dim);
}

.card h3 {
  font-family: var(--font-display);
  font-size: 1.2rem;
  margin: 0 0 0.5rem;
  line-height: 1.25;
}

.card p {
  color: var(--ink-dim);
  font-size: 0.95rem;
  margin: 0;
  flex-grow: 1;
}

.card__cta {
  margin-top: 1rem;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--accent);
}

/* ---------------- Detail panel ---------------- */
.detail {
  margin-top: 3rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper-alt);
  padding: 2rem;
}

.detail__close {
  background: none;
  border: none;
  color: var(--ink-dim);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  cursor: pointer;
  margin-bottom: 1.2rem;
  padding: 0;
}

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

.detail h2 {
  font-family: var(--font-display);
  font-size: 1.8rem;
  margin: 0 0 0.6rem;
}

.detail__inner p {
  font-size: 1.02rem;
  line-height: 1.65;
  text-align: justify;
}

.detail__image {
  width: 100%;
  max-height: 420px;
  object-fit: cover;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  margin: 1rem 0 1.4rem;
}

.detail__links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  margin-top: 1.2rem;
}

.detail__link {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--ink);
  text-decoration: none;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.5rem 0.9rem;
  transition: border-color 0.15s, color 0.15s;
}

.detail__link:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.detail__map {
  width: 100%;
  height: 420px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  margin-top: 1.4rem;
  background: var(--paper);
}

.detail__hero-video {
  margin: 1.4rem 0 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--paper-alt);
}

.detail__hero-video video {
  display: block;
  width: 100%;
  background: var(--paper);
}

.detail__hero-video figcaption {
  padding: 0.7rem 0.9rem;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  line-height: 1.4;
  color: var(--ink-dim);
}

.detail__section-heading {
  font-family: var(--font-display);
  font-size: 1.05rem;
  color: var(--accent);
  margin: 2rem 0 0;
  padding-top: 1.4rem;
  border-top: 1px solid var(--line);
}

.detail__gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
  margin-top: 1.4rem;
}

.gallery__item {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--paper-alt);
}

.gallery__item--wide {
  grid-column: 1 / -1;
}

.gallery__item img,
.gallery__item video {
  display: block;
  width: 100%;
  background: #fff;
}

.gallery__item img {
  aspect-ratio: 4 / 3;
  object-fit: contain;
}

.gallery__item video { background: var(--paper); }

.gallery__item img.lightbox-trigger {
  cursor: zoom-in;
  transition: opacity 0.15s;
}

.gallery__item img.lightbox-trigger:hover {
  opacity: 0.88;
}

.gallery__item figcaption {
  padding: 0.6rem 0.8rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  line-height: 1.4;
  text-align: justify;
  color: var(--ink-dim);
}

/* ---------------- Compare slider ---------------- */
.compare-slider {
  position: relative;
  width: 100%;
  overflow: hidden;
  cursor: ew-resize;
  touch-action: none;
  background: #fff;
}

.compare-slider__img {
  display: block;
  width: 100%;
  height: auto;
  pointer-events: none;
  user-select: none;
}

.compare-slider__before {
  position: absolute;
  top: 0;
  left: 0;
}

.compare-slider__handle {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--accent);
  transform: translateX(-50%);
  pointer-events: none;
}

.compare-slider__handle::before {
  content: "\2194";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 34px;
  height: 34px;
  line-height: 34px;
  text-align: center;
  border-radius: 50%;
  background: var(--paper-alt);
  border: 1px solid var(--accent);
  color: var(--accent);
  font-size: 1rem;
}

/* ---------------- Lightbox ---------------- */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(10, 9, 6, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem;
  cursor: zoom-out;
}

.lightbox[hidden] {
  display: none;
}

.lightbox__img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: var(--radius);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  background: #fff;
}

.lightbox__close {
  position: fixed;
  top: 1.2rem;
  right: 1.6rem;
  background: none;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: var(--radius);
  color: #fff;
  font-family: var(--font-mono);
  font-size: 1.4rem;
  line-height: 1;
  padding: 0.4rem 0.8rem;
  cursor: pointer;
}

.lightbox__close:hover {
  border-color: #fff;
}

/* ---------------- Footer ---------------- */
.site-footer {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2rem 2rem 3rem;
  border-top: 1px solid var(--line);
  color: var(--ink-dim);
  font-family: var(--font-mono);
  font-size: 0.82rem;
  position: relative;
  z-index: 2;
}

.site-footer__note {
  margin-top: 0.4rem;
  opacity: 0.7;
}

/* Leaflet popup tweak so popups match the palette */
.leaflet-popup-content-wrapper,
.leaflet-popup-tip {
  background: var(--paper-alt);
  color: var(--ink);
}

@media (max-width: 640px) {
  main, .legend, .site-footer, .hero__content { padding-left: 1.2rem; padding-right: 1.2rem; }
}
