@import url("https://fonts.googleapis.com/css2?family=Manrope:wght@300;400;500;600;700&family=Space+Grotesk:wght@300;400;500;600;700&display=swap");

/* Root */

:root {
  --bg-primary: #000000;
  --bg-secondary: #0a0a0a;
  --bg-tertiary: #111111;
  --surface: #161616;

  --text-primary: #ffffff;
  --text-secondary: #b3b3b3;
  --text-muted: #7a7a7a;

  --border: #3d3c3c;
  --border-light: #474747;

  --accent: #ffffff;
  --accent-hover: #d9d9d9;

  --card-bg: #363636;
  --card-bg-hover: #282828;

  --card-border: #242424;
  --card-border-hover: #444444;

  --card-text: #ffffff;
  --card-text-secondary: #a3a3a3;

  --card-shadow: 0 18px 45px rgba(0, 0, 0, 0.35);

  --social-icon: #ffffff;
  --social-hover-bg: #ffffff;
  --social-hover-icon: #000000;

  --home-btn-border: #ffffff;
  --home-btn-before: rgba(247, 247, 247, 0.1);
  --home-btn-after: rgba(255, 255, 255, 0.5);

  --mode-hover-bg: rgba(255, 255, 255, 0.12);

  --helmet-image: url("/images/helmet.png");

  --font-main: "Manrope", sans-serif;
  --font-heading: "Space Grotesk", sans-serif;

  --fs-xs: 0.75rem;
  --fs-sm: 0.875rem;
  --fs-base: 1rem;
  --fs-md: 1.125rem;
  --fs-lg: 1.5rem;
  --fs-xl: 2rem;
  --fs-2xl: 3rem;
  --fs-3xl: 4.5rem;

  --fw-light: 300;
  --fw-regular: 400;
  --fw-medium: 500;
  --fw-semibold: 600;
  --fw-bold: 700;

  --line-height: 1.6;
  --letter-spacing: 0.02em;

  --space-xs: 0.5rem;
  --space-sm: 0.75rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;
  --space-3xl: 5rem;

  --container-width: 1200px;
  --container-padding: clamp(1rem, 3vw, 1.5rem);
  --section-padding: clamp(4rem, 8vw, 6rem);

  --transition-fast: 0.2s ease;
  --transition-medium: 0.35s ease;
}

/* Light mode */

.light-mode {
  --bg-primary: #f5f5f5;
  --bg-secondary: #eeeeee;
  --bg-tertiary: #e5e5e5;
  --surface: #ffffff;

  --text-primary: #000000;
  --text-secondary: #444444;
  --text-muted: #777777;

  --border: #d4d4d4;
  --border-light: #bbbbbb;

  --accent: #000000;
  --accent-hover: #333333;

  --card-bg: #d0d0d0;
  --card-bg-hover: #e1dede;

  --card-border: #d8d8d8;
  --card-border-hover: #999999;

  --card-text: #111111;
  --card-text-secondary: #626262;

  --card-shadow: 0 18px 45px rgba(0, 0, 0, 0.09);

  --social-icon: #111111;
  --social-hover-bg: #111111;
  --social-hover-icon: #ffffff;

  --home-btn-border: #000000;
  --home-btn-before: rgba(0, 0, 0, 0.08);
  --home-btn-after: rgba(0, 0, 0, 0.45);

  --mode-hover-bg: rgba(0, 0, 0, 0.08);

  --helmet-image: url("/images/light-helmet.png");
}

/* Reset */

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

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  overflow-x: hidden;

  background-color: var(--bg-primary);
  color: var(--text-primary);

  font-family: var(--font-main);
  font-size: var(--fs-base);
  font-weight: var(--fw-light);

  line-height: var(--line-height);
  letter-spacing: var(--letter-spacing);

  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;

  transition:
    background-color 0.7s ease,
    color 0.7s ease;
}

img,
picture,
video,
canvas,
svg {
  display: block;
  max-width: 100%;
}

input,
button,
textarea,
select {
  font: inherit;
  color: inherit;

  background: none;
  border: none;
  outline: none;
}

button {
  cursor: pointer;
}

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

ul,
ol {
  list-style: none;
}

/* Typography */

h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: var(--font-heading);
  font-weight: var(--fw-medium);

  line-height: 1.1;
  letter-spacing: -0.03em;
}

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

/* Layout */

main {
  width: 100%;
}

section {
  padding: var(--section-padding) var(--container-padding);
}

.container {
  width: min(100%, var(--container-width));
  margin-inline: auto;
}

/* Global */

nav a,
button,
.home-btn {
  font-family: var(--font-main);
  font-size: var(--fs-md);
  font-weight: var(--fw-medium);

  letter-spacing: 0.18em;
  text-transform: uppercase;
}

a,
button {
  transition:
    color var(--transition-fast),
    opacity var(--transition-fast),
    border-color var(--transition-fast),
    background-color var(--transition-fast),
    transform var(--transition-fast);
}

a:hover {
  color: var(--text-secondary);
}

/* Access */

:focus-visible {
  outline: 1px solid var(--text-primary);
  outline-offset: 4px;
}

::selection {
  background-color: var(--text-primary);
  color: var(--bg-primary);
}

/* Header */

header {
  position: sticky;
  top: 0;
  z-index: 100;

  width: 100%;
  padding-top: clamp(0.7rem, 2vw, 1.2rem);

  background-color: var(--bg-primary);
  background-color: color-mix(
    in srgb,
    var(--bg-primary) 80%,
    transparent
  );

  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);

  transition: background-color 0.7s ease;
}

/* Navigation */

nav {
  display: flex;
  align-items: center;
  justify-content: center;

  gap: clamp(0.35rem, 4.5vw, 3.9rem);
    opacity: 0.8;
  width: min(calc(100% - 1rem), 900px);

  margin: 0 auto;
  padding-inline: clamp(0.35rem, 1.8vw, 1.3rem);
}

nav a {
  flex-shrink: 0;

  font-size: clamp(0.76rem, 1.85vw, 0.95rem);
  font-weight: var(--fw-bold);
  letter-spacing: clamp(0.06em, 0.25vw, 0.18em);

  white-space: nowrap;
}

nav a:hover {
  transform: scale(1.033, 1.099);
}

/* Mode button */

.mode-btn {
  position: relative;

  display: flex;
  align-items: center;
  justify-content: center;

  width: clamp(1.7rem, 3.5vw, 2.3rem);
  height: clamp(1.7rem, 3.5vw, 2.3rem);

  flex-shrink: 0;

  padding: clamp(0.25rem, 0.7vw, 0.5rem);

  border-radius: 50%;

  color: var(--text-primary);

  transition:
    background-color 0.4s ease,
    color 0.7s ease,
    transform 0.4s ease;
}

.mode-btn::before,
.mode-btn::after {
  content: "";

  position: absolute;

  width: clamp(0.95rem, 2vw, 1.25rem);
  height: clamp(0.95rem, 2vw, 1.25rem);

  background-color: currentColor;

  mask-position: center;
  mask-repeat: no-repeat;
  mask-size: contain;

  -webkit-mask-position: center;
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-size: contain;

  transition:
    opacity 0.4s ease,
    transform 0.5s ease;
}

.mode-btn::before {
  opacity: 1;

  mask-image: url("/images/sun.svg");
  -webkit-mask-image: url("/images/sun.svg");

  transform: rotate(0deg) scale(1);
}

.mode-btn::after {
  opacity: 0;

  mask-image: url("/images/moon.svg");
  -webkit-mask-image: url("/images/moon.svg");

  transform: rotate(-45deg) scale(0.5);
}

.mode-btn:hover {
  background-color: var(--mode-hover-bg);

  transform: scale(1.08);
}

.mode-btn:hover::before {
  transform: rotate(90deg) scale(1.2);
}

.mode-btn:active {
  transform: scale(0.92);
}

.light-mode .mode-btn::before {
  opacity: 0;

  transform: rotate(90deg) scale(0.5);
}

.light-mode .mode-btn::after {
  opacity: 1;

  transform: rotate(0deg) scale(1);
}

.light-mode .mode-btn:hover::after {
  transform: rotate(-20deg) scale(1.2);
}

/* Home */

.home {
  position: relative;
  isolation: isolate;

  min-height: max(36rem, calc(100svh - 4rem));

  margin-bottom: clamp(2rem, 4vw, 3.5rem);
  padding: 0;

  overflow: hidden;
}

/* Home content */

.home-content {
  position: absolute;
  z-index: 2;

  top: clamp(6.5rem, 13vw, 8rem);
  left: clamp(1rem, 6vw, 5rem);

  width: fit-content;
  max-width: calc(100% - 2rem);
}

.home-content > span {
  display: block;

  font-size: clamp(0.65rem, 1.45vw, 1.05rem);
  line-height: 1.4;

  white-space: nowrap;
}

.home h1 {
  margin-block: clamp(0.1rem, 0.4vw, 0.25rem);

  font-size: clamp(2.8rem, 7.5vw, 6.25rem);

  line-height: 0.95;
  white-space: nowrap;
}

/* Helmet */

.home-bg {
  position: absolute;
  z-index: 1;

  top: clamp(2.5rem, 5vw, 4rem);
  right: clamp(-5rem, -4vw, -2rem);

  width: clamp(25rem, 67vw, 57rem);
  aspect-ratio: 1 / 1;

  background-image: var(--helmet-image);
  background-repeat: no-repeat;
  background-position: right center;
  background-size: contain;

  pointer-events: none;

  transition: background-image var(--transition-medium);
}

/* Home button */

.home-btn {
  position: relative;
  isolation: isolate;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  width: fit-content;

  margin-top: clamp(0.65rem, 1vw, 0.9rem);
  padding:
    clamp(0.5rem, 1vw, 0.7rem)
    clamp(0.75rem, 1.4vw, 1rem);

  border: 1px solid var(--home-btn-border);

  font-size: clamp(0.57rem, 1vw, 0.75rem);

  transition:
    color 0.5s ease,
    border-color 0.7s ease;
}

.home-btn::before {
  content: "";

  position: absolute;
  inset: 0;
  z-index: -1;

  background-color: var(--home-btn-before);

  pointer-events: none;

  transition:
    opacity 0.9s ease,
    transform 0.9s ease,
    background-color 0.7s ease;
}

.home-btn:hover::before {
  opacity: 0;

  transform: scale(0.5);
}

.home-btn::after {
  content: "";

  position: absolute;
  inset: 0;
  z-index: -1;

  opacity: 0;

  border: 1px solid var(--home-btn-after);

  transform: scale(1.3);

  pointer-events: none;

  transition:
    opacity 0.9s ease,
    transform 0.9s ease,
    border-color 0.7s ease;
}

.home-btn:hover::after {
  opacity: 1;

  transform: scale(1);
}

/* Scroll prompt */

.scroll-prompt {
  position: absolute;
  z-index: 3;

  left: 50%;
  bottom: 1rem;

  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;

  color: var(--text-secondary);

  transform: translateX(-50%);

  pointer-events: none;
}

.scroll-prompt > span {
  padding: 1px 3px;

  border: 1px dotted;

  font-size: clamp(0.6rem, 0.8vw, 0.65rem);
  font-weight: var(--fw-semibold);
  letter-spacing: 0.29em;
  text-transform: uppercase;

  white-space: nowrap;
}

.scroll-line {
  width: 1px;
  height: 2rem;

  background-color: var(--text-secondary);
}

.scroll-dot {
  display: none;
}

/* Projects */

.projects {
  display: grid;
  grid-template-columns: minmax(18rem, 21rem) minmax(0, 1fr);
  align-items: stretch;

  gap: 2rem;

  width: min(100%, 80rem);

  margin-inline: auto;
  padding-top: clamp(2.5rem, 5vw, 4rem);
}

/* Project summary */

.project-desc-card {
  display: flex;
  flex-direction: column;

  width: 95%;
  padding: 2rem;

  border: 1px solid var(--card-border);
  border-radius: 8px;

  background-color: var(--card-bg);
}

.desc-card-title {
  margin-bottom: 1rem;

  font-size: var(--fs-sm);
  text-decoration: underline;
}

.desc-card-sub {
  margin-bottom: 1rem;

  font-size: 1.2rem;
  line-height: 1.25;
}

.desc-card-para {
  margin-bottom: 1.5rem;

  font-size: 1rem;
  line-height: 1.7;
}

.model-btn {
  align-self: flex-start;

  margin-top: auto;
  padding: 0.75rem 1rem;

  border: 1px solid var(--border-light);

  background-color: var(--border-light);
}

.model-btn:hover {
  background-color: var(--card-bg-hover);

  transform: translateY(-2px);
}

/* Project view */

.project-showcase {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;

  min-width: 0;
  min-height: 29rem;

  padding: 8px;

  overflow: hidden;

  border-radius: 3px;
}

/* Carousel view */

.carousel-viewport {
  width: 120%;
  min-width: 0;

  overflow: hidden;

  scroll-behavior: smooth;
  scroll-snap-type: x mandatory;
}

/* Carousel track */

.project-cards-con {
  display: flex;
  gap: 1rem;

  width: max-content;
  padding: 1rem;
}

/* Project card */

.project-card {
  flex: 0 0 calc((min(59vw, 55rem) - 4rem) / 3);

  min-width: 0;
  min-height: 25rem;

  overflow: hidden;

  border: 1px solid var(--border-light);
  border-radius: 8px;

  background-color: var(--card-bg);

  scroll-snap-align: start;

  transition:
    background-color var(--transition-fast),
    box-shadow var(--transition-fast),
    transform var(--transition-fast);
}

.project-btn {
  display: flex;
  flex-direction: column;

  width: 100%;
  height: 100%;
}

.project-image {
  display: flex;
  align-items: center;
  justify-content: center;

  width: 100%;
  height: 14rem;

  padding: 1rem;

  overflow: hidden;

  background-color: #050505;
}

.project-image img {
  width: 100%;
  height: 100%;

  object-fit: contain;
  object-position: center;

  transition: transform 0.35s ease;
}

.project-card:hover {
  background-color: var(--card-border);

  box-shadow: -3px 1.5px 1px var(--card-bg-hover);

  transform: scale(1.01);
}

.project-card:hover .project-image img {
  transform: scale(1.02);
}

.project-info {
  padding: 1rem;
}

.project-number {
  display: block;

  margin-bottom: 0.5rem;

  color: var(--card-text-secondary);

  font-size: var(--fs-xs);
  letter-spacing: 0.18em;
}

.project-title {
  margin-bottom: 0.5rem;

  font-size: var(--fs-base);
}

.project-info p {
  font-size: var(--fs-sm);
  line-height: 1.6;
}

/* Carousel controls */

.carousel-controls {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;

  gap: 0.3rem;

  padding: 0.1rem 1rem;

  border-top: 2px solid var(--border-light);
}

.carousel-btn {
  width: fit-content;
  padding: 1rem 0;

  font-size: 0.75rem;
}

.carousel-btn:last-child {
  justify-self: end;
}

.carousel-btn:hover:not(:disabled) {
  color: var(--border-light);

  transform: translateY(-1px);
}

.carousel-btn:disabled {
  cursor: not-allowed;
  opacity: 0.3;
}

.carousel-count {
  color: var(--text-secondary);

  font-size: var(--fs-xs);
  font-weight: var(--fw-medium);
  letter-spacing: 0.12em;
}

/* About page */

.about-page main {
  width: min(
    calc(100% - (var(--container-padding) * 2)),
    80rem
  );

  margin-inline: auto;
}

/* About */

.about {
  display: grid;
  grid-template-columns:
    minmax(16rem, 0.8fr)
    minmax(18rem, 1.2fr);

  gap: clamp(3rem, 8vw, 8rem);

  min-height: calc(100svh - 4rem);

  padding-block: clamp(7rem, 13vw, 11rem);

  border-bottom: 1px solid var(--border);
}

.about-heading {
  display: flex;
  flex-direction: column;
}

.section-label {
  display: inline-block;

  margin-bottom: 1.5rem;

  color: var(--text-muted);

  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.about-header,
.contact-header {
  max-width: 12ch;

  font-size: clamp(2.7rem, 6.5vw, 6rem);
  font-weight: var(--fw-medium);

  line-height: 0.98;
  letter-spacing: -0.05em;
}

.about-content {
  align-self: end;

  max-width: 42rem;
}

.about-intro {
  margin-bottom: 2rem;

  color: var(--text-primary);

  font-family: var(--font-heading);
  font-size: clamp(1.35rem, 2.5vw, 2.2rem);

  line-height: 1.3;
  letter-spacing: -0.03em;
}

.about-para {
  max-width: 62ch;
  margin-bottom: 1.25rem;

  font-size: clamp(0.95rem, 1.3vw, 1.05rem);
  line-height: 1.8;
}

.about-details {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));

  gap: 1rem;

  margin-top: clamp(2.5rem, 5vw, 4rem);
  padding-top: 1.5rem;

  border-top: 1px solid var(--border);
}

.about-detail span {
  display: block;

  margin-bottom: 0.5rem;

  color: var(--text-muted);

  font-size: 0.65rem;
  font-weight: var(--fw-semibold);
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.about-detail p {
  font-size: var(--fs-sm);
  line-height: 1.5;
}

/* Contact */

.contact {
  display: grid;
  grid-template-columns:
    minmax(16rem, 0.8fr)
    minmax(18rem, 1.2fr);

  gap: clamp(3rem, 8vw, 8rem);

  min-height: 75vh;

  padding-block: clamp(6rem, 11vw, 9rem);
}

.contact-heading {
  display: flex;
  flex-direction: column;
}

.contact-content {
  align-self: end;

  max-width: 42rem;
}

.contact-para {
  max-width: 58ch;
  margin-bottom: 2.5rem;

  font-size: clamp(1rem, 1.6vw, 1.2rem);
  line-height: 1.8;
}

/* Social links */

.social-links {
  display: flex;
  flex-wrap: wrap;

  gap: 0.75rem;

  margin-bottom: 2.5rem;
}

.social-link {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;

  gap: 0.75rem;

  width: auto;
  height: auto;

  padding: 0.8rem 1rem;

  color: var(--social-icon);

  border: 1px solid var(--border-light);
  border-radius: 0;

  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  letter-spacing: 0.12em;
  text-transform: uppercase;

  transition:
    color var(--transition-fast),
    background-color var(--transition-fast),
    border-color var(--transition-fast),
    transform var(--transition-fast);
}

.social-link svg {
  width: 18px;
  height: 18px;

  flex-shrink: 0;

  fill: currentColor;
}

.social-link:hover {
  color: var(--social-hover-icon);

  background-color: var(--social-hover-bg);
  border-color: var(--social-hover-bg);

  transform: translateY(-3px);
}

.contact-email {
  display: inline-block;

  max-width: 100%;

  color: var(--text-primary);

  border-bottom: 1px solid var(--border-light);

  font-family: var(--font-heading);
  font-size: clamp(1.25rem, 3vw, 2.25rem);

  line-height: 1.2;
  overflow-wrap: anywhere;
}

.contact-email:hover {
  color: var(--text-secondary);

  border-color: var(--text-secondary);
}

/* Footer */

footer {
  display: flex;
  align-items: center;
  justify-content: center;

  min-height: 100px;
  padding: var(--space-xl) var(--container-padding);

  border-top: 1px solid var(--border);

  text-align: center;
}

footer p {
  color: var(--text-muted);

  font-size: var(--fs-xs);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

footer a {
  color: var(--text-primary);
  font-weight: var(--fw-semibold);
}

footer a:hover {
  color: var(--text-secondary);
}

/* Desktop */

@media (min-width: 901px) {
  .home-bg {
    top: clamp(2rem, 4.5vw, 3.5rem);
  }
}

/* Tablet */

@media (max-width: 950px) {
  .projects {
    grid-template-columns: minmax(0, 24rem);
    justify-content: center;

    gap: 1.2rem;
  }

  .project-desc-card {
    width: 100%;
    min-height: auto;
  }

  .project-showcase {
    min-height: 29rem;
  }

  .project-card {
    flex-basis: calc((24rem - 3rem) / 2);
  }

  .model-btn {
    margin-top: 2rem;
  }

  .home-content {
    top: 7rem;
  }

  .home-bg {
    right: -5rem;

    width: clamp(25rem, 72vw, 45rem);
  }
}

/* About tablet */

@media (max-width: 800px) {
  .about,
  .contact {
    grid-template-columns: 1fr;

    gap: 3rem;
  }

  .about {
    min-height: auto;
  }

  .about-header,
  .contact-header {
    max-width: 10ch;
  }

  .about-content,
  .contact-content {
    align-self: initial;
  }
}

/* Mobile */

@media (max-width: 640px) {
  nav {
    gap: 2.3rem;
    opacity: 0.8;
    padding-inline: 0.15rem;
  }

  nav a {
    font-size: 0.82rem;
    letter-spacing: 0.09em;
  }

  .home {
    min-height: max(35rem, calc(100svh - 3rem));

    margin-bottom: 2.5rem;
  }

  .home-content {
    top: 6.2rem;
    left: 1rem;

    max-width: calc(100% - 2rem);
  }

  .home h1 {
    font-size: clamp(2.2rem, 11vw, 3.3rem);
  }

  .home-content > span {
    font-size: 0.56rem;
  }

  .home-bg {
    top: 7rem;
    right: -5rem;

    width: clamp(25rem, 112vw, 35rem);
  }

  .scroll-prompt {
    bottom: 0.75rem;
  }

  .scroll-line {
    height: 1.75rem;
  }

  .projects {
    width: 100%;
    padding-top: 2rem;
  }

  .project-card {
    flex-basis: calc(100vw - 4rem);
  }

  .project-image {
    height: 17rem;
  }

  .project-showcase:hover {
    box-shadow: none;

    transform: none;
  }

  .about-page main {
    width: calc(
      100% - (var(--container-padding) * 2)
    );
  }

  .about,
  .contact {
    padding-inline: 0;
    padding-block: 5rem;
  }

  .about-details {
    grid-template-columns: 1fr;

    gap: 1.5rem;
  }

  .social-links {
    align-items: stretch;
    flex-direction: column;
  }

  .social-link {
    width: 100%;
  }
}

/* Small phones */

@media (max-width: 400px) {
  .home {
    min-height: max(34rem, calc(100svh - 3rem));

    margin-bottom: 2rem;
  }

  .home-content {
    top: 5.7rem;
  }

  .home h1 {
    font-size: 2.15rem;
  }

  .home-bg {
    top: 7.8rem;
    right: -5.5rem;

    width: 27rem;
  }

  .project-image {
    height: 15rem;
  }

  .about-header,
  .contact-header {
    font-size: clamp(2.4rem, 14vw, 3.5rem);
  }
}

/* Reduced motion */

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}