/* =========================================================
   responsive.css  (public pages, loaded LAST)

   Photos and controls scale with the screen. On a small screen photos get
   small, so several fit and can be looked through easily; on a big screen
   they keep their normal size. Only sizes and wrapping are set here.
   ========================================================= */

img, video, canvas { max-width: 100%; }
body { overflow-wrap: anywhere; }

/* Plant library cards */
.plant-grid { grid-template-columns: repeat(auto-fill, minmax(min(100%, clamp(140px, 42vw, 280px)), 1fr)); }
.plant-grid .image-box { height: clamp(110px, 30vw, 210px); }

/* Plant profile hero */
.profile-page .profile-hero { height: clamp(150px, 38vw, 380px); max-height: 46vh; }
.profile-page .hero-placeholder .material-symbols-outlined { font-size: clamp(56px, 16vw, 96px); }

/* Discovery photos */
.discovery-photos { gap: clamp(4px, 1.4vw, 10px); }
.discovery-photos img { width: clamp(64px, 20vw, 140px); height: clamp(64px, 20vw, 140px); }

/* Record page thumbnails and viewer */
.record-thumbs { gap: clamp(4px, 1.4vw, 10px); }
.record-thumb { width: clamp(58px, 18vw, 96px); }
.record-thumb-open { width: clamp(58px, 18vw, 96px); height: clamp(58px, 18vw, 96px); }
.record-discovery-photos img,
.record-carried img { max-width: clamp(64px, 22vw, 160px); }
.record-submission-image img { max-width: 100%; max-height: clamp(120px, 34vh, 320px); object-fit: cover; }
.record-modal img { max-width: 100%; max-height: calc(100vh - 80px); max-height: calc(100dvh - 80px); }

/* Scan page preview and report photos */
.scan-preview img,
.scan-preview-inline img { max-width: 100%; max-height: clamp(160px, 42vh, 420px); object-fit: contain; }
.scan-discovery-card .report-photo-box img { max-width: 100%; max-height: clamp(120px, 30vh, 280px); object-fit: cover; }
.report-photo { max-width: clamp(80px, 26vw, 160px); }

/* Controls never wider than the screen */
input, select, textarea, button { max-width: 100%; }
table { max-width: 100%; }

@media (max-width: 479px) {
    .discovery-thumb { width: 48px; height: 48px; }
}

@media (max-height: 520px) {
    .profile-page .profile-hero { height: 120px; }
    .scan-preview img,
    .scan-preview-inline img { max-height: 36vh; }
    .record-modal img { max-height: calc(100vh - 50px); max-height: calc(100dvh - 50px); }
}
