/* ==========================================================================
   0. DESIGN TOKENS — change a value here and it changes everywhere
   ========================================================================== */
@import url("https://fonts.googleapis.com/css2?family=Afacad+Flux:wght@100..1000&family=Barlow:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap");

:root {
  /* Colors */
  --color-bg: #ffffff;
  --color-text: #000000;
  --color-muted: #6b6b6b;
  --color-accent: #1f4fd8; /* primary accent: every clickable link, home highlight block */
  --color-accent-2: #d6246e; /* second accent: link hover, home highlight while hovering */
  --color-accent-on-dark: #7f9dff; /* primary accent tuned for the black footer */
  --color-accent-2-on-dark: #ff7aa8; /* second accent tuned for the black footer */
  --color-current: #000000; /* current page in the top nav */
  --color-overlay-text: #ffffff; /* description text over artwork */
  --color-mosaic-fallback: #1a1a1a; /* shows through the home letters if the mosaic image is missing */

  /* Footer (reverse colors) and form fields */
  --color-footer-bg: #000000;
  --color-footer-text: #ffffff;
  --color-footer-muted: #b3b3b3;
  --color-field-bg: #ffffff;
  --color-field-text: #000000;
  --color-field-placeholder: #767676;

  /* Link colors: set these two and every link follows.
     Social icons can be overridden separately with --color-social / --color-social-hover. */
  --link: var(--color-accent);
  --link-hover: var(--color-accent-2);

  /* Mosaic image masked into the large home navigation */
  --mosaic-image: url("../images/mosaic.jpg");

  /* Typefaces — swap the family names to restyle the whole site */
  --font-main: "Afacad Flux", "Helvetica Neue", Arial, sans-serif; /* the single typeface used across the whole site */

  /* Font weights */
  --weight-light: 300;
  --weight-regular: 400;
  --weight-bold: 600;
  --weight-home-nav: 1000; /* heaviest Afacad Flux weight, used for the big home navigation */

  /* Type scale */
  --size-body: 1rem;
  --size-small: 0.875rem;
  --size-nav: 1rem;
  --size-home-nav: min(
    calc(100cqw / 3.3),
    17vh
  ); /* fallback only: js/main.js (fitHomeText) sets the real size and tracking so each word runs edge to edge */
  --size-title: clamp(1.75rem, 3vw, 2.5rem);

  /* Spacing */
  --space-xs: 0.5rem;
  --space-sm: 1rem;
  --space-md: 2rem;
  --space-lg: 4rem;
  --gap-artwork: 22vh; /* white gap between stacked artworks */
  --nav-height: 4.5rem;
  --social-size: 48px;
  --content-max: 1048px; /* max width of footer content */

  /* Motion */
  --t-fast: 0.25s;
  --t-medium: 0.75s;
  --t-slow: 1.2s; /* slow lighten/darken on artwork */
  --ease: cubic-bezier(0.35, 0, 0.15, 1);

  /* Artwork hover: lower than 1 darkens, higher than 1 lightens */
  --work-hover-brightness: 0.35;
  --work-frame-height: 85vh; /* height of each full-width artwork frame (image is cropped, never stretched) */
  --work-top-gap: var(--space-md); /* gap between the nav and the first artwork */
  --color-lightbox-bg: rgba(0, 0, 0, 0.82); /* dark and see-through */
}

/* ==========================================================================
   1. UNIVERSAL — reset, base, shared components, animations
   ========================================================================== */

/* 1.1 Reset and base */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
html {
  scroll-behavior: smooth;
}
body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-main);
  font-weight: var(--weight-light);
  font-size: var(--size-body);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}
main {
  flex: 1;
  animation: page-in var(--t-medium) var(--ease) both;
}
a {
  color: inherit;
  text-decoration: none;
}
ul {
  list-style: none;
}
img {
  display: block;
  max-width: 100%;
}
button,
input,
textarea {
  font: inherit;
  color: inherit;
  border: 0;
  background: none;
}
:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 3px;
}

/* 1.2 Top navigation (all pages except home) */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--nav-height);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 0 var(--space-md);
  background: var(--color-bg);
  font-size: var(--size-nav);
  font-weight: var(--weight-regular);
}
.nav__home {
  grid-column: 1;
  justify-self: start;
  font-family: var(--font-main);
  font-size: 1.6rem;
  font-weight: var(--weight-bold);
}
.nav__links {
  grid-column: 3;
  justify-self: end;
  display: flex;
  gap: var(--space-md);
} /* always the top right corner */
.nav__home,
.nav__link {
  color: var(--link);
  transition: color var(--t-fast) var(--ease);
}
.nav__home:hover,
.nav__link:hover {
  color: var(--link-hover);
}
.nav__link.is-current,
.nav__link.is-current:hover {
  color: var(--color-current);
  font-weight: var(--weight-bold);
}

/* Hamburger button (only shown on small screens, see section 3) */
.nav__toggle {
  display: none;
  grid-column: 3;
  justify-self: end;
  position: relative;
  width: 48px;
  height: 48px;
  margin-right: -12px;
  cursor: pointer;
  color: var(--link);
  transition: color var(--t-fast) var(--ease);
}
.nav__toggle:hover {
  color: var(--link-hover);
}
.nav__toggle span {
  position: absolute;
  left: 12px;
  right: 12px;
  height: 2px;
  background: currentColor;
  transition:
    transform var(--t-fast) var(--ease),
    opacity var(--t-fast) var(--ease);
}
.nav__toggle span:nth-child(1) {
  top: 16px;
}
.nav__toggle span:nth-child(2) {
  top: 23px;
}
.nav__toggle span:nth-child(3) {
  top: 30px;
}
.nav__toggle[aria-expanded="true"] span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
.nav__toggle[aria-expanded="true"] span:nth-child(2) {
  opacity: 0;
}
.nav__toggle[aria-expanded="true"] span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* 1.3 Work dropdown (centered in nav) */
.dropdown {
  grid-column: 2;
  position: relative;
  justify-self: center;
}
/* The toggle reads as a button: bold, underlined, with a down arrow that nudges on page load and flips when open */
.dropdown__toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  white-space: nowrap;
  cursor: pointer;
  padding: var(--space-xs) var(--space-sm);
  font-weight: var(--weight-bold);
  color: var(--link);
  transition: color var(--t-fast) var(--ease);
}
.dropdown__label {
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 0.35em;
}
.dropdown__chevron {
  width: 1rem;
  height: 1rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
  animation: nudge 0.9s ease-in-out 1.5s 3;
  transition: transform var(--t-fast) var(--ease);
}
.dropdown[data-open="true"] .dropdown__chevron {
  transform: rotate(180deg);
  animation: none;
}
.dropdown__toggle:hover,
.dropdown[data-open="true"] .dropdown__toggle {
  color: var(--link-hover);
}
.dropdown__panel {
  position: absolute;
  top: 100%;
  left: 50%;
  min-width: min(18rem, calc(100vw - 2rem));
  max-height: 70vh;
  overflow-y: auto;
  padding: var(--space-xs) 0;
  background: var(--color-bg);
  opacity: 0;
  visibility: hidden;
  transform: translate(-50%, -0.5rem);
  transition:
    opacity var(--t-fast) var(--ease),
    transform var(--t-fast) var(--ease),
    visibility var(--t-fast);
}
.dropdown[data-open="true"] .dropdown__panel {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, 0);
}
.dropdown__item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-xs) var(--space-md);
  color: var(--link);
  transition: color var(--t-fast) var(--ease);
}
.dropdown__item:hover {
  color: var(--link-hover);
}
.dropdown__thumb {
  width: 2.75rem;
  height: 2.75rem;
  object-fit: cover;
  flex-shrink: 0;
}

/* 1.4 Socials (48px square targets, transparent background) */
.socials {
  display: flex;
  gap: var(--space-xs);
  justify-content: center;
}
.socials__link {
  width: var(--social-size);
  height: var(--social-size);
  display: grid;
  place-items: center;
  background: transparent;
  color: var(--color-social, var(--link));
  transition: color var(--t-fast) var(--ease);
}
.socials__link:hover {
  color: var(--color-social-hover, var(--link-hover));
}
.socials__link svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* 1.5 Footer: reverse colors, content held to --content-max, pushed below the fold on short pages */
.footer {
  --link: var(--color-accent-on-dark);
  --link-hover: var(--color-accent-2-on-dark);
  padding: var(--space-lg) 0;
  background: var(--color-footer-bg);
  color: var(--color-footer-text);
}
.footer__inner {
  width: min(var(--content-max), 100% - 2 * var(--space-lg));
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-lg);
  align-items: start;
}
.footer__heading {
  font-family: var(--font-main);
  font-size: var(--size-title);
  font-weight: var(--weight-bold);
  line-height: 1.1;
  margin-bottom: var(--space-sm);
}
.footer__socials .socials {
  justify-content: flex-start;
  margin-left: calc((24px - var(--social-size)) / 2);
} /* aligns icon edge with the heading */
.contact {
  display: grid;
  gap: var(--space-xs);
  width: 100%;
}
.contact__field {
  width: 100%;
  padding: 0.75rem 1rem;
  background: var(--color-field-bg);
  color: var(--color-field-text);
}
.contact__field::placeholder {
  color: var(--color-field-placeholder);
  opacity: 1;
}
textarea.contact__field {
  min-height: 7rem;
  resize: vertical;
}
.contact__submit {
  justify-self: start;
  padding: 0.6rem 0;
  cursor: pointer;
  font-weight: var(--weight-bold);
  color: var(--link);
  transition: color var(--t-fast) var(--ease);
}
.contact__submit:hover {
  color: var(--link-hover);
}
.contact__status {
  min-height: 1.5em;
  font-size: var(--size-small);
  color: var(--color-footer-muted);
}

/* 1.6 Animations */
@keyframes page-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
@keyframes nudge {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(0.3rem);
  }
}

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

/* ==========================================================================
   2. PAGE SPECIFIC
   ========================================================================== */

/* 2.1 HOME ------------------------------------------------------------
   The left third is three layers:
   1. mosaic image (back)   2. solid accent block (middle)
   3. white foreground with black nav text (front). It uses mix-blend-mode: screen,
      so the white hides the layers behind it and the black letters become cut-outs.
      Keep the foreground pure #fff and the text pure #000 for the cut-out to work. */
.home {
  display: grid;
  grid-template-columns: 1fr 1fr;
  height: 100vh;
}
.home__left {
  position: relative;
  display: grid;
  isolation: isolate;
  container-type: inline-size;
}
.home__mosaic {
  position: absolute;
  inset: 0;
  background:
    var(--mosaic-image) center / cover,
    var(--color-mosaic-fallback);
}
.home__block {
  /* moved by js to the active item */
  position: absolute;
  top: 0;
  left: 0;
  width: 0;
  height: 0;
  background: var(--color-accent);
  transition:
    transform var(--t-medium) var(--ease),
    width var(--t-medium) var(--ease),
    height var(--t-medium) var(--ease),
    background-color var(--t-medium) var(--ease);
}
.home__block.is-hover {
  background: var(--color-accent-2);
}
.home__foreground {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: var(--space-md) 0;
  background: #ffffff;
  color: #000000;
  mix-blend-mode: screen;
}
.home__nav,
.home__links {
  display: flex;
  flex-direction: column;
  align-items: center;
} /* always stacked */
.home__nav {
  gap: 6vh;
} /* space between "Mayra" and the links */
.home__links {
  gap: 3vh;
} /* space between About / Work / Shop */
.home__item {
  display: block;
  padding: 0;
  white-space: nowrap; /* words never wrap */
  font-family: var(--font-main);
  font-weight: var(--weight-home-nav);
  font-size: var(--size-home-nav);
  text-transform: uppercase;
  text-align: center;
  line-height: 1;
}
.home__item:focus-visible {
  outline: none;
} /* the moving block shows keyboard focus */
.home__title {
  cursor: default;
}
.home__socials {
  position: absolute;
  left: 0;
  right: 0;
  bottom: var(--space-md);
  z-index: 3;
}

.home__feature {
  position: relative;
  display: block;
  overflow: hidden;
  cursor: pointer;
  user-select: none;
  -webkit-touch-callout: none;
}
.home__feature img,
.feature__overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.home__feature img {
  object-fit: cover;
  pointer-events: none;
  -webkit-user-drag: none;
  transition: filter var(--t-slow) var(--ease);
}
.feature__overlay {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-xs);
  text-align: center;
  color: var(--color-overlay-text);
  opacity: 0;
  transition: opacity var(--t-slow) var(--ease);
}
.feature__title {
  font-family: var(--font-main);
  font-size: 2.5rem;
  font-weight: var(--weight-bold);
  line-height: 1.1;
}
.feature__arrow {
  font-size: 2rem;
  transition: transform var(--t-medium) var(--ease);
}
.home__feature:hover img,
.home__feature:focus-visible img {
  filter: brightness(var(--work-hover-brightness));
}
.home__feature:hover .feature__overlay,
.home__feature:focus-visible .feature__overlay {
  opacity: 1;
}
.home__feature:hover .feature__arrow {
  transform: translateX(0.5rem);
}

/* 2.2 ABOUT ------------------------------------------------------------ */
.about {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: calc(100vh - var(--nav-height));
}
.about__portrait {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.about__text {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: var(--space-md);
  padding: var(--space-lg);
}
.about__block {
  max-width: 30rem;
  font-size: var(--size-small);
}
.about__heading {
  font-family: var(--font-main);
  font-size: 1.5rem;
  font-weight: var(--weight-bold);
  margin-bottom: var(--space-xs);
}

/* 2.3 WORK ------------------------------------------------------------- */
.work {
  width: 100%;
  margin: 0 0 var(--gap-artwork);
  display: flex;
  flex-direction: column;
  gap: var(--gap-artwork);
}
.artwork {
  position: relative;
  height: var(--work-frame-height);
  overflow: hidden;
  cursor: zoom-in;
  scroll-margin-top: var(--nav-height);
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}
.artwork:focus-visible {
  outline-offset: -3px;
}
.artwork__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
  -webkit-user-drag: none;
  transition: filter var(--t-slow) var(--ease);
}
.artwork__overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-xs);
  padding: var(--space-md);
  text-align: center;
  color: var(--color-overlay-text);
  opacity: 0;
  transition: opacity var(--t-slow) var(--ease);
}
.artwork__title {
  font-family: var(--font-main);
  font-size: 2rem;
  font-weight: var(--weight-bold);
  line-height: 1.1;
}
.artwork__desc {
  max-width: 30rem;
  font-size: var(--size-small);
}
.artwork:hover .artwork__img,
.artwork.is-touched .artwork__img {
  filter: brightness(var(--work-hover-brightness));
}
.artwork:hover .artwork__overlay,
.artwork.is-touched .artwork__overlay {
  opacity: 1;
}
@media print {
  .work,
  .lightbox {
    display: none;
  }
}

/* Lightbox: whole image fits the screen at its own proportions, nothing cropped */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  background: var(--color-lightbox-bg);
  opacity: 0;
  visibility: hidden;
  cursor: zoom-out;
  transition:
    opacity var(--t-medium) var(--ease),
    visibility var(--t-medium);
}
.lightbox.is-open {
  opacity: 1;
  visibility: visible;
}
.lightbox__img {
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
}

/* 2.4 SHOP ------------------------------------------------------------- */
.shop {
  min-height: calc(100vh - var(--nav-height));
  display: grid;
  place-items: center;
}
.shop__message {
  font-family: var(--font-main);
  font-size: var(--size-title);
  font-weight: var(--weight-regular);
}

/* ==========================================================================
   3. SCREEN SIZE ADAPTATION
   ========================================================================== */

/* 3.1 Tablet */
@media (max-width: 960px) {
  .home {
    grid-template-columns: 1fr;
    grid-template-rows: auto 70vh;
    height: auto;
    min-height: 100vh;
  }
  .home__foreground {
    padding: var(--space-lg) 0 calc(var(--social-size) + 3 * var(--space-md));
  }
  .about {
    grid-template-columns: 1fr;
  }
  .about__portrait {
    height: 60vh;
  }
  .about__text {
    padding: var(--space-lg) var(--space-md);
  }
  .footer__inner {
    grid-template-columns: 1fr;
    gap: var(--space-md);
  }
}

/* 3.2 Mobile: nav links collapse into the hamburger; the Artworks button stays centered */
@media (max-width: 640px) {
  :root {
    --space-md: 1.25rem;
    --space-lg: 2.5rem;
    --gap-artwork: 12vh;
    --work-frame-height: 65vh;
  }
  .nav__home {
    font-size: 1.25rem;
  }
  .nav__toggle {
    display: block;
  }
  .nav__links {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    margin-right: calc(-1 * var(--space-md));
    min-width: 12rem;
    flex-direction: column;
    align-items: flex-end;
    gap: 0;
    padding: var(--space-xs) var(--space-md) var(--space-sm);
    background: var(--color-bg);
  }
  .nav[data-menu-open="true"] .nav__links {
    display: flex;
  }
  .nav__link {
    padding: 0.75rem 0;
    font-size: 1.25rem;
    white-space: nowrap;
  }
}
