/* Fonts */
@font-face {
  font-family: "Montreal";
  src: url("/fonts/montreal-regular.woff2") format("woff2");
  font-display: swap;
  font-style: normal;
  font-weight: 400;
}

@font-face {
  font-family: "Montreal";
  src: url("/fonts/montreal-medium.woff2") format("woff2");
  font-display: swap;
  font-style: normal;
  font-weight: 500;
}

@font-face {
  font-family: "Montreal";
  src: url("/fonts/montreal-bold.woff2") format("woff2");
  font-display: swap;
  font-style: normal;
  font-weight: 700;
}

@font-face {
  font-family: "Editorial";
  src: url("/fonts/editorial-regular.woff2") format("woff2");
  font-display: swap;
  font-style: normal;
  font-weight: 400;
}

@font-face {
  font-family: "Editorial";
  src: url("/fonts/editorial-italic.woff2") format("woff2");
  font-display: swap;
  font-style: italic;
  font-weight: 400;
}

@font-face {
  font-family: "JetBrains Mono Clone";
  src: url("/fonts/jetbrains-mono.woff2") format("woff2");
  font-display: swap;
  font-style: normal;
  font-weight: 400;
}

/* Tokens */
:root {
  --background: #0c0c0c;
  --foreground: #ffffff;
  --color-primary: #ffffff;
  --color-secondary: #aaaaaa;
  --color-tertiary: #262626;
  --color-green: #22c55e;
  --font-montreal: "Montreal", Arial, sans-serif;
  --font-editorial: "Editorial", "Times New Roman", serif;
  --font-mono: "JetBrains Mono Clone", Consolas, monospace;
  --max-width-2xl: 96rem;
  --max-width-md: 48rem;
}

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

html {
  height: 100%;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

html,
body {
  background: var(--background);
  color: var(--foreground);
  color-scheme: dark;
  overscroll-behavior-y: none;
}

body {
  margin: 0;
  min-height: 100%;
  display: flex;
  flex-direction: column;
  font-family: var(--font-montreal);
}

img {
  user-select: none;
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  color: inherit;
  text-decoration: none;
}

::selection {
  background: rgba(255, 255, 255, 0.18);
}

.font-editorial {
  font-family: var(--font-editorial);
}

.text-primary {
  color: var(--color-primary);
}

.text-secondary {
  color: var(--color-secondary);
}

.text-muted {
  color: rgba(170, 170, 170, 0.5);
}

/* Layout — Home */
.page-home {
  position: relative;
  z-index: 0;
  display: flex;
  min-height: 100vh;
  width: 100%;
  flex-direction: column;
  align-items: center;
  gap: 5rem;
}

.page-home__main {
  display: flex;
  width: 100%;
  max-width: var(--max-width-2xl);
  flex: 1;
  flex-direction: column;
  padding-left: 1rem;
  padding-right: 1rem;
}

.hero {
  margin-top: 2rem;
  display: grid;
  align-items: start;
  gap: 2rem;
}

.hero__header {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  color: var(--color-primary);
}

.hero__name {
  font-family: var(--font-editorial);
  font-size: 1.5rem;
  font-style: italic;
  outline: none;
  transition: color 150ms ease;
}

.hero__name:focus {
  color: var(--color-secondary);
}

.hero__socials {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--color-secondary);
}

.social-link {
  display: inline-flex;
  border-radius: 0.25rem;
  outline: none;
  transition: color 150ms ease;
}

.social-link:hover,
.social-link:focus {
  color: var(--color-primary);
}

.social-link:focus-visible {
  box-shadow: 0 0 0 1px var(--color-primary);
}

.icon {
  width: 1.25rem;
  height: 1.25rem;
}

.hero__bio {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  font-size: 1.125rem;
  line-height: 1.25;
  color: var(--color-primary);
}

.hero__bio p {
  margin: 0;
}

/* Work grid */
.work {
  margin-top: 3rem;
  display: grid;
  gap: 1rem;
  color: var(--color-primary);
}

.project-card {
  position: relative;
  z-index: 0;
  margin-top: 2rem;
  font-size: 1rem;
  outline: none;
  display: block;
}

.project-card__media {
  position: relative;
  z-index: -1;
  aspect-ratio: 16 / 9;
  width: 100%;
  background-color: var(--color-tertiary);
  background-size: cover;
  background-position: center;
  overflow: hidden;
}

.project-card__image {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.project-card__glow {
  position: absolute;
  left: 0;
  top: 0;
  z-index: -1;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  filter: blur(48px) saturate(2);
  transition: opacity 300ms ease;
}

.project-card__title {
  margin-top: 1rem;
  font-size: 1.125rem;
  line-height: 1.25;
}

.project-card__title span:first-child {
  text-underline-offset: 2px;
}

.project-card__summary {
  color: var(--color-secondary);
}

@media (min-width: 640px) {
  .hero {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
  }

  .hero__header {
    height: 100%;
    flex-direction: column;
  }

  .project-card:hover .project-card__glow,
  .project-card:focus-visible .project-card__glow {
    opacity: 0.75;
  }

  .project-card:hover .project-card__title span:first-child,
  .project-card:focus-visible .project-card__title span:first-child {
    text-decoration: underline;
  }
}

@media (min-width: 768px) {
  .work {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Footer */
.site-footer {
  display: flex;
  width: 100%;
  justify-content: center;
  border-top: 1px solid var(--color-tertiary);
  color: var(--color-secondary);
}

.site-footer__inner {
  display: flex;
  width: 100%;
  max-width: var(--max-width-2xl);
  align-items: center;
  justify-content: space-between;
  padding: 1rem;
}

.site-footer__name {
  font-family: var(--font-editorial);
  font-style: italic;
  outline: none;
  transition: color 150ms ease;
}

.site-footer__name:hover,
.site-footer__name:focus {
  color: var(--color-primary);
}

.site-footer__name:focus-visible {
  text-decoration: underline;
}

.site-footer__status {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.status-dot {
  position: relative;
  display: flex;
  width: 1.25rem;
  height: 1.25rem;
  align-items: center;
  justify-content: center;
  padding: 0.25rem;
}

.status-dot__ping {
  position: absolute;
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 9999px;
  background-color: var(--color-green);
  opacity: 0.75;
  animation: ping 1s cubic-bezier(0, 0, 0.2, 1) infinite;
}

.status-dot__core {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 9999px;
  background-color: var(--color-green);
}

@keyframes ping {
  75%,
  100% {
    transform: scale(2);
    opacity: 0;
  }
}

/* Layout — Project page */
.page-project {
  display: flex;
  min-height: 100vh;
  width: 100%;
  flex-direction: column;
}

.page-project__wrap {
  display: flex;
  width: 100%;
  flex: 1;
  flex-direction: column;
  align-items: center;
}

.page-project__main {
  display: flex;
  width: 100%;
  max-width: var(--max-width-md);
  flex-direction: column;
  padding-left: 1rem;
  padding-right: 1rem;
  padding-bottom: 9rem;
}

.project-nav {
  display: flex;
  justify-content: space-between;
  padding-top: 1.5rem;
  padding-bottom: 1.5rem;
}

.project-nav__link {
  display: flex;
  align-items: center;
  color: var(--color-secondary);
  outline: none;
  transition: color 150ms ease;
}

.project-nav__link:hover,
.project-nav__link:focus {
  color: var(--color-primary);
}

.project-nav__link .icon {
  width: 1rem;
  height: 1rem;
}

.project-nav__link--back .icon {
  margin-right: 0.5rem;
}

.project-nav__link--external .icon {
  margin-left: 0.5rem;
}

.project-header {
  position: relative;
  z-index: 10;
}

.project-header__title {
  margin: 0;
  text-align: center;
  font-family: var(--font-editorial);
  font-size: 1.5rem;
  font-style: italic;
  font-weight: 400;
  color: var(--color-primary);
}

.project-header__meta {
  margin: 0.25rem 0 0;
  text-align: center;
  font-size: 1.125rem;
  color: var(--color-secondary);
}

.project-hero {
  position: relative;
  z-index: -1;
  margin-top: 2rem;
  margin-bottom: 2rem;
  aspect-ratio: 16 / 9;
  width: 100%;
  background-color: var(--color-tertiary);
  background-size: cover;
  background-position: center;
  overflow: hidden;
}

.project-hero__image {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.project-hero__glow {
  position: absolute;
  left: 0;
  top: 0;
  z-index: -1;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: blur(48px) saturate(2);
}

.project-details {
  position: relative;
  z-index: 10;
  display: flex;
  flex-direction: column-reverse;
  gap: 1rem;
}

.project-details__column {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.detail-group__title {
  margin: 0;
  font-size: 1rem;
  font-weight: 400;
  color: var(--color-primary);
}

.detail-group__items {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.25rem;
  margin-top: 0.5rem;
}

.detail-group__item {
  line-height: 1.375;
  color: var(--color-secondary);
}

.detail-group__item a {
  outline: none;
  transition: color 150ms ease;
}

.detail-group__item a:hover,
.detail-group__item a:focus {
  color: var(--color-primary);
}

@media (min-width: 640px) {
  .page-project__wrap {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .project-details {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .project-header__title {
    font-size: 1.875rem;
  }
}

/* Article content */
.article {
  position: relative;
  z-index: 0;
  margin-top: 2rem;
  max-width: none;
  line-height: normal;
  color: var(--color-primary);
}

.article p {
  margin: 1.25em 0;
  color: var(--color-secondary);
  line-height: 1.75;
}

.article strong {
  color: var(--color-primary);
  font-weight: 400;
}

.article a {
  color: var(--color-secondary);
  font-weight: 400;
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: color 150ms ease;
}

.article a:hover,
.article a:focus {
  color: var(--color-primary);
}

.article h1,
.article h2,
.article h3 {
  color: var(--color-primary);
  font-weight: 400;
  line-height: 1.35;
  scroll-margin-top: 2.5rem;
}

.article h1 {
  margin-top: 4rem;
  margin-bottom: 1rem;
  font-size: 1.5rem;
}

.article h2 {
  margin-top: 2rem;
  margin-bottom: 1rem;
  font-size: 1.25rem;
}

.article h3 {
  margin-top: 1.6rem;
  margin-bottom: 0.6rem;
  font-size: 1.125rem;
}

.article ul,
.article ol {
  margin: 1.25em 0;
  padding-left: 1.625em;
  color: var(--color-secondary);
  line-height: 1.75;
}

.article ul {
  list-style: disc;
}

.article ol {
  list-style: decimal;
}

.article li {
  margin: 0.5em 0;
  padding-left: 0.375em;
}

.article pre {
  margin: 1.75em 0;
  overflow-x: auto;
  border: 1px solid var(--color-tertiary);
  background: rgba(38, 38, 38, 0.5);
  padding: 0.875rem 1rem;
  color: var(--color-secondary);
  font-family: var(--font-mono);
  font-size: 0.875rem;
  line-height: 1.7;
}

.article code {
  font-family: var(--font-mono);
}

/* Article blocks */
.figure {
  margin: 2rem 0;
}

.figure--flush {
  margin: 0;
}

.figure__frame {
  position: relative;
  width: 100%;
  overflow: hidden;
  background-color: var(--color-tertiary);
  background-size: cover;
  background-position: center;
}

.figure__frame--video {
  aspect-ratio: 16 / 9;
}

.figure__frame--square {
  aspect-ratio: 1 / 1;
}

.figure__frame--portrait {
  aspect-ratio: 9 / 16;
}

.figure__frame img {
  position: absolute;
  inset: 0;
  min-width: 100%;
  min-height: 100%;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.image-grid {
  margin: 2rem 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.feature-grid {
  margin: 2rem 0;
  display: grid;
  gap: 2.5rem 1rem;
}

.feature-grid__title {
  margin: 0;
  font-size: 1rem;
  font-weight: 400;
  color: var(--color-primary);
}

.feature-grid__desc {
  margin: 0.5rem 0 0;
  line-height: 1.375;
  color: var(--color-secondary);
}

@media (min-width: 480px) {
  .feature-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 640px) {
  .image-grid {
    gap: 1rem;
  }
}

/* Table of contents */
.toc {
  position: fixed;
  left: 0;
  top: 13rem;
  z-index: 50;
  display: none;
  flex-direction: column;
  font-size: 0.75rem;
  color: var(--color-secondary);
  opacity: 0.6;
  transition: opacity 500ms ease;
}

.toc:hover {
  opacity: 1;
}

.toc__backdrop {
  pointer-events: none;
  position: absolute;
  top: -4rem;
  right: -2rem;
  bottom: -4rem;
  left: -1rem;
  z-index: -1;
  background: rgba(12, 12, 12, 0.4);
  opacity: 0;
  backdrop-filter: blur(2px);
  transition: opacity 300ms ease;
  mask-image:
    linear-gradient(to bottom, transparent, black 80px, black calc(100% - 80px), transparent),
    linear-gradient(to right, transparent, black 48px, black calc(100% - 48px), transparent);
  mask-composite: intersect;
  -webkit-mask-composite: source-in;
}

.toc:hover .toc__backdrop {
  opacity: 1;
}

.toc__link {
  position: relative;
  display: flex;
  height: 1rem;
  align-items: center;
  gap: 0.5rem;
  outline: none;
}

.toc__line {
  height: 1px;
  transition: background-color 150ms ease;
}

.toc__line--parent {
  width: 1rem;
}

.toc__line--child {
  width: 2rem;
}

.toc__line.is-active {
  background-color: var(--color-primary);
}

.toc__line:not(.is-active) {
  background-color: rgba(170, 170, 170, 0.5);
}

.toc__label {
  position: absolute;
  white-space: nowrap;
  transition: opacity 300ms ease;
}

.toc__label--parent {
  left: 1.5rem;
}

.toc__label--child {
  left: 2.5rem;
}

.toc__label:not(.is-active) {
  color: var(--color-secondary);
  opacity: 0;
}

.toc:hover .toc__label:not(.is-active) {
  opacity: 1;
}

.toc__label.is-active {
  color: var(--color-primary);
  opacity: 1;
}

.toc__link:hover .toc__label,
.toc__link:focus-visible .toc__label {
  color: var(--color-primary);
}

@media (min-width: 768px) {
  .toc {
    display: flex;
  }
}

@media (min-width: 1024px) {
  .toc {
    opacity: 1;
  }
}

/* Page transitions */
html {
  background: var(--background);
}

body {
  opacity: 0;
}

body.is-ready {
  opacity: 1;
  transition: opacity 0.4s ease;
}

body.is-navigating {
  overflow: hidden;
}

#page-transition,
.page-transition {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: var(--background);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.38s ease;
}

#page-transition.is-active,
.page-transition.is-active {
  opacity: 1;
  pointer-events: auto;
}

#app.is-exiting {
  opacity: 0;
  transform: translateY(10px) scale(0.995);
  transition:
    opacity 0.38s ease,
    transform 0.38s ease;
}

#app.is-entering {
  animation: page-enter 0.52s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes page-enter {
  from {
    opacity: 0;
    transform: translateY(18px);
  }

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

.transition-clone {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 150;
  margin: 0;
  object-fit: cover;
  pointer-events: none;
  transition:
    width 0.48s cubic-bezier(0.4, 0, 0.2, 1),
    height 0.48s cubic-bezier(0.4, 0, 0.2, 1),
    transform 0.48s cubic-bezier(0.4, 0, 0.2, 1);
}

@media (prefers-reduced-motion: reduce) {
  body,
  body.is-ready,
  #app.is-exiting,
  #app.is-entering,
  #page-transition,
  .page-transition,
  .transition-clone {
    animation: none !important;
    transition: none !important;
    transform: none !important;
    opacity: 1 !important;
  }
}
