/* ==========================================================
   Nadia Nabavi — Artist portfolio
   Minimal gallery: white walls, the paintings do the talking.
   ========================================================== */

:root {
  /* Color tokens */
  --color-bg: #ffffff;
  --color-text: #151515;
  --color-text-muted: #5c5c5c;
  --color-accent: #a4262c;          /* pomegranate red, drawn from the paintings */
  --color-accent-hover: #7e1a1f;
  --color-line: #e6e3df;
  --color-veil: rgba(255, 255, 255, 0.8);
  --color-scrim: rgba(250, 249, 247, 0.82);
  --color-focus: #151515;

  /* Type */
  --font: "Montserrat", "Helvetica Neue", Arial, sans-serif;

  /* Space (8pt rhythm) */
  --space-1: 8px;
  --space-2: 16px;
  --space-3: 24px;
  --space-4: 32px;
  --space-6: 48px;
  --space-8: 64px;
  --space-12: 96px;

  /* Layout */
  --sidebar-w: 330px;
  --topbar-h: 64px;

  /* Motion */
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --dur-veil: 550ms;
  --dur-veil-out: 380ms;
  --dur-fast: 200ms;

  /* Layers */
  --z-topbar: 20;
  --z-sidebar: 40;
}

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

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

body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font);
  font-weight: 400;
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

img { display: block; max-width: 100%; height: auto; }
a { color: inherit; }
button { font: inherit; color: inherit; }
svg { display: block; }

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

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

.skip-link {
  position: absolute; left: var(--space-2); top: -60px;
  background: var(--color-text); color: #fff; padding: 10px 16px;
  z-index: 100; text-decoration: none; font-size: 14px;
}
.skip-link:focus { top: var(--space-2); }

/* ---------- Brand ---------- */
.brand {
  display: flex; flex-direction: column; align-items: center;
  text-decoration: none; text-align: center; line-height: 1.15;
}
.brand__name {
  font-size: 30px; font-weight: 400; letter-spacing: 0.06em; text-transform: uppercase;
}
.brand__role {
  font-size: 22px; font-weight: 300; letter-spacing: 0.08em; margin-top: 6px;
}

/* ---------- Sidebar ---------- */
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w);
  padding: var(--space-6) var(--space-3);
  display: flex; flex-direction: column; align-items: center;
  overflow-y: auto; background: var(--color-bg);
  z-index: var(--z-sidebar);
}
.menu-close { display: none; }

.nav { margin-top: var(--space-6); width: 100%; }
.nav__list { list-style: none; margin: 0; padding: 0; text-align: center; }
.nav__list li + li { margin-top: 2px; }
.nav__link {
  display: inline-block; padding: 5px 6px;
  font-size: 15.5px; font-weight: 300; letter-spacing: 0.03em; line-height: 1.35;
  text-decoration: none; color: var(--color-text);
  background: none; border: 0; cursor: pointer;
  transition: color var(--dur-fast) ease;
}
.nav__link:hover { color: var(--color-accent); }
.nav__link[aria-current="page"] { color: var(--color-accent); font-weight: 400; }
.nav__sep {
  width: 32px; height: 1px; background: var(--color-line);
  margin: var(--space-2) auto !important;
}
.nav__ext { display: inline-flex; align-items: center; gap: 6px; }
.nav__ext svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 2; }

/* ---------- Social ---------- */
.social { display: flex; gap: var(--space-1); justify-content: center; margin-top: var(--space-4); }
.social a {
  display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%;
  color: var(--color-text); transition: color var(--dur-fast) ease, background-color var(--dur-fast) ease;
}
.social a:hover { color: var(--color-accent); background: #f6f3f0; }
.social svg { width: 18px; height: 18px; fill: currentColor; }
.social--large a { width: 48px; height: 48px; border: 1px solid var(--color-line); }
.social--large svg { width: 20px; height: 20px; }

/* ---------- Main ---------- */
.main {
  margin-left: var(--sidebar-w);
  min-height: 100dvh;
  padding: var(--space-6) var(--space-6) var(--space-8);
  outline: none;
}
.view { animation: view-in 500ms var(--ease-out) both; }
@keyframes view-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.page-head { text-align: center; margin: 0 auto var(--space-6); max-width: 640px; }
.page-title {
  margin: 0; font-size: 15px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase;
}
.page-sub { margin: var(--space-1) 0 0; font-size: 14px; color: var(--color-text-muted); font-weight: 300; }
.page-count { margin-top: 4px; font-size: 12px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--color-text-muted); }

/* ---------- Gallery ---------- */
.gallery {
  list-style: none; margin: 0 auto; padding: 0;
  display: flex; flex-direction: column; align-items: center; gap: var(--space-12);
  max-width: 1100px;
}
.gallery > li { width: 100%; display: flex; flex-direction: column; align-items: center; }

/* Available originals */
.availability {
  display: flex; align-items: center; justify-content: center; gap: 8px; margin: var(--space-2) 0 0;
  font-size: 12px; font-weight: 500; letter-spacing: 0.12em; text-transform: uppercase;
}
.availability__dot { width: 7px; height: 7px; border-radius: 50%; background: var(--color-accent); }
.availability__sep { color: var(--color-text-muted); }
.availability__link {
  min-height: 32px; padding: 0 2px; background: none; border: 0; cursor: pointer;
  font: inherit; letter-spacing: inherit; text-transform: inherit; color: var(--color-accent);
  text-decoration: underline; text-underline-offset: 4px;
  transition: color var(--dur-fast) ease;
}
.availability__link:hover { color: var(--color-accent-hover); }

/* "New" marker in the nav */
.nav__badge {
  display: inline-block; margin-left: 4px; padding: 1px 6px; vertical-align: 2px;
  font-size: 10px; font-weight: 500; letter-spacing: 0.1em;
  color: var(--color-accent); border: 1px solid currentColor; border-radius: 999px;
}
.home__links { display: flex; flex-wrap: wrap; justify-content: center; gap: 0 var(--space-4); }
.contact__context {
  margin: 0 auto var(--space-2); padding: 8px 14px; display: inline-block; max-width: 100%;
  font-size: 13px; background: #f6f3f0; color: #2a2a2a;
}
.contact__context[hidden] { display: none; }

.artwork {
  position: relative; margin: 0; cursor: pointer;
  /* size to the painting, never taller than the viewport */
  width: min(100%, calc(84dvh * var(--ratio)));
  -webkit-tap-highlight-color: transparent;
}
.artwork__img {
  width: 100%; height: auto; background: #f4f2ef;
  aspect-ratio: var(--ratio);
  opacity: 0; transition: opacity 700ms ease;
}
.artwork__img.is-loaded { opacity: 1; }

/* The veil: painting fades to white, description appears centered */
.artwork__veil {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: var(--space-4);
  text-align: center;
  background: var(--color-veil);
  opacity: 0;
  transition: opacity var(--dur-veil-out) ease-in;
}
.artwork__veil > * {
  transform: translateY(6px);
  transition: transform var(--dur-veil-out) ease-in;
}
.artwork__title {
  margin: 0; font-size: 15px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase;
  text-wrap: balance;
}
.artwork__medium { margin: 4px 0 0; font-size: 13.5px; font-weight: 400; }
.artwork__desc {
  margin: var(--space-2) 0 0; max-width: 42ch; font-size: 14px; font-weight: 400; line-height: 1.6;
  color: #2a2a2a;
}

/* Only on devices with a real pointer. On touch screens a tapped element stays
   ":hover" after the viewer closes, which would leave the veil showing; touch
   users get the caption under the painting and the full description in the viewer. */
@media (hover: hover) {
  .artwork:hover .artwork__veil,
  .artwork:focus-visible .artwork__veil {
    opacity: 1;
    transition: opacity var(--dur-veil) var(--ease-out);
  }
  .artwork:hover .artwork__veil > *,
  .artwork:focus-visible .artwork__veil > * {
    transform: none;
    transition: transform var(--dur-veil) var(--ease-out);
  }
}
.artwork:focus-visible { outline-offset: 6px; }

/* Touch devices: a small museum-style label under each painting (title + medium).
   Hidden from screen readers because the figcaption already carries the same text. */
.artwork__label { display: none; }
.artwork__label-title {
  margin: 0; font-size: 12.5px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase;
  text-wrap: balance;
}
.artwork__label-medium { margin: 2px 0 0; font-size: 13px; color: var(--color-text-muted); }

/* Touch devices: captions open on tap, hint shown under each painting */
.tap-hint { display: none; }
@media (hover: none) {
  .artwork__label { display: block; margin-top: 12px; text-align: center; max-width: 100%; padding: 0 var(--space-1); }
  .artwork__label + .availability { margin-top: 8px; }
  .tap-hint {
    display: block; margin-top: var(--space-1); text-align: center;
    font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--color-text-muted);
  }
}

/* Small screens: keep long descriptions readable inside short paintings */
@media (max-width: 560px) {
  .artwork__veil { padding: var(--space-2); }
  .artwork__desc { font-size: 13px; line-height: 1.5; margin-top: var(--space-1); }
  .artwork--short .artwork__desc { display: none; }
}

/* ---------- Home ---------- */
.home {
  min-height: calc(100dvh - var(--space-6) - var(--space-8));
  display: grid; place-items: center;
}
.home__art { width: min(100%, calc(80dvh * var(--ratio))); margin: 0 auto; }
.home__intro { text-align: center; margin-top: var(--space-4); }
.home__intro p { margin: 0; font-size: 13px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--color-text-muted); }
.btn-link {
  display: inline-flex; align-items: center; gap: 8px; margin-top: var(--space-2);
  font-size: 14px; font-weight: 500; letter-spacing: 0.06em; text-decoration: none;
  border-bottom: 1px solid currentColor; padding-bottom: 2px;
  transition: color var(--dur-fast) ease;
}
.btn-link:hover { color: var(--color-accent); }
.btn-link svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; }

/* ---------- About ---------- */
.about {
  max-width: 1040px; margin: 0 auto;
  display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: var(--space-8);
  align-items: start;
}
.about__photo { margin: 0; position: sticky; top: var(--space-6); }
.about__photo img { width: 100%; }
.about__photo figcaption { margin-top: var(--space-1); font-size: 12px; color: var(--color-text-muted); letter-spacing: 0.04em; }
.about__body h1 {
  margin: 0 0 var(--space-4); font-size: 15px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase;
}
.about__lede {
  font-size: 22px; font-weight: 300; line-height: 1.5; margin: 0 0 var(--space-3); letter-spacing: 0.005em;
}
.about__body p { max-width: 60ch; }
.about__body p:not(.about__lede) { font-weight: 400; color: #2a2a2a; margin: 0 0 var(--space-2); }
.about__meta {
  display: flex; flex-wrap: wrap; gap: var(--space-1) var(--space-3);
  margin: var(--space-4) 0; padding: var(--space-3) 0;
  border-top: 1px solid var(--color-line); border-bottom: 1px solid var(--color-line);
  font-size: 13px; letter-spacing: 0.04em;
}
.about__meta dt { color: var(--color-text-muted); text-transform: uppercase; font-size: 11px; letter-spacing: 0.12em; }
.about__meta dd { margin: 2px 0 0; }
.about__actions { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-top: var(--space-4); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 var(--space-3);
  font-size: 13px; font-weight: 500; letter-spacing: 0.12em; text-transform: uppercase; text-decoration: none;
  border: 1px solid var(--color-text); background: var(--color-text); color: #fff; cursor: pointer;
  transition: background-color var(--dur-fast) ease, color var(--dur-fast) ease, border-color var(--dur-fast) ease;
}
.btn:hover { background: var(--color-accent); border-color: var(--color-accent); }
.btn--ghost { background: transparent; color: var(--color-text); }
.btn--ghost:hover { background: transparent; color: var(--color-accent); border-color: var(--color-accent); }
.btn svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; }

/* ---------- Footer ---------- */
.site-footer {
  margin-top: var(--space-12); text-align: center; font-size: 12px; letter-spacing: 0.06em; color: var(--color-text-muted);
}

/* ---------- Contact dialog ---------- */
.contact {
  border: 0; padding: 0; background: transparent; max-width: calc(100vw - 32px); width: 520px;
  color: var(--color-text); overflow: visible;
}
.contact::backdrop { background: var(--color-scrim); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.contact[open] { animation: dialog-in 380ms var(--ease-out); }
.contact[open]::backdrop { animation: fade-in 380ms ease; }
.contact.is-closing { animation: dialog-out 220ms ease-in forwards; }
.contact.is-closing::backdrop { animation: fade-out 220ms ease-in forwards; }
@keyframes dialog-in { from { opacity: 0; transform: translateY(12px) scale(0.98); } to { opacity: 1; transform: none; } }
@keyframes dialog-out { to { opacity: 0; transform: translateY(8px) scale(0.98); } }
@keyframes fade-in { from { opacity: 0; } }
@keyframes fade-out { to { opacity: 0; } }

.contact__card {
  position: relative; background: #fff; padding: var(--space-6) var(--space-6) var(--space-4);
  text-align: center; box-shadow: 0 24px 60px -24px rgba(0, 0, 0, 0.25); border: 1px solid var(--color-line);
}
.contact__close {
  position: absolute; top: 8px; right: 8px; width: 44px; height: 44px; display: grid; place-items: center;
  background: none; border: 0; cursor: pointer; border-radius: 50%;
  transition: background-color var(--dur-fast) ease;
}
.contact__close:hover { background: #f6f3f0; }
.contact__close svg, .menu-close svg, .menu-toggle svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; }
.eyebrow { margin: 0; font-size: 12px; font-weight: 500; letter-spacing: 0.18em; text-transform: uppercase; color: var(--color-accent); }
.contact__title { margin: var(--space-1) 0 var(--space-2); font-size: 26px; font-weight: 300; letter-spacing: 0.02em; }
.contact__lead { margin: 0 auto; max-width: 36ch; color: #2a2a2a; }
.contact__email {
  display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: var(--space-1) var(--space-2);
  margin-top: var(--space-3);
}
.contact__email a {
  font-size: 18px; font-weight: 500; text-decoration: none; overflow-wrap: anywhere;
  border-bottom: 1px solid var(--color-accent); padding-bottom: 2px;
  transition: color var(--dur-fast) ease;
}
.contact__email a:hover { color: var(--color-accent); }
.copy-btn {
  display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 12px;
  font-size: 12px; font-weight: 500; letter-spacing: 0.1em; text-transform: uppercase;
  background: none; border: 1px solid var(--color-line); cursor: pointer;
  transition: border-color var(--dur-fast) ease, color var(--dur-fast) ease;
}
.copy-btn:hover { border-color: var(--color-text); }
.copy-btn svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.contact__status { min-height: 1.4em; margin: var(--space-1) 0 0; font-size: 13px; color: var(--color-text-muted); }
.contact__divider {
  display: flex; align-items: center; gap: var(--space-2); margin: var(--space-3) 0 0;
  font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--color-text-muted);
}
.contact__divider::before, .contact__divider::after { content: ""; flex: 1; height: 1px; background: var(--color-line); }
.contact .social { margin-top: var(--space-2); }

/* ---------- Topbar (mobile) ---------- */
.topbar { display: none; }
.noscript { margin-left: var(--sidebar-w); padding: var(--space-6); text-align: center; }

@media (max-width: 1023px) {
  .topbar {
    display: flex; align-items: center; justify-content: space-between;
    position: sticky; top: 0; z-index: var(--z-topbar);
    height: var(--topbar-h); padding: 0 var(--space-1) 0 var(--space-2);
    background: rgba(255, 255, 255, 0.94); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--color-line);
  }
  .brand--compact { flex-direction: row; align-items: baseline; gap: 10px; }
  .brand--compact .brand__name { font-size: 18px; }
  .brand--compact .brand__role { font-size: 14px; margin: 0; color: var(--color-text-muted); }
  .menu-toggle {
    width: 48px; height: 48px; display: grid; place-items: center; background: none; border: 0; cursor: pointer;
  }

  .sidebar {
    width: 100%; padding-top: var(--space-8);
    visibility: hidden; opacity: 0; transform: translateY(-8px);
    transition: opacity 300ms var(--ease-out), transform 300ms var(--ease-out), visibility 0s linear 300ms;
  }
  .sidebar.is-open {
    visibility: visible; opacity: 1; transform: none;
    transition: opacity 300ms var(--ease-out), transform 300ms var(--ease-out), visibility 0s;
  }
  .menu-close {
    display: grid; place-items: center; position: absolute; top: 8px; right: 8px;
    width: 48px; height: 48px; background: none; border: 0; cursor: pointer;
  }
  .nav__link { font-size: 17px; padding: 8px; }

  .main { margin-left: 0; padding: var(--space-4) var(--space-2) var(--space-8); }
  .noscript { margin-left: 0; }
  .gallery { gap: var(--space-8); }
  .home { min-height: calc(100dvh - var(--topbar-h) - var(--space-12)); }
  .home__art { width: min(100%, calc(70dvh * var(--ratio))); }
  .artwork { width: min(100%, calc(78dvh * var(--ratio))); }

  .about { grid-template-columns: 1fr; gap: var(--space-4); }
  .about__photo { position: static; max-width: 420px; margin: 0 auto; }
  .about__lede { font-size: 19px; }
}

@media (max-width: 1023px) and (min-width: 600px) {
  .main { padding-left: var(--space-4); padding-right: var(--space-4); }
}

@media (max-width: 480px) {
  .contact__card { padding: var(--space-6) var(--space-3) var(--space-3); }
  .contact__email a { font-size: 16px; }
}

/* ---------- Painting viewer (lightbox) ---------- */
.artwork { cursor: zoom-in; }

.viewer {
  position: fixed; inset: 0; margin: 0; padding: 0; border: 0;
  width: auto; height: auto; max-width: none; max-height: none;
  background: #000; color: #fff; overflow: hidden;
  display: none; grid-template-rows: minmax(0, 1fr) auto;
}
.viewer[open] { display: grid; animation: fade-in 320ms ease; }
.viewer::backdrop { background: #000; }
.viewer.is-closing { animation: fade-out 200ms ease-in forwards; }

.viewer__stage { position: relative; min-height: 0; }
.viewer__img {
  position: absolute; top: 48px; bottom: 12px; left: 96px; right: 96px;
  width: calc(100% - 192px); height: calc(100% - 60px); max-width: none; object-fit: contain;
  transition: opacity 260ms ease;
  user-select: none; -webkit-user-drag: none;
}
.viewer__img.is-swapping { opacity: 0; }

.viewer__caption {
  max-width: 720px; margin: 0 auto; padding: var(--space-1) var(--space-3) var(--space-4);
  text-align: center; transition: opacity 260ms ease;
}
.viewer__caption.is-swapping { opacity: 0; }
.viewer__title { margin: 0; font-size: 14px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; }
.viewer__medium { margin: 2px 0 0; font-size: 13px; font-weight: 600; color: #e9e9e9; }
.viewer__desc { margin: 6px 0 0; font-size: 13px; font-weight: 500; line-height: 1.55; color: #d9d9d9; }
.viewer__medium:empty, .viewer__desc:empty { display: none; }
.viewer__avail {
  display: flex; align-items: center; justify-content: center; gap: 8px; margin: var(--space-1) 0 0;
  font-size: 11px; font-weight: 500; letter-spacing: 0.12em; text-transform: uppercase;
}
.viewer__avail[hidden] { display: none; }
.viewer__avail .availability__dot { background: #ff5a5f; }
.viewer__inquire {
  min-height: 32px; background: none; border: 0; cursor: pointer; padding: 0 2px;
  font: inherit; letter-spacing: inherit; text-transform: inherit; color: #ff8a8e;
  text-decoration: underline; text-underline-offset: 4px;
}
.viewer__inquire:hover { color: #fff; }

.viewer__count {
  position: absolute; top: 18px; left: 24px; margin: 0;
  font-size: 12px; letter-spacing: 0.12em; color: #9a9a9a;
}
.viewer__btn {
  position: absolute; display: grid; place-items: center;
  width: 48px; height: 48px; border-radius: 50%;
  background: rgba(255, 255, 255, 0.06); border: 0; color: #fff; cursor: pointer;
  transition: background-color var(--dur-fast) ease;
}
.viewer__btn:hover { background: rgba(255, 255, 255, 0.16); }
.viewer__btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.viewer__btn:focus-visible { outline-color: #fff; }
.viewer__close { top: 8px; right: 12px; }
.viewer__prev { left: 16px; top: 50%; transform: translateY(-50%); }
.viewer__next { right: 16px; top: 50%; transform: translateY(-50%); }
.viewer__btn[hidden] { display: none; }

@media (max-width: 767px) {
  .viewer__img { top: 60px; bottom: 8px; left: 8px; right: 8px; width: calc(100% - 16px); height: calc(100% - 68px); }
  .viewer__prev, .viewer__next { top: auto; bottom: 12px; transform: none; }
  .viewer__prev { left: 8px; }
  .viewer__next { right: 8px; }
  .viewer__caption { padding: var(--space-1) 60px var(--space-3); }
  .viewer__desc { font-size: 12.5px; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 1ms !important; animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
  }
  .artwork__veil > * { transform: none !important; }
}
