/* The interface stays quiet so the photographs can lead. */
:root {
  color-scheme: light;
  --paper: #fff;
  --ink: #181818;
  --muted: #707070;
  --rule: #e7e7e7;
  --gutter: clamp(20px, 4vw, 64px);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; scrollbar-gutter: stable; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
body.modal-open { overflow: hidden; }
button, a { -webkit-tap-highlight-color: transparent; }
button { font: inherit; }
a { color: inherit; text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 5px; }
button, a { touch-action: manipulation; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 6px; }
img { display: block; max-width: 100%; }
.shell { width: min(1280px, calc(100% - var(--gutter) * 2)); margin-inline: auto; }

/* Header and gallery */
.profile {
  display: flex;
  align-items: center;
  gap: 24px;
  padding-block: clamp(36px, 6vw, 80px) clamp(48px, 7vw, 96px);
}
.avatar { width: 72px; height: 72px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.profile h1 { margin: 0; font-size: clamp(22px, 2.8vw, 34px); font-weight: 450; letter-spacing: -.045em; line-height: 1.15; }
.header-nav { margin-left: auto; padding-left: 16px; font-size: 13px; }
.header-nav a { display: flex; align-items: center; gap: 18px; min-height: 44px; }
.grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(10px, 2vw, 28px); }
.tile { display: block; background: #f5f4f2; aspect-ratio: 3 / 4; }
.tile img { width: 100%; height: 100%; object-fit: cover; transition: opacity 180ms ease; }
@media (hover: hover) { .tile:hover img { opacity: .88; } }
.empty-state { grid-column: 1 / -1; padding-block: 64px; color: var(--muted); font-size: 14px; }

/* About remains part of the same page. */
.about {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 28px;
  margin-top: clamp(88px, 12vw, 160px);
  padding-block: 40px 100px;
  border-top: 1px solid var(--rule);
  scroll-margin-top: 40px;
}
.about h2 { margin: 6px 0 0; font-size: 13px; font-weight: 500; }
.about-content { max-width: 580px; }
.about-content p { margin: 0; font-size: clamp(20px, 2.2vw, 27px); font-weight: 400; letter-spacing: -.025em; line-height: 1.5; white-space: pre-line; overflow-wrap: anywhere; }
.about-links { display: flex; flex-wrap: wrap; gap: 28px; margin-top: 28px; font-size: 13px; }
.about-links a { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; }

/* A native dialog contains keyboard focus and handles Escape. */
.viewer {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  height: 100dvh;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 64px 88px 32px;
  border: 0;
  background: var(--paper);
  color: var(--ink);
}
.viewer[open] { display: grid; place-items: center; }
.viewer::backdrop { background: var(--paper); }
.icon-button { display: grid; place-items: center; width: 48px; height: 48px; border: 0; padding: 0; background: transparent; color: inherit; font-size: 28px; cursor: pointer; }
.icon-button:disabled { opacity: .22; cursor: default; }
.close-viewer { position: absolute; top: 12px; right: 20px; font-size: 32px; }
.viewer-prev, .viewer-next { position: absolute; top: calc(50% - 24px); }
.viewer-prev { left: 20px; }
.viewer-next { right: 20px; }
.viewer-figure { display: flex; flex-direction: column; align-items: center; width: 100%; min-width: 0; margin: 0; }
.viewer-image-wrap { display: flex; align-items: center; justify-content: center; width: 100%; min-height: 80px; touch-action: pan-y; }
.viewer-image-wrap img { width: auto; height: auto; max-height: calc(100dvh - 190px); object-fit: contain; }
#viewer-error { max-width: 30ch; font-size: 14px; color: var(--muted); line-height: 1.6; }
.viewer-caption { display: grid; grid-template-columns: 1fr auto; gap: 8px 24px; width: min(100%, 620px); padding-top: 24px; font-size: 14px; line-height: 1.5; }
#viewer-text { white-space: pre-line; overflow-wrap: anywhere; }
#viewer-date { color: var(--muted); font-size: 12px; justify-self: end; grid-column: 2; }
#viewer-count { color: var(--muted); font-size: 12px; grid-column: 1 / -1; }

/* Individual links also work without JavaScript and from RSS readers. */
.post-header { display: flex; justify-content: space-between; align-items: center; gap: 24px; padding-block: 30px; font-size: 13px; }
.post-header a { display: inline-flex; align-items: center; min-height: 44px; }
.post { max-width: 900px; padding-bottom: 80px; }
.post-meta { padding-block: 26px 32px; }
.post-meta p { margin: 0 0 12px; font-size: 22px; line-height: 1.5; white-space: pre-line; }
.post-meta time { font-size: 12px; color: var(--muted); }
.post-image { width: auto; max-height: 90dvh; margin: 0 auto 24px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip-link { position: fixed; top: 12px; left: 12px; z-index: 10; padding: 12px; background: var(--paper); transform: translateY(-180%); }
.skip-link:focus { transform: translateY(0); }

@media (max-width: 640px) {
  .profile { flex-wrap: wrap; gap: 16px; padding-block: 32px 48px; }
  .avatar { width: 48px; height: 48px; }
  .profile h1 { flex: 1; max-width: 210px; font-size: 23px; }
  .header-nav { padding-left: 0; font-size: 12px; }
  .header-nav a { gap: 8px; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .about { grid-template-columns: 1fr; gap: 24px; padding-bottom: 64px; }
  .viewer { padding: 64px 20px 82px; }
  .close-viewer { right: 10px; }
  .viewer-prev, .viewer-next { top: auto; bottom: max(16px, env(safe-area-inset-bottom)); }
  .viewer-prev { left: 12px; }
  .viewer-next { right: 12px; }
  .viewer-image-wrap img { max-height: calc(100dvh - 250px); }
  .viewer-caption { gap: 8px 16px; padding-top: 20px; font-size: 13px; }
  #viewer-date { font-size: 11px; }
  .post-name { max-width: 150px; text-align: right; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .tile img { transition: none; }
}
