:root {
  --bg: #faf7f2;
  --bg-soft: #f4f7fa;
  --text: #2d2a26;
  --muted: #6b6560;
  --accent: #b85c4a;
  --accent-hover: #a45242;
  --accent-soft: rgba(184, 92, 74, 0.14);
  --accent-secondary: #7a9eb8;
  --accent-secondary-hover: #6a8da8;
  --accent-mint: #8fbfb0;
  --border: #e8e2d9;
  --shadow-sm: 0 2px 8px rgba(45, 42, 38, 0.06);
  --shadow-md: 0 8px 24px rgba(45, 42, 38, 0.09);
  --shadow-lg: 0 16px 40px rgba(45, 42, 38, 0.12);
  --max-width: 42rem;
  --font-title: "Source Serif 4", Georgia, "Times New Roman", serif;
  --font-body: "Lora", Georgia, "Times New Roman", serif;
  --radius-pill: 9999px;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
}

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

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

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

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.65;
  color: var(--text);
  background: linear-gradient(180deg, var(--bg) 0%, var(--bg-soft) 100%);
  background-attachment: fixed;
}

.page {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2.5rem 1.5rem 4rem;
}

/* —— Hero —— */

.hero {
  display: grid;
  gap: 2rem;
  margin-bottom: 2.75rem;
}

.hero__intro {
  position: relative;
  z-index: 2;
}

.name {
  margin: 0;
  font-family: var(--font-title);
  font-size: clamp(2.25rem, 7vw, 3.25rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.15;
  color: var(--text);
}

/* —— Portrait gallery —— */

.portraits {
  width: 100%;
}

.portrait-gallery {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(0.5rem, 2vw, 1rem);
  width: 100%;
}

.portrait {
  margin: 0;
  opacity: 0.42;
  transition: opacity 0.35s var(--ease-out);
  outline: none;
  cursor: default;
}

.portrait__frame {
  position: relative;
  border-radius: 0.75rem;
  overflow: hidden;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
  transition: box-shadow 0.35s var(--ease-out), transform 0.35s var(--ease-out),
    border-color 0.35s var(--ease-out);
}

.portrait__frame::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: inset 0 0 0 1px rgba(45, 42, 38, 0.06);
  pointer-events: none;
}

.portrait img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  background: linear-gradient(135deg, var(--bg-soft) 0%, var(--border) 100%);
}

.portrait:focus-visible {
  opacity: 1;
}

.portrait:focus-visible .portrait__frame {
  box-shadow: var(--shadow-lg);
  outline: 2px solid var(--accent-secondary);
  outline-offset: 3px;
}

@media (hover: hover) {
  .portrait-gallery:hover .portrait {
    opacity: 0.38;
  }

  .portrait-gallery .portrait:hover,
  .portrait-gallery .portrait:focus-within,
  .portrait-gallery .portrait:focus-visible {
    opacity: 1;
  }

  .portrait:hover .portrait__frame,
  .portrait:focus-within .portrait__frame,
  .portrait:focus-visible .portrait__frame {
    border-color: var(--accent-mint);
    box-shadow: var(--shadow-lg);
    transform: translateY(-3px);
  }

  .portrait:focus-visible .portrait__frame {
    outline: 2px solid var(--accent-secondary);
    outline-offset: 3px;
  }
}

@media (hover: none) {
  .portrait {
    opacity: 0.5;
    cursor: pointer;
  }

  .portrait.is-active {
    opacity: 1;
  }

  .portrait.is-active .portrait__frame {
    box-shadow: var(--shadow-lg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .portrait-gallery .portrait {
    opacity: 1;
    cursor: default;
  }

  .portrait-gallery .portrait .portrait__frame {
    transform: none;
  }
}

/* —— About —— */

.about {
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.75;
  color: var(--text);
}

.about p {
  margin: 0 0 1.25rem;
}

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

/* —— Links / buttons —— */

.links {
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
  margin-top: 2.75rem;
}

.link {
  display: block;
  padding: 0.95rem 1.75rem;
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 500;
  text-align: center;
  text-decoration: none;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s var(--ease-out), box-shadow 0.2s var(--ease-out),
    border-color 0.2s ease, color 0.2s ease, background 0.2s ease;
}

.link:hover,
.link:focus-visible {
  border-color: var(--accent-secondary);
  color: var(--accent-secondary-hover);
  background: var(--bg-soft);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
  outline: none;
}

.link:active {
  transform: translateY(0);
  box-shadow: var(--shadow-sm);
}

.link--primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  box-shadow: 0 4px 14px rgba(184, 92, 74, 0.28);
}

.link--primary:hover,
.link--primary:focus-visible {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  color: #fff;
  box-shadow: 0 6px 20px rgba(184, 92, 74, 0.36);
}

/* —— Footer —— */

.footer {
  margin-top: 3.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.footer p {
  margin: 0;
  font-family: var(--font-body);
  font-size: 0.875rem;
  color: var(--muted);
}

.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;
}

/* —— Wider layout —— */

@media (min-width: 640px) {
  .page {
    padding-top: 3.5rem;
    max-width: 52rem;
  }

  .hero {
    grid-template-columns: 1fr;
    gap: 2rem;
    margin-bottom: 3rem;
  }

  .hero__intro {
    max-width: 28rem;
  }
}

@media (max-width: 479px) {
  .portrait-gallery {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .portrait-gallery .portrait:last-child {
    grid-column: 1 / -1;
    width: min(100%, 14rem);
    justify-self: center;
  }
}

@media (min-width: 480px) {
  .page {
    padding-left: 2rem;
    padding-right: 2rem;
  }
}
