/* davismartin.ink
   The cloud photo is a fixed background. A centered header (Davis's signature) sits above a menu that stays pinned
   while scrolling. Then the intro box, the grid of white post boxes (js/posts.js filters them and opens them full
   screen), About me with two polaroids, and the footer. */

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { background: #000; scroll-padding-top: 3.5rem; }  /* menu links land just below the pinned menu */
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
body { margin: 0; color: #fff; font-family: 'Cormorant', Georgia, 'Times New Roman', serif; font-weight: 700; }
img, svg { display: block; }

/* The cloud photo is a fixed background for the whole site; everything scrolls over it. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background: #8a8a8a url('../img/cover-clouds.jpg') center / cover no-repeat;
}

/* Header: Davis's signature as the logo, centered above the menu. It scrolls away; the menu stays. */
.site-header {
  text-align: center;
  padding: 1rem 1rem 0;
  background: rgb(0 0 0 / 40%);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}
.site-header h1 { margin: 0; line-height: 0; }  /* the logo is the page's main heading */
.logo { display: inline-block; }
.logo img { width: clamp(260px, 32vw, 460px); height: auto; filter: drop-shadow(0 0 0.35rem rgb(0 0 0 / 55%)); }

/* Menu: pinned to the top of the window while scrolling. */
.menu {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: rgb(0 0 0 / 40%);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}
.menu ul {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.4rem 2.5rem;
  margin: 0;
  padding: 0.65rem 1rem;
  list-style: none;
  font-size: 1.25rem;
  letter-spacing: 0.06rem;
  line-height: 1.2;
  text-shadow: 0 0 0.3em rgb(0 0 0 / 70%);
}
.menu a, .menu span { color: rgb(255 255 255 / 85%); text-decoration: none; }
.menu a:hover, .menu a:focus-visible, .menu a[aria-current="true"] {
  color: #fff;
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

/* Page column shared by the posts, About me and the footer. */
.posts, .about, .site-footer { width: min(100% - 2rem, 72rem); margin-inline: auto; }

/* Posts: white boxes in a grid, 3 columns (2 on tablets, 1 on phones). The menu filters them (js/posts.js). */
.posts { margin-block: 2.5rem 3.5rem; }
.post-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.75rem; }
.post {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  padding: 1rem;
  background: #fff;
  color: #111;
  cursor: pointer;
  box-shadow: 0 0.2rem 0.9rem rgb(0 0 0 / 25%);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.post:hover { transform: translateY(-3px); box-shadow: 0 0.5rem 1.4rem rgb(0 0 0 / 35%); }
.post:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }
.post h3 { margin: 0; font-size: 1.45rem; line-height: 1.15; }
.post-photos { position: relative; aspect-ratio: 1; overflow: hidden; }
.post-photos img { width: 100%; height: 100%; object-fit: cover; }
.post-photos img + img, .post-text { display: none; }  /* the card shows the first photo; the rest open in the viewer */
.post-photos:has(img + img)::after {  /* Instagram-style "more photos" mark */
  content: "";
  position: absolute;
  top: 0.6rem;
  right: 0.6rem;
  width: 1.5rem;
  aspect-ratio: 1;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2'%3E%3Crect x='7' y='3' width='14' height='14' rx='2'/%3E%3Cpath d='M3 7v12a2 2 0 0 0 2 2h12'/%3E%3C/svg%3E") center / contain no-repeat;
  filter: drop-shadow(0 0 2px rgb(0 0 0 / 70%));
}
.post-text-only .post-text {  /* a post without photos: the start of its text takes the photo's square */
  display: block;
  aspect-ratio: 1;
  overflow: hidden;
  font-size: 1.05rem;
  line-height: 1.45;
}
.post-text-only .post-text p { margin: 0 0 0.6em; }
.post-text-only .post-text.more {  /* longer than the square (js/posts.js): fade out the bottom edge */
  -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 3em), transparent);
  mask-image: linear-gradient(to bottom, #000 calc(100% - 3em), transparent);
}
.post-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.post-tags li { border: 1px solid #111; padding: 0.05rem 0.45rem; }

/* Filter intros (shown above the grid while a filter is active): white boxes. */
.filter-intro { margin-bottom: 1.75rem; padding: 1.2rem 1.4rem; background: #fff; color: #111; }
.filter-intro h2 { margin: 0 0 0.5rem; font-size: 1.6rem; text-transform: uppercase; letter-spacing: 0.06em; }
.filter-intro p { margin: 0 0 0.6em; font-size: 1.1rem; line-height: 1.5; }

/* Site introduction above the grid, on the main page only: text on top, one image underneath, centered under the
   logo. Clear, so the clouds show through; white text with a soft shadow to stay readable on the sky. */
.site-intro {
  display: grid;
  justify-items: center;
  gap: 1.25rem;
  margin-bottom: 3rem;
  padding: 0.5rem 0 0;
  background: transparent;
  color: #fff;
  text-align: center;
  text-shadow: 0 0 0.3em rgb(0 0 0 / 70%), 0 0.05em 0.15em rgb(0 0 0 / 80%);
}
.site-intro-text { max-width: 44rem; }
.site-intro h2 { margin-bottom: 0.4rem; font-size: 1.8rem; }
.site-intro .intro-lead { font-size: clamp(1.2rem, 1rem + 0.6vw, 1.55rem); line-height: 1.3; margin-bottom: 0.9em; }
.site-intro p { font-size: 1.15rem; }
.site-intro-image { width: min(100%, 44rem); }
.site-intro-image img, .placeholder-image { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }
.placeholder-image {
  display: grid;
  place-items: center;
  border: 1px dashed rgb(255 255 255 / 60%);
  background: rgb(255 255 255 / 12%);
  color: #fff;
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* About me: the two polaroids on the sky beside a white text box (stacked on narrow screens). */
.about {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  gap: 3rem;
  align-items: center;
  margin-block: 4.5rem 3rem;
}
.about-photos { position: relative; aspect-ratio: 1.2717; }
.about-text { padding: 1.6rem 1.8rem; background: #fff; color: #111; box-shadow: 0 0.2rem 0.9rem rgb(0 0 0 / 25%); }
.about-text h2 { margin: 0 0 0.8rem; font-size: 1.8rem; letter-spacing: 0.06em; text-transform: uppercase; }
.about-text p { margin: 0 0 0.85em; font-size: 1.12rem; line-height: 1.55; }
.about-text p:last-child { margin-bottom: 0; }
.about-text hr { width: 3rem; margin: 1.3rem 0; border: 0; border-top: 1px solid #111; }

/* Polaroids: each photo and its frame are placed with --x/--y/--w/--h (left, top, width, height in % of their box),
   stacked with --z and tilted with --r. The <img> inside a frame sits where the crop box (--cx/--cy/--cw/--ch) says. */
.el {
  position: absolute;
  left: calc(var(--x) * 1%);
  top: calc(var(--y) * 1%);
  width: calc(var(--w) * 1%);
  height: calc(var(--h) * 1%);
  margin: 0;
  z-index: var(--z, 0);
  transform: rotate(var(--r, 0deg));
}
.group { transform: none; }
.img { overflow: hidden; }
.img img {
  position: absolute;
  left: calc(var(--cx, 0) * 1%);
  top: calc(var(--cy, 0) * 1%);
  width: calc(var(--cw, 100) * 1%);
  height: calc(var(--ch, 100) * 1%);
  max-width: none;
}
.stack .img:not(.zoomable) { pointer-events: none; }  /* clicks pass through the polaroid frames */
.zoomable { cursor: zoom-in; }
.zoomable:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }

/* Footer */
.site-footer {
  margin-block: 1rem 2.5rem;
  text-align: center;
  font-size: 0.95rem;
  letter-spacing: 0.06em;
  text-shadow: 0 0 0.3em rgb(0 0 0 / 70%), 0 0.05em 0.15em rgb(0 0 0 / 80%);
}

/* Post viewer: one post per screen (title, photo carousel, text); scroll/swipe up and down between posts. */
.reel {
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: #050505;
  color: #fff;
  overflow-y: auto;
  overscroll-behavior: contain;
  scroll-snap-type: y mandatory;
}
.reel::backdrop { background: rgb(0 0 0 / 60%); }
.reel-item {
  height: 100vh;
  height: 100dvh;
  margin: 0;
  padding: 3.5rem 1rem 1.25rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  scroll-snap-align: start;
  scroll-snap-stop: always;
}
.reel-post-title { margin: 0; font-size: clamp(1.3rem, 1rem + 1vw, 1.9rem); line-height: 1.2; text-align: center; }
.carousel-wrap { position: relative; flex: 0 0 auto; width: min(100%, 64rem); display: flex; }
.carousel {
  flex: 1;
  display: flex;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
}
.carousel::-webkit-scrollbar { display: none; }
.carousel img {  /* all photos in a post share the tallest one's height, each fitted inside it */
  flex: 0 0 100%;
  width: 100%;
  height: auto;
  max-height: 56vh;
  max-height: 56dvh;
  object-fit: contain;
  scroll-snap-align: center;
}
.carousel-prev, .carousel-next {
  position: absolute;
  top: 50%;
  translate: 0 -50%;
  padding: 0.2rem 0.6rem;
  border: 0;
  background: rgb(0 0 0 / 45%);
  color: #fff;
  font: inherit;
  font-size: 2rem;
  line-height: 1;
  cursor: pointer;
}
.carousel-prev { left: 0.25rem; }
.carousel-next { right: 0.25rem; }
.carousel-dots { display: flex; gap: 0.4rem; }
.carousel-dots span { width: 0.45rem; height: 0.45rem; border-radius: 50%; background: rgb(255 255 255 / 40%); }
.carousel-dots span.active { background: #fff; }
.reel-post-text {  /* shrinks and scrolls before the photo would */
  flex: 0 1 auto;
  min-height: 3rem;
  max-width: 42rem;
  max-height: 30vh;
  max-height: 30dvh;
  overflow-y: auto;
  padding: 0 0.25rem;
  font-size: 1.1rem;
  line-height: 1.45;
}
.reel-post-text p { margin: 0 0 0.7em; }
.reel-text-only .reel-post-text { max-height: 75vh; max-height: 75dvh; }
.reel-post-text.more {
  -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 2.5rem), transparent);
  mask-image: linear-gradient(to bottom, #000 calc(100% - 2.5rem), transparent);
}
.reel-controls { position: fixed; top: 0.6rem; right: 0.75rem; z-index: 1; display: flex; gap: 0.3rem; }
.reel-controls button {
  padding: 0.3rem 0.65rem;
  border: 0;
  background: rgb(0 0 0 / 40%);
  color: #fff;
  font: inherit;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
}
.reel-controls .reel-close { font-size: 1.9rem; }
.reel-single .reel-prev, .reel-single .reel-next { display: none; }
body:has(.reel[open]) { overflow: hidden; }

/* Tablets and phones */
@media (max-width: 900px) {
  .menu ul { gap: 0.3rem 1.5rem; font-size: 1.1rem; }
  .post-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
  .about { grid-template-columns: 1fr; gap: 2rem; margin-top: 3rem; }
  .about-photos { width: min(100%, 30rem); margin-inline: auto; }
}
@media (max-width: 560px) {
  .post-grid { grid-template-columns: 1fr; }
  .about-text { padding: 1.3rem 1.3rem; }
}
