/* =========================================
   ARCHIVE — ZARAGOZA
   ========================================= */

:root {
  --page-bg: #ffffff;
  --text: #000000;

  /* HOME / WORK-DONE COLORWAY */
  --menu-height: 56px;

  --menu-background:
    linear-gradient(
      90deg,
      #f5f1e8,
      #e8ded2,
      #f3eadc
    );

  --menu-border:
    rgba(35, 30, 25, 0.18);

  --header-visible-logo-height:
    calc(var(--menu-height) - 4px);

  --header-logo-box-height:
    calc(
      var(--header-visible-logo-height)
      * 2.2255
    );

  --header-logo-box-width:
    calc(
      var(--header-visible-logo-height)
      * 2.880
    );

  --heading-size:
    clamp(42px, 8vw, 88px);

  --year-size:
    clamp(28px, 5vw, 54px);

  --body-size:
    clamp(16px, 2vw, 20px);

  --archive-side-gap:
    clamp(8px, 2vw, 28px);

  --grid-gap:
    clamp(3px, 0.8vw, 9px);

  --grid-max-width:
    1280px;

  --tile-radius:
    clamp(5px, 1.3vw, 13px);

  --year-border:
    rgba(112, 82, 62, 0.23);

  /* PHONE LIGHTBOX GAP ≈ 1/8 INCH */
  --lightbox-edge-gap: 12px;

  --lightbox-backdrop:
    rgba(14, 13, 12, 0.78);

  --lightbox-caption-bg:
    linear-gradient(
      to top,
      rgba(0, 0, 0, 0.72),
      rgba(0, 0, 0, 0.34),
      transparent
    );

  --background-blur-strength: 10px;

  --footer-background:
    rgba(112, 82, 62, 0.50);

  --footer-text-color:
    #ffd84d;
}


* {
  box-sizing: border-box;
}


html {
  width: 100%;
  min-height: 100%;

  scroll-behavior: smooth;
}


body {
  margin: 0;

  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;

  overflow-x: hidden;

  background: var(--page-bg);
  color: var(--text);

  font-family:
    "Times New Roman",
    Times,
    serif;
}


body.lightbox-open {
  overflow: hidden;
}


/* =========================================
   HEADER
   ========================================= */

#site-header {
  position: fixed;

  top: 0;
  left: 0;

  width: 100%;

  height:
    calc(
      var(--menu-height)
      +
      env(safe-area-inset-top)
    );

  padding-top:
    env(safe-area-inset-top);

  display: flex;
  align-items: center;
  justify-content: center;

  background:
    var(--menu-background);

  border-bottom:
    1px solid
    var(--menu-border);

  z-index: 10000;
}


.header-logo-link {
  width:
    var(--header-logo-box-width);

  height:
    var(--header-logo-box-height);

  display: flex;
  align-items: center;
  justify-content: center;

  transform:
    translateY(-2px);
}


#site-logo {
  width: 100%;
  height: 100%;

  display: block;

  object-fit: contain;
}


/* Hamburger */

#menu-toggle {
  position: absolute;

  left:
    clamp(12px, 3vw, 28px);

  top:
    calc(
      env(safe-area-inset-top)
      +
      var(--menu-height) / 2
    );

  transform:
    translateY(-50%);

  width: 44px;
  height: 44px;

  padding: 6px;

  border: 0;

  background:
    transparent;

  display: flex;
  flex-direction: column;
  justify-content: center;

  gap: 7px;

  cursor: pointer;

  z-index: 2;
}


#menu-toggle span {
  display: block;

  width: 32px;
  height: 3px;

  background: #050505;

  border-radius: 2px;

  transition:
    transform 300ms ease,
    opacity 200ms ease;
}


#menu-toggle.open span:nth-child(1) {
  transform:
    translateY(10px)
    rotate(45deg);
}


#menu-toggle.open span:nth-child(2) {
  opacity: 0;
}


#menu-toggle.open span:nth-child(3) {
  transform:
    translateY(-10px)
    rotate(-45deg);
}


/* Menu */

#submenu {
  position: fixed;

  top:
    calc(
      var(--menu-height)
      +
      env(safe-area-inset-top)
    );

  left: 0;

  width: 100%;

  padding:
    26px
    20px
    30px;

  display: flex;
  flex-direction: column;
  align-items: center;

  gap: 22px;

  background: #ffffff;

  border-bottom:
    1px solid
    rgba(0, 0, 0, 0.10);

  transform:
    translateY(-120%);

  opacity: 0;

  pointer-events: none;

  z-index: 9999;

  transition:
    transform 350ms ease,
    opacity 250ms ease;
}


#submenu.open {
  transform: translateY(0);

  opacity: 1;

  pointer-events: auto;
}


#submenu a {
  color: #000000;

  text-decoration: none;

  font-size:
    clamp(22px, 3vw, 30px);

  font-weight: bold;
}


#background-blur {
  position: fixed;
  inset: 0;

  width: 100%;
  height: 100%;

  border: 0;
  padding: 0;

  background:
    rgba(255, 255, 255, 0.15);

  backdrop-filter:
    blur(
      var(
        --background-blur-strength
      )
    );

  -webkit-backdrop-filter:
    blur(
      var(
        --background-blur-strength
      )
    );

  opacity: 0;

  pointer-events: none;

  z-index: 9000;

  transition:
    opacity 250ms ease;
}


#background-blur.active {
  opacity: 1;

  pointer-events: auto;
}


/* =========================================
   ARCHIVE PAGE
   ========================================= */

.archive-page {
  width: 100%;

  min-height:
    100dvh;

  padding-top:
    calc(
      var(--menu-height)
      +
      env(safe-area-inset-top)
    );
}


.archive-intro {
  min-height:
    clamp(
      190px,
      28dvh,
      360px
    );

  padding:
    clamp(65px, 9vh, 110px)
    20px
    clamp(40px, 6vh, 72px);

  display: flex;

  align-items: center;
  justify-content: center;

  text-align: center;
}


.archive-intro h1 {
  margin: 0;

  font-size:
    var(--heading-size);

  line-height: 1;

  font-weight: bold;
}


.archive-years {
  width:
    min(
      calc(
        100%
        -
        (
          var(--archive-side-gap)
          * 2
        )
      ),
      var(--grid-max-width)
    );

  margin:
    0 auto
    clamp(90px, 14vh, 160px);
}


/* =========================================
   YEAR ACCORDIONS
   ========================================= */

.archive-year {
  width: 100%;

  border-top:
    1px solid
    var(--year-border);
}


.archive-year:last-child {
  border-bottom:
    1px solid
    var(--year-border);
}


.archive-year-button {
  width: 100%;

  min-height:
    clamp(72px, 10vh, 110px);

  padding:
    12px
    clamp(4px, 1vw, 10px);

  border: 0;

  background:
    transparent;

  display: flex;
  align-items: center;
  justify-content: space-between;

  color: #000000;

  font-family:
    inherit;

  font-size:
    var(--year-size);

  font-weight:
    bold;

  cursor: pointer;
}


.archive-year-arrow {
  display: inline-block;

  font-size:
    0.58em;

  transform:
    rotate(-90deg);

  transition:
    transform 260ms ease;
}


.archive-year.open
.archive-year-arrow {
  transform:
    rotate(0deg);
}


.archive-year-content {
  display: grid;

  grid-template-rows:
    0fr;

  opacity: 0;

  transition:
    grid-template-rows 360ms ease,
    opacity 250ms ease;
}


.archive-year.open
.archive-year-content {
  grid-template-rows:
    1fr;

  opacity: 1;
}


.archive-year-inner {
  min-height: 0;

  overflow: hidden;
}


/* =========================================
   RESPONSIVE GRID
   3 columns phone -> max 6
   ========================================= */

.archive-grid {
  display: grid;

  grid-template-columns:
    repeat(3, minmax(0, 1fr));

  gap:
    var(--grid-gap);

  padding-bottom:
    clamp(28px, 5vh, 58px);
}


.archive-tile {
  position: relative;

  width: 100%;

  aspect-ratio: 1 / 1;

  padding: 0;

  border: 0;

  overflow: hidden;

  border-radius:
    var(--tile-radius);

  background: #eeeae4;

  cursor: pointer;

  isolation: isolate;
}


.archive-tile-media {
  position: relative;

  z-index: 1;

  width: 100%;
  height: 100%;

  display: block;

  object-position:
    var(
      --media-position,
      50% 50%
    );

  transform:
    scale(
      var(
        --media-scale,
        1
      )
    );

  transform-origin:
    var(
      --media-position,
      50% 50%
    );
}


.archive-tile-media[data-fit="cover"] {
  object-fit: cover;
}


.archive-tile-media[data-fit="contain"] {
  object-fit: contain;
}


.archive-video-badge {
  position: absolute;

  top: 7px;
  right: 7px;

  z-index: 3;

  width: 22px;
  height: 22px;

  border-radius: 50%;

  display: flex;
  align-items: center;
  justify-content: center;

  background:
    rgba(0, 0, 0, 0.52);

  color: #ffffff;

  font-size: 11px;

  pointer-events: none;
}


/* =========================================
   LIGHTBOX
   ========================================= */

.archive-lightbox {
  position: fixed;
  inset: 0;

  z-index: 20000;

  display: flex;
  align-items: center;
  justify-content: center;

  padding:
    calc(
      var(--lightbox-edge-gap)
      +
      env(safe-area-inset-top)
    )
    calc(
      var(--lightbox-edge-gap)
      +
      env(safe-area-inset-right)
    )
    calc(
      var(--lightbox-edge-gap)
      +
      env(safe-area-inset-bottom)
    )
    calc(
      var(--lightbox-edge-gap)
      +
      env(safe-area-inset-left)
    );

  background:
    var(--lightbox-backdrop);

  backdrop-filter:
    blur(13px);

  -webkit-backdrop-filter:
    blur(13px);

  opacity: 0;

  pointer-events: none;

  transition:
    opacity 220ms ease;
}


.archive-lightbox.open {
  opacity: 1;

  pointer-events: auto;
}


.lightbox-card {
  position: relative;

  width: min(
    100%,
    920px
  );

  height:
    min(
      100%,
      920px
    );

  display: flex;
  align-items: center;
  justify-content: center;

  overflow: hidden;

  border-radius:
    clamp(12px, 2vw, 22px);

  background:
    rgba(22, 21, 19, 0.84);

  box-shadow:
    0 18px 70px
    rgba(0, 0, 0, 0.35);
}


.lightbox-stage {
  position: absolute;

  inset: 0;

  width: 100%;
  height: 100%;

  display: flex;
  align-items: center;
  justify-content: center;

  overflow: hidden;
}


.lightbox-bg {
  position: absolute;

  inset: -8%;

  width: 116%;
  height: 116%;

  object-fit: cover;

  filter:
    blur(42px)
    saturate(0.68);

  opacity: 0.26;

  transform:
    scale(1.08);
}


.lightbox-media {
  position: relative;

  z-index: 1;

  max-width: 100%;
  max-height: 100%;

  width: 100%;
  height: 100%;

  object-position:
    var(
      --media-position,
      50% 50%
    );

  transform:
    scale(
      var(
        --media-scale,
        1
      )
    );

  transform-origin:
    var(
      --media-position,
      50% 50%
    );
}


.lightbox-media[data-fit="cover"] {
  object-fit: cover;
}


.lightbox-media[data-fit="contain"] {
  object-fit: contain;
}


.lightbox-caption {
  position: absolute;

  z-index: 5;

  left: 0;
  right: 0;
  bottom: 0;

  min-height: 92px;

  padding:
    44px
    clamp(16px, 4vw, 34px)
    clamp(17px, 3vh, 28px);

  background:
    var(--lightbox-caption-bg);

  color: #ffffff;

  font-size:
    var(--body-size);

  line-height: 1.4;

  pointer-events: none;
}


/* X */

.lightbox-close {
  position: fixed;

  top:
    calc(
      var(--lightbox-edge-gap)
      +
      env(safe-area-inset-top)
    );

  right:
    calc(
      var(--lightbox-edge-gap)
      +
      env(safe-area-inset-right)
    );

  z-index: 20005;

  width: 42px;
  height: 42px;

  border: 0;

  border-radius: 50%;

  background:
    rgba(0, 0, 0, 0.52);

  color: #ffffff;

  font-size: 31px;

  line-height: 1;

  cursor: pointer;
}


/* Left / right arrows */

.lightbox-arrow {
  position: fixed;

  top: 50%;

  z-index: 20004;

  transform:
    translateY(-50%);

  width: 44px;
  height: 58px;

  border: 0;

  background:
    rgba(0, 0, 0, 0.34);

  color: #ffffff;

  border-radius:
    12px;

  font-family:
    Arial,
    sans-serif;

  font-size:
    43px;

  line-height: 1;

  cursor: pointer;

  backdrop-filter:
    blur(6px);

  -webkit-backdrop-filter:
    blur(6px);
}


.lightbox-prev {
  left:
    calc(
      var(--lightbox-edge-gap)
      +
      env(safe-area-inset-left)
    );
}


.lightbox-next {
  right:
    calc(
      var(--lightbox-edge-gap)
      +
      env(safe-area-inset-right)
    );
}


/* =========================================
   FOOTER
   ========================================= */

#site-footer {
  min-height:
    clamp(
      72px,
      10vh,
      110px
    );

  padding:
    18px
    clamp(18px, 4vw, 56px);

  display: flex;
  align-items: center;

  background:
    var(--footer-background);
}


#site-footer p {
  margin: 0;

  color:
    var(--footer-text-color);

  font-family:
    "Courier New",
    Courier,
    monospace;

  font-size:
    var(--body-size);
}


/* =========================================
   RESPONSIVE GRID
   ========================================= */

@media (min-width: 600px) {

  :root {
    --menu-height: 62px;
  }

  .archive-grid {
    grid-template-columns:
      repeat(
        4,
        minmax(0, 1fr)
      );
  }

}


@media (min-width: 900px) {

  .archive-grid {
    grid-template-columns:
      repeat(
        5,
        minmax(0, 1fr)
      );
  }

}


@media (min-width: 1200px) {

  :root {
    --menu-height: 66px;
  }

  .archive-grid {
    grid-template-columns:
      repeat(
        6,
        minmax(0, 1fr)
      );
  }

}


/*
  Phones:
  floating card is intentionally slightly
  smaller than the available screen area.
*/

@media (max-width: 699px) {

  .lightbox-caption,
  .lightbox-arrow,
  .lightbox-close {
    transition:
      opacity 140ms ease;
  }

  .archive-lightbox.mobile-controls-hidden .lightbox-caption,
  .archive-lightbox.mobile-controls-hidden .lightbox-arrow,
  .archive-lightbox.mobile-controls-hidden .lightbox-close {
    opacity: 0;
    pointer-events: none;
  }

  .lightbox-card {
    width:
      calc(
        100%
        -
        18px
      );

    height:
      calc(
        100%
        -
        18px
      );
  }

  .lightbox-arrow {
    width: 34px;
    height: 52px;

    border-radius: 10px;

    font-size: 36px;
  }

  .lightbox-prev {
    left:
      calc(
        var(--lightbox-edge-gap)
        + 2px
      );
  }

  .lightbox-next {
    right:
      calc(
        var(--lightbox-edge-gap)
        + 2px
      );
  }

}


/* Motion accessibility */

@media (prefers-reduced-motion: reduce) {

  html {
    scroll-behavior: auto;
  }

  #submenu,
  #background-blur,
  #menu-toggle span,
  .archive-year-arrow,
  .archive-year-content,
  .archive-lightbox {
    transition: none !important;
  }

  .lightbox-caption,
  .lightbox-arrow,
  .lightbox-close {
    transition: none !important;
  }

}
