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

/* ===== Fonts & type sizes — play with these ===== */
:root {
  /* Figma pairing: Space Mono (headings) + Plus Jakarta Sans (body) */
  --font-heading: "Space Mono", ui-monospace, Menlo, Consolas, monospace;
  --font-body: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Helvetica, Arial, sans-serif;

  --fs-base: 14px;            /* general text: about, project meta/description, footer */
  --fs-site-title: 28px;      /* the *_* site title (top-left) */
  --fs-grid-title: 14px;      /* captions under the grid images */
  --fs-project-heading: 14px; /* project page title */
}

body {
  font-family: var(--font-body);
  font-size: var(--fs-base);
  padding: 3%;
  background: #f3f3f3;
  color: #000;
}

/* Content fades in on each load; the header is left out so the title +
   About nav stay constant (they still scroll with the page). */
.page-content {
  animation: page-fade-in 0.8s ease both;
}

@keyframes page-fade-in {
  from {
    opacity: 0;
    transform: translateY(50px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .page-content {
    animation: none;
  }
}

a {
  color: #000;
  text-decoration: underline;
}

a:visited,
a:hover,
a:active {
  color: #000;
}

/* Header */
.header {
  padding-bottom: 40px;
}

.header-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 20px;
  margin-bottom: 16px;
}

.site-title {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: var(--fs-site-title);
}

.site-title a {
  text-decoration: none;
}

.site-nav a {
  font-family: var(--font-heading);
  text-decoration: none;
}

.site-nav a:hover {
  text-decoration: underline;
}

.about {
  max-width: 520px;
}

/* About page */
.about-page {
  max-width: 600px;
}

.about-body {
  line-height: 1.6;
  margin-bottom: 22px;
}

.about-body p {
  margin-bottom: 1em;
}

.about-body a {
  font-weight: 700;
  text-decoration: none;
}

.about-body a:hover {
  text-decoration: underline;
}

/* Project grid (landing) */
.project-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 50px 50px;
}

.grid-item {
  display: block;
  text-decoration: none;
}

.grid-image {
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: #e6e6e6;
}

.grid-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.5s ease, opacity 0.5s ease;
}

.grid-item:hover .grid-image img {
  transform: scale(1.02);
  opacity: 0.85;
}

.grid-image video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.4s ease, opacity 0.4s ease;
}

.grid-item:hover .grid-image video {
  transform: scale(1.02);
  opacity: 0.85;
}

.grid-title {
  margin-top: 18px;
  text-align: left;
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: var(--fs-grid-title);
}

.grid-item:hover .grid-title {
  text-decoration: underline;
}

.grid-desc {
  margin-top: 4px;
  font-family: var(--font-body);
  color: #555;
  line-height: 1.4;
}

/* Project page */
.project {
  display: grid;
  grid-template-columns: 1fr 1.5fr;
  gap: 40px;
  align-items: start;
}

.project-media {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.project-nav {
  margin-top: 40px;
  padding-top: 24px;
  border-top: 1px solid #ddd;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* Desktop: nav sits in the text column; the mobile copy is hidden.
   On mobile (below) this flips so the nav sits below the gallery. */
.project-nav.is-mobile {
  display: none;
}

.project-nav a {
  display: block;
  text-decoration: none;
}

.project-nav-label {
  display: block;
  margin-bottom: 3px;
  color: #888;
  font-size: 0.85em;
}

.project-nav-title {
  display: block;
  font-family: var(--font-heading);
}

.project-nav a:hover .project-nav-title {
  text-decoration: underline;
}

.project-heading {
  font-family: var(--font-heading);
  font-size: var(--fs-project-heading);
  font-weight: 700;
  margin-bottom: 6px;
}

.project-meta {
  margin-bottom: 18px;
}

.project-description {
  max-width: 600px;
  margin-bottom: 22px;
  line-height: 1.6;
}

.project-description p {
  margin-bottom: 1em;
}

.project-cta {
  margin-bottom: 28px;
}

.project-video {
  margin-bottom: 0;
}

.project-video iframe {
  width: 100%;
  aspect-ratio: 16 / 9;
  display: block;
  border: 0;
}

.project-video video {
  width: 100%;
  height: auto;
  display: block;
}

.project-gallery {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.project-gallery img {
  width: 100%;
  height: auto;
  display: block;
}

/* Code page — text-led sketch rows */
.code-intro {
  max-width: 600px;
  margin-bottom: 10px;
}

.sketch-row {
  display: flex;
  gap: 30px;
  align-items: flex-start;
  padding: 30px 0;
  border-top: 1px solid #ddd;
}

.sketch-row .sketch-preview {
  flex: 0 0 48%;
}

.sketch-preview {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  margin: 0;
  background: #e6e6e6;
  cursor: pointer;
  font: inherit;
  color: inherit;
  text-decoration: none;
}

.sketch-preview video,
.sketch-preview img {
  width: 100%;
  height: auto;
  display: block;
  transition: opacity 0.3s ease;
}

.sketch-preview:hover video,
.sketch-preview:hover img {
  opacity: 0.85;
}

.sketch-row-text {
  flex: 1;
}

.sketch-row-title {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: var(--fs-project-heading);
  margin-bottom: 6px;
}

.sketch-row-date {
  color: #888;
  margin-bottom: 12px;
}

.sketch-row-desc {
  line-height: 1.6;
  margin-bottom: 14px;
}

.sketch-row-desc p {
  margin-bottom: 1em;
}

.sketch-row-desc p:last-child {
  margin-bottom: 0;
}

.sketch-open {
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  font: inherit;
  font-family: var(--font-heading);
  color: inherit;
  text-decoration: none;
}

.sketch-open:hover {
  text-decoration: underline;
}

/* Fullscreen sketch overlay (injected on <body>) */
.sketch-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: #000;
}

.sketch-overlay-frame {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

.sketch-overlay-close {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 1001;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

.sketch-overlay-close:hover {
  background: rgba(0, 0, 0, 0.85);
}

/* Responsive */
@media (max-width: 900px) {
  .project-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .project {
    grid-template-columns: 1fr;
    gap: 28px;
  }

  /* Code rows stack: preview above text */
  .sketch-row {
    flex-direction: column;
    gap: 16px;
  }

  .sketch-row .sketch-preview {
    flex-basis: auto;
  }

  /* Move prev/next below the gallery on mobile */
  .project-nav.is-desktop {
    display: none;
  }

  .project-nav.is-mobile {
    display: flex;
    margin-top: 0;
  }
}

/* Phones */
@media (max-width: 600px) {
  :root {
    --fs-site-title: 22px;
  }

  body {
    padding: 20px;
  }

  .header {
    padding-bottom: 20px;
  }

  .header-top {
    margin-bottom: 12px;
  }

  .project-grid {
    grid-template-columns: 1fr;
    gap: 40px;
  }

  .grid-title {
    margin-top: 12px;
  }

  .project-nav {
    margin-top: 28px;
    padding-top: 20px;
  }

  /* finger-friendly tap targets */
  .site-nav a,
  .project-nav a {
    padding: 4px 0;
  }
}
