/* ==========================================================================
   Mahboub Anvari, portfolio
   One stylesheet. Tokens first, then layout, then components.
   Every rule appears once. No !important anywhere.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Tokens
   Contrast ratios against --paper were calculated with the WCAG 2.1
   relative-luminance formula. All body-text pairings clear 4.5:1 (SC 1.4.3).
   -------------------------------------------------------------------------- */
:root {
  --paper:      #f3f3f2;   /* neutral gallery wall                          */
  --paper-warm: #ececeb;   /* recessed panels, hover fills                  */
  --ink:        #17181a;   /* primary text          15.99:1                 */
  --ink-2:      #4a4c50;   /* secondary text         7.75:1                 */
  --ink-3:      #6b6d71;   /* captions, metadata     4.66:1                 */
  --rule:       #d7d7d4;   /* hairlines                                     */
  --rule-soft:  #e4e4e1;

  --font-ui:   "Archivo", -apple-system, BlinkMacSystemFont, "Segoe UI",
               Roboto, Helvetica, Arial, sans-serif;
  --font-text: "Newsreader", Georgia, "Times New Roman", serif;

  --step--1: 0.8125rem;
  --step-0:  1.0625rem;
  --step-1:  clamp(1.15rem, 1.05rem + 0.4vw, 1.35rem);
  --step-2:  clamp(1.5rem,  1.25rem + 1.1vw, 2.1rem);
  --step-3:  clamp(1.9rem,  1.45rem + 2.1vw, 3rem);

  --gutter: clamp(20px, 5vw, 56px);
  --measure: 63ch;
  --header-h: 61px;

  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

/* --------------------------------------------------------------------------
   2. Reset and base
   -------------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  overflow-x: hidden;              /* nothing may push the page sideways    */
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-text);
  font-size: var(--step-0);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

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

h1, h2, h3, h4 { margin: 0; font-weight: 400; line-height: 1.2; }

p { margin: 0 0 1.15em; }

a { color: inherit; }

:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
  border-radius: 1px;
}

.skip-link {
  position: absolute;
  left: 12px;
  top: -100px;
  z-index: 200;
  padding: 10px 16px;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--font-ui);
  font-size: var(--step--1);
  text-decoration: none;
  transition: top 0.15s var(--ease);
}
.skip-link:focus { top: 12px; }

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

.wrap {
  width: 100%;
  max-width: 1180px;
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.wrap--narrow { max-width: 820px; }

/* --------------------------------------------------------------------------
   3. Header and navigation
   The mobile panel is display:none when closed, so it can never sit
   off-screen and create horizontal overflow.
   -------------------------------------------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--paper);
  border-bottom: 1px solid var(--rule);
}

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: var(--header-h);
}

.wordmark {
  font-family: var(--font-ui);
  font-size: var(--step--1);
  font-weight: 500;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--ink);
  white-space: nowrap;
}

.nav__list {
  display: flex;
  align-items: center;
  gap: 30px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.nav__link {
  display: inline-block;
  padding: 4px 0;
  font-family: var(--font-ui);
  font-size: var(--step--1);
  letter-spacing: 0.04em;
  color: var(--ink-2);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: color 0.18s var(--ease), border-color 0.18s var(--ease);
}
.nav__link:hover { color: var(--ink); border-bottom-color: var(--ink); }
.nav__link[aria-current="page"] { color: var(--ink); border-bottom-color: var(--ink); }

.nav-toggle {
  display: none;
  align-items: center;
  gap: 9px;
  padding: 8px 2px;
  background: none;
  border: 0;
  cursor: pointer;
  font-family: var(--font-ui);
  font-size: var(--step--1);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink);
}
.nav-toggle__bars {
  position: relative;
  display: block;
  width: 20px;
  height: 9px;
}
.nav-toggle__bars::before,
.nav-toggle__bars::after {
  content: "";
  position: absolute;
  left: 0;
  width: 100%;
  height: 1.5px;
  background: var(--ink);
  transition: transform 0.2s var(--ease), top 0.2s var(--ease);
}
.nav-toggle__bars::before { top: 0; }
.nav-toggle__bars::after  { top: 7.5px; }
[aria-expanded="true"] .nav-toggle__bars::before { top: 4px; transform: rotate(45deg); }
[aria-expanded="true"] .nav-toggle__bars::after  { top: 4px; transform: rotate(-45deg); }

@media (max-width: 720px) {
  .nav-toggle { display: inline-flex; }

  .nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--paper);
    border-bottom: 1px solid var(--rule);
  }
  body.nav-open .nav { display: block; }

  .nav__list {
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 4px var(--gutter) 16px;
  }
  .nav__link {
    padding: 13px 0;
    font-size: 0.9375rem;
    border-bottom: 1px solid var(--rule-soft);
  }
  .nav__link:hover,
  .nav__link[aria-current="page"] { border-bottom-color: var(--rule-soft); }
  .nav__list li:last-child .nav__link { border-bottom: 0; }
}

/* --------------------------------------------------------------------------
   4. Shared page furniture
   -------------------------------------------------------------------------- */
.eyebrow {
  margin: 0 0 14px;
  font-family: var(--font-ui);
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.page-head { padding-block: clamp(48px, 8vw, 88px) clamp(28px, 4vw, 44px); }

.page-title {
  font-size: var(--step-3);
  font-weight: 300;
  letter-spacing: -0.015em;
}

.page-intro {
  max-width: var(--measure);
  margin-top: 18px;
  color: var(--ink-2);
}

.lede { font-size: var(--step-1); color: var(--ink-2); }

.back-link {
  display: inline-block;
  margin-bottom: 26px;
  font-family: var(--font-ui);
  font-size: var(--step--1);
  letter-spacing: 0.04em;
  color: var(--ink-3);
  text-decoration: none;
  transition: color 0.18s var(--ease);
}
.back-link:hover { color: var(--ink); }
.back-link::before { content: "\2190"; margin-right: 8px; }

.site-footer {
  margin-top: clamp(72px, 10vw, 128px);
  border-top: 1px solid var(--rule);
  padding: 32px 0 44px;
}
.site-footer__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px 32px;
  font-family: var(--font-ui);
  font-size: var(--step--1);
  color: var(--ink-3);
}
.site-footer a {
  color: var(--ink-3);
  text-decoration: none;
  border-bottom: 1px solid var(--rule);
  transition: color 0.18s var(--ease), border-color 0.18s var(--ease);
}
.site-footer a:hover { color: var(--ink); border-bottom-color: var(--ink); }

/* --------------------------------------------------------------------------
   5. Home, hero
   The name is set small on purpose. The painting is the loudest thing here.
   -------------------------------------------------------------------------- */
.hero {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  align-items: center;
  gap: clamp(32px, 5vw, 72px);
  padding-block: clamp(40px, 6vw, 80px) clamp(56px, 8vw, 96px);
}

.hero__name {
  font-size: var(--step-2);
  font-weight: 300;
  letter-spacing: -0.01em;
}

.hero__role {
  margin: 10px 0 30px;
  font-family: var(--font-ui);
  font-size: var(--step--1);
  line-height: 1.65;
  color: var(--ink-3);
}

.hero__line {
  max-width: 34ch;
  padding-top: 22px;
  border-top: 1px solid var(--rule);
  font-size: var(--step-1);
  font-style: italic;
  color: var(--ink-2);
}

.hero__cite {
  display: inline-block;
  margin-top: 4px;
  letter-spacing: 0.04em;
  font-family: var(--font-ui);
  font-size: var(--step--1);
  font-style: normal;
  color: var(--ink-3);
  text-decoration: none;
  border-bottom: 1px solid var(--ink-3);
  transition: color 0.18s var(--ease), border-color 0.18s var(--ease);
}
.hero__cite::after { content: " \2192"; }
.hero__cite:hover { color: var(--ink); border-bottom-color: var(--ink); }

.hero__figure { margin: 0; }
.hero__figure img {
  width: 100%;
  box-shadow: 0 1px 2px rgba(23, 24, 26, 0.07), 0 12px 32px rgba(23, 24, 26, 0.09);
}

@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; gap: 34px; }
  .hero__line { max-width: none; }
}

/* --------------------------------------------------------------------------
   6. Caption block, used under every work
   -------------------------------------------------------------------------- */
.caption {
  margin-top: 14px;
  font-family: var(--font-ui);
  font-size: var(--step--1);
  line-height: 1.55;
  color: var(--ink-3);
}
.caption__title {
  display: block;
  color: var(--ink);
  font-style: italic;
  font-family: var(--font-text);
  font-size: 1.0625rem;
  line-height: 1.4;
}
.caption__meta { display: block; margin-top: 3px; }

/* --------------------------------------------------------------------------
   7. Collections index (home)
   -------------------------------------------------------------------------- */
.collections {
  display: grid;
  grid-template-columns: 1fr;
  gap: clamp(24px, 3.5vw, 40px);
  padding-bottom: clamp(24px, 4vw, 48px);
}
@media (min-width: 560px)  { .collections { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1000px) { .collections { grid-template-columns: repeat(4, 1fr); } }

.collection-card { text-decoration: none; color: inherit; display: block; }

.collection-card__frame {
  display: block;
  overflow: hidden;
  background: var(--paper-warm);
  aspect-ratio: 4 / 5;
}
.collection-card__frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s var(--ease);
}
.collection-card:hover .collection-card__frame img,
.collection-card:focus-visible .collection-card__frame img { transform: scale(1.035); }

.collection-card__name {
  display: block;
  margin-top: 15px;
  font-size: var(--step-1);
  font-weight: 400;
}
.collection-card__count {
  display: block;
  margin-top: 2px;
  font-family: var(--font-ui);
  font-size: var(--step--1);
  color: var(--ink-3);
}

/* --------------------------------------------------------------------------
   8. Work grid
   Every work hangs on a shared centreline, the way pictures are hung in a
   gallery. Fixed cell height, image contained and centred inside it.
   -------------------------------------------------------------------------- */
.works {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: clamp(36px, 4.5vw, 64px) clamp(24px, 3.5vw, 48px);
  padding-bottom: 8px;
}

.work { margin: 0; }

.work__frame {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  height: clamp(210px, 26vw, 340px);
}

.work__button {
  display: block;
  max-width: 100%;
  max-height: 100%;
  padding: 0;
  border: 0;
  background: none;
  cursor: zoom-in;
  line-height: 0;
}
.work__button img {
  max-width: 100%;
  max-height: clamp(210px, 26vw, 340px);
  width: auto;
  height: auto;
  box-shadow: 0 1px 2px rgba(23, 24, 26, 0.08), 0 8px 20px rgba(23, 24, 26, 0.08);
  transition: opacity 0.22s var(--ease);
}
.work__button:hover img { opacity: 0.86; }

/* --------------------------------------------------------------------------
   9. Long-form text: statement
   -------------------------------------------------------------------------- */
.prose { max-width: var(--measure); }
.prose p { color: var(--ink-2); }
.prose p:first-of-type {
  font-size: var(--step-1);
  color: var(--ink);
}
.prose em { font-style: italic; }

/* --------------------------------------------------------------------------
   10. CV
   -------------------------------------------------------------------------- */
.cv { max-width: 900px; }

.cv__block {
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr);
  gap: 8px 32px;
  padding: 28px 0;
  border-top: 1px solid var(--rule);
}
.cv__block:last-of-type { border-bottom: 1px solid var(--rule); }

.cv__heading {
  font-family: var(--font-ui);
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-3);
  padding-top: 5px;
}

.cv__list { margin: 0; padding: 0; list-style: none; }
.cv__list > li { margin-bottom: 17px; }
.cv__list > li:last-child { margin-bottom: 0; }

.cv__year {
  display: block;
  font-family: var(--font-ui);
  font-size: var(--step--1);
  letter-spacing: 0.04em;
  color: var(--ink-3);
}
.cv__what { display: block; color: var(--ink); }
.cv__what em { font-style: italic; }
.cv__where { display: block; color: var(--ink-2); font-size: 0.9375rem; }

@media (max-width: 640px) {
  .cv__block { grid-template-columns: 1fr; gap: 14px; }
  .cv__heading { padding-top: 0; }
}

/* --------------------------------------------------------------------------
   11. Contact
   -------------------------------------------------------------------------- */
.contact-list { margin: 0; padding: 0; list-style: none; max-width: var(--measure); }
.contact-list li { border-top: 1px solid var(--rule); }
.contact-list li:last-child { border-bottom: 1px solid var(--rule); }

.contact-list a {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 20px;
  padding: 20px 0;
  text-decoration: none;
  transition: padding-inline-start 0.2s var(--ease);
}
.contact-list a:hover { padding-inline-start: 8px; }

.contact-list__label {
  font-family: var(--font-ui);
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-3);
  flex: 0 0 auto;
  min-width: 96px;
}
.contact-list__value { color: var(--ink); word-break: break-word; text-align: right; }

/* --------------------------------------------------------------------------
   12. Lightbox
   -------------------------------------------------------------------------- */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: none;
  flex-direction: column;
  background: var(--paper);
}
.lightbox[open],
.lightbox.is-open { display: flex; }

.lightbox__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px var(--gutter);
  border-bottom: 1px solid var(--rule);
  flex: 0 0 auto;
}

.lightbox__count {
  font-family: var(--font-ui);
  font-size: var(--step--1);
  letter-spacing: 0.08em;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}

.lightbox__controls { display: flex; align-items: center; gap: 4px; }

.lb-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  background: none;
  border: 1px solid transparent;
  border-radius: 2px;
  color: var(--ink-2);
  cursor: pointer;
  transition: color 0.18s var(--ease), background 0.18s var(--ease);
}
.lb-btn:hover { color: var(--ink); background: var(--paper-warm); }
.lb-btn svg { width: 19px; height: 19px; fill: none; stroke: currentColor;
              stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }
.lb-btn--close { margin-left: 8px; }

.lightbox__stage {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  min-height: 0;
  padding: clamp(20px, 4vw, 44px) var(--gutter);
}

.lightbox__pic { display: contents; }

.lightbox__img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  min-height: 0;
  object-fit: contain;
  box-shadow: 0 1px 2px rgba(23, 24, 26, 0.08), 0 16px 44px rgba(23, 24, 26, 0.13);
}

.lightbox__caption {
  flex: 0 0 auto;
  max-width: 60ch;
  text-align: center;
  font-family: var(--font-ui);
  font-size: var(--step--1);
  line-height: 1.55;
  color: var(--ink-3);
}
.lightbox__caption .caption__title { font-size: 1rem; }

@media (max-width: 640px) {
  .lightbox__stage { gap: 14px; }
  .lb-btn { width: 44px; height: 44px; }
}

/* --------------------------------------------------------------------------
   13. Motion
   Content is visible by default. Animation only adds to it, so a blocked
   or disabled animation can never leave text invisible.
   -------------------------------------------------------------------------- */
@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: none; }
}

.rise { animation: rise 0.6s var(--ease) both; }
.rise--2 { animation-delay: 0.08s; }
.rise--3 { animation-delay: 0.16s; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

/* --------------------------------------------------------------------------
   14. Print, so the CV prints cleanly
   -------------------------------------------------------------------------- */
@media print {
  .site-header, .site-footer, .back-link, .nav-toggle { display: none; }
  body { background: #fff; color: #000; font-size: 11pt; }
  .cv__block { break-inside: avoid; }
  a { text-decoration: none; }
}
