/* The Van Gogh gallery's styles. Only the gallery's pages load this file,
   and every rule is scoped to its classes. */

:root {
  --vg-bg: #000;
  --vg-ink: #f2ede4;
  --vg-muted: #b9b1a4;
  --vg-panel: #17140f;
  --vg-panel-2: #221e17;
  --vg-line: #3a3329;
  --vg-accent: #e8c14a;
  --vg-focus: #ffd75e;
  --vg-flag: #e6a07a;
  color-scheme: dark;
}

html.vg-nojs, html.vg-js { background: var(--vg-bg); }

body.vg {
  margin: 0;
  background: var(--vg-bg);
  color: var(--vg-ink);
  font: 17px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-text-size-adjust: 100%;
}

.vg a { color: var(--vg-accent); }
.vg :focus-visible { outline: 3px solid var(--vg-focus); outline-offset: 2px; }
.vg code { font-size: 0.9em; }

/* --- the opening credit --------------------------------------------- */

.vg-credit {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
}
.vg-credit-text {
  margin: 0;
  padding: 0 16px;
  color: #fff;
  font: 400 clamp(18px, 3.4vw, 30px)/1.3 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  letter-spacing: 0.04em;
  text-align: center;
}
.vg-credit-skip {
  position: absolute;
  right: max(16px, env(safe-area-inset-right));
  bottom: max(16px, env(safe-area-inset-bottom));
  min-width: 44px;
  min-height: 44px;
  padding: 8px 16px;
  border: 1px solid #555;
  border-radius: 22px;
  background: transparent;
  color: #ddd;
  font: inherit;
  font-size: 15px;
  cursor: pointer;
}
/* Without JavaScript the credit leaves by itself after 1.5 s. */
.vg-nojs .vg-credit { animation: vg-credit-out 0.4s ease 1.5s forwards; }
.vg-js-only { display: none !important; }
.vg-js .vg-js-only { display: revert !important; }
.vg-js .vg-js-only[hidden] { display: none !important; }
.vg-credit-fade { transition: opacity 0.4s ease, visibility 0s linear 0.4s; opacity: 0; visibility: hidden; }
.vg-credit-gone { display: none; }
@keyframes vg-credit-out { to { opacity: 0; visibility: hidden; } }
@media (prefers-reduced-motion: reduce) {
  .vg-nojs .vg-credit { animation: vg-credit-cut 0s linear 1.5s forwards; }
  .vg-credit-fade { transition: none; }
}
@keyframes vg-credit-cut { to { visibility: hidden; } }

/* --- the entry screen ------------------------------------------------ */

.vg-entry {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  box-sizing: border-box;
  background: radial-gradient(ellipse at 50% 35%, #1d1a14 0%, #000 70%);
}
.vg-entry-inner { max-width: 640px; text-align: center; }
.vg-title { margin: 0; font: 300 clamp(48px, 11vw, 104px)/1 Georgia, "Times New Roman", serif; letter-spacing: 0.06em; }
.vg-subtitle { margin: 12px 0 28px; color: var(--vg-muted); font-size: 1.1rem; }
.vg-destination { color: var(--vg-ink); }
.vg-entry-actions { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; margin: 20px 0; }
.vg-status { color: var(--vg-muted); min-height: 1.6em; }
.vg-entry-note { color: var(--vg-muted); font-size: 0.9rem; }

.vg-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  padding: 8px 18px;
  box-sizing: border-box;
  border: 1px solid var(--vg-line);
  border-radius: 8px;
  background: var(--vg-panel-2);
  color: var(--vg-ink);
  font: inherit;
  font-size: 1rem;
  text-decoration: none;
  cursor: pointer;
}
.vg-btn:hover { border-color: var(--vg-accent); }
.vg-btn:disabled { opacity: 0.5; cursor: progress; }
.vg-btn-primary { background: var(--vg-accent); border-color: var(--vg-accent); color: #1a1408; font-weight: 600; }

/* The page behind the museum (a linked work's details) stays readable
   below the entry screen. */
.vg-direct { max-width: 760px; margin: 0 auto; padding: 32px 16px 64px; }

/* --- the museum -------------------------------------------------------- */

.vg-in-app body.vg { overflow: hidden; }
.vg-app {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: #000;
  overscroll-behavior: none;
}
.vg-app[hidden] { display: none; }
.vg-canvas { position: absolute; inset: 0; }
.vg-gl { display: block; width: 100%; height: 100%; touch-action: none; }

.vg-topbar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: flex-start;
  justify-content: space-between;
  padding: max(8px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) 8px max(12px, env(safe-area-inset-left));
  background: linear-gradient(rgba(0, 0, 0, 0.7), rgba(0, 0, 0, 0));
  pointer-events: none;
}
.vg-topbar > * { pointer-events: auto; }
.vg-loc { max-width: 46ch; text-shadow: 0 1px 3px #000; }
.vg-loc-title { margin: 0; font-weight: 600; }
.vg-loc-sub { margin: 0; color: var(--vg-muted); font-size: 0.85rem; }
.vg-topnav { display: flex; flex-wrap: wrap; gap: 6px; }
.vg-hudbtn {
  min-width: 44px;
  min-height: 44px;
  padding: 6px 12px;
  box-sizing: border-box;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 8px;
  background: rgba(20, 17, 12, 0.72);
  color: var(--vg-ink);
  font: inherit;
  font-size: 0.9rem;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
}
.vg-hudbtn[hidden] { display: none; }

.vg-controls {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  padding: 12px max(16px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  pointer-events: none;
}
.vg-controls > * { pointer-events: auto; }
/* The walking controls are laid out physically (the help describes the
   circle at the bottom left) in every language, also right-to-left ones. */
.vg-controls { direction: ltr; }
.vg-lefty .vg-controls { flex-direction: row-reverse; }
.vg-movegroup, .vg-lookgroup { display: flex; align-items: flex-end; gap: 10px; }
.vg-lefty .vg-movegroup, .vg-lefty .vg-lookgroup { flex-direction: row-reverse; }
.vg-stick {
  position: relative;
  width: 132px;
  height: 132px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-radius: 50%;
  background: rgba(10, 8, 6, 0.4);
  touch-action: none;
}
.vg-knob {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 56px;
  height: 56px;
  margin: -28px 0 0 -28px;
  border-radius: 50%;
  background: rgba(242, 237, 228, 0.75);
  pointer-events: none;
}
.vg-movebtns, .vg-lookbtns { display: flex; flex-direction: column; gap: 8px; }
.vg-lookbtns { flex-direction: row; }
.vg-move, .vg-look-btn {
  width: 52px;
  height: 52px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 12px;
  background: rgba(20, 17, 12, 0.72);
  color: var(--vg-ink);
  font-size: 22px;
  touch-action: none;
  cursor: pointer;
}
.vg-lookpad {
  width: 132px;
  height: 132px;
  border: 2px dashed rgba(255, 255, 255, 0.28);
  border-radius: 16px;
  background: rgba(10, 8, 6, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: none;
}
.vg-lookpad-hint { color: rgba(255, 255, 255, 0.6); font-size: 0.8rem; }
.vg-interact {
  align-self: center;
  margin-bottom: 40px;
  max-width: 40vw;
  min-height: 48px;
  padding: 10px 18px;
  border: 0;
  border-radius: 24px;
  background: var(--vg-accent);
  color: #1a1408;
  font: inherit;
  font-weight: 600;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  line-height: 1.3;
  cursor: pointer;
}
.vg-interact[hidden] { display: none; }
@media (pointer: fine) {
  .vg-stick, .vg-lookpad { width: 104px; height: 104px; }
}
@media (max-width: 520px) {
  .vg-stick, .vg-lookpad { width: 112px; height: 112px; }
  .vg-lookpad { display: none; }
  .vg-interact { max-width: 62vw; margin-bottom: 140px; }
  .vg-movebtns { display: none; }
  .vg-hudbtn { padding: 6px 8px; font-size: 0.8rem; }
  .vg-loc { max-width: 100%; }
}
@media (max-height: 460px) {
  .vg-stick, .vg-lookpad { width: 96px; height: 96px; }
  .vg-loc-sub { display: none; }
}
.vg-overlay {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  max-width: min(90vw, 480px);
  padding: 20px;
  border-radius: 12px;
  background: rgba(10, 8, 6, 0.9);
  text-align: center;
}
.vg-overlay[hidden] { display: none; }
.vg-overlay .vg-btn { margin: 4px; }
.vg-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.vg-debug { position: absolute; left: 8px; top: 96px; margin: 0; padding: 6px; background: rgba(0, 0, 0, 0.7); color: #9f9; font: 11px/1.3 ui-monospace, monospace; pointer-events: none; }

/* --- dialogs ----------------------------------------------------------- */

.vg-dialog {
  width: min(560px, calc(100vw - 24px));
  max-height: calc(100dvh - 24px);
  padding: 0;
  border: 1px solid var(--vg-line);
  border-radius: 12px;
  background: var(--vg-panel);
  color: var(--vg-ink);
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.vg-dialog:not([open]) { display: none; }
.vg-dialog-wide { width: min(820px, calc(100vw - 24px)); }
.vg-dialog::backdrop { background: rgba(0, 0, 0, 0.55); }
.vg-dialog a { color: var(--vg-accent); }
.vg-dialog :focus-visible { outline: 3px solid var(--vg-focus); outline-offset: 2px; }
.vg-dialog-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 14px 16px 8px; border-bottom: 1px solid var(--vg-line); }
.vg-dialog-head h2 { margin: 0; font: 400 1.4rem/1.25 Georgia, serif; }
.vg-dialog-body { padding: 12px 16px 20px; overflow-y: auto; overscroll-behavior: contain; }
.vg-close { flex: none; width: 44px; height: 44px; border: 1px solid var(--vg-line); border-radius: 8px; background: var(--vg-panel-2); color: var(--vg-ink); font-size: 24px; line-height: 1; cursor: pointer; }
.vg-dialog label { display: block; margin: 12px 0 4px; }
.vg-dialog input[type="search"], .vg-dialog input[type="text"], .vg-dialog select {
  display: block;
  width: 100%;
  min-height: 44px;
  box-sizing: border-box;
  margin-top: 4px;
  padding: 8px 10px;
  border: 1px solid var(--vg-line);
  border-radius: 8px;
  background: #0d0b08;
  color: var(--vg-ink);
  font: inherit;
}
.vg-check { display: flex !important; align-items: center; gap: 10px; min-height: 44px; }
.vg-check input { width: 22px; height: 22px; }
.vg-dialog input[type="range"] { width: 100%; min-height: 44px; }
.vg-work-nav { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 12px; }
.vg-viewer {
  position: relative;
  height: min(62dvh, 640px);
  overflow: hidden;
  border-radius: 8px;
  background: #6e6e6e; /* neutral grey: no scenic light on the work */
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: none;
  cursor: grab;
}
.vg-viewer img { max-width: 100%; max-height: 100%; width: auto; height: auto; transform-origin: center; user-select: none; }
.vg-viewer-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 10px; }
.vg-maplist { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 6px; }
.vg-maplink { width: 100%; min-height: 44px; padding: 8px 12px; border: 1px solid var(--vg-line); border-radius: 8px; background: var(--vg-panel-2); color: var(--vg-ink); font: inherit; text-align: start; cursor: pointer; }
.vg-here { border-color: var(--vg-accent); }
.vg-map h3 { margin: 18px 0 6px; font-size: 1.05rem; }
.vg-results, .vg-related { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.vg-results li { display: grid; grid-template-columns: 72px 1fr; gap: 10px; align-items: start; }
.vg-results img, .vg-results .vg-noimg { width: 72px; height: 72px; object-fit: contain; background: #0d0b08; border-radius: 4px; }
.vg-result-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.vg-related li a { display: flex; align-items: center; gap: 10px; min-height: 44px; }
.vg-related img { width: 64px; height: 64px; object-fit: contain; background: #0d0b08; }

/* --- reading pages ----------------------------------------------------- */

.vg-page .vg-skiplink { position: absolute; inset-inline-start: -999px; }
.vg-page .vg-skiplink:focus { inset-inline-start: 16px; top: 8px; z-index: 5; padding: 8px; background: var(--vg-panel); }
.vg-header { border-bottom: 1px solid var(--vg-line); }
.vg-header nav { max-width: 1100px; margin: 0 auto; padding: 10px 16px; display: flex; flex-wrap: wrap; gap: 12px 24px; align-items: center; justify-content: space-between; }
.vg-header ul { display: flex; flex-wrap: wrap; gap: 4px 18px; margin: 0; padding: 0; list-style: none; }
.vg-header a { display: inline-flex; align-items: center; min-height: 44px; }
.vg-brand { font: 400 1.5rem/1 Georgia, serif; color: var(--vg-ink) !important; text-decoration: none; letter-spacing: 0.05em; }
.vg-main { max-width: 1100px; margin: 0 auto; padding: 24px 16px 64px; box-sizing: border-box; }
.vg-main h1 { font: 400 clamp(2rem, 6vw, 3rem)/1.15 Georgia, serif; margin: 8px 0 12px; }
.vg-lede { color: var(--vg-muted); max-width: 70ch; }
.vg-footer { border-top: 1px solid var(--vg-line); color: var(--vg-muted); font-size: 0.85rem; padding: 16px; text-align: center; }
.vg-search label { display: block; margin-bottom: 4px; }
.vg-search-row { display: flex; gap: 8px; }
.vg-search input[type="search"] { flex: 1; min-width: 0; min-height: 44px; padding: 8px 10px; border: 1px solid var(--vg-line); border-radius: 8px; background: #0d0b08; color: var(--vg-ink); font: inherit; }
.vg-filters { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: flex-end; margin: 14px 0; padding: 12px; border: 1px solid var(--vg-line); border-radius: 8px; }
.vg-filters label { display: flex; flex-direction: column; font-size: 0.9rem; gap: 4px; }
.vg-filters select { min-height: 44px; padding: 6px; border: 1px solid var(--vg-line); border-radius: 8px; background: #0d0b08; color: var(--vg-ink); font: inherit; max-width: 100%; }
.vg-cards { list-style: none; margin: 16px 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 16px; }
.vg-card a { display: flex; flex-direction: column; gap: 4px; color: var(--vg-ink); text-decoration: none; }
.vg-card img, .vg-card .vg-noimg { width: 100%; height: 160px; object-fit: contain; background: #0d0b08; border-radius: 4px; }
.vg-noimg { display: flex; align-items: center; justify-content: center; color: var(--vg-muted); font-size: 0.85rem; }
.vg-card-title { font-weight: 600; line-height: 1.3; }
.vg-card-meta { color: var(--vg-muted); font-size: 0.85rem; }
.vg-card-flag, .vg-flag { display: inline-block; color: var(--vg-flag); font-size: 0.8rem; }
.vg-pager { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: center; margin: 24px 0; }
.vg-table { border-collapse: collapse; width: 100%; margin: 8px 0 16px; font-size: 0.95rem; }
.vg-table th, .vg-table td { text-align: start; padding: 6px 8px; border-bottom: 1px solid var(--vg-line); vertical-align: top; }
.vg-error { color: var(--vg-flag); }
.vg-note { color: var(--vg-muted); font-size: 0.9rem; }
.vg-notice { border-inline-start: 3px solid var(--vg-accent); padding-inline-start: 10px; }
.vg-work header h2, .vg-scene h2 { font: 400 clamp(1.7rem, 5vw, 2.4rem)/1.2 Georgia, serif; margin: 0 0 4px; }
.vg-work-date { color: var(--vg-muted); margin: 0 0 12px; }
.vg-work-figure { margin: 12px 0; }
.vg-work-figure img { max-width: 100%; height: auto; display: block; background: #0d0b08; }
.vg-work-figure figcaption { color: var(--vg-muted); font-size: 0.85rem; margin-top: 6px; }
.vg-facts { display: grid; grid-template-columns: minmax(110px, max-content) 1fr; gap: 6px 14px; margin: 12px 0; }
.vg-facts dt { color: var(--vg-muted); }
.vg-facts dd { margin: 0; }
.vg-claims { padding-inline-start: 1.1em; }
.vg-claims p { margin: 0; }
.vg-claim-meta { color: var(--vg-muted); font-size: 0.85rem; }
.vg-sources { padding-inline-start: 1.1em; word-break: break-word; }
.vg-imgnote { padding: 16px; border: 1px dashed var(--vg-line); border-radius: 8px; color: var(--vg-muted); }
@media (max-width: 520px) {
  .vg-facts { grid-template-columns: 1fr; }
  .vg-facts dd { margin-bottom: 6px; }
}
html[dir="rtl"] .vg-interact { direction: rtl; }
