:root {
  --bg: #091114;
  --surface: #101c20;
  --surface-raised: #15262b;
  --ink: #edf8f8;
  --muted: #9caeb1;
  --accent: #35d2cf;
  --accent-soft: #8be9e4;
  --line: rgba(211, 246, 245, .13);
  --shadow: 0 24px 70px rgba(0, 0, 0, .35);
}

* { box-sizing: border-box; }
html { background: var(--bg); }
body { margin: 0; min-width: 320px; color: var(--ink); background: radial-gradient(ellipse 78% 33% at 50% -4%, #163439 0%, transparent 72%), var(--bg); font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }

.page-shell { width: min(1240px, calc(100% - 40px)); margin: auto; }
.hero { max-width: 850px; padding: clamp(78px, 12vw, 142px) 0 70px; }
.eyebrow, .section-label { margin: 0 0 13px; color: var(--accent-soft); font-size: .73rem; font-weight: 750; letter-spacing: .13em; text-transform: uppercase; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 20px; font-size: clamp(3.4rem, 9vw, 7.2rem); line-height: .9; letter-spacing: -.075em; }
h1 span { color: var(--accent); }
.intro { max-width: 620px; margin-bottom: 34px; color: var(--muted); font-size: clamp(1rem, 2vw, 1.19rem); line-height: 1.65; }
.search-form { display: flex; gap: 10px; padding: 7px; border: 1px solid var(--line); border-radius: 17px; background: rgba(20, 38, 42, .78); box-shadow: var(--shadow); }
.search-form:focus-within { border-color: rgba(53, 210, 207, .65); box-shadow: 0 0 0 4px rgba(53, 210, 207, .1), var(--shadow); }
.search-form input { min-width: 0; flex: 1; padding: 13px 15px; border: 0; outline: 0; color: var(--ink); background: transparent; font-size: 1.05rem; }
.search-form input::placeholder { color: #789094; }
.primary-button, .random-button, .suggestion { cursor: pointer; transition: transform .18s ease, background .18s ease, border-color .18s ease; }
.primary-button { border: 0; border-radius: 11px; padding: 13px 19px; color: #062427; background: var(--accent); font-weight: 800; white-space: nowrap; }
.primary-button:hover { transform: translateY(-1px); background: #76e6e0; }
.explore-actions { margin-top: 15px; }
.random-button { padding: 8px 0; border: 0; color: var(--accent-soft); background: transparent; font-size: .9rem; font-weight: 700; }
.random-button:hover { color: white; transform: translateX(2px); }
.suggestions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 26px; color: var(--muted); font-size: .85rem; }
#suggestionList { display: flex; flex-wrap: wrap; gap: 7px; }
.suggestion { border: 1px solid var(--line); border-radius: 999px; padding: 6px 10px; color: #c7dbdc; background: rgba(255, 255, 255, .035); font-size: .8rem; }
.suggestion:hover { border-color: rgba(53, 210, 207, .52); background: rgba(53, 210, 207, .12); }

.gallery-section { padding-bottom: 100px; }
.gallery-heading { display: flex; justify-content: space-between; gap: 20px; align-items: end; margin-bottom: 24px; }
.gallery-heading h2 { margin-bottom: 0; font-size: clamp(1.55rem, 3vw, 2.3rem); letter-spacing: -.045em; }
.result-count { margin: 0 0 3px; color: var(--muted); font-size: .9rem; }
.gallery { display: grid; grid-template-columns: repeat(12, 1fr); grid-auto-rows: 42px; gap: 12px; }
.image-card { position: relative; grid-column: span 3; grid-row: span 7; overflow: hidden; padding: 0; border: 0; border-radius: 14px; color: var(--ink); background: var(--surface-raised); box-shadow: 0 6px 20px rgba(0,0,0,.15); cursor: pointer; opacity: 0; animation: card-in .55s cubic-bezier(.2,.8,.2,1) forwards; }
.image-card:nth-child(5n+1) { grid-column: span 4; grid-row: span 10; }
.image-card:nth-child(7n+3) { grid-column: span 2; grid-row: span 6; }
.image-card:nth-child(8n+5) { grid-row: span 9; }
.image-card img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform .45s ease, filter .45s ease; }
.image-card::after { content: ""; position: absolute; inset: 0; background: linear-gradient(transparent 42%, rgba(0,0,0,.7)); opacity: .82; transition: opacity .25s ease; }
.card-title { position: absolute; z-index: 1; right: 12px; bottom: 11px; left: 12px; overflow: hidden; color: white; font-size: .82rem; font-weight: 650; line-height: 1.25; text-align: left; text-shadow: 0 1px 8px #000; white-space: nowrap; text-overflow: ellipsis; }
.image-card:hover img, .image-card:focus-visible img { transform: scale(1.06); filter: saturate(1.13); }
.image-card:hover::after { opacity: .55; }
.image-card:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
@keyframes card-in { to { opacity: 1; } }

.status-message { display: grid; justify-items: center; gap: 14px; padding: 58px 20px; border: 1px dashed var(--line); border-radius: 16px; color: var(--muted); text-align: center; }
.status-message.hidden { display: none; }
.gallery-actions { display: flex; justify-content: center; min-height: 46px; padding-top: 28px; }
.load-more-button { padding: 12px 17px; border: 1px solid rgba(53,210,207,.42); border-radius: 10px; color: var(--accent-soft); background: rgba(53,210,207,.08); font-weight: 750; cursor: pointer; transition: transform .18s ease, background .18s ease, border-color .18s ease; }
.load-more-button:hover:not(:disabled) { border-color: var(--accent); background: rgba(53,210,207,.17); transform: translateY(-1px); }
.load-more-button:disabled { color: var(--muted); border-color: var(--line); background: transparent; cursor: default; }
.load-more-button.hidden { display: none; }
.loader { width: 29px; height: 29px; border: 3px solid rgba(53,210,207,.18); border-top-color: var(--accent); border-radius: 50%; animation: spin .75s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.retry-button { padding: 10px 14px; border: 1px solid rgba(53,210,207,.4); border-radius: 9px; color: var(--accent-soft); background: transparent; cursor: pointer; }

.modal { position: fixed; z-index: 10; inset: 0; display: grid; place-items: center; padding: 18px; visibility: hidden; opacity: 0; transition: opacity .2s ease, visibility .2s ease; }
.modal.open { visibility: visible; opacity: 1; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0, 6, 8, .78); backdrop-filter: blur(8px); }
.modal-content { position: relative; z-index: 1; display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(255px, .8fr); width: min(1080px, 100%); max-height: min(760px, calc(100vh - 36px)); overflow: auto; border: 1px solid var(--line); border-radius: 18px; background: #0d181c; box-shadow: var(--shadow); transform: translateY(8px); transition: transform .25s ease; }
.modal.open .modal-content { transform: translateY(0); }
.modal-image-wrap { min-height: 340px; background: #071012; }
.modal-image-wrap img { display: block; width: 100%; height: 100%; max-height: 720px; object-fit: contain; }
.modal-details { align-self: center; padding: clamp(26px, 4vw, 45px); }
.modal-details h2 { margin-bottom: 29px; font-size: clamp(1.45rem, 3vw, 2.2rem); letter-spacing: -.045em; overflow-wrap: anywhere; }
.metadata { margin: 0 0 32px; }
.metadata div { padding: 13px 0; border-top: 1px solid var(--line); }
.metadata dt { margin-bottom: 5px; color: var(--muted); font-size: .72rem; font-weight: 750; letter-spacing: .1em; text-transform: uppercase; }
.metadata dd { margin: 0; color: #d6e5e5; line-height: 1.45; overflow-wrap: anywhere; }
.source-link { color: var(--accent); font-weight: 750; text-decoration: none; }
.source-link:hover { color: white; }
.modal-close { position: absolute; z-index: 2; top: 11px; right: 12px; width: 37px; height: 37px; border: 1px solid var(--line); border-radius: 50%; color: white; background: rgba(7,16,18,.75); font-size: 1.8rem; line-height: 1; cursor: pointer; }
footer { width: min(1240px, calc(100% - 40px)); margin: auto; padding: 28px 0 38px; border-top: 1px solid var(--line); color: #719093; font-size: .8rem; }
.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; }

@media (max-width: 760px) { .page-shell { width: min(100% - 28px, 1240px); } .hero { padding-top: 70px; padding-bottom: 54px; } .search-form { display: block; padding: 5px; } .search-form input { width: 100%; padding: 13px 12px; } .primary-button { width: 100%; } .gallery { grid-auto-rows: 34px; gap: 8px; } .image-card { grid-column: span 4; grid-row: span 7; border-radius: 10px; } .image-card:nth-child(5n+1) { grid-column: span 8; grid-row: span 10; } .image-card:nth-child(7n+3) { grid-column: span 4; grid-row: span 6; } .image-card:nth-child(8n+5) { grid-row: span 9; } .modal-content { grid-template-columns: 1fr; } .modal-image-wrap { min-height: 230px; max-height: 48vh; } .modal-details { padding: 25px; } footer { width: min(100% - 28px, 1240px); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }
