:root {
  color-scheme: dark;
  --bg: #15181d;
  --accent: #e0a800;
  --ink: #fff;
  --header-top: max(3.5vh, env(safe-area-inset-top));
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  background: var(--bg);
}

* { box-sizing: border-box; }

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--bg);
  color: var(--ink);
}

button,
a { color: inherit; }

button { font: inherit; }

.hubris-header {
  position: fixed;
  inset: 0 0 auto;
  z-index: 20;
  height: calc(var(--header-top) + 62px);
  pointer-events: none;
}

.section-nav {
  position: absolute;
  top: var(--header-top);
  left: 3vw;
  display: flex;
  align-items: center;
  gap: 20px;
  pointer-events: auto;
}

.section-label {
  position: absolute;
  top: calc(var(--header-top) + 63px);
  left: 3vw;
  height: 13px;
  color: rgba(255, 255, 255, .35);
  font-size: 10px;
  font-weight: 300;
  letter-spacing: .32em;
  line-height: 1;
  text-transform: uppercase;
  white-space: nowrap;
  opacity: 0;
  transition: opacity 150ms ease;
}

.section-link,
.brand-link,
.step-button,
.image-button,
.gallery-button {
  appearance: none;
  padding: 0;
  border: 0;
  background: transparent;
  text-decoration: none;
}

.section-link {
  width: 54px;
  height: 54px;
  opacity: .45;
  transition: opacity 180ms ease;
}

.section-link svg {
  width: 100%;
  height: 100%;
  display: block;
  fill: var(--ink);
  transform: scale(.8);
  transform-origin: center;
}

.section-link .nav-fill,
.section-link .ws-fill,
.section-link .contact-fill,
.section-link .font-letter { fill: var(--ink); }

.section-link .cell-inner,
.section-link .ws-stroke,
.section-link .contact-stroke,
.section-link .font-frame,
.section-link .hubris-stroke {
  fill: none;
  stroke: var(--ink);
  stroke-width: 1;
  stroke-linejoin: round;
  stroke-miterlimit: 10;
}

.section-link .font-letter {
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 22px;
  font-weight: 300;
}

.section-link:hover,
.section-link:focus-visible { opacity: 1; }

.section-link:hover svg,
.section-link:focus-visible svg,
.section-link:hover .nav-fill,
.section-link:focus-visible .nav-fill,
.section-link:hover .ws-fill,
.section-link:focus-visible .ws-fill,
.section-link:hover .contact-fill,
.section-link:focus-visible .contact-fill,
.section-link:hover .font-letter,
.section-link:focus-visible .font-letter { fill: var(--accent); }

.section-link:hover .cell-inner,
.section-link:focus-visible .cell-inner,
.section-link:hover .ws-stroke,
.section-link:focus-visible .ws-stroke,
.section-link:hover .contact-stroke,
.section-link:focus-visible .contact-stroke,
.section-link:hover .font-frame,
.section-link:focus-visible .font-frame,
.section-link:hover .hubris-stroke,
.section-link:focus-visible .hubris-stroke { stroke: var(--accent); }

.section-link.is-active { opacity: 1; }
.section-link.is-active svg { fill: var(--accent); }
.section-link.is-active .hubris-stroke { stroke: var(--accent); stroke-width: 1.5; }

.brand-link {
  position: absolute;
  top: var(--header-top);
  left: 50%;
  width: 70px;
  height: 70px;
  opacity: .7;
  transform: translate(-50%, -8px);
  pointer-events: auto;
  transition: opacity 180ms ease;
}

.brand-link:hover,
.brand-link:focus-visible { opacity: 1; }
.brand-link svg { width: 100%; height: 100%; fill: var(--ink); }
.brand-link:hover svg,
.brand-link:focus-visible svg { fill: var(--accent); }

.viewer {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: calc(var(--header-top) + 72px) 9vw max(4vh, env(safe-area-inset-bottom));
  background: radial-gradient(circle at 50% 47%, rgba(40, 48, 57, .16), transparent 48%), var(--bg);
  touch-action: pan-y;
  user-select: none;
}

.image-button {
  position: relative;
  z-index: 5;
  display: grid;
  max-width: 100%;
  max-height: 100%;
  place-items: center;
  cursor: pointer;
  will-change: transform;
}

.image-button img {
  display: block;
  max-width: 100%;
  max-height: calc(100vh - var(--header-top) - 96px - env(safe-area-inset-bottom));
  object-fit: contain;
  opacity: 0;
  transform: scale(.995);
  transition: opacity 320ms ease, transform 420ms ease;
}

body.is-ready .image-button img {
  opacity: 1;
  transform: scale(1);
}

.swipe-frame {
  position: absolute;
  inset: 0;
  z-index: 6;
  display: grid;
  padding: inherit;
  place-items: center;
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  will-change: transform;
}

.swipe-frame img {
  display: block;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.viewer.is-swiping .swipe-frame {
  visibility: visible;
  opacity: 1;
}

.gallery-button { display: none; }

.loading-mark {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  pointer-events: none;
  transition: opacity 260ms ease;
}

body.is-ready .loading-mark { opacity: 0; }
.loading-mark svg { width: 44px; height: 44px; transform: rotate(-90deg); }
.loading-mark circle {
  fill: none;
  stroke: #263039;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-dasharray: 100;
  animation: loading 1100ms ease-in-out infinite;
}

.step-button {
  position: fixed;
  top: 0;
  bottom: 0;
  z-index: 4;
  display: flex;
  align-items: center;
  width: 50vw;
  height: auto;
  overflow: hidden;
  color: rgba(255,255,255,.25);
  cursor: pointer;
  transition: color 180ms ease, opacity 180ms ease;
}

.step-button:hover,
.step-button:focus-visible { color: var(--accent); }
.step-button:disabled { opacity: .08; cursor: default; }
.step-button svg { width: 48px; height: 48px; }
.step-button path { fill: none; stroke: currentColor; stroke-width: 1.25; }
.step-newer { left: 0; justify-content: center; }
.step-older { right: 0; justify-content: center; }

dialog {
  position: fixed;
  inset: 0;
  z-index: 10;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  overflow-x: hidden;
  overflow-y: auto;
  border: 0;
  color: var(--ink);
  background: rgba(21, 24, 29, .985);
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

body.is-archive-open {
  overflow-y: auto;
}

body.is-archive-open .hubris-header {
  position: relative;
  inset: auto;
}

body.is-archive-open .viewer {
  display: none;
}

body.is-archive-open dialog {
  position: relative;
  inset: auto;
  min-height: 100vh;
  height: auto;
  overflow: visible;
}

body.is-archive-open .archive-grid {
  padding-top: 30px;
}

.archive-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1.4vw;
  width: min(88vw, 1480px);
  margin: 0 auto;
  padding: calc(var(--header-top) + 86px) 0 max(6vh, env(safe-area-inset-bottom));
}

.archive-item {
  appearance: none;
  position: relative;
  padding: 0;
  overflow: hidden;
  border: 0;
  background: #0e1013;
  cursor: pointer;
  aspect-ratio: 1;
}

.archive-item::after {
  content: "";
  position: absolute;
  inset: 0;
  border: 1px solid transparent;
  transition: border-color 180ms ease;
}

.archive-item:hover::after,
.archive-item:focus-visible::after,
.archive-item.is-current::after { border-color: var(--accent); }
.archive-item img { width: 100%; height: 100%; object-fit: cover; display: block; }

@keyframes loading {
  from { stroke-dashoffset: 100; opacity: .4; }
  75% { stroke-dashoffset: 0; opacity: 1; }
  to { stroke-dashoffset: 0; opacity: 0; }
}

@media (max-width: 820px), (pointer: coarse) {
  :root { --header-top: max(2.5vh, env(safe-area-inset-top)); }

  .hubris-header { height: calc(var(--header-top) + 52px); }
  .section-nav { left: 4vw; gap: 8px; }
  .section-label { display: none; }
  .section-link { width: 42px; height: 42px; }
  .desktop-only, .hubris-link { display: none; }

  body.is-empty .cell-link { display: block; }

  .brand-link {
    width: 52px;
    height: 52px;
    transform: translate(-50%, -5px);
  }

  .viewer {
    padding: calc(var(--header-top) + 62px) 0 max(58px, calc(env(safe-area-inset-bottom) + 44px));
    touch-action: pan-y;
  }

  .image-button { width: 100%; cursor: default; }
  .image-button img {
    max-height: calc(100vh - var(--header-top) - 126px - env(safe-area-inset-bottom));
    width: 100%;
  }

  .gallery-button {
    position: fixed;
    bottom: max(10px, env(safe-area-inset-bottom));
    left: 50%;
    z-index: 8;
    display: grid;
    width: 42px;
    height: 42px;
    place-items: center;
    color: rgba(255, 255, 255, .42);
    transform: translateX(-50%);
  }

  .gallery-button svg {
    width: 26px;
    height: 26px;
    fill: currentColor;
  }

  .gallery-button:active,
  .gallery-button:focus-visible { color: var(--accent); }

  .archive-grid {
    width: 100%;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 2px;
    padding: calc(var(--header-top) + 66px) 0 max(4vh, env(safe-area-inset-bottom));
  }

  body.is-archive-open .archive-grid { padding-top: 12px; }

}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: 1ms !important; animation: none !important; }
}
