/* Edgar Alan — portafolio editorial */

:root {
  --bg: #f4f5f4;
  --fg: #1a1a1a;
  --fg-muted: #5c5c5c;
  --accent: #2a2a2a;
  --line: rgba(26, 26, 26, 0.08);
  --font-display: "Cormorant Garamond", Georgia, "Times New Roman", serif;
  --font-body: "Outfit", system-ui, -apple-system, sans-serif;
  --space-xs: 0.5rem;
  --space-sm: 1rem;
  --space-md: 1.75rem;
  --space-lg: 3rem;
  --space-xl: clamp(3rem, 8vw, 6rem);
  --max-text: 38rem;
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-weight: 300;
  font-size: clamp(0.9375rem, 0.9rem + 0.2vw, 1.0625rem);
  line-height: 1.65;
  letter-spacing: 0.01em;
  -webkit-font-smoothing: antialiased;
}

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

.page {
  max-width: 1200px;
  margin: 0 auto;
  padding: var(--space-xl) clamp(1.25rem, 4vw, 2.5rem) var(--space-lg);
}

/* Header */
.site-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-md);
  padding-bottom: var(--space-lg);
  border-bottom: 1px solid var(--line);
}

.brand__name {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(2rem, 5vw, 2.75rem);
  letter-spacing: 0.02em;
  line-height: 1.15;
  color: var(--accent);
}

.brand__tagline {
  margin: var(--space-xs) 0 0;
  font-size: 0.8125rem;
  font-weight: 400;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--fg-muted);
}

.contact-nav {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding-top: 0.35rem;
}

.contact-nav__link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  color: var(--accent);
  border-radius: 50%;
  transition: background 0.35s var(--ease), transform 0.35s var(--ease);
}

.contact-nav__link:hover,
.contact-nav__link:focus-visible {
  background: rgba(26, 26, 26, 0.06);
  transform: translateY(-1px);
}

.contact-nav__link:focus-visible {
  outline: 1px solid var(--fg-muted);
  outline-offset: 2px;
}

.contact-nav__icon {
  display: block;
  opacity: 0.85;
}

/* Main two columns */
.main-block {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
  gap: clamp(2rem, 5vw, 4rem);
  align-items: start;
  padding-top: var(--space-lg);
}

.bio {
  order: 1;
}

.hero-photo {
  order: 2;
  margin: 0;
}

.prose p {
  margin: 0 0 var(--space-md);
  max-width: var(--max-text);
  color: var(--fg);
}

.prose p:last-child {
  margin-bottom: 0;
}

.prose em {
  font-style: italic;
  font-weight: 400;
}

.prose cite {
  font-style: italic;
  font-family: var(--font-display);
  font-size: 1.05em;
}

.prose a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid rgba(26, 26, 26, 0.25);
  transition: border-color 0.25s var(--ease), color 0.25s var(--ease);
}

.prose a:hover,
.prose a:focus-visible {
  border-bottom-color: var(--accent);
}

.bio__links {
  font-size: 0.9375rem;
  color: var(--fg-muted);
}

/* Hero image */
.hero-photo__img {
  display: block;
  width: 100%;
  height: auto;
  max-height: min(85vh, 900px);
  object-fit: cover;
  object-position: center 20%;
  filter: contrast(1.02);
}

/* Gallery */
.gallery-section {
  padding-top: var(--space-xl);
  margin-top: var(--space-lg);
  border-top: 1px solid var(--line);
}

.gallery-section__title {
  margin: 0 0 var(--space-md);
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(1.25rem, 2.5vw, 1.5rem);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--fg-muted);
}

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: clamp(0.75rem, 2vw, 1.25rem);
  list-style: none;
  margin: 0;
  padding: 0;
}

.gallery > li {
  margin: 0;
  padding: 0;
}

.gallery__item {
  position: relative;
  margin: 0;
  overflow: hidden;
  aspect-ratio: 4 / 5;
  background: rgba(0, 0, 0, 0.04);
  cursor: pointer;
  border: none;
  padding: 0;
  display: block;
  width: 100%;
  font: inherit;
  color: inherit;
  transition: transform 0.45s var(--ease), box-shadow 0.45s var(--ease);
}

.gallery__item:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.gallery__item:hover {
  transform: translateY(-3px);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.08);
}

.gallery__thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.55s var(--ease), opacity 0.45s var(--ease);
}

.gallery__item:hover .gallery__thumb {
  transform: scale(1.04);
  opacity: 0.96;
}

/* Lightbox */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(244, 245, 244, 0.97);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-sm);
}

.lightbox[hidden] {
  display: none;
}

.lightbox__frame {
  max-width: min(92vw, 1200px);
  max-height: 88vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox__img {
  max-width: 100%;
  max-height: 88vh;
  width: auto;
  height: auto;
  object-fit: contain;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.12);
}

.lightbox__close {
  position: absolute;
  top: var(--space-sm);
  right: var(--space-sm);
  width: 3rem;
  height: 3rem;
  border: none;
  background: transparent;
  font-size: 2rem;
  line-height: 1;
  cursor: pointer;
  color: var(--fg-muted);
  transition: color 0.25s var(--ease);
}

.lightbox__close:hover,
.lightbox__close:focus-visible {
  color: var(--accent);
}

.lightbox__nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 3rem;
  height: 3rem;
  border: none;
  background: rgba(26, 26, 26, 0.06);
  color: var(--accent);
  font-size: 1.75rem;
  line-height: 1;
  cursor: pointer;
  border-radius: 50%;
  transition: background 0.25s var(--ease), opacity 0.25s var(--ease);
}

.lightbox__nav:hover,
.lightbox__nav:focus-visible {
  background: rgba(26, 26, 26, 0.12);
}

.lightbox__nav--prev {
  left: clamp(0.5rem, 2vw, 1.5rem);
}

.lightbox__nav--next {
  right: clamp(0.5rem, 2vw, 1.5rem);
}

.lightbox__nav:disabled {
  opacity: 0.25;
  cursor: default;
}

/* Mobile order: header → photo → bio → gallery */
@media (max-width: 768px) {
  .main-block {
    display: flex;
    flex-direction: column;
    gap: var(--space-lg);
  }

  .hero-photo {
    order: 1;
  }

  .bio {
    order: 2;
  }

  .hero-photo__img {
    max-height: 70vh;
  }

  .gallery {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.65rem;
  }

  .lightbox__nav {
    width: 2.5rem;
    height: 2.5rem;
    font-size: 1.5rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .gallery__item,
  .gallery__thumb,
  .contact-nav__link {
    transition: none;
  }

  .gallery__item:hover {
    transform: none;
  }

  .gallery__item:hover .gallery__thumb {
    transform: none;
  }
}
