/* Shared foundation: reset, focus, reveal mechanics, painting viewer.
   Concepts set: --ground --ink --muted --accent --font-display --font-text --ease */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { margin: 0; background: var(--ground); color: var(--ink); font-family: var(--font-text); font-size: 1.0625rem; line-height: 1.55; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
img { display: block; max-width: 100%; height: auto; }
h1, h2, h3, p, figure, blockquote, ul, ol { margin: 0; }
ul, ol { padding: 0; list-style: none; }
a { color: inherit; text-underline-offset: 0.22em; text-decoration-thickness: 1px; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
h1, h2, h3 { font-family: var(--font-display); font-weight: 400; text-wrap: balance; }
p { text-wrap: pretty; }
::selection { background: var(--accent); color: var(--ground); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
html { scrollbar-color: var(--accent) var(--ground); scrollbar-width: thin; }
.skip { position: absolute; inset-inline-start: 1rem; top: -4rem; background: var(--ink); color: var(--ground); padding: .75rem 1rem; z-index: 99; }
.skip:focus { top: 1rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* Entrance. Content is visible without script; only .js hides it before it enters. */
.js [data-reveal] { opacity: 0; transform: translateY(28px); transition: opacity .9s var(--ease), transform 1.1s var(--ease); }
.js [data-reveal].is-in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .js [data-reveal] { opacity: 1; transform: none; transition: none; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* Painting viewer */
.viewer-open { overflow: hidden; }
.viewer { width: 100vw; height: 100dvh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; background: var(--viewer-ground, var(--ground)); color: var(--viewer-ink, var(--ink)); }
.viewer[open] { display: grid; grid-template-columns: minmax(0, 1fr) minmax(280px, 26rem); animation: viewer-in .5s var(--ease); }
.viewer::backdrop { background: var(--viewer-ground, var(--ground)); }
@keyframes viewer-in { from { opacity: 0; transform: scale(1.02); } }
.viewer__stage { display: grid; place-items: center; padding: clamp(1rem, 4vw, 4rem); min-height: 0; }
.viewer__img { max-height: calc(100dvh - 2 * clamp(1rem, 4vw, 4rem)); width: auto; object-fit: contain; box-shadow: 0 30px 60px -20px rgb(0 0 0 / .55); }
.viewer__side { background: var(--field); color: var(--field-ink); padding: clamp(1.5rem, 3vw, 3rem); padding-top: 5.5rem; overflow-y: auto; display: flex; flex-direction: column; gap: 1rem; transition: background-color .5s var(--ease); }
.viewer__title { font-size: clamp(2rem, 3.2vw, 3.25rem); line-height: 1; letter-spacing: -0.02em; }
.viewer__note { font-size: 1.125rem; max-width: 34ch; }
.viewer__rooms { display: grid; grid-template-columns: repeat(2, 1fr); gap: .75rem; margin-top: 1rem; }
.viewer__rooms img { aspect-ratio: 3 / 4; object-fit: cover; width: 100%; }
.viewer__ask { margin-top: auto; align-self: flex-start; padding: .9rem 1.4rem; background: var(--field-ink); color: var(--field); text-decoration: none; font-weight: 500; transition: transform .25s var(--ease); }
.viewer__ask:hover { transform: translateY(-2px); }
.viewer__btn { position: absolute; width: 48px; height: 48px; display: grid; place-items: center; border-radius: 50%; background: var(--field-ink); color: var(--field); transition: transform .25s var(--ease); }
.viewer__btn:hover { transform: scale(1.08); }
.viewer__btn:focus-visible { outline-color: var(--field-ink); }
.viewer__close { top: 1.25rem; inset-inline-end: 1.25rem; }
.viewer__prev, .viewer__next { bottom: 1.25rem; background: var(--viewer-ink, var(--ink)); color: var(--viewer-ground, var(--ground)); }
.viewer__prev { inset-inline-start: 1.25rem; }
.viewer__next { inset-inline-start: 5rem; }
@media (max-width: 820px) {
  .viewer[open] { grid-template-columns: 1fr; grid-template-rows: auto auto; overflow-y: auto; }
  .viewer__stage { padding: 4.5rem 1rem 1rem; }
  .viewer__img { max-height: 62dvh; }
  .viewer__side { padding-top: 1.5rem; padding-bottom: 5.5rem; overflow: visible; }
  .viewer__btn { position: fixed; }
  .viewer__close { background: var(--viewer-ink, var(--ink)); color: var(--viewer-ground, var(--ground)); }
}
