/* ozzy.cat */

@font-face {
  font-family: "Cormorant Garamond";
  src: url("../fonts/cormorant-garamond-latin.woff2") format("woff2");
  font-weight: 300 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --ink: #f2ece0;                                  /* warm ivory rather than stark white */
  --ease-calm: cubic-bezier(0.22, 0.61, 0.36, 1);  /* soft ease-out: glides up, settles gently */
  --rise-delay: 0.3s;                              /* the title's rise; the socials wait for it */
  --rise-time: 4.2s;
}

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

html,
body {
  height: 100%;
  margin: 0;
  background: #000;
}

body {
  overflow: hidden;
  color: var(--ink);
  font-family: "Cormorant Garamond", "EB Garamond", Garamond, "Times New Roman", serif;
}

/* The night sky, drawn by js/sky.js, fades in behind everything. */
#sky {
  position: fixed;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  animation: appear 2.4s ease-out both;
}

.stage {
  position: fixed;
  inset: 0;
  display: grid;
  grid-template-rows: 1fr auto 1fr; /* the title sits in the exact middle row */
  justify-items: center;
  overflow: hidden;                 /* the title emerges from the bottom edge */
}

.title {
  grid-row: 2;
  position: relative;
  top: -0.125em;        /* centres the lowercase letters themselves, not the line box */
  margin: 0;
  padding-left: 0.04em; /* balances the trailing letter-spacing */
  font-size: clamp(3.75rem, 15vw, 9.5rem);
  font-weight: 300;
  line-height: 1;
  letter-spacing: 0.04em;
  text-shadow: 0 0 0.25em rgba(255, 240, 215, 0.16);
}

/* Socials: quiet round buttons, and a caption line naming whichever one you're on. */
.socials {
  grid-row: 3;
  align-self: start;
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: clamp(1.5rem, 4vh, 2.5rem);
}

.links {
  display: flex;
  gap: 0.9rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.social {
  display: grid;
  place-items: center;
  width: 2.875rem;
  height: 2.875rem;
  padding: 0;
  border: 1px solid rgba(242, 236, 224, 0.2);
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.4);
  color: rgba(242, 236, 224, 0.75);
  font: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition:
    color 0.5s ease,
    border-color 0.5s ease,
    box-shadow 0.5s ease,
    transform 0.5s var(--ease-calm);
}

.social svg {
  width: 1.2rem;
  height: 1.2rem;
  fill: currentColor;
}

/* Only on devices that really hover, so taps on phones don't leave buttons stuck lit. */
@media (hover: hover) {
  .social:hover {
    color: var(--ink);
    border-color: rgba(242, 236, 224, 0.55);
    box-shadow: 0 0 1.25rem rgba(255, 240, 215, 0.12);
    transform: translateY(-2px);
  }
}

.social:focus-visible {
  color: var(--ink);
  border-color: rgba(242, 236, 224, 0.55);
  outline: 1px solid rgba(242, 236, 224, 0.7);
  outline-offset: 4px;
}

.social:active {
  transform: scale(0.95);
  transition-duration: 0.1s;
}

.caption {
  min-height: 1.5em; /* holds the line, so nothing shifts when words appear */
  margin: 0.9rem 0 0;
  font-size: 1.15rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  color: rgba(242, 236, 224, 0.7);
  opacity: 0;
  transform: translateY(-0.25rem);
  transition:
    opacity 0.5s ease,
    transform 0.5s var(--ease-calm);
}

.caption.on {
  opacity: 1;
  transform: none;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/*
 * Intro: the title rises from just below the screen and comes to rest in the
 * centre, then the socials surface one by one.
 */
.js .title {
  opacity: 0;
}

.js .links li {
  visibility: hidden; /* not just transparent: nothing clickable until it appears */
}

.js.ready .title {
  animation:
    rise var(--rise-time) var(--ease-calm) var(--rise-delay) both,
    appear 1.8s ease-out var(--rise-delay) both;
}

.js.ready .links li {
  animation: surface 1.8s var(--ease-calm) calc(var(--rise-delay) + var(--rise-time) + var(--i) * 0.15s) both;
}

@keyframes rise {
  from { transform: translateY(calc(50vh + 75%)); }
  to   { transform: translateY(0); }
}

@keyframes appear {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes surface {
  from { opacity: 0; visibility: hidden; transform: translateY(var(--lift, 0.5rem)); }
  to   { opacity: 1; visibility: visible; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .js.ready .title {
    animation: appear 1.8s ease-out both;
  }

  .js.ready .links li {
    --lift: 0;
    animation-delay: calc(1.2s + var(--i) * 0.15s);
  }
}
