/* The home page: hero, three pinned showcases, and Contact. The components style
   themselves; this file sets the shared gutter, the seams between sections, and the
   Contact section. Tokens only. */

:root {
  --home-gutter: max(1rem, 5.5vw, env(safe-area-inset-left, 0px));
  --home-ease: cubic-bezier(0.16, 1, 0.3, 1);
}

@media (max-aspect-ratio: 9/10) {
  :root {
    --home-gutter: max(1rem, env(safe-area-inset-left, 0px));
    --home-headline-stacked: clamp(2.2rem, 0.9rem + 6vw, 3.6rem);
  }
}

.home-page {
  background: var(--ds-color-bg);
  overflow-x: clip;
}

/* ---------- Hero ---------- */

.hero__toggle {
  position: absolute;
  z-index: 2;
  top: max(var(--ds-space-4), env(safe-area-inset-top, 0px));
  right: var(--home-gutter);
  animation: home-fade 1.4s var(--home-ease) 1.5s both;
}

@keyframes home-fade {
  from {
    opacity: 0;
  }
}

/* Links row: CV (with a small PDF tag), Travels and Family as a fine-line glyph and a
   label; GitHub and LinkedIn as their logo marks. */
.hero__links {
  align-items: center;
}

/* Glyphs: drawn on a 24px grid (inside a 3px margin, so 1.6rem matches the optical size
   of the 1.35rem logo marks) with a 1.35px stroke that stays 1.35px at any size, in
   the ink color of the logo marks; they turn gold with their link, like the marks. */
.glyph {
  flex: none;
  width: 1.6rem;
  height: 1.6rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.35;
  stroke-linecap: round;
  stroke-linejoin: round;
  overflow: visible;
}

.glyph * {
  vector-effect: non-scaling-stroke;
}

.glyph .glyph__fill {
  fill: currentColor;
  stroke: none;
}

.glyph-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.glyph-link .glyph {
  color: var(--ds-color-ink);
  transition: color 0.4s var(--home-ease), transform 0.6s var(--home-ease);
}

.glyph-link:hover .glyph,
.glyph-link:focus-visible .glyph {
  color: var(--ds-color-gold-text);
  transform: translateY(-1px);
}

.hero__cv {
  display: inline-flex;
  align-items: center;
}

.hero__pdf {
  display: inline-flex;
  align-items: center;
  gap: 0.25em;
  margin-left: 0.6rem;
  padding: 0.15em 0.45em 0.15em 0.3em;
  border: var(--ds-rule-hairline) solid var(--ds-color-gold);
  font-family: var(--ds-font-mono);
  font-style: normal;
  font-size: var(--ds-text-xs);
  line-height: 1.2;
  letter-spacing: var(--ds-tracking-tag);
  color: var(--ds-color-gold-text);
  text-decoration: none;
  transition: background-color 0.3s var(--home-ease), color 0.3s var(--home-ease);
}

.hero__pdf .glyph--tag {
  width: 1.15em;
  height: 1.15em;
  stroke-width: 1.2;
}

.hero__pdf:hover,
.hero__pdf:focus-visible {
  background: var(--ds-color-gold);
  color: var(--ds-color-bg);
}

.icon-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  margin: -0.5rem;
  color: var(--ds-color-ink);
  transition: color 0.4s var(--home-ease), transform 0.6s var(--home-ease);
}

.icon-link__mark {
  width: 1.35rem;
  height: 1.35rem;
  fill: currentColor;
}

.icon-link:hover,
.icon-link:focus-visible {
  color: var(--ds-color-gold-text);
  transform: translateY(-1px);
}

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

/* ---------- Showcases and seams ---------- */

/* While a showcase scrolls in, it comes up from a dim; while it scrolls away it drifts a
   little ahead of the page and fades, so the next section takes over cleanly. home.js
   sets --enter and --exit (0..1) on the stage. */
.showcase .pin-stage > * {
  opacity: calc((0.25 + 0.75 * var(--enter, 1)) * (1 - 0.9 * var(--exit, 0)));
  transform: translate3d(0, calc(var(--exit, 0) * -10svh), 0);
}

/* One headline size for all three showcases, and one height for their copy (the field
   title, then the beat's name and sentence), so the titles line up from field to field. */
:root {
  --home-copy-top: clamp(4.5rem, 16svh, 10rem);
  --home-copy-shift: none;
  --home-headline: clamp(2.3rem, 0.8rem + 3.4vw, 4.6rem);
}

.showcase:not(.is-mounted) .pin-stage {
  background: var(--ds-color-bg);
}

/* Between sections: an engraved rule drawn out from a small gold lozenge. */
.seam {
  position: relative;
  height: clamp(4.5rem, 14svh, 9rem);
  margin-inline: var(--home-gutter);
}

.seam::before,
.seam::after {
  content: "";
  position: absolute;
  top: 50%;
}

.seam::before {
  left: 0;
  right: 0;
  height: 3px;
  margin-top: -1px;
  border-block: 1px solid var(--ds-color-gold);
  opacity: 0.55;
  transform: scaleX(var(--draw, 1));
  transition: transform 1.6s var(--home-ease);
}

.seam::after {
  left: 50%;
  width: 7px;
  height: 7px;
  margin: -3px 0 0 -3.5px;
  background: var(--ds-color-bg);
  border: 1px solid var(--ds-color-gold);
  transform: rotate(45deg) scale(var(--draw, 1));
  transition: transform 1.2s var(--home-ease) 0.2s;
}

.js .seam:not(.is-in) {
  --draw: 0;
}

/* ---------- Lower sections ---------- */

.more {
  max-width: 84rem;
  margin-inline: var(--home-gutter);
  padding-bottom: clamp(var(--ds-space-8), 12svh, var(--ds-space-10, 8rem));
}

.more__row {
  display: grid;
  grid-template-columns: 11rem minmax(0, 1fr);
  gap: var(--ds-space-4) var(--ds-space-6);
  padding-block: var(--ds-space-7);
  border-top: var(--ds-rule-hairline) solid var(--ds-color-rule);
}

.more__row:first-child {
  border-top: 0;
  padding-top: var(--ds-space-5);
}

.more__label {
  margin: 0;
  padding-top: 0.3em;
}

.more__contact {
  display: flex;
  flex-direction: column;
  gap: var(--ds-space-5);
}

.more__email {
  display: inline-flex;
  align-items: center;
  gap: 0.3em;
  width: fit-content;
  max-width: 100%;
  font-family: var(--ds-font-display);
  font-size: clamp(1.7rem, 0.8rem + 3.4vw, 3.6rem);
  line-height: 1.1;
  letter-spacing: var(--ds-tracking-display);
  color: var(--ds-color-ink);
  text-decoration: none;
  transition: color 0.4s var(--home-ease);
}

.more__email-glyph {
  width: 0.62em;
  height: 0.62em;
  stroke-width: 1.5;
  transition: color 0.4s var(--home-ease);
}

.more__email-text {
  min-width: 0;
  overflow-wrap: anywhere;
  background: linear-gradient(var(--ds-color-gold), var(--ds-color-gold)) 0 100% / 100% 1px no-repeat;
  padding-bottom: 0.08em;
  transition: background-size 0.8s var(--home-ease);
}

.more__email:hover {
  color: var(--ds-color-accent);
}

.more__email:hover .more__email-glyph,
.more__email:focus-visible .more__email-glyph {
  color: var(--ds-color-gold-text);
}

.more__email:hover .more__email-text {
  background-size: 0 1px;
  background-position: 100% 100%;
}

.more__links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--ds-space-3) var(--ds-space-7);
  font-family: var(--ds-font-text);
  font-style: italic;
  font-size: var(--ds-text-lg);
}

.more__links .theme-toggle {
  margin-left: auto;
  font-style: normal;
}

/* Rows rise in once as they enter. */
.js .reveal {
  opacity: 0;
  transform: translate3d(0, 1.5rem, 0);
  transition: opacity 1.1s var(--home-ease), transform 1.4s var(--home-ease);
}

.js .reveal.is-in {
  opacity: 1;
  transform: none;
}

@media (max-width: 720px) {
  .more__row {
    grid-template-columns: minmax(0, 1fr);
    padding-block: var(--ds-space-6);
  }

  .more__links .theme-toggle {
    margin-left: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .hero__toggle {
    animation: none;
  }

  .showcase .pin-stage > * {
    transform: none;
  }

  .js .reveal,
  .js .seam:not(.is-in) {
    --draw: 1;
    opacity: 1;
    transform: none;
    transition: none;
  }

  .seam::before,
  .seam::after {
    transition: none;
  }

  .glyph-link:hover .glyph,
  .glyph-link:focus-visible .glyph {
    transform: none;
  }
}
