:root {
  --bg: #101010;
  --panel: #151515;
  --text: #f5f5f5;
  --muted: #a9a9a9;
  --muted-soft: #777777;
  --accent: #ff1515;
  --line: rgba(255, 255, 255, 0.10);
  --line-strong: rgba(255, 255, 255, 0.22);
  --shadow: rgba(0, 0, 0, 0.38);
}

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

html {
  scroll-behavior: smooth;
}

html,
body {
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: "Montserrat", "Helvetica Neue", Arial, sans-serif;
}

body {
  overflow-x: hidden;
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 255, 255, 0.055), transparent 34%),
    linear-gradient(135deg, #0d0d0d 0%, #181818 100%);
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  font-family: inherit;
}

/* HEADER */

.gallery-header {
  height: 96px;
  padding: 0 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}

.gallery-brand {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

.gallery-brand img {
  width: 96px;
  display: block;
}

.gallery-nav {
  display: flex;
  align-items: center;
  gap: 42px;
}

.gallery-nav a {
  color: var(--text);
  text-decoration: none;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 4px;
  text-transform: uppercase;
  opacity: 0.78;
  transition:
    color 0.25s ease,
    opacity 0.25s ease;
}

.gallery-nav a:hover {
  color: var(--accent);
  opacity: 1;
}

/* PAGE */

.gallery-page {
  width: min(1420px, 100%);
  margin: 0 auto;
  padding: 58px 56px 48px;
}

.gallery-title {
  margin-bottom: 46px;
}

.breadcrumb {
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 5px;
  text-transform: uppercase;
  margin-bottom: 28px;
}

.breadcrumb span {
  color: var(--accent);
  margin: 0 10px;
}

.gallery-title h1 {
  color: var(--text);
  font-size: clamp(44px, 5vw, 82px);
  font-weight: 300;
  letter-spacing: 22px;
  text-transform: uppercase;
  margin-bottom: 26px;
}

.gallery-subtitle {
  max-width: 520px;
  color: var(--muted);
  font-size: 16px;
  font-weight: 300;
  line-height: 1.8;
  letter-spacing: 0.5px;
}

.gallery-title::after {
  content: "";
  display: block;
  width: 58px;
  height: 1px;
  background: var(--accent);
  margin-top: 32px;
}

/* VIEWER */

.gallery-viewer {
  position: relative;
  padding: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 255, 255, 0.035), transparent 36%),
    rgba(255, 255, 255, 0.018);
  box-shadow: 0 28px 80px var(--shadow);
}

.viewer-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
}

.viewer-top p {
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 4px;
}

.viewer-top p span:first-child {
  color: var(--accent);
}

.close-gallery {
  color: var(--muted);
  text-decoration: none;
  font-size: 34px;
  font-weight: 200;
  line-height: 1;
  transition:
    color 0.25s ease,
    transform 0.25s ease;
}

.close-gallery:hover {
  color: var(--accent);
  transform: rotate(90deg);
}

.viewer-main {
  position: relative;
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 22px;
  align-items: stretch;
}

.viewer-arrow {
  display: none;
}

/* FOTO PRINCIPALE */

.main-photo-wrap {
  position: relative;
  grid-column: 2;
  min-height: 590px;
  overflow: hidden;
  border-radius: 4px;
  background: #000;
  isolation: isolate;
}

.main-photo-wrap img {
  width: 100%;
  height: 100%;
  min-height: 590px;
  object-fit: cover;
  object-position: center;
  display: block;
  filter: contrast(1.03) brightness(0.92);
  transition:
    transform 0.45s ease,
    filter 0.45s ease,
    opacity 0.25s ease;
}

.main-photo-wrap::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(to top, rgba(0, 0, 0, 0.45), transparent 42%),
    radial-gradient(circle at center, transparent 0%, rgba(0, 0, 0, 0.12) 100%);
  pointer-events: none;
}

/* METADATA */

.photo-info {
  grid-column: 1;
  grid-row: 1;
  align-self: end;
  padding: 26px 26px 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(12, 12, 12, 0.82);
  backdrop-filter: blur(10px);
}

.photo-location {
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 3px;
  text-transform: uppercase;
  margin-bottom: 18px;
}

.photo-info h2 {
  color: var(--text);
  font-size: 24px;
  font-weight: 300;
  letter-spacing: 8px;
  text-transform: uppercase;
  line-height: 1.5;
  margin-bottom: 18px;
}

.photo-date {
  color: var(--muted);
  font-size: 13px;
  letter-spacing: 1px;
}

.photo-line {
  width: 46px;
  height: 1px;
  background: var(--accent);
  margin: 26px 0;
}

.photo-data {
  display: grid;
  gap: 13px;
  list-style: none;
}

.photo-data li {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 300;
}

.photo-data span {
  color: var(--muted);
}

.photo-data strong {
  color: var(--text);
  font-weight: 300;
  text-align: right;
}

/* FULLSCREEN BUTTON DESKTOP */

.photo-fullscreen {
  position: absolute;
  right: 24px;
  bottom: 24px;
  z-index: 3;
  width: 44px;
  height: 44px;
  border: 1px solid rgba(255, 21, 21, 0.65);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.48);
  color: var(--accent);
  font-size: 20px;
  cursor: pointer;
  backdrop-filter: blur(8px);
  transition:
    background 0.25s ease,
    color 0.25s ease,
    transform 0.25s ease;
}

.photo-fullscreen:hover {
  background: var(--accent);
  color: #fff;
  transform: translateY(-2px);
}

/* ACTIONS */

.viewer-actions {
  display: none;
}

.viewer-actions button {
  border: 0;
  background: transparent;
  color: var(--accent);
  font-size: 13px;
  letter-spacing: 5px;
  text-transform: uppercase;
  cursor: pointer;
}

.viewer-actions button span {
  display: block;
  font-size: 34px;
  margin-bottom: 8px;
}

.viewer-actions p {
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 1px;
}

/* FULLSCREEN CONTROLS */

.fullscreen-close-button,
.fullscreen-rotate-button {
  display: none;
}

.main-photo-wrap:fullscreen .fullscreen-close-button {
  position: fixed;
  top: 22px;
  right: 22px;
  z-index: 20;
  width: 46px;
  height: 46px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.58);
  color: #fff;
  font-size: 34px;
  font-weight: 200;
  line-height: 1;
  display: grid;
  place-items: center;
  cursor: pointer;
  backdrop-filter: blur(10px);
}

.main-photo-wrap:fullscreen .fullscreen-rotate-button {
  position: fixed;
  left: 50%;
  bottom: 26px;
  z-index: 20;
  height: 48px;
  padding: 0 22px;
  border: 1px solid rgba(255, 21, 21, 0.65);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.58);
  color: #fff;
  font-size: 11px;
  letter-spacing: 3px;
  text-transform: uppercase;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  cursor: pointer;
  transform: translateX(-50%);
  backdrop-filter: blur(10px);
}

.main-photo-wrap:fullscreen .fullscreen-rotate-button span {
  color: var(--accent);
  font-size: 18px;
}

/* THUMBS */

.thumb-strip {
  padding-top: 24px;
  margin-top: 28px;
  border-top: 1px solid var(--line);
  overflow: hidden;
}

.thumb-row {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 0 0 14px;
  scroll-behavior: smooth;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 21, 21, 0.75) rgba(255, 255, 255, 0.08);
}

.thumb-row::-webkit-scrollbar {
  height: 8px;
}

.thumb-row::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.07);
  border-radius: 999px;
}

.thumb-row::-webkit-scrollbar-thumb {
  background: rgba(255, 21, 21, 0.75);
  border-radius: 999px;
}

.thumb {
  position: relative;
  min-width: 170px;
  width: 170px;
  height: 86px;
  flex: 0 0 auto;
  border: 1px solid transparent;
  border-radius: 4px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.005)),
    #070707;
  overflow: hidden;
  cursor: pointer;
  opacity: 0.62;
  transition:
    opacity 0.25s ease,
    border-color 0.25s ease,
    transform 0.25s ease,
    box-shadow 0.25s ease;
}

.thumb::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 22px;
  height: 22px;
  border: 2px solid rgba(255, 255, 255, 0.18);
  border-top-color: var(--accent);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  animation: thumbLoading 0.8s linear infinite;
  opacity: 1;
  z-index: 2;
}

.thumb::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(to top, rgba(0, 0, 0, 0.32), transparent 55%),
    radial-gradient(circle at center, transparent 0%, rgba(0, 0, 0, 0.18) 100%);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  z-index: 1;
}

.thumb.loaded::before {
  display: none;
}

.thumb.loaded::after {
  opacity: 1;
}

.thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
  opacity: 0;
  transform: scale(1.04);
  filter: contrast(1.02) brightness(0.9);
  transition:
    opacity 0.35s ease,
    transform 0.35s ease,
    filter 0.35s ease;
}

.thumb.loaded img {
  opacity: 1;
  transform: scale(1);
}

.thumb.active {
  opacity: 1;
  border-color: var(--accent);
  box-shadow:
    0 0 18px rgba(255, 21, 21, 0.22),
    0 12px 30px rgba(0, 0, 0, 0.36);
}

.thumb.active img {
  filter: contrast(1.06) brightness(1);
}

.thumb:hover {
  opacity: 1;
  transform: translateY(-2px);
}

.thumb:hover img {
  transform: scale(1.06);
  filter: contrast(1.06) brightness(1);
}

.thumb.thumb-error {
  background:
    linear-gradient(135deg, rgba(255, 21, 21, 0.18), rgba(255, 255, 255, 0.02)),
    #111;
}

.thumb.thumb-error::before {
  display: none;
}

.thumb.thumb-error::after {
  content: "!";
  display: grid;
  place-items: center;
  color: var(--accent);
  font-size: 24px;
  font-weight: 300;
  opacity: 1;
  background: transparent;
}

@keyframes thumbLoading {
  from {
    transform: translate(-50%, -50%) rotate(0deg);
  }

  to {
    transform: translate(-50%, -50%) rotate(360deg);
  }
}

/* WIDE VIEW */

body.wide-view .gallery-viewer {
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 255, 255, 0.035), transparent 36%),
    rgba(255, 255, 255, 0.018);
}

body.wide-view .viewer-main {
  grid-template-columns: 260px 1fr;
}

body.wide-view .photo-info {
  display: block;
}

body.wide-view .main-photo-wrap {
  grid-column: 2;
  min-height: 590px;
}

body.wide-view .main-photo-wrap img {
  min-height: 590px;
  object-fit: cover;
  background: #000;
}

/* FULLSCREEN MODE */

body.fullscreen-mode .photo-info {
  display: none;
}

body.fullscreen-mode .viewer-actions {
  display: none;
}

body.fullscreen-mode .thumb-strip {
  display: none;
}

.main-photo-wrap:fullscreen {
  width: 100vw;
  height: 100vh;
  border-radius: 0;
  background: #000;
}

.main-photo-wrap:fullscreen img {
  width: 100vw;
  height: 100vh;
  min-height: 100vh;
  object-fit: contain;
  background: #000;
  filter: none;
}

.main-photo-wrap:fullscreen::after {
  display: none;
}

.main-photo-wrap:fullscreen .photo-fullscreen {
  display: none;
}

/* FOOTER */

.gallery-footer {
  width: min(1420px, 100%);
  margin: 0 auto;
  padding: 0 56px 36px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.6px;
}

.gallery-footer a {
  color: var(--muted);
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: 4px;
  transition: color 0.25s ease;
}

.gallery-footer a:hover {
  color: var(--accent);
}

.gallery-footer span {
  color: var(--accent);
}

/* TABLET */

@media (max-width: 1100px) {
  .gallery-page {
    padding: 48px 34px 42px;
  }

  .gallery-viewer {
    padding: 28px;
  }

  .viewer-main {
    grid-template-columns: 230px 1fr;
  }

  .photo-info {
    padding: 22px;
  }

  .photo-info h2 {
    font-size: 21px;
    letter-spacing: 6px;
  }

  .main-photo-wrap,
  .main-photo-wrap img {
    min-height: 520px;
  }

  .thumb {
    min-width: 148px;
    width: 148px;
    height: 78px;
  }
}

/* MOBILE */

@media (max-width: 768px) {
  body {
    background:
      radial-gradient(circle at 50% 0%, rgba(255, 255, 255, 0.045), transparent 30%),
      linear-gradient(135deg, #0d0d0d 0%, #151515 100%);
  }

  .gallery-header {
    height: 92px;
    padding: 0 28px;
  }

  .gallery-brand img {
    width: 86px;
  }

  .gallery-nav {
    display: none;
  }

  .gallery-page {
    width: 100%;
    padding: 40px 22px 28px;
  }

  .gallery-title {
    text-align: center;
    margin-bottom: 34px;
  }

  .breadcrumb {
    font-size: 10px;
    letter-spacing: 5px;
    margin-bottom: 28px;
  }

  .breadcrumb span {
    margin: 0 12px;
  }

  .gallery-title h1 {
    font-size: clamp(34px, 10vw, 48px);
    letter-spacing: 13px;
    margin-bottom: 22px;
  }

  .gallery-subtitle {
    display: none;
  }

  .gallery-title::after {
    width: 54px;
    margin: 26px auto 0;
  }

  .gallery-viewer {
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }

  .viewer-top {
    padding: 0 4px;
    margin-bottom: 24px;
  }

  .viewer-top p {
    font-size: 13px;
    letter-spacing: 6px;
  }

  .close-gallery {
    font-size: 44px;
  }

  .viewer-main {
    display: block;
    position: relative;
  }

  .main-photo-wrap,
  body.wide-view .main-photo-wrap {
    width: 100%;
    min-height: 52svh;
    border-radius: 16px;
    grid-column: auto;
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.42);
  }

  .main-photo-wrap img,
  body.wide-view .main-photo-wrap img {
    width: 100%;
    min-height: 52svh;
    object-fit: cover;
    filter: contrast(1.02) brightness(0.96);
  }

  .main-photo-wrap::after {
    background:
      linear-gradient(to top, rgba(0, 0, 0, 0.32), transparent 48%),
      linear-gradient(to bottom, rgba(0, 0, 0, 0.24), transparent 35%);
  }

  .photo-fullscreen {
    display: none;
  }

  .photo-info,
  body.wide-view .photo-info {
    position: static;
    width: 100%;
    max-width: none;
    margin-top: 18px;
    padding: 22px 22px 24px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: rgba(12, 12, 12, 0.72);
    backdrop-filter: blur(10px);
    display: block;
  }

  .photo-location {
    display: block;
    color: var(--accent);
    font-size: 10px;
    letter-spacing: 4px;
    margin-bottom: 14px;
  }

  .photo-info h2 {
    font-size: 26px;
    letter-spacing: 9px;
    line-height: 1.45;
    margin-bottom: 12px;
  }

  .photo-date {
    font-size: 13px;
    color: var(--muted);
  }

  .photo-line {
    width: 44px;
    margin: 20px 0;
  }

  .photo-data {
    display: grid;
    gap: 11px;
  }

  .photo-data li {
    font-size: 12px;
    gap: 12px;
  }

  .photo-data span {
    color: var(--muted);
  }

  .photo-data strong {
    color: var(--text);
    font-weight: 300;
    text-align: right;
  }

  .viewer-actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    width: 100%;
    margin: 18px 0 22px;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    backdrop-filter: none;
  }

  .viewer-actions button {
    width: 100%;
    height: 54px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: rgba(10, 10, 10, 0.72);
    color: var(--text);
    font-size: 10px;
    letter-spacing: 3px;
    text-transform: uppercase;
    cursor: pointer;
    backdrop-filter: blur(10px);
  }

  .viewer-actions button span {
    display: inline-block;
    color: var(--accent);
    font-size: 18px;
    margin: 0 8px 0 0;
    vertical-align: middle;
  }

  .viewer-actions p {
    display: none;
  }

  .thumb-strip {
    padding-top: 0;
    margin-top: 10px;
    border-top: 0;
    overflow: visible;
  }

  .thumb-row {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 0 4px 8px;
    border-top: 0;
    scrollbar-width: none;
  }

  .thumb-row::-webkit-scrollbar {
    display: none;
  }

  .thumb {
    min-width: 92px;
    width: 92px;
    height: 64px;
    border-radius: 8px;
  }

  .thumb::before {
    width: 18px;
    height: 18px;
    border-width: 2px;
  }

  .thumb img {
    height: 100%;
  }

  .thumb.active {
    box-shadow:
      0 0 14px rgba(255, 21, 21, 0.25),
      0 10px 22px rgba(0, 0, 0, 0.28);
  }

  .gallery-footer {
    padding: 34px 22px 28px;
    flex-direction: column;
    gap: 16px;
    text-align: center;
    font-size: 11px;
  }

  .gallery-footer p:last-child {
    display: none;
  }

  body.fullscreen-mode .photo-info {
    display: none;
  }

  body.fullscreen-mode .viewer-actions {
    display: none;
  }

  body.fullscreen-mode .thumb-strip {
    display: none;
  }

  .main-photo-wrap:fullscreen {
    width: 100vw;
    height: 100vh;
    border-radius: 0;
  }

  .main-photo-wrap:fullscreen img {
    width: 100vw;
    height: 100vh;
    min-height: 100vh;
    object-fit: contain;
    background: #000;
    filter: none;
  }
}

/* MOBILE PICCOLI */

@media (max-width: 420px) {
  .gallery-header {
    padding: 0 22px;
  }

  .gallery-brand img {
    width: 78px;
  }

  .gallery-page {
    padding: 34px 18px 24px;
  }

  .breadcrumb {
    font-size: 9px;
    letter-spacing: 4px;
  }

  .gallery-title h1 {
    font-size: 34px;
    letter-spacing: 10px;
  }

  .main-photo-wrap,
  body.wide-view .main-photo-wrap {
    min-height: 48svh;
    border-radius: 14px;
  }

  .main-photo-wrap img,
  body.wide-view .main-photo-wrap img {
    min-height: 48svh;
  }

  .photo-info,
  body.wide-view .photo-info {
    padding: 20px;
    border-radius: 16px;
  }

  .photo-info h2 {
    font-size: 22px;
    letter-spacing: 7px;
  }

  .photo-data li {
    font-size: 11px;
  }

  .viewer-actions {
    gap: 10px;
  }

  .viewer-actions button {
    height: 52px;
    font-size: 9px;
    letter-spacing: 2.4px;
  }

  .thumb {
    min-width: 84px;
    width: 84px;
    height: 58px;
  }
}