:root {
  color-scheme: light;
  --ink: #282a26;
  --muted: #65665e;
  --wine: #843d35;
  --gold: #be8e37;
  --paper: #f7f1e5;
  --surface: #fffdf8;
  font-family: "Segoe UI", "Trebuchet MS", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background: var(--paper);
  color: var(--ink);
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  margin: 0;
  background:
    radial-gradient(ellipse at 50% 0%, #fffdf8 0, #fffdf85c 40rem, transparent 60rem),
    radial-gradient(ellipse 4px 7px at 50% 29%, #be8e3724 95%, transparent 100%),
    radial-gradient(ellipse 4px 7px at 50% 71%, #be8e3724 95%, transparent 100%),
    radial-gradient(ellipse 7px 4px at 29% 50%, #be8e3724 95%, transparent 100%),
    radial-gradient(ellipse 7px 4px at 71% 50%, #be8e3724 95%, transparent 100%),
    radial-gradient(circle at 50% 50%, #843d3519 0 1.5px, transparent 2px),
    var(--paper);
  background-size:
    auto,
    48px 48px,
    48px 48px,
    48px 48px,
    48px 48px,
    48px 48px,
    auto;
}

main {
  overflow: hidden;
}

.welcome {
  position: relative;
  z-index: 1;
  padding: clamp(34px, 5vw, 64px) 22px 12px;
  text-align: center;
}

.welcome__name,
.portals__eyebrow {
  margin: 0;
  color: var(--wine);
  font-size: 0.83rem;
  font-weight: 800;
  letter-spacing: 0.19em;
  text-transform: uppercase;
}

.welcome__name {
  font-size: 1rem;
}

h1 {
  margin: 11px 0 12px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.05rem, 5vw, 3.55rem);
  font-weight: 500;
  letter-spacing: -0.045em;
  line-height: 1.06;
}

h1 span {
  color: var(--wine);
}

.welcome__motto {
  margin: 0;
  color: #8a652f;
  font-size: clamp(0.95rem, 2.1vw, 1.17rem);
  font-weight: 750;
  letter-spacing: 0.025em;
}

.welcome__message {
  margin: 10px auto 0;
  color: var(--muted);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(0.98rem, 2.1vw, 1.16rem);
  line-height: 1.55;
}

.family {
  position: relative;
  display: grid;
  width: min(100% - 32px, 670px);
  margin: 0 auto;
  place-items: center;
}

.family__portrait {
  display: block;
  width: 100%;
  height: auto;
  filter: drop-shadow(0 17px 24px #523a2417);
}

.family__spark {
  position: absolute;
  color: #bb8e45;
  pointer-events: none;
  animation: glimmer 3.2s ease-in-out infinite;
}

.family__spark--one {
  top: 12%;
  left: 16%;
  font-size: clamp(1.1rem, 3vw, 1.8rem);
}

.family__spark--two {
  top: 20%;
  right: 17%;
  animation-delay: 1.1s;
  font-size: clamp(1.3rem, 3.5vw, 2rem);
}

.portals {
  position: relative;
  padding: clamp(24px, 4vw, 46px) 24px clamp(48px, 7vw, 76px);
  text-align: center;
}

.portals::before {
  position: absolute;
  z-index: -1;
  top: 0;
  right: 0;
  left: 0;
  height: 100%;
  background: linear-gradient(180deg, #f1e7d5ed 0%, #f8f3e9ed 100%);
  content: "";
}

.portals__eyebrow {
  color: #92703e;
  font-size: 0.74rem;
}

h2 {
  margin: 8px 0 28px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.65rem, 3.5vw, 2.25rem);
  font-weight: 500;
  letter-spacing: -0.025em;
}

.portal-grid {
  display: flex;
  width: min(100%, 1010px);
  margin: 0 auto;
  align-items: start;
  justify-content: center;
  column-gap: clamp(16px, 4vw, 44px);
}

.portal-card {
  --portal-size: clamp(152px, 18vw, 202px);
  display: flex;
  flex: 0 0 var(--portal-size);
  flex-direction: column;
  align-items: center;
  gap: 13px;
  color: var(--ink);
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}

.portal-card__image-wrap {
  display: block;
  width: var(--portal-size);
  height: var(--portal-size);
  flex: 0 0 var(--portal-size);
  aspect-ratio: 1;
  overflow: hidden;
  border: 5px solid var(--surface);
  border-radius: 50%;
  background: #211e19;
  box-shadow:
    0 0 0 1px #b38a5270,
    0 10px 22px #51391d21;
  transition: box-shadow 220ms ease, transform 220ms ease;
}

.portal-card__image {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  object-fit: cover;
  transition: transform 350ms ease;
}

.portal-card__title {
  color: #49352b;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(0.94rem, 1.8vw, 1.12rem);
  font-weight: 700;
  line-height: 1.3;
}

.portal-card:hover .portal-card__image-wrap,
.portal-card:focus-visible .portal-card__image-wrap {
  transform: translateY(-6px) rotate(-2deg);
  box-shadow:
    0 0 0 3px #be8e37,
    0 17px 26px #51391d2b;
}

.portal-card:hover .portal-card__image,
.portal-card:focus-visible .portal-card__image {
  transform: scale(1.07);
}

.portal-card:focus-visible {
  border-radius: 14px;
  outline: 3px solid var(--wine);
  outline-offset: 7px;
}

.portal-card:focus-visible .portal-card__image-wrap {
  outline: none;
}

.portal-card--error {
  width: auto;
  grid-column: 1 / -1;
  color: #842b25;
}

footer {
  padding: 18px 22px 28px;
  color: #777266;
  font-size: 0.82rem;
  text-align: center;
}

@keyframes glimmer {
  0%, 100% {
    opacity: 0.55;
    transform: scale(0.86) rotate(-9deg);
  }
  50% {
    opacity: 1;
    transform: scale(1.08) rotate(9deg);
  }
}

@media (max-width: 980px) {
  .portal-grid {
    width: calc(100% + 24px);
    margin-right: -12px;
    margin-left: -12px;
    justify-content: flex-start;
    overflow-x: auto;
    padding: 4px 12px 18px;
    scroll-snap-type: x mandatory;
    scrollbar-color: #be8e3780 transparent;
  }

  .portal-card {
    scroll-snap-align: center;
  }
}

@media (max-width: 520px) {
  .welcome {
    padding-top: 31px;
  }

  .welcome__message {
    max-width: 340px;
  }

  .family {
    width: min(100% - 10px, 450px);
  }

  .portal-card {
    --portal-size: clamp(136px, 39vw, 178px);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
