/*
 * Atlas Portrait theme. Hand-written, no build step, no Bootstrap: the
 * layout (themes/atlas/views/index.volt) loads only this file and app.js.
 */
:root {
  --fg: #1c1917;
  --muted: #5c564f;
  --bg: #f6f4f1;
  --surface: #fffcf8;
  --line: #e4dfd8;
  --accent: #1c1917;
  --radius: .5rem;
  --wrap: 72rem;
  --shadow: 0 1px 2px rgba(28, 25, 23, .06), 0 8px 24px rgba(28, 25, 23, .04);
  --serif: "Iowan Old Style", Palatino, "Palatino Linotype", Georgia, "Songti SC", "PMingLiU", "Hiragino Mincho ProN", "Yu Mincho", "Source Han Serif", serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: 4.5rem;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", "PingFang SC", "Hiragino Sans", "Microsoft YaHei", "Malgun Gothic", sans-serif;
  font-size: 1rem;
  line-height: 1.55;
  color: var(--fg);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

html[lang="zh-CN"] body,
html[lang="zh-TW"] body,
html[lang="ja"] body,
html[lang="ko"] body {
  line-height: 1.7;
}

a {
  color: var(--accent);
  text-underline-offset: .18em;
}

a:hover {
  text-decoration-thickness: 2px;
}

img {
  max-width: 100%;
  height: auto;
}

h1,
h2,
.brand {
  font-family: var(--serif);
  font-weight: 560;
  letter-spacing: -.015em;
}

h1 {
  font-size: clamp(1.75rem, 1.2rem + 2vw, 2.5rem);
  line-height: 1.2;
  margin: 0 0 .75rem;
}

h2 {
  font-size: 1.25rem;
  line-height: 1.3;
  margin: 2rem 0 .75rem;
}

:focus-visible {
  outline: 2px solid var(--fg);
  outline-offset: 3px;
}

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 0 1.25rem;
}

.skip-link {
  position: absolute;
  left: .75rem;
  top: .75rem;
  padding: .5rem 1rem;
  background: var(--surface);
  color: var(--fg);
  border-radius: var(--radius);
  transform: translateY(-150%);
  z-index: 30;
}

.skip-link:focus {
  transform: none;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(246, 244, 241, .92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}

.site-header__inner {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: center;
  gap: .75rem 1rem;
  padding-top: .75rem;
  padding-bottom: .75rem;
}

.brand {
  font-size: 1.2rem;
  color: var(--fg);
  text-decoration: none;
  line-height: 1.1;
}

.brand:hover {
  text-decoration: none;
}

.brand img {
  display: block;
  max-height: 32px;
  width: auto;
}

.header-search {
  display: flex;
  gap: .4rem;
  min-width: 0;
}

.header-search input {
  flex: 1;
  min-width: 0;
  padding: .55rem .9rem;
  font: inherit;
  color: var(--fg);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
}

.header-search input:focus-visible,
.search-form input:focus-visible {
  border-color: var(--fg);
}

.header-search button,
.search-form button,
.form button[type="submit"],
.pager a {
  padding: .55rem 1rem;
  font: inherit;
  font-size: .9375rem;
  color: var(--surface);
  background: var(--fg);
  border: 1px solid var(--fg);
  border-radius: 999px;
  cursor: pointer;
  text-decoration: none;
}

.header-search button:hover,
.search-form button:hover,
.form button[type="submit"]:hover,
.pager a:hover {
  background: #3a342e;
}

/*
 * <details> as a flex item shrinks below its summary, so "Toggle navigation"
 * was clipped at the right edge of a 390px screen. Keep the closed control
 * at its text width and let the header wrap instead.
 */
.nav {
  justify-self: end;
  max-width: 100%;
}

.nav > summary {
  cursor: pointer;
  list-style: none;
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  padding: .45rem .8rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  white-space: nowrap;
}

.nav > summary::before {
  content: "";
  width: .9rem;
  height: .65rem;
  background:
    linear-gradient(currentColor, currentColor) 0 0 / 100% 1.5px,
    linear-gradient(currentColor, currentColor) 0 50% / 100% 1.5px,
    linear-gradient(currentColor, currentColor) 0 100% / 100% 1.5px;
  background-repeat: no-repeat;
}

.nav > summary::-webkit-details-marker {
  display: none;
}

.nav__list {
  list-style: none;
  margin: .5rem 0 0;
  padding: 0;
}

.nav__list a {
  display: block;
  padding: .4rem 0;
  text-decoration: none;
}

.nav__list a[aria-current] {
  font-weight: 650;
  text-decoration: underline;
  text-underline-offset: .2em;
}

@media (max-width: 47.99rem) {
  .site-header {
    position: sticky;
  }

  .site-header__inner {
    grid-template-columns: minmax(0, 1fr) auto auto;
  }

  .brand {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .header-search {
    grid-column: 1 / -1;
    order: 3;
  }

  .site-header:has(details.nav[open]) {
    background: var(--bg);
  }

  .nav[open] > nav {
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    z-index: 5;
    padding: .5rem 1.25rem .75rem;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    box-shadow: var(--shadow);
  }

  .nav__list a {
    padding: .7rem 0;
  }
}

@media (min-width: 48rem) {
  .nav {
    display: flex;
    justify-content: flex-end;
  }

  .nav > summary {
    display: none;
  }

  .nav > nav {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    align-items: center;
    gap: .25rem 1.25rem;
  }

  .nav__list {
    display: flex;
    flex-wrap: wrap;
    gap: .25rem 1rem;
    margin: 0;
  }
}

/*
 * Language menu stays one button at any count of languages. It is not
 * details.nav, so the wide-screen script does not force it open.
 */
.lang-menu {
  position: relative;
  justify-self: end;
}

.lang-menu > summary {
  cursor: pointer;
  list-style: none;
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  max-width: 9.5rem;
  padding: .45rem .75rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  font-size: .875rem;
  white-space: nowrap;
}

.lang-menu > summary::-webkit-details-marker {
  display: none;
}

.lang-menu > summary::marker {
  content: "";
}

.lang-menu > summary span[lang] {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lang-menu > summary::after {
  content: "";
  flex: 0 0 auto;
  width: .4rem;
  height: .4rem;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: translateY(-.12rem) rotate(45deg);
}

.lang-menu[open] > summary::after {
  transform: translateY(.12rem) rotate(225deg);
}

.lang-menu ul {
  position: absolute;
  right: 0;
  top: calc(100% + .35rem);
  z-index: 30;
  min-width: 11rem;
  margin: 0;
  padding: .35rem;
  list-style: none;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.lang-menu a {
  display: block;
  padding: .5rem .7rem;
  border-radius: .35rem;
  color: var(--fg);
  font-size: .9375rem;
  text-decoration: none;
  white-space: nowrap;
}

.lang-menu a:hover,
.lang-menu a:focus-visible {
  background: var(--bg);
  text-decoration: none;
}

.lang-menu a[aria-current="true"] {
  font-weight: 650;
  background: var(--bg);
}

@media (max-width: 47.99rem) {
  /* The button is the last item on the top row. Anchor the list to the
     header so it opens under the search field instead of covering it. */
  .lang-menu {
    position: static;
  }

  .lang-menu ul {
    left: 0;
    right: 0;
    top: 100%;
    min-width: 0;
    padding: .35rem 1.25rem .75rem;
    border-radius: 0;
    border-right: 0;
    border-left: 0;
  }
}

.site-main {
  flex: 1 0 auto;
  padding-top: 1.75rem;
  padding-bottom: 3rem;
}

.home-intro {
  max-width: 40rem;
  margin-bottom: 2rem;
}

.home-browse {
  display: grid;
  gap: 1.5rem;
  margin-bottom: 2.25rem;
}

.home-browse h2 {
  margin: 0 0 .75rem;
}

.home-browse h2 a {
  color: var(--fg);
  text-decoration: none;
  border-bottom: 1px solid var(--line);
}

.home-browse h2 a:hover {
  border-bottom-color: var(--fg);
}

.home-intro .page-content {
  color: var(--muted);
  font-size: 1.0625rem;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1.25rem .9rem;
}

.portrait-grid {
  list-style: none;
  margin: 0;
  padding: 0;
}

.portrait-card a {
  display: block;
  color: var(--fg);
  text-decoration: none;
}

.portrait-card__media {
  display: block;
  aspect-ratio: 3 / 4;
  overflow: hidden;
  border-radius: var(--radius);
  background: #ebe6df;
  box-shadow: var(--shadow);
}

.portrait-card img {
  display: block;
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: cover;
  transition: transform .35s ease;
}

.portrait-card a:hover img,
.portrait-card a:focus-visible img {
  transform: scale(1.04);
}

.portrait-card__title {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  margin-top: .55rem;
  font-size: .9375rem;
  line-height: 1.35;
}

.portrait-card a:hover .portrait-card__title {
  text-decoration: underline;
  text-underline-offset: .15em;
}

.portrait__figure {
  margin: 0 0 1.5rem;
}

.portrait__zoom {
  display: block;
  /* --intrinsic is the file's width. sizes/srcset would otherwise lay the
     photo out at the slot size and upscale a small file. */
  width: min(100%, 42rem, var(--intrinsic, 42rem));
  margin-inline: auto;
  padding: 0;
  border: 0;
  border-radius: var(--radius);
  background: none;
  cursor: zoom-in;
  appearance: none;
}

.portrait__zoom img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: inherit;
  background: #ebe6df;
  box-shadow: var(--shadow);
}

.portrait-zoom {
  padding: 0;
  border: 0;
  background: transparent;
}

.portrait-zoom[open] {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .6rem;
  width: fit-content;
  max-width: calc(100vw - 1.5rem);
  max-height: calc(100dvh - 1.5rem);
  overflow: visible;
}

.portrait-zoom::backdrop {
  background: rgba(28, 25, 23, .88);
}

.portrait-zoom__close {
  align-self: flex-end;
  padding: .4rem .9rem;
  font: inherit;
  font-size: .875rem;
  color: var(--fg);
  background: var(--surface);
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: var(--shadow);
}

.portrait-zoom__close:hover {
  background: var(--bg);
}

.portrait-zoom__img {
  display: block;
  max-width: calc(100vw - 1.5rem);
  max-height: calc(100dvh - 4.5rem);
  width: auto;
  height: auto;
  margin: 0;
  border-radius: var(--radius);
  background: #ebe6df;
  cursor: zoom-out;
  object-fit: contain;
}

.portrait__figure figcaption {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem 1rem;
  max-width: 42rem;
  margin: .75rem auto 0;
  font-size: .875rem;
  color: var(--muted);
}

.portrait__figure .sharealike {
  flex-basis: 100%;
}

.portrait__country {
  color: var(--muted);
}

.portrait__country a {
  color: var(--fg);
}

.portrait__topics-title,
.portrait__topics h2,
.portrait__related h2 {
  font-size: 1.05rem;
  margin: 0 0 .6rem;
}

.portrait__topics h2 {
  font-family: inherit;
  font-weight: 600;
  letter-spacing: 0;
}

.portrait__facts {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin: 0 0 1.5rem;
  padding: 0;
  list-style: none;
}

.portrait__facts a {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  min-height: 2.25rem;
  padding: .3rem .75rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--fg);
  text-decoration: none;
  font-size: .875rem;
}

.portrait__facts a:hover,
.portrait__facts a:focus-visible {
  border-color: var(--fg);
}

.swatch {
  width: .75rem;
  height: .75rem;
  border-radius: 50%;
  box-shadow: inset 0 0 0 1px rgba(28, 25, 23, .18);
}

.swatch--red { background: #c23b3b; }
.swatch--orange { background: #e07a2f; }
.swatch--yellow { background: #e2c044; }
.swatch--lime { background: #8fbf3f; }
.swatch--green { background: #3e8f4a; }
.swatch--teal { background: #2a9d8f; }
.swatch--cyan { background: #3db7d0; }
.swatch--azure { background: #6aa7e8; }
.swatch--blue { background: #2f5fbf; }
.swatch--indigo { background: #3d3a8c; }
.swatch--purple { background: #7a4ea3; }
.swatch--pink { background: #d96a9a; }
.swatch--brown { background: #8a5a3a; }
.swatch--black { background: #1c1917; }
.swatch--white { background: #f7f4ef; }
.swatch--gray { background: #8d8882; }

.portrait__related {
  margin-top: 2rem;
}

.portrait__related h2 a {
  color: var(--fg);
  text-decoration: none;
  border-bottom: 1px solid var(--line);
}

.browse__intro {
  color: var(--muted);
  margin-top: 0;
}

.breadcrumbs ol {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: .25rem;
  margin: 0 0 1.25rem;
  padding: 0;
  font-size: .875rem;
  color: var(--muted);
}

.breadcrumbs a {
  color: var(--muted);
}

.breadcrumbs li + li::before {
  content: "/";
  margin-right: .25rem;
}

.country-list,
.photographer-list {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin: 0;
  padding: 0;
}

.country-list a,
.photographer-list a {
  display: inline-block;
  padding: .45rem .9rem;
  color: var(--fg);
  text-decoration: none;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
}

.country-list a:hover,
.photographer-list a:hover {
  border-color: var(--fg);
}

.photographer-index__list {
  list-style: none;
  margin: 1.5rem 0 0;
  padding: 0;
}

.photographer-index__list > li {
  padding: 1.25rem 0 1.5rem;
  border-top: 1px solid var(--line);
}

.photographer-index__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: .2rem .75rem;
  margin-bottom: .75rem;
}

.photographer-index__name {
  margin: 0;
  font-size: 1.35rem;
  line-height: 1.3;
}

.photographer-index__name a {
  color: var(--fg);
  text-decoration: none;
}

.photographer-index__name a:hover {
  text-decoration: underline;
  text-underline-offset: .15em;
}

.photographer-index__count {
  margin: 0;
  color: var(--muted);
  font-size: .875rem;
}

/* Three columns even when a photographer has fewer than three works,
   so one or two thumbs stay the same size as a full row. */
.photographer-index__works {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .5rem;
  width: min(100%, 36rem);
  margin: 0;
  padding: 0;
}

.photographer-index__works .portrait-card__media {
  border-radius: calc(var(--radius) - .125rem);
}

.photographer-index__fallback {
  display: block;
  padding: .75rem;
  color: var(--fg);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.pager {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  margin: 2rem 0 0;
}

.pager a {
  color: var(--surface);
}

.empty,
.pager__status {
  color: var(--muted);
}

.error-page {
  padding: 3rem 0;
  text-align: center;
}

.error-page__code {
  font-family: var(--serif);
  font-size: 4rem;
  margin: 0;
  color: var(--muted);
}

.error-page__details {
  text-align: left;
  overflow: auto;
  font-size: .8125rem;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.search-form {
  display: flex;
  gap: .5rem;
  margin: 0 0 1.5rem;
}

.search-form input {
  flex: 1;
  min-width: 0;
  padding: .7rem .9rem;
  font: inherit;
  font-size: 1.05rem;
  color: var(--fg);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
}

.form {
  max-width: 40rem;
}

.form .mb-3 {
  margin-bottom: 1rem;
}

.form label {
  display: block;
  margin-bottom: .25rem;
  font-weight: 600;
}

.form input,
.form select,
.form textarea {
  width: 100%;
  padding: .6rem .75rem;
  font: inherit;
  color: var(--fg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.form .is-invalid {
  border-color: #8f2d2d;
}

.form .invalid-feedback {
  margin-top: .25rem;
  color: #8f2d2d;
  font-size: .875rem;
}

.form__hint {
  color: var(--muted);
  font-size: .875rem;
}

.page-content {
  max-width: 42rem;
}

.page-content img,
.page-content iframe {
  max-width: 100%;
  height: auto;
}

.page-content h2,
.page-content h3 {
  margin-top: 1.5rem;
}

.alert {
  padding: .75rem 1rem;
  margin-bottom: 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.alert-danger {
  border-color: #e0b4b4;
  background: #fdf3f3;
}

.alert-success {
  border-color: #b7dfb9;
  background: #f3fbf3;
}

.site-footer {
  border-top: 1px solid var(--line);
  padding: 1.75rem 0 2rem;
  font-size: .875rem;
  color: var(--muted);
  background: #efebe6;
}

.footer-links {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: .75rem 1.25rem;
  margin: 0 0 .75rem;
  padding: 0;
}

.footer-links a {
  color: var(--fg);
}

.footer-note,
.footer-copy {
  margin: .25rem 0 0;
  max-width: 40rem;
}

@media (max-width: 30rem) {
  .header-search button {
    padding-inline: .8rem;
  }
}

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