/* ===== Base ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* animatable page color: the body AND the hero's bottom gradient both
   read it, so the tint on journal hover flows through the seam */
@property --page-bg {
  syntax: "<color>";
  inherits: true;
  initial-value: #4a463f;
}

:root {
  --bg: #4a463f;
  --fg: #ede7db;
  --sans: "Archivo", "Helvetica Neue", Arial, sans-serif;
  --mono: "Courier Prime", "Courier New", monospace;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--mono);
  background: var(--page-bg);
  color: var(--fg);
  line-height: 1.75;
  /* hovering a journal row tints the whole page toward that journal */
  transition: --page-bg 0.9s ease, background-color 0.9s ease;
}

em {
  font-family: var(--sans);
  font-style: italic;
  font-weight: 400;
}

/* ===== Header ===== */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 20;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 22px 4vw;
  mix-blend-mode: difference;
  color: #fff;
}

.wordmark {
  font-family: var(--sans);
  font-style: italic;
  font-weight: 500;
  font-size: 17px;
  letter-spacing: 0.02em;
  color: #fff;
  text-decoration: none;
}

.site-nav a {
  margin-left: 26px;
  color: #fff;
  text-decoration: underline;
  text-underline-offset: 4px;
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: 0.04em;
  opacity: 0.85;
  transition: opacity 0.2s;
}

.site-nav a:hover {
  opacity: 1;
}

/* ===== Featured: the covers themselves rotate, full-bleed ===== */
.featured {
  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  overflow: hidden;
  display: flex;
  align-items: center;
}

.featured-bg img.fbg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  /* a soft-focus ground: gently blurred and dimmed so the type and
     the sharp cards stand clear of it; scaled a touch so the blur
     never shows a soft edge at the frame */
  filter: brightness(0.82) saturate(0.95) blur(3.5px);
  transform: scale(1.03);
  opacity: 0;
  transition: opacity 1.4s ease;
}

.featured-bg img.fbg.is-active {
  opacity: 1;
}

/* soft landing: the hero dissolves into the page color below */
.featured::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 24vh;
  z-index: 2;
  pointer-events: none;
  background: linear-gradient(to bottom, transparent 0%, var(--page-bg) 96%);
  transition: --page-bg 0.9s ease;
}

.featured-inner {
  position: absolute;
  top: 19vh;
  left: 0;
  right: 0;
  z-index: 3;
  padding: 0 6vw;
  pointer-events: none;
}

.featured-inner a,
.featured-id {
  pointer-events: auto;
}

.featured-id {
  max-width: 34em;
  /* three layers: a crisp contact shadow lifts the letterforms off the
     photo, a mid glow separates them from busy areas, and a wide soft
     pool grounds the whole block — quiet dimensionality */
  text-shadow:
    0 1px 1px rgba(12, 11, 9, 0.9),
    0 4px 12px rgba(12, 11, 9, 0.55),
    0 18px 56px rgba(12, 11, 9, 0.5);
}

.masthead-name {
  text-shadow:
    0 1px 0 rgba(12, 11, 9, 0.95),
    0 2px 2px rgba(12, 11, 9, 0.6),
    0 6px 18px rgba(12, 11, 9, 0.55),
    0 26px 70px rgba(12, 11, 9, 0.5);
}

/* ===== The reel: an angled spine of uniform cards on the right.
   Every card leans away like frames on a light table; the one in
   front is what the backdrop shows. Hover a card and it turns to
   face you, lifts and brightens; click opens the journal. ===== */
.reel {
  position: absolute;
  left: 54%;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  overflow: hidden;
  cursor: grab;
  touch-action: pan-y;
  padding: 40px 0;
  perspective: 1100px;
  /* a long, eased feather on the left: the resting card's edge melts
     gently into the backdrop (which is the same photo), and departing
     cards dissolve through it without any visible seam */
  -webkit-mask-image: linear-gradient(to right,
    transparent 0,
    rgba(0, 0, 0, 0.18) 22px,
    rgba(0, 0, 0, 0.45) 42px,
    rgba(0, 0, 0, 0.75) 60px,
    rgba(0, 0, 0, 0.93) 74px,
    #000 84px,
    #000 93%,
    transparent 100%);
  mask-image: linear-gradient(to right,
    transparent 0,
    rgba(0, 0, 0, 0.18) 22px,
    rgba(0, 0, 0, 0.45) 42px,
    rgba(0, 0, 0, 0.75) 60px,
    rgba(0, 0, 0, 0.93) 74px,
    #000 84px,
    #000 93%,
    transparent 100%);
}

.reel.is-dragging {
  cursor: grabbing;
}

.reel.is-dragging .reel-item {
  cursor: grabbing;
}

.reel-track {
  display: flex;
  transform-style: preserve-3d;
  transition: transform 1.5s cubic-bezier(0.22, 1, 0.36, 1);
  will-change: transform;
}

.reel-item {
  flex: 0 0 auto;
  display: block;
  /* uniform square frames */
  width: clamp(150px, 15vw, 220px);
  aspect-ratio: 1 / 1;
  border: none;
  padding: 0;
  background: none;
  cursor: grab;
  border-radius: 10px;
  overflow: hidden;
  opacity: 0.9;
  /* --tilt / --shift / --depth are set per card by js/home.js:
     a gentle lean keeps every photo readable, while each card
     steps back in space (translateZ) and dims a touch, so the
     depth comes from recession rather than steep angles */
  transform: translateZ(var(--depth, 0px)) rotateY(var(--tilt, -30deg)) translateX(var(--shift, 0px));
  filter: brightness(var(--dim, 0.92));
  /* z-index holds for the return journey, so a card being put back
     into the album settles on top instead of ducking under its
     neighbours mid-animation */
  transition: opacity 0.45s ease, transform 0.45s cubic-bezier(0.33, 1, 0.45, 1), filter 0.45s ease, z-index 0s 0.45s;
  box-shadow: 0 18px 40px -16px rgba(15, 13, 10, 0.55);
}

.reel-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* the tail packs shoulder-over-shoulder behind the front card */
.reel-item + .reel-item {
  margin-left: -26px;
}

/* picked out of the album: turns to face you and lifts clear,
   always on top of its neighbours */
.reel-item:hover {
  opacity: 1;
  transform: rotateY(0deg) translateX(var(--shift, 0px)) translateY(-20px) scale(1.045);
  filter: brightness(1.05);
  z-index: 40 !important;
  transition: opacity 0.45s ease, transform 0.45s cubic-bezier(0.33, 1, 0.45, 1), filter 0.45s ease, z-index 0s 0s;
}

/* the card in focus — it turns to face you exactly like a hover,
   and the backdrop behind everything is this same photo */
.reel-item.is-open {
  opacity: 1;
  transform: rotateY(0deg) translateX(var(--shift, 0px)) translateY(-8px) scale(1.045);
  filter: brightness(1.05);
  z-index: 30 !important;
}

/* quiet prev / next, tucked under the strip */
.reel-nav {
  position: absolute;
  right: 5vw;
  top: calc(50% + clamp(150px, 15vw, 220px) / 2 + 54px);
  z-index: 3;
  display: flex;
  gap: 18px;
}

.reel-nav button {
  border: none;
  background: none;
  padding: 4px 6px;
  font-family: var(--mono);
  font-size: 17px;
  color: var(--fg);
  opacity: 0.7;
  cursor: pointer;
  text-shadow: 0 1px 10px rgba(15, 14, 12, 0.6);
  transition: opacity 0.2s;
}

.reel-nav button:hover {
  opacity: 1;
}

/* quiet caption for the current journal, lower left — clear of the reel */
.featured-caption {
  position: absolute;
  left: 6vw;
  bottom: 9vh;
  z-index: 3;
  display: block;
  text-align: left;
  color: var(--fg);
  text-decoration: none;
  font-family: var(--mono);
  text-shadow: 0 1px 12px rgba(15, 14, 12, 0.5);
}

.featured-caption {
  transition: opacity 0.5s ease;
}

.featured-caption.is-fading {
  opacity: 0;
}

.featured-caption > span {
  display: block;
}

.fc-count {
  font-size: 12px;
  letter-spacing: 0.14em;
  opacity: 0.6;
  margin-bottom: 10px;
}

.fc-date {
  font-size: 12.5px;
  letter-spacing: 0.05em;
  opacity: 0.8;
}

.fc-title {
  font-family: var(--sans);
  font-style: italic;
  font-weight: 500;
  font-size: clamp(19px, 2vw, 27px);
  margin: 4px 0 8px;
}

.fc-cta {
  font-size: 12.5px;
  letter-spacing: 0.05em;
  opacity: 0.7;
  transition: opacity 0.25s;
}

.featured-caption:hover .fc-cta {
  opacity: 1;
  text-decoration: underline;
  text-underline-offset: 4px;
}

.featured-caption:hover .fc-title {
  text-decoration: underline;
  text-underline-offset: 5px;
  text-decoration-thickness: 1px;
}

.featured-scroll {
  position: absolute;
  bottom: 24px;
  right: 5vw;
  z-index: 3;
  font-size: 13px;
  color: var(--fg);
  opacity: 0.85;
}

.masthead-name {
  font-family: var(--sans);
  font-style: italic;
  font-weight: 500;
  font-size: clamp(34px, 4.2vw, 58px);
  line-height: 1.1;
  display: inline-block;
  border-bottom: 1px solid rgba(237, 231, 219, 0.7);
  padding-bottom: 10px;
  margin-bottom: 22px;
}

.masthead-line {
  font-size: clamp(13px, 1.3vw, 15px);
  letter-spacing: 0.02em;
  opacity: 0.85;
  max-width: 44em;
}

/* ===== Journal index ===== */
.journals {
  padding: 6vh 6vw 16vh;
}

.journals-kicker {
  font-size: 13px;
  letter-spacing: 0.06em;
  opacity: 0.55;
  /* the hover constellation unfolds into this air above and below */
  margin-bottom: 165px;
}

.entry {
  display: flex;
  align-items: baseline;
  gap: 2.2em;
  flex-wrap: wrap;
  padding: 26px 0;
  border-top: 1px solid rgba(237, 231, 219, 0.25);
  color: var(--fg);
  text-decoration: none;
  transition: opacity 0.2s;
}

.entry:last-of-type {
  border-bottom: 1px solid rgba(237, 231, 219, 0.25);
}

.entry-no {
  font-size: 13px;
  opacity: 0.55;
}

.entry-date {
  font-size: 13px;
  opacity: 0.7;
}

.entry-title {
  font-family: var(--sans);
  font-style: italic;
  font-weight: 500;
  font-size: clamp(20px, 2.4vw, 32px);
  line-height: 1.2;
}

.entry-meta {
  font-size: 13px;
  opacity: 0.6;
}

.entry-arrow {
  margin-left: auto;
  font-size: 15px;
  opacity: 0.55;
  transition: transform 0.25s ease, opacity 0.25s ease;
}

.entry:hover .entry-arrow {
  transform: translateX(8px);
  opacity: 1;
}

.entry:hover .entry-title {
  text-decoration: underline;
  text-underline-offset: 6px;
  text-decoration-thickness: 1px;
}

.journals-note {
  font-size: 13px;
  letter-spacing: 0.05em;
  opacity: 0.4;
  padding-top: 165px;
}

/* hover constellation: a handful of the journal's frames gather
   around the row, each easing in on its own beat (built by js/home.js) */
.entry {
  position: relative;
}

.entry:hover {
  z-index: 6;
}

.entry-cloud {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 3;
}

.cloud-item {
  position: absolute;
  display: block;
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.5s ease, transform 0.55s cubic-bezier(0.33, 1, 0.45, 1);
}

.cloud-item img {
  display: block;
  width: auto;
  border-radius: 8px;
  box-shadow: 0 18px 44px -16px rgba(0, 0, 0, 0.55);
}

/* contact-sheet note under each print */
.cloud-item i {
  display: block;
  font-style: normal;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  opacity: 0.6;
  padding-top: 6px;
}

/* the evening reads left to right, alternating above and below the row;
   prints may cross the rules but never the type */
.cloud-item:nth-child(1) { top: -122px;    left: 2%;   transition-delay: 0s; }
.cloud-item:nth-child(2) { bottom: -100px; left: 8%;   transition-delay: 0.05s; }
.cloud-item:nth-child(3) { top: -142px;    left: 20%;  transition-delay: 0.1s; }
.cloud-item:nth-child(4) { bottom: -126px; left: 31%;  transition-delay: 0.04s; }
.cloud-item:nth-child(5) { top: -94px;     left: 43%;  transition-delay: 0.12s; }
.cloud-item:nth-child(6) { bottom: -140px; left: 54%;  transition-delay: 0.07s; }
.cloud-item:nth-child(7) { top: -130px;    left: 58%;  transition-delay: 0.14s; }
.cloud-item:nth-child(8) { bottom: -132px; right: 3%;  transition-delay: 0.09s; }
.cloud-item:nth-child(9) { top: -134px;    right: 2%;  transition-delay: 0.16s; }

.cloud-item:nth-child(1) img { height: 100px; }
.cloud-item:nth-child(2) img { height: 76px; }
.cloud-item:nth-child(3) img { height: 120px; }
.cloud-item:nth-child(4) img { height: 104px; }
.cloud-item:nth-child(5) img { height: 72px; }
.cloud-item:nth-child(6) img { height: 118px; }
.cloud-item:nth-child(7) img { height: 108px; }
.cloud-item:nth-child(8) img { height: 110px; }
.cloud-item:nth-child(9) img { height: 112px; }

.entry:hover .cloud-item {
  opacity: 1;
  transform: none;
}

/* journals with only three frames spread them across the full row
   instead of bunching at the left (positions above assume nine) */
.entry.cloud-3 .cloud-item:nth-child(1) { top: -122px;    left: 6%;   right: auto; }
.entry.cloud-3 .cloud-item:nth-child(2) { bottom: -104px; left: 42%;  right: auto; top: auto; }
.entry.cloud-3 .cloud-item:nth-child(3) { top: -134px;    right: 4%;  left: auto; }

.entry.cloud-3 .cloud-item:nth-child(1) img { height: 108px; }
.entry.cloud-3 .cloud-item:nth-child(2) img { height: 96px; }
.entry.cloud-3 .cloud-item:nth-child(3) img { height: 124px; }

/* seven-frame journals: the last two prints take the right corners */
.entry.cloud-7 .cloud-item:nth-child(6) { bottom: -132px; right: 3%;  left: auto; top: auto; }
.entry.cloud-7 .cloud-item:nth-child(7) { top: -134px;    right: 2%;  left: auto; }

/* ===== About / Contact ===== */
.about {
  padding: 14vh 6vw 4vh;
}

.about-kicker,
.contact-kicker {
  font-size: 13px;
  letter-spacing: 0.06em;
  opacity: 0.55;
  margin-bottom: 26px;
}

.about-text {
  font-size: clamp(16px, 1.8vw, 21px);
  line-height: 2;
  max-width: 34em;
}

.about-text em {
  font-size: 1.15em;
}

/* the mirror self-portrait sits below the ( about ) kicker, behind
   the text, its straight edges feathered away into the page colour */
.about {
  position: relative;
  overflow: hidden;
  display: grid;
  /* the text column is exactly as wide as the guestbook column below,
     so the two blocks line up down the page */
  grid-template-columns: calc(min(760px, 100vw) - 12vw) minmax(0, 1fr);
  align-items: center;
}

.about-kicker {
  grid-column: 1 / -1;
  position: relative;
  z-index: 2;
}

.about-text {
  grid-column: 1;
  grid-row: 2;
  position: relative;
  z-index: 2;
  max-width: none;
}

.about-portrait {
  grid-column: 2;
  grid-row: 2;
  justify-self: end;
  width: min(58vw, 820px);
  /* bleeds past the right edge and back under the text column */
  margin: 1.5vh -8vw -6vh -34%;
  z-index: 1;
  pointer-events: none;
}

.about-portrait img {
  width: 100%;
  display: block;
  /* softened and tuned toward the page colour so it sinks into it,
     more memory than photograph */
  filter: brightness(0.9) saturate(0.8) blur(2.5px);
  opacity: 0.8;
  /* straight-edged feather: two crossed linear fades, no rounding */
  -webkit-mask-image:
    linear-gradient(to right, transparent 0, #000 22%, #000 78%, transparent 100%),
    linear-gradient(to bottom, transparent 0, #000 22%, #000 78%, transparent 100%);
  -webkit-mask-composite: source-in;
  mask-image:
    linear-gradient(to right, transparent 0, #000 22%, #000 78%, transparent 100%),
    linear-gradient(to bottom, transparent 0, #000 22%, #000 78%, transparent 100%);
  mask-composite: intersect;
}

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

  .about-portrait {
    grid-column: 1;
    grid-row: 2;
    justify-self: center;
    width: 100%;
    max-width: 560px;
    /* the text rises into the feathered lower edge */
    margin: 0 auto -7vh;
  }

  .about-text {
    grid-column: 1;
    grid-row: 3;
  }
}

.contact {
  padding: 10vh 6vw 8vh;
}

.contact-link {
  font-family: var(--sans);
  font-style: italic;
  font-weight: 500;
  font-size: clamp(22px, 2.8vw, 38px);
  color: currentColor;
  text-decoration: underline;
  text-underline-offset: 7px;
  text-decoration-thickness: 1px;
  transition: opacity 0.2s;
}

.contact-link:hover {
  opacity: 0.65;
}

.footer-note {
  font-size: 12px;
  letter-spacing: 0.04em;
  margin-top: 12vh;
  opacity: 0.4;
}


/* ===== Guestbook ===== */
.guestbook {
  padding: 7vh 6vw 14vh;
  max-width: 760px;
}

.guestbook-kicker {
  font-size: 13px;
  letter-spacing: 0.06em;
  opacity: 0.55;
  margin-bottom: 26px;
}

.guestbook-lede {
  font-family: var(--sans);
  font-style: italic;
  font-weight: 400;
  font-size: clamp(19px, 2.2vw, 27px);
  line-height: 1.5;
  margin-bottom: 6vh;
}

.gb-field {
  display: block;
  margin-bottom: 30px;
}

.gb-label {
  display: block;
  font-size: 12px;
  letter-spacing: 0.1em;
  opacity: 0.55;
  margin-bottom: 8px;
}

.gb-input {
  width: 100%;
  border: none;
  border-bottom: 1px solid rgba(237, 231, 219, 0.35);
  background: none;
  padding: 6px 0 10px;
  font-family: var(--mono);
  font-size: 15px;
  color: var(--fg);
  transition: border-color 0.25s;
}

.gb-input::placeholder {
  color: var(--fg);
  opacity: 0.35;
}

.gb-input:focus {
  outline: none;
  border-bottom-color: rgba(237, 231, 219, 0.9);
}

.gb-textarea {
  resize: vertical;
  min-height: 84px;
  line-height: 1.8;
}

/* honeypot lives far off screen */
.gb-trap {
  position: absolute;
  left: -6000px;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.gb-actions {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 2em;
  flex-wrap: wrap;
}

.gb-note {
  font-size: 12.5px;
  letter-spacing: 0.04em;
  opacity: 0.6;
  min-height: 1.6em;
}

.gb-note.is-error {
  opacity: 0.85;
}

.gb-send {
  border: none;
  background: none;
  font-family: var(--mono);
  font-size: 14px;
  letter-spacing: 0.05em;
  color: var(--fg);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 5px;
  opacity: 0.85;
  transition: opacity 0.2s;
}

.gb-send:hover:not(:disabled) {
  opacity: 1;
}

.gb-send:disabled {
  opacity: 0.4;
  cursor: wait;
}

/* the stage: one comment types itself out, rests, wipes, repeats */
.gb-stage {
  margin-top: 9vh;
  padding-top: 30px;
  border-top: 1px dashed rgba(237, 231, 219, 0.28);
  /* room for a batch of lines, so the page doesn't breathe up and down */
  min-height: 24em;
}

.gb-line {
  margin-bottom: 34px;
}

.gb-type-head {
  display: flex;
  align-items: baseline;
  gap: 14px;
  min-height: 1.8em;
  margin-bottom: 6px;
}

.gb-type-name {
  font-family: var(--sans);
  font-style: italic;
  font-weight: 500;
  font-size: 17px;
  letter-spacing: 0.02em;
}

.gb-type-date {
  font-size: 12px;
  letter-spacing: 0.05em;
  opacity: 0.5;
}

.gb-type-msg {
  font-size: 14px;
  line-height: 1.9;
  opacity: 0.9;
  overflow-wrap: anywhere;
}

/* the blinking caret that does the writing */
.gb-cursor {
  display: inline-block;
  width: 9px;
  height: 1.05em;
  margin-left: 3px;
  vertical-align: text-bottom;
  background: var(--fg);
  opacity: 0.75;
  animation: gb-blink 1.05s steps(1) infinite;
}

@keyframes gb-blink {
  50% { opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .gb-cursor {
    animation: none;
    opacity: 0.4;
  }
}


/* full comment list, present for screen readers only */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ===== Responsive ===== */
@media (max-width: 900px) {
  /* name and tagline up top, reel along the lower third — no overlap */
  .featured-inner {
    top: 17vh;
    padding: 0 7vw;
  }

  .masthead-line {
    font-size: 12.5px;
    line-height: 1.7;
  }

  .masthead-line {
    max-width: 30em;
  }

  .reel {
    left: 0;
    right: 0;
    top: auto;
    bottom: 14vh;
    transform: none;
    padding: 24px 0;
  }

  .reel-item {
    width: clamp(105px, 30vw, 145px);
  }

  .reel-nav {
    top: auto;
    bottom: 10.5vh;
    right: 7vw;
  }

  .featured-caption {
    left: 7vw;
    bottom: 3.5vh;
  }

  .featured-scroll {
    display: none;
  }

  .entry {
    gap: 1em 1.4em;
  }

  .entry-title {
    width: 100%;
    order: -1;
  }

  /* no hover on touch screens — keep the index quiet */
  .entry-cloud {
    display: none;
  }

  .journals-kicker {
    margin-bottom: 40px;
  }

  .journals-note {
    padding-top: 40px;
  }
}

@media (max-width: 560px) {
  .site-header {
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 14px 5vw;
  }

  .site-nav a {
    margin: 0 8px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .cloud-item,
  .entry-arrow,
  .reel-track,
  .reel-item {
    transition: none;
  }

  .film {
    overflow-x: auto;
  }
}
