@import url('https://fonts.googleapis.com/css2?family=Ubuntu+Mono:wght@400;700&display=swap');

/* Base layout */

body {
  font-family: 'Ubuntu Mono', monospace;
  margin: 0;
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow-x: clip;
  background: #aaa;
}

/* Header and navigation */

.site-header {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: clamp(1rem, 3vw, 2rem);
  padding: clamp(1rem, 3vw, 2rem);
}

.site-nav {
  display: flex;
  align-items: center;
  gap: clamp(1rem, 3vw, 2rem);
  font-size: 0.875rem;
}

.site-nav a,
.home-link {
  color: #444;
  text-decoration: none;
}

.site-nav a:hover,
.site-nav a[aria-current="page"],
.home-link:hover {
  color: #111;
  text-decoration: underline;
  text-underline-offset: 0.3em;
}

.site-nav a:focus-visible,
.home-link:focus-visible {
  outline: 2px solid #333;
  outline-offset: 5px;
}

.icon-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 44px;
  flex-shrink: 0;
  color: #444;
  border-radius: 6px;
}

.icon-link img {
  display: block;
  width: 28px;
  height: 28px;
}

.icon-link:hover {
  color: #111;
}

.icon-link:hover img {
  filter: brightness(0.25);
}

.icon-link:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 4px;
}

/* Hero and shared text effect */

.hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(2rem, 5vw, 4rem);
}

h1 {
  font-size: 15vw;
}

/* The control stays still while only the heading text moves. */
.heading-controls {
  position: relative;
  width: max-content;
}

.motion-toggle {
  position: absolute;
  bottom: 0;
  left: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 44px;
  margin-left: 0.5rem;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  cursor: pointer;
}

.motion-toggle[hidden] {
  display: none;
}

.motion-toggle:hover {
  background: rgb(0 0 0 / 8%);
}

.motion-toggle:focus-visible {
  outline: 2px solid #333;
  outline-offset: 2px;
}

.motion-toggle:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.text-effect {
  display: block;
  position: relative;
  z-index: 0;
  margin: 0;
  font-weight: 700;
  line-height: 1;
  text-transform: uppercase;
  color: #dfdfdf;
  -webkit-text-stroke: 2px #555;
  paint-order: stroke fill;
  /* Eight unblurred layers form the letters' solid, shaded extrusion.
     JavaScript adjusts --depth-x to match the projected shadow angle. */
  text-shadow:
    var(--depth-x, -0.00707em) -0.003em 0 #999,
    calc(var(--depth-x, -0.00707em) * 2) -0.006em 0 #929292,
    calc(var(--depth-x, -0.00707em) * 3) -0.009em 0 #888,
    calc(var(--depth-x, -0.00707em) * 4) -0.012em 0 #808080,
    calc(var(--depth-x, -0.00707em) * 5) -0.015em 0 #777,
    calc(var(--depth-x, -0.00707em) * 6) -0.018em 0 #707070,
    calc(var(--depth-x, -0.00707em) * 7) -0.021em 0 #666,
    calc(var(--depth-x, -0.00707em) * 8) -0.024em 0 #555;
  transform: translate(var(--text-x, 0px), var(--text-y, 0px));
  transition: transform 180ms ease-out, text-shadow 180ms ease-out;
}

.text-effect::before {
  /* A blurred copy of the heading forms the shadow on the ground. */
  content: attr(data-text);
  position: absolute;
  top: 0;
  left: 0;
  z-index: -1;
  color: #000;
  text-shadow: none;
  -webkit-text-stroke: 0;
  -webkit-text-fill-color: #000;
  filter: blur(14px);
  /* Keep the shadow attached near the text baseline. */
  transform-origin: left 85%;
  transform: skewX(var(--shadow-angle, 67deg)) scaleY(var(--shadow-scale, 0.5));
  transition: transform 180ms ease-out;
  -webkit-mask-image: linear-gradient(180deg, transparent 0%, #000 100%);
  mask-image: linear-gradient(180deg, transparent 0%, #000 100%);
  pointer-events: none;
}

/* About and Projects pages */

.content-page {
  align-items: flex-start;
}

.page-content {
  box-sizing: border-box;
  display: grid;
  gap: clamp(3rem, 6vw, 5rem);
  width: 100%;
  max-width: 72rem;
  margin-inline: auto;
  padding: 8rem 1.5rem 3rem;
}

.page-heading {
  text-align: center;
}

.content-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 18rem), 1fr));
  gap: 1.5rem;
  align-items: start;
}

.content-card {
  min-width: 0;
  padding: clamp(1.25rem, 3vw, 2rem);
  border: 1px solid #888;
  border-radius: 0.75rem;
  background: #b5b5b5;
  color: #333;
  line-height: 1.6;
  overflow-wrap: anywhere;
}

.content-card h2 {
  margin: 0 0 0.75rem;
  font-size: 1.25rem;
}

.content-card p {
  margin: 0;
  font-size: 1rem;
  font-weight: 400;
}

.content-card p + p {
  margin-top: 0.75rem;
}

.content-card .project-title {
  margin: 0 0 0.75rem;
  font-size: clamp(1.5rem, 3vw, 2rem);
  line-height: 1.2;
}

.project-link {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  color: inherit;
  text-decoration: none;
}

.project-link img {
  flex-shrink: 0;
  object-fit: contain;
}

.project-link:hover {
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

.project-link:focus-visible {
  outline: 2px solid #333;
  outline-offset: 5px;
}

.page-content h1 {
  font-size: clamp(2.5rem, 10vw, 8rem);
}

.page-content .text-effect {
  width: max-content;
  white-space: nowrap;
  line-height: 1.025;
}

/* Leave room for the blur, then feather the sides and front edge. */
.page-content .text-effect::before {
  left: -28px;
  width: 100%;
  padding-inline: 28px;
  -webkit-mask-image:
    linear-gradient(180deg, transparent 0%, #000 75%, transparent 100%),
    linear-gradient(90deg, transparent, #000 28px, #000 calc(100% - 28px), transparent);
  mask-image:
    linear-gradient(180deg, transparent 0%, #000 75%, transparent 100%),
    linear-gradient(90deg, transparent, #000 28px, #000 calc(100% - 28px), transparent);
  -webkit-mask-composite: source-in;
  mask-composite: intersect;
}

.page-description,
.home-link {
  color: #333;
}

/* Accessibility */

@media (prefers-reduced-motion: reduce) {
  .text-effect,
  .text-effect::before {
    transition: none;
  }
}
