@font-face {
  font-family: 'Serrif';
  src: url('Serrif-TRIAL-Light.ttf') format('truetype');
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Saans';
  src: url('Saans-TRIAL-Regular.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'SaansMono';
  src: url('SaansMono-Light.woff2') format('woff2');
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'SaansMono';
  src: url('SaansMono-Regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

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

html {
  scroll-behavior: smooth;
  --mobile-header-height: 3.25rem;
  --mobile-personal-nav-height: 3.3rem;
}

body {
  font-family: 'Serrif', Georgia, serif;
  background: #fff;
  color: #111;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.5s ease;
}


/* ── Header ── */

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 1.75rem 2.5rem;
  background: #fff;
  border-bottom: 1px solid #f0f0f0;
}

.site-name {
  font-size: 1.125rem;
  font-weight: 400;
  letter-spacing: 0.01em;
  text-decoration: none;
  color: #111;
}

.filter-nav {
  display: flex;
  gap: 1.75rem;
}

.filter-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-family: 'Serrif', Georgia, serif;
  font-size: 1.025rem;
  font-weight: 400;
  letter-spacing: 0.04em;
  color: #bbb;
  padding: 0;
  text-decoration: none;
  transition: color 0.2s ease;
}

.filter-btn:hover {
  color: #555;
}

.site-name:focus-visible,
.filter-btn:focus-visible,
.video-sound-btn:focus-visible,
.website-preview:focus-visible,
.carousel-btn:focus-visible,
.overlay-close:focus-visible,
#work-sidebar a:focus-visible,
#personal-sidebar a:focus-visible {
  outline: 1px solid #111;
  outline-offset: 4px;
}

.filter-btn.active {
  color: #111;
}

/* ── Layout ── */

#layout {
  transition: padding-left 0.4s ease;
}

body.work-mode #layout,
body.personal-mode #layout {
  padding-left: 210px;
}

/* ── Feed ── */

#feed {
  max-width: 860px;
  margin: 0 auto;
  padding: 3rem 2.5rem 10rem;
  display: flex;
  flex-direction: column;
  gap: 4rem;
}

/* ── Post ── */

.post {
  width: 100%;
  transition: opacity 0.3s ease;
}

.post.hidden {
  display: none;
}

/* ── Media ── */

.post-media {
  width: 100%;
  position: relative;
  overflow: hidden;
}

/* ── Placeholder (swap these out for real <img> or <video> tags) ── */

.placeholder {
  width: 100%;
  background: #ebebeb;
  display: flex;
  align-items: center;
  justify-content: center;
}

.video-placeholder {
  cursor: pointer;
}

.post-video,
.hero-loop {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  background: #f3f3f3;
  display: block;
}

.media-16x9 {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  display: block;
}

.post-video {
  cursor: pointer;
}

.media-grid {
  display: grid;
  grid-template-columns: 3fr 1fr;
  gap: 6px;
}

.media-thumbs {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.media-thumb {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  cursor: pointer;
  opacity: 0.45;
  background: #e8e8e8;
  transition: opacity 0.2s ease;
}

.media-thumb:hover,
.media-thumb.active {
  opacity: 1;
}

.media-thumb img,
.media-thumb video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.yt-embed {
  position: relative;
  width: 100%;
  aspect-ratio: 16/9;
}

.yt-embed iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}

.video-wrapper {
  position: relative;
}

.video-sound-btn {
  position: absolute;
  bottom: 0.75rem;
  right: 0.75rem;
  background: rgba(0,0,0,0.45);
  border: none;
  border-radius: 50%;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #fff;
  opacity: 0.5;
  transition: opacity 0.2s ease;
}

.video-wrapper:hover .video-sound-btn {
  opacity: 1;
}

.video-sound-btn .icon-sound {
  display: none;
}

.video-wrapper.playing .video-sound-btn .icon-muted {
  display: none;
}

.video-wrapper.playing .video-sound-btn .icon-sound {
  display: block;
}

.play-icon {
  font-size: 1.25rem;
  color: #aaa;
  line-height: 1;
}

/* ── Carousel ── */

.carousel-track {
  display: flex;
  gap: 12px;
  transition: transform 0.45s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  will-change: transform;
}

.carousel-slide {
  flex: 0 0 88%;
  min-width: 0;
}

.carousel-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  font-family: 'Serrif', Georgia, serif;
  font-size: 1.3rem;
  color: #111;
  padding: 1rem;
  line-height: 1;
  z-index: 10;
  transition: opacity 0.2s ease;
}

.carousel-btn.prev { left: 0; }
.carousel-btn.next { right: 0; }

.carousel-btn:hover { opacity: 0.4; }
.carousel-btn:disabled { opacity: 0.15; cursor: default; }

.carousel-counter {
  position: absolute;
  bottom: 0.9rem;
  right: 1.1rem;
  font-size: 0.75rem;
  font-style: italic;
  color: #888;
  letter-spacing: 0.04em;
  pointer-events: none;
}

/* ── Caption ── */

.post-caption {
  margin-top: 1.4rem;
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 2.5rem;
  align-items: start;
}

.caption-left {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding-top: 0.1rem;
}

.project-name {
  font-size: 1.025rem;
  font-weight: 400;
  letter-spacing: 0.02em;
  color: #111;
}

.project-year {
  display: none;
}

.caption-right p {
  font-size: 0.975rem;
  font-weight: 300;
  color: #666;
  line-height: 1.7;
  max-width: 520px;
  transition: font-family 0s, font-size 0.3s ease, color 0.3s ease;
}

.caption-right a {
  color: inherit;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
  transition: color 0.2s ease;
}

.caption-right a:hover {
  color: #111;
}



/* ── Thumbnail grid ── */

.thumb-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
}

.thumb-grid img {
  width: 100%;
  height: 200px;
  object-fit: cover;
  display: block;
}

/* ── Hero + 2 stacked thumbnails ── */

.thumb-hero-grid {
  display: grid;
  grid-template-columns: 1fr 0.42fr;
  grid-template-rows: 1fr 1fr;
  gap: 0.5rem;
}

.thumb-hero-item {
  position: relative;
  overflow: hidden;
}

.thumb-hero-item:first-child {
  grid-row: 1 / 3;
}

.thumb-hero-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  min-height: 0;
}

.thumb-hero-item:nth-child(2) img,
.thumb-hero-item:nth-child(3) img {
  aspect-ratio: 16/9;
}

.play-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  color: #fff;
  background: rgba(0,0,0,0);
  opacity: 0;
  transition: opacity 0.2s ease, background 0.2s ease;
  pointer-events: none;
}

.thumb-hero-item:hover .play-overlay {
  opacity: 1;
  background: rgba(0,0,0,0.25);
}

/* ── Website showcase post ── */

.website-preview {
  display: block;
  text-decoration: none;
}

.website-preview-inner {
  background: #f0f0f0;
  padding: 1.75rem;
  display: flex;
  align-items: flex-start;
  gap: 1.25rem;
  aspect-ratio: 2.2/1;
  transition: background 0.2s ease;
}

.website-preview:hover .website-preview-inner {
  background: #e8e8e8;
}

.website-desktop {
  display: block;
  width: 74%;
  border-radius: 6px;
  flex-shrink: 0;
}

.website-mobile {
  display: block;
  width: 22%;
  border-radius: 6px;
  flex-shrink: 0;
}

.browser-frame {
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 4px 24px rgba(0,0,0,0.10), 0 1px 4px rgba(0,0,0,0.06);
  transition: box-shadow 0.2s ease;
}

.website-preview:hover .browser-frame {
  box-shadow: 0 8px 36px rgba(0,0,0,0.15), 0 2px 8px rgba(0,0,0,0.07);
}

.browser-bar {
  background: #e3e3e3;
  height: 40px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 16px;
  position: relative;
}

.browser-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #c4c4c4;
}

.browser-url {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  background: #d4d4d4;
  border-radius: 7px;
  padding: 4px 20px;
  font-size: 0.72rem;
  color: #666;
  letter-spacing: 0.02em;
  white-space: nowrap;
  pointer-events: none;
  min-width: 220px;
  text-align: center;
}

.browser-frame img {
  width: 100%;
  display: block;
}

.website-visit {
  display: block;
  margin-top: 0.6rem;
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  color: #999;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.website-preview:hover .website-visit {
  opacity: 1;
}

/* ── Work Sidebar ── */

#work-sidebar {
  position: fixed;
  left: 0;
  top: 4.6rem;
  bottom: 0;
  width: 200px;
  padding: 3rem 1rem 3rem 2.5rem;
  overflow-y: auto;
  background: #fff;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease;
}

body.work-mode #work-sidebar,
body.personal-mode #personal-sidebar {
  opacity: 1;
  pointer-events: all;
}

#personal-sidebar {
  position: fixed;
  left: 0;
  top: 4.6rem;
  bottom: 0;
  width: 200px;
  padding: 3rem 1rem 3rem 2.5rem;
  overflow-y: auto;
  background: #fff;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease;
}

#personal-sidebar ul {
  list-style: none;
  display: flex;
  flex-direction: column;
}

#personal-sidebar a {
  display: block;
  text-decoration: none;
  font-family: 'Serrif', Georgia, serif;
  font-size: 0.925rem;
  font-weight: 400;
  letter-spacing: 0.1em;
  color: #bbb;
  padding: 0.8rem 0;
  transition: color 0.2s ease;
  white-space: nowrap;
}

#personal-sidebar a:hover { color: #777; }
#personal-sidebar a.active { color: #111; }

.sidebar-label {
  display: block;
  font-family: 'Serrif', Georgia, serif;
  font-size: 1.725rem;
  font-weight: 400;
  letter-spacing: -0.01em;
  color: #111;
  margin-bottom: 1.25rem;
}

#work-sidebar ul {
  list-style: none;
  display: flex;
  flex-direction: column;
}

#work-sidebar li {
}

#work-sidebar a {
  display: block;
  text-decoration: none;
  font-family: 'Serrif', Georgia, serif;
  font-size: 0.925rem;
  font-weight: 400;
  letter-spacing: 0.1em;
  color: #bbb;
  padding: 0.8rem 0;
  transition: color 0.2s ease;
  white-space: nowrap;
}

#work-sidebar a:hover {
  color: #777;
}

#work-sidebar a.active {
  color: #111;
}

#work-sidebar .sidebar-year {
  display: block;
  font-style: italic;
  font-size: 0.62rem;
  text-transform: none;
  letter-spacing: 0.04em;
  color: inherit;
  opacity: 0.5;
  margin-top: 0.15rem;
}

/* ── View project button ── */


.view-project-btn {
  display: inline-block;
  margin-top: 1rem;
  background: none;
  border: none;
  padding: 0;
  font-family: 'Serrif', Georgia, serif;
  font-size: 0.975rem;
  color: #aaa;
  cursor: pointer;
  letter-spacing: 0.04em;
  transition: color 0.2s ease;
}

.view-project-btn:hover {
  color: #111;
}

/* ── Project overlay ── */

#project-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: #fff;
  overflow-y: auto;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

#project-overlay.open {
  opacity: 1;
  pointer-events: all;
}

.overlay-close {
  position: fixed;
  top: 1.75rem;
  right: 2.5rem;
  background: none;
  border: none;
  font-size: 1rem;
  color: #aaa;
  cursor: pointer;
  z-index: 201;
  transition: color 0.2s ease;
  line-height: 1;
}

.overlay-close:hover {
  color: #111;
}

.overlay-inner {
  max-width: 900px;
  margin: 0 auto;
  padding: 5rem 2.5rem 10rem;
}

.overlay-header {
  margin-bottom: 3.5rem;
}

.overlay-meta {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.overlay-name {
  font-size: 1rem;
  font-weight: 400;
  color: #111;
}

.overlay-year {
  font-size: 0.8rem;
  font-style: italic;
  color: #bbb;
}

.overlay-desc {
  font-size: 1rem;
  font-weight: 300;
  color: #666;
  line-height: 1.7;
  max-width: 520px;
}

.overlay-hero {
  width: 100%;
  margin-bottom: 1rem;
}

.overlay-hero video,
.overlay-hero img {
  width: 100%;
  display: block;
}

.overlay-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.overlay-grid video,
.overlay-grid img {
  width: 100%;
  display: block;
}

/* ── API Hero composite ── */

.api-hero {
  position: relative;
  width: 100%;
  aspect-ratio: 16/9;
  overflow: hidden;
  border-radius: 12px;
}

.api-hero-backdrop,
.api-hero-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.api-hero-video {
  z-index: 1;
}

.api-hero-text {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2rem;
  color: #1a1a1a;
}

.api-hero-logo {
  width: 48px;
  height: 48px;
  margin-bottom: 1rem;
}

.api-hero-label {
  font-family: 'SaansMono', monospace;
  font-weight: 400;
  font-size: 0.65rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 0.5rem;
  color: #444;
}

.api-hero-title {
  font-family: 'Serrif', Georgia, serif;
  font-size: clamp(1.75rem, 5vw, 3.5rem);
  font-weight: 300;
  letter-spacing: -0.03em;
  line-height: 1;
  margin-bottom: 1rem;
  color: #111;
}

.api-hero-desc {
  font-family: 'Saans', sans-serif;
  font-size: clamp(0.8rem, 1.5vw, 1rem);
  font-weight: 400;
  color: #444;
  max-width: 420px;
  line-height: 1.5;
}

/* ── Personal layout override ── */

body.personal-mode #feed {
  max-width: 100%;
  padding-left: 2.5rem;
  padding-right: 2.5rem;
}

/* ── Personal sections ── */

.mobile-personal-nav {
  display: none;
}

.personal-section {
  margin-bottom: 5rem;
  scroll-margin-top: 7rem;
}

.personal-section-title {
  font-family: 'Serrif', Georgia, serif;
  font-size: 1.725rem;
  font-weight: 300;
  letter-spacing: -0.01em;
  line-height: 1;
  color: #444;
  margin-bottom: 1.75rem;
}

.personal-photo-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.personal-photo-grid--dense {
  grid-template-columns: repeat(5, 1fr);
}

.personal-photo-grid img,
.personal-photo-grid .placeholder {
  width: 100%;
  display: block;
  height: 100%;
  object-fit: cover;
}

/* ── About ── */

body.about-mode #feed {
  margin-left: 0;
  max-width: 600px;
}

.about-content {
  max-width: 520px;
}

.about-content p {
  font-size: 1.075rem;
  font-weight: 300;
  color: #666;
  line-height: 1.7;
}

.about-content p + p {
  margin-top: 1.25rem;
}

.about-content code {
  font-family: 'SaansMono', monospace;
  font-size: 0.8rem;
  color: #888;
}

.about-content a {
  color: inherit;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
  transition: color 0.2s ease;
}

.about-content a:hover {
  color: #111;
}

/* ── Responsive ── */

@media (max-width: 760px) {
  .site-header {
    align-items: flex-start;
    gap: 0.9rem;
    padding: 1rem 1.25rem;
  }

  .site-name {
    max-width: 11rem;
    line-height: 1.2;
  }

  .filter-nav {
    gap: 1rem;
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  body.work-mode #layout,
  body.personal-mode #layout {
    padding-left: 0;
  }

  #work-sidebar,
  #personal-sidebar {
    display: none;
  }

  #feed {
    width: 100%;
    max-width: none;
    padding: 2rem 1.25rem 7rem;
    gap: 4.5rem;
  }

  .post-caption {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

  .caption-right p,
  .about-content p {
    font-size: 1.075rem;
    line-height: 1.65;
  }

  .browser-frame {
    border-radius: 6px;
  }

  .browser-bar {
    height: 30px;
    gap: 4px;
    padding: 0 10px;
  }

  .browser-dot {
    width: 8px;
    height: 8px;
  }

  .browser-url {
    min-width: 0;
    max-width: 58%;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 3px 10px;
    font-size: 0.62rem;
  }

  .website-visit {
    opacity: 1;
  }

  body.personal-mode #feed {
    padding-left: 1.25rem;
    padding-right: 1.25rem;
    padding-top: 0.75rem;
  }

  .personal-section {
    margin-bottom: 4rem;
    scroll-margin-top: calc(var(--mobile-header-height) + var(--mobile-personal-nav-height) + 1rem);
  }

  .mobile-personal-nav {
    position: sticky;
    top: var(--mobile-header-height);
    z-index: 90;
    display: flex;
    align-items: baseline;
    gap: 0.45rem;
    padding: 1.1rem 0 1.25rem;
    margin: 0 0 1rem;
    background: rgba(255, 255, 255, 0.94);
    font-family: 'Serrif', Georgia, serif;
  }

  .mobile-personal-nav a,
  .mobile-personal-nav span {
    color: #bbb;
    font-size: 1rem;
    font-weight: 300;
    line-height: 1;
    text-decoration: none;
    transition: color 0.2s ease;
  }

  .mobile-personal-nav a.active {
    color: #111;
  }

  .personal-section-title {
    display: none;
  }

  .personal-photo-grid,
  .personal-photo-grid--dense {
    grid-template-columns: repeat(2, 1fr);
  }

  .personal-photo-grid img {
    aspect-ratio: 4 / 5;
  }

  .personal-photo-grid--natural img {
    height: auto;
    aspect-ratio: auto;
    object-fit: contain;
  }

  body.about-mode #feed {
    max-width: none;
    margin-left: auto;
  }

  .about-content {
    max-width: none;
  }
}

@media (min-width: 761px) and (max-width: 980px) {
  body.work-mode #layout,
  body.personal-mode #layout {
    padding-left: 170px;
  }

  #work-sidebar,
  #personal-sidebar {
    width: 160px;
    padding-left: 1.5rem;
  }
}
