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

:root {
  font-size: 16px;
  --color-text: #b8afaa;
  --color-bg: #000;
  --color-link: #968a84;
  --color-link-hover: #fff;
  --page-padding: 1rem;
  --color-highlight-start: #968a84;
  --color-highlight-end: #968a84;
  --color-highlight-end-alt: #968a84;
}

html,
body {
  /* This was causing subtle overflow on iOS:
     width: 100vw; */
  width: 100%;
  overflow-x: hidden;
}

body {
  margin: 0;
  color: var(--color-text);
  background-color: var(--color-bg);
  font-family: "parabolica", serif;
  line-height: 1;
  font-weight: 300;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background-image: url(../img/noise.png),
    radial-gradient(ellipse at top, #242937, transparent),
    radial-gradient(ellipse at bottom, #171340, transparent);
  background-size: 200px, 100%, 200%;
  background-attachment: fixed;
}

nav {
  padding: 16px;
}

.video-wrapper {
  position: relative;
  width: 100%;
  padding-top: 56.25%; /* 16:9 */
}

.video-wrapper video {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Page Loader */
.js .loading::before,
.js .loading::after {
  content: '';
  position: fixed;
  z-index: 1000;
}

.js .loading::before {
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--color-bg);
}

.js .loading::after {
  top: 50%;
  left: 50%;
  width: 60px;
  height: 60px;
  margin: -30px 0 0 -30px;
  opacity: 0.4;
  background: var(--color-link);
  animation: loaderAnim 0.7s linear infinite alternate forwards;
}

.portfolio-image {
  max-width: 100%;
  height: auto;
}

.portfolio-span {
  max-width: 100%;
  height: auto;
  padding: 8px;
}

/* Neutral base image style */
.portfolio-thumb {
  display: block;
  width: 100%;
  height: auto;
  max-width: none;
  padding: 0;
  vertical-align: middle;
}

/* Case study thumbnails grid */
.portfolio-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr)); /* 3 per row */
  gap: 32px;
  margin-top: 24px;
  max-width: 1200px; /* gives the 3-up layout proper breathing room */
}

/* Each clickable card */
.portfolio-item {
  position: relative;
  display: block;
  cursor: pointer;
  border-radius: 12px;
  overflow: hidden; /* needed for zoom */
  line-height: 0;   /* kill invisible extra height */
}

/* Wrapper just handles overflow + radius */
.portfolio-thumb-wrapper {
  position: relative;
  width: 100%;
  overflow: hidden;
  border-radius: inherit;
}

/* The actual thumbnail image (720x405, full card width) */
.portfolio-grid .portfolio-thumb,
.portfolio-thumb-wrapper .portfolio-thumb {
  display: block;
  width: 100%;
  height: auto;          /* keeps natural 16:9 ratio */
  transform: scale(1);
  transform-origin: center center;
  transition: transform 0.35s ease;
}

/* White stroke overlay on hover – moved to wrapper */
.portfolio-thumb-wrapper::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  border: 2px solid #ffffff;
  opacity: 0;
  pointer-events: none;
  box-sizing: border-box;
  transition: opacity 0.25s ease;
}

/* Hover / focus effects */
.portfolio-item:hover .portfolio-thumb,
.portfolio-item:focus-visible .portfolio-thumb {
  transform: scale(1.05);
}

.portfolio-item:hover .portfolio-thumb-wrapper::after,
.portfolio-item:focus-visible .portfolio-thumb-wrapper::after {
  opacity: 1;
}

.portfolio-item:focus-visible {
  outline: none;
}

/* Mobile: stack to one column */
@media (max-width: 720px) {
  .portfolio-grid {
    grid-template-columns: 1fr;
  }
}

@keyframes loaderAnim {
  to {
    opacity: 1;
    transform: scale3d(0.7, 0.7, 1);
  }
}

a {
  text-decoration: underline;
  color: var(--color-link);
  outline: none;
  cursor: pointer;
}

a:hover {
  text-decoration: none;
  color: var(--color-link-hover);
  outline: none;
}

/* Better focus styles */
a:focus {
  outline: none;
}

a:focus-visible {
  outline: 2px solid red;
}

.unbutton {
  background: none;
  border: 0;
  padding: 0;
  margin: 0;
  font: inherit;
  cursor: pointer;
}

.unbutton:focus {
  outline: none;
}

main {
  padding: var(--page-padding);
  position: relative;
  height: 100%;
  /* This was clipping the text on the right:
     overflow: hidden; */
  overflow: visible;
}

.frame {
  opacity: 0.6;
  font-size: 12px;
  position: relative;
  display: grid;
  width: 100%;
  grid-row-gap: 1rem;
  grid-column-gap: 2rem;
  pointer-events: none;
  justify-items: start;
  text-transform: uppercase;
  font-weight: 400;
}

.frame--header {
  grid-template-columns: 100%;
  grid-template-areas: 'title' 'back' 'archive' 'github' 'tags' 'sponsor';
}

.frame--footer {
  margin-top: 40vh;
  grid-template-columns: auto auto;
  justify-content: space-between;
}

.frame #cdawrap {
  justify-self: start;
}

.frame a {
  pointer-events: auto;
}

.frame__title {
  grid-area: title;
  font-size: inherit;
  font-weight: 400;
  margin: 0;
}

.frame__back {
  grid-area: back;
  justify-self: start;
}

.frame__archive {
  grid-area: archive;
  justify-self: start;
}

.frame__github {
  grid-area: github;
}

.intro {
  display: grid;
  min-height: 50vh;
  margin-bottom: 80vh;
}

.intro h2 {
  font-size: clamp(2rem, 6vw, 8rem);
  line-height: 0.8;
  margin: 0;
  align-self: end;
  text-transform: uppercase;
  font-family: "the-seasons", serif;
  font-weight: 300;
}

.intro h2 > span {
  animation: shine 2s linear forwards;
}

@keyframes shine {
  from {
    filter: brightness(60%) blur(6px);
  }
  to {
    filter: brightness(150%) blur(0px);
  }
}

.content {
  display: grid;
  min-height: 100vh;
  font-size: clamp(2rem,7vw,3.25rem);
  line-height: 1.2;
  letter-spacing: -0.0225em;
}

.content__inner {
  justify-self: start;
  margin-bottom: 60vh;
}

.content__inner p {
  margin: 0;
  max-width: 900px;
  text-wrap: balance;
}

.hx {
  background: none;
  color: var(--color-highlight-start);
  display: inline-block;
  position: relative;
  white-space: nowrap;
}

/* ... rest of your hx / animation / media-query styles ... */

@media screen and (min-width: 53em) {
  body {
    --page-padding: 2rem 3rem;
  }
  .frame--header {
    grid-template-columns: auto auto auto auto 1fr;
    grid-template-areas: 'title back archive github tags sponsor';
  }
  .frame #cdawrap {
    justify-self: end;
  }
  .intro {
    height: calc(100vh - 6rem);
  }
}
