:root{
  /* ...keep your variables... */
  --navH: 56px;     /* approximate nav height area */
  --topGap: 36px;   /* how much space below nav before content */
}

/* fixed nav always takes space; content always starts same */
main{
  padding-top: calc(var(--navH) + var(--topGap));
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
img { max-width: 100%; height: auto; display: block; }

:root{
  --bg: #f2f2f2;
  --card: #ffffff;
  --text: #111111;
  --muted: #444444;
  --line: rgba(0,0,0,0.18);

  --max: 980px;
  --pad: 26px;
}

body{
  background: var(--bg);
  color: var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  line-height: 1.55;
}

a{
  color: var(--text);
  text-decoration: none;
  border-bottom: 1px solid rgba(0,0,0,0.35);
}
a:hover{ border-bottom-color: rgba(0,0,0,0.7); }
a:focus-visible{
  outline: 2px solid var(--text);
  outline-offset: 3px;
  border-bottom-color: transparent;
}

.wrap{
  max-width: var(--max);
  margin: 0 auto;
  padding: 46px var(--pad);
}

.skip-link{
  position: absolute;
  left: -999px;
  top: 10px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  background: var(--card);
  z-index: 9999;
}
.skip-link:focus{ left: 12px; }

/* NAV: aligned with content left edge (no frame) */
/* NAV: aligned with content left edge (CLICKABLE, no frame) */
.nav{
  position: fixed;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  width: min(var(--max), calc(100vw - (2 * var(--pad))));
  z-index: 1000;

  /* no background, no border */
  background: transparent;
  border: 0;
  padding: 0;
}

/* one-line nav */
.nav a{
  border-bottom: none;
  color: var(--muted);
  text-transform: lowercase;
  letter-spacing: 0.01em;
}

.nav a[aria-current="page"]{
  color: var(--text);
  border-bottom: 1px solid var(--text);
}

.nav .sep{
  display: inline-block;
  padding: 0 10px;
  color: rgba(0,0,0,0.35);
}


/* Type: small, plain */
p{ margin: 0 0 14px; color: var(--muted); max-width: 78ch; }

/* Headings: subtle */
h2{
  margin: 18px 0 8px;
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}

/* Contact rows */
.contact{
  display: grid;
  gap: 8px;
  margin-top: 8px;
}
.contact-row{
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 12px;
}
@media (max-width: 520px){
  .contact-row{ grid-template-columns: 1fr; }
}
.label{ color: var(--muted); }

/* Projects: square tiles */
.grid{
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.tile{
  display: block;
  border: 0;              /* no frame around the whole tile */
  background: transparent; /* removes the white block behind the title */
  border-bottom: none;
  transition: transform 160ms ease;
}

.tile:hover{
  transform: scale(1.04);
  border-color: rgba(0,0,0,0.35);
  z-index: 2;
}

.square{
  aspect-ratio: 1 / 1;
  overflow: hidden;
  background: transparent;
  border: 1px solid var(--line);  /* frame only around image */
}

.square img{
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 160ms ease;
}
.tile:hover .square img{ transform: scale(1.03); }

/* Caption under image: NO white bg, NO box */
.caption{
  padding: 10px 0 12px;
  background: transparent;
  border: 0;
}
.caption .title{
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}
.caption .sub{
  margin: 6px 0 0;
  font-size: 12px;
  color: var(--muted);
}

/* Text-only tile */
.tile--text .square{
  display: grid;
  place-items: center;
  background: #fff;
}
.tile--text .square span{
  padding: 16px;
  color: var(--muted);
  text-align: center;
  font-size: 13px;
}

/* Overlay modal on click (:target) */
.modal{
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  display: none;
  z-index: 9999;
  padding: 18px;
}
.modal:target{ display: grid; place-items: center; }

.modal-card{
  width: min(880px, 92vw);   /* was 1040px / 96vw */
  max-height: 86vh;          /* slightly smaller window */
  overflow: auto;
  background: var(--card);
  border: 1px solid rgba(0,0,0,0.25);
}

/* small links line under modal title */
.modal-meta{
  margin-top: 6px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.2;
}

.modal-meta a{
  color: var(--muted);
  border-bottom: 1px solid rgba(0,0,0,0.25);
}
.modal-meta a:hover{
  color: var(--text);
  border-bottom-color: rgba(0,0,0,0.55);
}

/* Make modal title area stack nicely */
.modal-top{
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
}
.modal-heading{
  display: flex;
  flex-direction: column;
}



.modal-top h2{
  margin: 0;
  font-size: 15px;
  font-weight: 700;
}

.close{
  border-bottom: none;
  color: var(--muted);
}
.close:hover{ color: var(--text); }


.modal-body{
  padding: 0 16px 16px;
}

.modal-media{ border: 1px solid var(--line); }

/* Activities: subtler bullets */
main ul{
  margin: 10px 0 16px 18px;
  padding: 0;
  color: var(--muted);
  max-width: 82ch;
}
main li{ margin: 6px 0; }
main li::marker{
  color: rgba(0,0,0,0.25);
  font-size: 0.75em;
}

/* Footer */
footer{
  margin-top: 42px;
  color: rgba(0,0,0,0.55);
  font-size: 14px;
}

/* Modal gallery (no JS) */
.gallery{
  /* make gallery fill modal-body */
  min-height: 0;
  display: grid;
  grid-template-rows: 1fr auto; /* big image + thumbs */
  gap: 12px;
}

.gallery input{
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

/* SIDE THUMBNAILS LAYOUT */
.viewer{
  display: grid;
  grid-template-columns: 72px 1fr; /* thumbs column + image */
  gap: 12px;
  align-items: start;
}

/* thumbs become vertical */
.viewer .thumbs{
  display: flex;
  flex-direction: column;
  flex-wrap: nowrap;
  gap: 10px;
  margin-top: 0; /* remove top margin */
}

/* optional: keep thumbs visible while scrolling modal */
.viewer .thumbs{
  position: sticky;
  top: 0;
}

/* your existing sizes can stay, but ensure these still apply */
.viewer .thumbs label{
  width: 62px;
  height: 62px;
}

/* thumbs become a vertical stack */
.thumbs{
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex-wrap: nowrap;  /* important: no wrapping */
  margin-top: 0;      /* remove top margin */
}

/* optional: keep thumbs visible while scrolling the modal */
.thumbs{
  position: sticky;
  top: 0;
}

/* on small screens, thumbs go back to bottom */
@media (max-width: 640px){
  .viewer{
    grid-template-columns: 1fr;
  }
  .viewer .thumbs{
    flex-direction: row;
    flex-wrap: wrap;
    position: static;
    margin-top: 12px;
  }
}


.big{
  background: #fff;           
  display: flex;
  justify-content: center;
}

.big img{
  display: none;
  width: auto;    /* scaled down instead of 100% */
  height: min(450px);
}


.thumbs label{
  width: 62px;
  height: 62px;
  overflow: hidden;
  cursor: pointer;
  border: 1px solid var(--line);
  background: transparent;
}

.thumbs img{
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}


/* subtle selected state */
.gallery input:checked + label{
  border-color: rgba(0,0,0,0.55);
}


