/*
 * Contact Sheet - Robert Frank style
 * Film strips on darkroom paper
 */

:root {
  --paper: #d4d0c8;
  --paper-dark: #b8b4ac;
  --film-base: #111;
  --rebate: #1a1a1a;
  --china-marker: #8b1a2d;
  --frame-num: rgba(180, 170, 150, 0.7);
}

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

body {
  font-family: 'Courier New', monospace;
  background: var(--paper);
  min-height: 100vh;
  padding: 2rem;

  /* Center contact sheet vertically */
  display: flex;
  align-items: center;
  justify-content: center;

  /* Paper texture */
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
  background-blend-mode: multiply;
  background-size: 100px;
}

.contact-sheet {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  max-width: 1400px;

  /* Rotate whole block 7° clockwise */
  transform: rotate(7deg);
}

/* Each strip is a row of frames */
.strip {
  display: flex;
  background: var(--film-base);
  position: relative;
  padding: 0;
}

/* Slight offset and rotation per strip - hand-laid feel */
.strip:nth-child(1) { transform: rotate(-0.3deg) translateX(2px); }
.strip:nth-child(2) { transform: rotate(0.2deg) translateX(-4px); }
.strip:nth-child(3) { transform: rotate(-0.15deg) translateX(6px); }
.strip:nth-child(4) { transform: rotate(0.35deg) translateX(-2px); }
.strip:nth-child(5) { transform: rotate(-0.25deg) translateX(3px); }
.strip:nth-child(6) { transform: rotate(0.1deg) translateX(-5px); }
.strip:nth-child(7) { transform: rotate(-0.2deg) translateX(1px); }
.strip:nth-child(8) { transform: rotate(0.25deg) translateX(-3px); }

/* Sprocket holes - top and bottom of strip */
.strip::before,
.strip::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  height: 8px;
  background: repeating-linear-gradient(
    to right,
    transparent 0px,
    transparent 6px,
    var(--film-base) 6px,
    var(--film-base) 8px,
    var(--paper) 8px,
    var(--paper) 12px,
    var(--film-base) 12px,
    var(--film-base) 14px,
    transparent 14px,
    transparent 28px
  );
}

.strip::before {
  top: 0;
}

.strip::after {
  bottom: 0;
}

/* Individual frame */
.frame {
  position: relative;
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
}

/* Rebate area - top */
.frame .rebate-top {
  height: 16px;
  background: var(--rebate);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 4px;
  margin-top: 8px;
}

.frame .rebate-top .film-text {
  font-size: 5px;
  color: var(--frame-num);
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.frame .rebate-top .frame-num {
  font-size: 7px;
  color: var(--frame-num);
  font-weight: bold;
}

/* Image area */
.frame .image {
  width: 160px;
  height: 107px; /* 3:2 aspect */
  background: var(--film-base);
  overflow: hidden;
}

.frame .image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Rebate area - bottom */
.frame .rebate-bottom {
  height: 16px;
  background: var(--rebate);
  display: flex;
  align-items: center;
  padding: 0 4px;
  margin-bottom: 8px;
}

.frame .rebate-bottom .film-code {
  font-size: 5px;
  color: var(--frame-num);
  letter-spacing: 0.1em;
}

/* China marker selections - red circles */
.frame.selected .image::after {
  content: '';
  position: absolute;
  top: 20px;
  left: 5px;
  right: 5px;
  bottom: 20px;
  border: 5px solid var(--china-marker);
  border-radius: 8px;
  opacity: 0.75;
  pointer-events: none;
  /* Hand-drawn imperfection */
  transform: rotate(-1deg);
}

/* Arrow mark */
.frame.arrow::before {
  content: '→';
  position: absolute;
  top: 30px;
  left: -5px;
  font-size: 28px;
  color: var(--china-marker);
  font-weight: bold;
  transform: rotate(-5deg);
  opacity: 0.75;
  z-index: 10;
}

/* Full strip selection - underline the whole strip */
.strip.selected-strip::after {
  content: '';
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: -4px;
  height: 6px;
  background: var(--china-marker);
  border-radius: 2px;
  transform: rotate(-0.3deg);
  opacity: 0.75;
}

/* Hover */
.frame:hover .image img {
  filter: brightness(1.05);
}

/* Responsive - smaller frames on mobile */
@media (max-width: 768px) {
  body {
    padding: 1rem;
  }

  .strip {
    flex-wrap: wrap;
  }

  .frame .image {
    width: 120px;
    height: 80px;
  }
}

/* Larger screens - bigger frames */
@media (min-width: 1200px) {
  .frame .image {
    width: 200px;
    height: 133px;
  }
}
