/* Face Equality Day
   Palette taken from the NoArt portraits and the exhibition guide. */

:root {
  --bg: #1C1713;
  --surface: #2A231D;
  --cream: #F2ECE4;
  --text: #DDD4C9;
  --muted: #A8968A;
  --strip: #F4EFE8;
  --strip-line: #D9CFC3;
  --line: rgba(242, 236, 228, 0.16);
  --strip-h: 64px;
  --font: 'Mulish', 'Helvetica Neue', Arial, sans-serif;
  --ease-out: cubic-bezier(.22, 1, .36, 1);
}

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

html {
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
}

html.is-locked { overflow: hidden; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--cream);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img { display: block; max-width: 100%; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ---------- Grid ---------- */

.page {
  min-height: 100svh;
  display: flex;
  flex-direction: column;
}

.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  background: var(--bg);
  flex: 1 0 auto;
}

.tile {
  position: relative;
  display: block;
  aspect-ratio: 2 / 3;
  overflow: hidden;
  background: var(--surface);
  color: inherit;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
  transition: opacity .6s var(--ease-out);
}

.tile__inner {
  position: absolute;
  inset: 0;
}

.tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: var(--pos-tile, 50% 50%);
  transition: transform 1.4s var(--ease-out);
}

.tile__label {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 64px 20px 18px;
  background: linear-gradient(to top, rgba(20, 16, 13, .82), rgba(20, 16, 13, 0));
  opacity: 0;
  transform: translateY(10px);
  transition: opacity .5s var(--ease-out), transform .5s var(--ease-out);
  pointer-events: none;
}

.tile__name {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--cream);
}

.tile__cause {
  font-size: 12px;
  font-weight: 300;
  letter-spacing: .06em;
  color: #D8CDC1;
}

.tile:focus-visible {
  outline: 2px solid var(--cream);
  outline-offset: -6px;
}

@media (hover: hover) {
  .grid:hover .tile { opacity: .38; }
  .grid .tile:hover { opacity: 1; }
  .tile:hover img { transform: scale(1.045); }
  .tile:hover .tile__label { opacity: 1; transform: none; }
}

.grid:focus-within .tile:focus-visible .tile__label { opacity: 1; transform: none; }

/* Touch devices: names always visible */
@media (hover: none) {
  .tile__label {
    opacity: 1;
    transform: none;
    padding: 48px 14px 14px;
  }
}

.js.is-intro .tile__inner { opacity: 0; }

@media (min-width: 640px) {
  .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (min-width: 1024px) {
  .grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}

/* Wide screens: the 6x2 grid and the strip fill exactly one screen */
@media (min-width: 1024px) and (min-aspect-ratio: 3 / 2) {
  .page { height: 100svh; min-height: 560px; }
  .grid { grid-template-rows: repeat(2, minmax(0, 1fr)); }
  .tile { aspect-ratio: auto; }
}

/* ---------- Logo strip ---------- */

.strip {
  flex: 0 0 auto;
  height: calc(var(--strip-h) + env(safe-area-inset-bottom, 0px));
  padding: 0 24px env(safe-area-inset-bottom, 0px);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 40px;
  background: var(--strip);
}

.strip__logo {
  display: flex;
  align-items: center;
  border-radius: 2px;
  transition: opacity .3s ease;
}

.strip__logo:hover { opacity: .75; }

.strip__logo:focus-visible {
  outline: 2px solid var(--bg);
  outline-offset: 4px;
}

.strip__logo img {
  height: 40px;
  width: auto;
}

.strip__divider {
  width: 1px;
  height: 28px;
  background: var(--strip-line);
}

@media (max-width: 639px) {
  :root { --strip-h: 72px; }
  .strip { gap: 28px; }
}

/* ---------- Story overlay ---------- */

.story {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
}

.story.is-open { display: block; }

.story__backdrop {
  position: absolute;
  inset: 0;
  background: var(--bg);
}

.story__article {
  position: absolute;
  inset: 0;
  display: none;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.story__article.is-active { display: block; }
.story__article.is-entering { z-index: 2; }

.story__media {
  position: relative;
  width: 100%;
  height: min(68svh, 600px);
  z-index: 3;
}

.story__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: var(--pos-large, 50% 18%);
  background: var(--surface);
}

.story__body {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 32px;
  padding: 28px 24px calc(56px + env(safe-area-inset-bottom, 0px));
}

.story__nav {
  display: flex;
  align-items: center;
  gap: 12px;
}

.story__step,
.story__close {
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: var(--cream);
  text-decoration: none;
  transition: background-color .3s ease, border-color .3s ease;
}

.story__step {
  width: 44px;
  height: 44px;
  border: 1px solid rgba(242, 236, 228, .3);
}

.story__step:hover,
.story__close:hover {
  background-color: rgba(242, 236, 228, .12);
  border-color: rgba(242, 236, 228, .6);
}

.story__step:focus-visible,
.story__close:focus-visible {
  outline: 2px solid var(--cream);
  outline-offset: 2px;
}

.story__count {
  min-width: 64px;
  text-align: center;
  font-size: 13px;
  letter-spacing: .2em;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.story__head {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.story__name {
  margin: 0;
  font-size: clamp(40px, 11vw, 44px);
  line-height: .98;
  text-transform: uppercase;
  color: var(--cream);
}

.story__first,
.story__last { display: block; }
.story__first { font-weight: 200; }
.story__last { font-weight: 700; }

.story__meta {
  margin: 0;
  font-size: 15px;
  letter-spacing: .04em;
  color: var(--muted);
}

.story__quote {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.story__event {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--muted);
}

.story__quote blockquote { margin: 0; }

.story__quote blockquote p {
  margin: 0;
  max-width: 30em;
  font-size: 21px;
  line-height: 1.38;
  font-weight: 300;
  font-style: italic;
  color: var(--cream);
}

.story__text {
  display: flex;
  flex-direction: column;
  gap: 20px;
  max-width: 34em;
}

.story__text p {
  margin: 0;
  font-size: 16px;
  line-height: 1.75;
  color: var(--text);
}

.story__ops {
  display: flex;
  align-items: flex-start;
  gap: 28px;
  max-width: 34em;
  padding-top: 28px;
  border-top: 1px solid var(--line);
}

.story__ops-count {
  margin: 0;
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--muted);
}

.story__ops-num {
  font-size: 52px;
  line-height: 1;
  font-weight: 200;
  letter-spacing: 0;
  color: var(--cream);
}

.story__ops-text {
  margin: 6px 0 0;
  font-size: 15px;
  line-height: 1.65;
  font-weight: 300;
  color: var(--text);
}

.story__close {
  position: absolute;
  top: calc(20px + env(safe-area-inset-top, 0px));
  right: 20px;
  z-index: 5;
  width: 48px;
  height: 48px;
  border: 1px solid rgba(242, 236, 228, .32);
  background: rgba(28, 23, 19, .55);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}

/* Split layout: portrait left, story right */
@media (min-width: 900px) and (min-aspect-ratio: 1 / 1) {
  .story__article.is-active {
    display: flex;
    overflow: visible;
  }

  .story__media {
    flex: 0 0 50%;
    width: 50%;
    height: 100%;
  }

  .story__body {
    flex: 1 1 auto;
    min-width: 0;
    height: 100%;
    overflow-y: auto;
    overscroll-behavior: contain;
    gap: 44px;
    padding: 40px clamp(48px, 6vw, 88px) 80px clamp(48px, 5.5vw, 80px);
  }

  .story__nav { padding-right: 56px; }
  .story__name { font-size: clamp(48px, 4.4vw, 64px); }
  .story__quote blockquote p { font-size: clamp(22px, 1.8vw, 26px); }
  .story__text p { font-size: 17px; }
  .story__close { top: 24px; right: 24px; }
}

/* Without JavaScript the overlay still works through :target */
html:not(.js) .story:has(.story__article:target) { display: block; }
html:not(.js) .story__article:target { display: block; }

@media (min-width: 900px) and (min-aspect-ratio: 1 / 1) {
  html:not(.js) .story__article:target { display: flex; overflow: visible; }
}

@media (prefers-reduced-motion: reduce) {
  .tile,
  .tile img,
  .tile__label { transition: none; }
}
