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

:root {
  color-scheme: light dark;

  --bg: #f4f0ea;
  --text: #1a1814;
  --text-muted: #5c564e;
  --accent: #2d4a3e;
  --curve-color: #3d6b8c;

  --font-serif: "Instrument Serif", Georgia, "Times New Roman", serif;
  --font-sans: "DM Sans", system-ui, sans-serif;

  --space-xs: clamp(0.5rem, 1.5vw, 0.75rem);
  --space-sm: clamp(0.75rem, 2vw, 1rem);
  --space-md: clamp(1rem, 3vw, 1.5rem);
  --space-lg: clamp(1.25rem, 4vw, 2rem);
  --space-xl: clamp(1.5rem, 5vw, 2.5rem);

  --name-size: clamp(2rem, 6vw, 3.5rem);
  --body-size: clamp(0.8125rem, 2vw, 1rem);
  --service-size: clamp(0.75rem, 1.8vw, 0.9375rem);
}

:root[data-theme="light"] {
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #141318;
    --text: #edeae4;
    --text-muted: #a39e96;
    --accent: #8fbfb0;
    --curve-color: #5a9fd4;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #141318;
  --text: #edeae4;
  --text-muted: #a39e96;
  --accent: #8fbfb0;
  --curve-color: #5a9fd4;
}

html {
  height: 100%;
}

body {
  margin: 0;
  min-height: 100%;
  height: 100dvh;
  overflow: hidden;
  font-family: var(--font-sans);
  font-size: var(--body-size);
  line-height: 1.55;
  color: var(--text);
  background-color: var(--bg);
  -webkit-font-smoothing: antialiased;
}

.page {
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(3rem, 14vw, 5.5rem) minmax(0, 1fr);
  align-items: center;
  height: 100dvh;
  max-height: 100dvh;
  padding: var(--space-lg) clamp(1rem, 4vw, 3rem);
  gap: clamp(0.5rem, 2vw, 1.25rem);
}

.intro {
  grid-column: 1;
  justify-self: end;
  text-align: right;
  max-width: 22rem;
  padding-right: var(--space-xs);
}

.eyebrow {
  margin: 0 0 var(--space-xs);
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.name {
  margin: 0 0 var(--space-sm);
  font-family: var(--font-serif);
  font-size: var(--name-size);
  font-weight: 400;
  line-height: 1.05;
  letter-spacing: -0.02em;
  white-space: nowrap;
}

.divider {
  grid-column: 2;
  grid-row: 1;
  align-self: center;
  width: 100%;
  height: min(78dvh, 100%);
  min-height: 12rem;
}

.divider__svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.divider__ribbon {
  fill: var(--curve-color);
  opacity: 0.9;
}

.details {
  grid-column: 3;
  align-self: center;
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  max-width: 20rem;
  padding-left: var(--space-xs);
}

.services__list {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: var(--service-size);
  color: var(--text);
}

.contact {
  font-style: normal;
}

.contact__link {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
  font-size: var(--service-size);
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s ease;
  word-break: break-all;
}

.contact__link--hero {
  display: inline-block;
  color: var(--curve-color);
  transition: color 0.2s ease, border-color 0.2s ease;
  word-break: normal;
  overflow-wrap: normal;
  white-space: nowrap;
}

.contact__link:hover,
.contact__link:focus-visible {
  border-bottom-color: currentColor;
  outline: none;
}

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

@media (min-width: 640px) {
  .intro {
    max-width: 26rem;
  }

  .details {
    max-width: 22rem;
  }
}

/* Phone: name above, vertical ribbon centered, services below */
@media (max-width: 639px) {
  :root {
    --name-size: clamp(2.75rem, 12vw, 3.5rem);
    --service-size: clamp(1.0625rem, 4vw, 1.2rem);
    --body-size: clamp(0.9375rem, 3.4vw, 1.0625rem);
  }

  body {
    background-image:
      radial-gradient(ellipse 120% 55% at 50% -5%, color-mix(in srgb, var(--curve-color) 14%, transparent), transparent 68%),
      radial-gradient(ellipse 100% 45% at 50% 105%, color-mix(in srgb, var(--curve-color) 9%, transparent), transparent 65%);
  }

  .page {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    padding:
      max(3.25rem, calc(env(safe-area-inset-top) + 2.25rem))
      clamp(1.25rem, 6vw, 1.75rem)
      max(3.5rem, calc(env(safe-area-inset-bottom) + 2.5rem));
    gap: clamp(1.1rem, 3.5dvh, 1.75rem);
  }

  .intro {
    grid-column: unset;
    justify-self: unset;
    align-self: center;
    flex: 0 0 auto;
    text-align: center;
    max-width: 22rem;
    width: 100%;
    padding: 0;
  }

  .eyebrow {
    margin-bottom: 0.7rem;
    font-size: 0.6875rem;
    letter-spacing: 0.16em;
  }

  .name {
    margin-bottom: 0.85rem;
    white-space: normal;
    line-height: 1.02;
  }

  .contact__link--hero {
    font-size: 0.9375rem;
    letter-spacing: 0.01em;
    white-space: normal;
    overflow-wrap: anywhere;
    padding-block: 0.15rem;
  }

  .divider {
    grid-column: unset;
    grid-row: unset;
    align-self: center;
    width: clamp(2.75rem, 16vw, 3.75rem);
    height: clamp(9rem, 28dvh, 14rem);
    min-height: 0;
    flex: 0 0 auto;
    margin-block: 0;
  }

  .details {
    grid-column: unset;
    justify-self: unset;
    align-self: center;
    align-items: center;
    flex: 0 0 auto;
    max-width: 22rem;
    width: 100%;
    padding: 0;
    gap: 0;
  }

  .services__list {
    align-items: center;
    text-align: center;
    gap: clamp(0.75rem, 2.2dvh, 1.05rem);
    letter-spacing: 0.015em;
  }

  .intro,
  .divider,
  .details {
    animation: rise-in 0.7s cubic-bezier(0.22, 1, 0.36, 1) both;
  }

  .divider {
    animation-delay: 0.1s;
  }

  .details {
    animation-delay: 0.2s;
  }
}

@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(0.7rem);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 639px) and (prefers-reduced-motion: reduce) {
  .intro,
  .divider,
  .details {
    animation: none;
  }
}

@media (max-height: 520px) {
  .page {
    padding-block: var(--space-sm);
  }

  .divider {
    height: min(88dvh, 100%);
    min-height: 8rem;
  }

  .name {
    margin-bottom: var(--space-xs);
  }
}

@media (max-width: 639px) and (max-height: 700px) {
  :root {
    --name-size: clamp(2.35rem, 11vw, 2.95rem);
    --service-size: clamp(0.9375rem, 3.6vw, 1.0625rem);
  }

  .page {
    padding-block: max(2rem, calc(env(safe-area-inset-top) + 1.35rem)) max(2.15rem, calc(env(safe-area-inset-bottom) + 1.5rem));
    gap: clamp(0.75rem, 2.5dvh, 1.15rem);
  }

  .intro {
    padding-top: 0;
  }

  .eyebrow {
    margin-bottom: 0.45rem;
  }

  .name {
    margin-bottom: 0.55rem;
  }

  .divider {
    height: clamp(6.5rem, 22dvh, 10rem);
  }

  .details {
    padding-bottom: 0;
  }

  .services__list {
    gap: 0.55rem;
  }
}

@media (max-width: 639px) and (max-height: 520px) {
  .page {
    padding-block: max(0.85rem, env(safe-area-inset-top)) max(1rem, env(safe-area-inset-bottom));
    gap: 0.55rem;
  }

  .divider {
    width: clamp(2rem, 12vw, 2.75rem);
    height: clamp(4.5rem, 16dvh, 6.5rem);
    min-height: 0;
  }
}
