:root {
  --paper: #eeeae1;
  --ink: #18241f;
  --muted: #6d746c;
  --line: rgba(24, 36, 31, 0.2);
  --forest: #172a25;
  --accent: #315344;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  background: var(--paper);
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100svh;
  color: var(--ink);
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.18), transparent 28%),
    var(--paper);
  font-family: Arial, Helvetica, sans-serif;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
}

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

button {
  font: inherit;
}

button:focus-visible,
a:focus-visible,
.artwork:focus-visible {
  outline: 2px solid #9b673d;
  outline-offset: 4px;
}

.gallery {
  display: grid;
  grid-template-columns: minmax(300px, 0.76fr) minmax(430px, 1.24fr);
  gap: clamp(18px, 2.4vw, 38px);
  height: 100svh;
  min-height: 580px;
  padding: 18px;
  overflow: hidden;
}

.editorial {
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-width: 0;
  padding: clamp(18px, 2.8vw, 44px) clamp(4px, 1.5vw, 22px) clamp(16px, 2vw, 30px);
}

.masthead {
  display: flex;
  align-items: center;
  gap: 13px;
}

.masthead p {
  margin: 0;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.masthead p span {
  margin: 0 5px;
  color: #8b9189;
}

.masthead-rule {
  width: 31px;
  height: 1px;
  background: var(--ink);
}

.title-block {
  align-self: center;
  padding: 24px 0 30px;
}

.eyebrow {
  margin: 0 0 17px 4px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.19em;
  text-transform: uppercase;
}

h1 {
  margin: 0 0 26px -5px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(76px, 8.2vw, 146px);
  font-weight: 400;
  line-height: 0.79;
  letter-spacing: -0.072em;
}

h1 em {
  display: inline-block;
  font-size: 0.82em;
  font-weight: 400;
  letter-spacing: -0.066em;
  white-space: nowrap;
}

.intro {
  max-width: 34ch;
  margin: 0 0 0 4px;
  color: #4f5b54;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(15px, 1.25vw, 19px);
  line-height: 1.55;
}

.editorial-footer {
  display: grid;
  gap: 18px;
}

.caption {
  max-width: 39ch;
  margin: 0 0 0 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.tools {
  display: flex;
  align-items: center;
  gap: 15px;
  margin-left: 4px;
}

.zoom-controls {
  display: inline-flex;
  align-items: center;
  height: 39px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.22);
}

.zoom-controls button {
  display: grid;
  width: 40px;
  height: 37px;
  padding: 0;
  place-items: center;
  border: 0;
  color: var(--ink);
  background: transparent;
  cursor: pointer;
  transition: background 160ms ease, color 160ms ease;
}

.zoom-controls button:hover {
  color: #f4efe4;
  background: var(--forest);
}

.zoom-controls svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.4;
  stroke-linecap: round;
}

.zoom-controls .zoom-value {
  width: 55px;
  border-right: 1px solid var(--line);
  border-left: 1px solid var(--line);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.08em;
}

.interaction-note {
  margin: 0;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.06em;
}

.touch-note {
  display: none;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 17px;
  margin-left: 4px;
}

.download-button {
  display: inline-flex;
  min-height: 45px;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 0 18px;
  color: #f5f0e5;
  background: var(--forest);
  border: 1px solid var(--forest);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-decoration: none;
  text-transform: uppercase;
  transition: background 160ms ease, transform 160ms ease;
}

.download-button:hover {
  background: #284b3d;
  transform: translateY(-1px);
}

.download-button svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.standalone-link {
  padding: 9px 0;
  border-bottom: 1px solid #aeb2a9;
  font-size: 11px;
  letter-spacing: 0.025em;
  text-decoration: none;
}

.standalone-link:hover {
  border-color: var(--ink);
}

.standalone-link span {
  margin-left: 4px;
}

.medium {
  margin: 0 0 0 4px;
  color: #8b9189;
  font-size: 9px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.medium span {
  margin: 0 6px;
}

.viewer {
  position: relative;
  display: flex;
  min-width: 0;
  min-height: 0;
  align-items: center;
  justify-content: center;
  margin: 0;
  overflow: hidden;
  background: var(--forest);
  box-shadow: 0 18px 55px rgba(28, 38, 31, 0.12);
}

.artboard {
  position: relative;
  width: min(100%, calc((100svh - 36px) * 0.8));
  max-height: 100%;
  aspect-ratio: 4 / 5;
  overflow: hidden;
  background: #172a25;
  isolation: isolate;
}

.artwork-reveal {
  width: 100%;
  height: 100%;
  transition: opacity 900ms ease, transform 1100ms cubic-bezier(0.2, 0.7, 0.2, 1);
}

.artwork {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  cursor: grab;
  touch-action: none;
  user-select: none;
  -webkit-user-drag: none;
  transform-origin: center;
  will-change: transform;
}

.artwork.is-dragging {
  cursor: grabbing;
}

.js .artwork-reveal {
  opacity: 0;
  transform: translateY(10px);
}

body.is-ready .artwork-reveal {
  opacity: 1;
  transform: translateY(0);
}

.loading {
  position: absolute;
  inset: 0;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 16px;
  color: #d6d5c7;
  background: var(--forest);
  font-size: 9px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  transition: opacity 350ms ease, visibility 350ms ease;
}

.loading-line {
  position: relative;
  width: 76px;
  height: 1px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.14);
}

.loading-line::after {
  position: absolute;
  inset: 0;
  background: #d6d5c7;
  content: "";
  transform: translateX(-100%);
  animation: load-line 1.4s ease-in-out infinite;
}

body.is-ready .loading {
  visibility: hidden;
  opacity: 0;
}

.load-error {
  position: absolute;
  inset: 0;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 8px;
  padding: 30px;
  color: #eee8dc;
  background: var(--forest);
  text-align: center;
}

.load-error p {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 22px;
}

.load-error a {
  font-size: 12px;
  text-underline-offset: 4px;
}

.viewer-label,
.viewer-hint {
  position: absolute;
  z-index: 2;
  top: 22px;
  margin: 0;
  color: rgba(239, 235, 222, 0.72);
  font-size: 8px;
  font-weight: 600;
  letter-spacing: 0.19em;
  pointer-events: none;
  text-transform: uppercase;
}

.viewer-label {
  left: 24px;
  display: flex;
  gap: 18px;
}

.viewer-medium {
  color: rgba(239, 235, 222, 0.4);
}

.viewer-hint {
  right: 24px;
  color: rgba(239, 235, 222, 0.42);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 11px;
  font-style: italic;
  font-weight: 400;
  letter-spacing: 0.02em;
  text-transform: none;
}

.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;
}

@keyframes load-line {
  0% { transform: translateX(-100%); }
  55%, 100% { transform: translateX(100%); }
}

@media (max-width: 1000px) and (min-width: 701px) {
  .gallery {
    grid-template-columns: minmax(270px, 0.8fr) minmax(360px, 1.2fr);
    gap: 15px;
    padding: 14px;
  }

  .editorial {
    padding-right: 5px;
    padding-left: 5px;
  }

  h1 {
    font-size: clamp(67px, 8.5vw, 88px);
  }

  .interaction-note {
    max-width: 13ch;
    line-height: 1.5;
  }

  .viewer-label {
    left: 17px;
  }

  .viewer-hint {
    right: 17px;
  }
}

@media (max-width: 700px) {
  body {
    overflow: auto;
  }

  .gallery {
    display: flex;
    height: auto;
    min-height: 100svh;
    flex-direction: column;
    gap: 0;
    padding: 12px;
    overflow: visible;
  }

  .editorial {
    display: contents;
  }

  .masthead {
    order: 0;
    margin: 25px 12px 0;
  }

  .title-block {
    order: 1;
    padding: 34px 12px 24px;
  }

  .eyebrow {
    margin-bottom: 15px;
  }

  h1 {
    margin-bottom: 23px;
    font-size: clamp(73px, 20vw, 118px);
  }

  .intro {
    max-width: 31ch;
    font-size: 16px;
  }

  .editorial-footer {
    order: 3;
    gap: 17px;
    margin-top: 0;
    padding: 0 12px 30px;
  }

  .caption {
    max-width: 42ch;
  }

  .tools {
    justify-content: space-between;
  }

  .interaction-note {
    text-align: right;
  }

  .desktop-note {
    display: none;
  }

  .touch-note {
    display: inline;
  }

  .actions {
    gap: 16px;
  }

  .viewer {
    order: 2;
    width: 100%;
    min-height: 0;
    aspect-ratio: 4 / 5;
  }

  .artboard {
    width: 100%;
    height: 100%;
  }

  .viewer-label,
  .viewer-hint {
    top: 17px;
    font-size: 7px;
  }

  .viewer-label {
    left: 16px;
  }

  .viewer-hint {
    right: 16px;
    font-size: 10px;
  }

  .viewer-medium {
    display: none;
  }
}

@media (max-width: 380px) {
  .editorial {
    padding-right: 8px;
    padding-left: 8px;
  }

  .actions {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }

  .interaction-note {
    max-width: 14ch;
  }
}

@media (max-height: 560px) {
  body {
    overflow: hidden;
  }

  .gallery {
    display: grid;
    grid-template-columns: minmax(150px, 0.42fr) minmax(190px, 0.58fr);
    gap: 10px;
    height: 100svh;
    min-height: 0;
    padding: 8px;
    overflow: hidden;
  }

  .editorial {
    display: grid;
    grid-template-rows: auto 1fr auto;
    padding: 10px 4px;
  }

  .masthead {
    margin: 0;
  }

  .masthead p {
    font-size: 7px;
    letter-spacing: 0.12em;
  }

  .masthead-rule {
    width: 18px;
  }

  .title-block {
    align-self: center;
    padding: 12px 0;
  }

  .eyebrow,
  .intro,
  .caption,
  .tools,
  .medium {
    display: none;
  }

  h1 {
    margin: 0 0 0 -2px;
    font-size: clamp(38px, 7.2vw, 70px);
    line-height: 0.82;
  }

  h1 em {
    font-size: 0.78em;
  }

  .editorial-footer {
    display: block;
    order: initial;
    padding: 0;
  }

  .actions {
    display: block;
    margin: 0;
  }

  .download-button {
    width: 100%;
    min-height: 34px;
    gap: 7px;
    padding: 0 9px;
    font-size: 8px;
  }

  .standalone-link {
    display: none;
  }

  .viewer {
    order: initial;
    width: auto;
    height: 100%;
    aspect-ratio: auto;
  }

  .artboard {
    width: min(100%, calc((100svh - 16px) * 0.8));
    height: auto;
  }

  .viewer-label,
  .viewer-hint {
    top: 12px;
    font-size: 6px;
  }

  .viewer-label {
    left: 12px;
  }

  .viewer-hint {
    right: 12px;
    font-size: 8px;
  }
}

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