/* ==========================================================================
   Pangram Pangram Dual-Font Setup: PP Neue Montreal + PP Kyoto
   Automatically picks up locally installed fonts OR files placed in ./fonts/
   Falls back seamlessly to Plus Jakarta Sans + Instrument Serif.
   ========================================================================== */

@font-face {
  font-family: "PP Neue Montreal";
  src:
    local("PP Neue Montreal Book"),
    local("PP Neue Montreal Regular"),
    local("PP Neue Montreal"),
    url("./fonts/PPNeueMontreal-Regular.woff2") format("woff2"),
    url("./fonts/PPNeueMontreal-Regular.otf") format("opentype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "PP Neue Montreal";
  src:
    local("PP Neue Montreal Medium"),
    url("./fonts/PPNeueMontreal-Medium.woff2") format("woff2"),
    url("./fonts/PPNeueMontreal-Medium.otf") format("opentype");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "PP Neue Montreal";
  src:
    local("PP Neue Montreal Bold"),
    url("./fonts/PPNeueMontreal-Bold.woff2") format("woff2"),
    url("./fonts/PPNeueMontreal-Bold.otf") format("opentype");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "PP Kyoto";
  src:
    local("PP Kyoto Regular"),
    local("PP Kyoto"),
    url("./fonts/PPKyoto-Regular.woff2") format("woff2"),
    url("./fonts/PPKyoto-Regular.otf") format("opentype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "PP Kyoto";
  src:
    local("PP Kyoto Medium"),
    url("./fonts/PPKyoto-Medium.woff2") format("woff2"),
    url("./fonts/PPKyoto-Medium.otf") format("opentype");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

/* ==========================================================================
   Design Tokens: Flat White, Solid Black, Secret Creator Offset (φ-derived)
   ========================================================================== */

:root {
  --bg: #ffffff;
  --ink: #000000;
  --surface-blob: #e6e6e6;

  --font-montreal: "PP Neue Montreal", "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif;
  --font-kyoto: "PP Kyoto", "Instrument Serif", Georgia, serif;

  /* Secret golden-ratio offsets (only perceptible to the creator):
     left = (1 - 1/φ) * 100vw          = 38.1966vw
     top  = (0.5 - (1 - 1/φ)) * 100vh  = 11.8034vh */
  --offset-x: 38.1966vw;
  --offset-y: clamp(44px, 11.8034vh, 118px);
  --measure: min(490px, 50vw);
}

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

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background-color: var(--bg);
  color: var(--ink);
  font-family: var(--font-montreal);
  font-size: 15.5px;
  line-height: 1.56;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  position: relative;
  overflow-x: hidden;
}

::selection {
  background: #000000;
  color: #ffffff;
}

/* ==========================================================================
   Background Biased Random Walk + Hover Project Preview Stage
   ========================================================================== */

#walk-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

#trail-stage {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  overflow: hidden;
}

.trail-card {
  position: absolute;
  width: 248px;
  background: var(--bg);
  border: 1px solid var(--ink);
  border-radius: 0;
  padding: 6px;
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.97);
  transition:
    opacity 240ms cubic-bezier(0.22, 1, 0.36, 1),
    transform 280ms cubic-bezier(0.22, 1, 0.36, 1);
  will-change: opacity, transform;
}

.trail-card.is-visible {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.trail-card.is-fading {
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.97);
}

.trail-media {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 10;
  background: var(--bg);
  overflow: hidden;
}

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

.trail-media img.is-contain {
  object-fit: contain;
  background: #f5f5f3;
}

.trail-media img.is-pan {
  animation: slowDrift 9s ease-in-out infinite alternate;
}

@keyframes slowDrift {
  from {
    transform: scale(1.03) translate(0%, 0%);
  }
  to {
    transform: scale(1.1) translate(-2%, -2%);
  }
}

.trail-label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  margin-top: 6px;
  padding: 0 2px;
  font-family: var(--font-kyoto);
  font-size: 13px;
  letter-spacing: 0.01em;
  color: var(--ink);
}

.trail-label strong {
  font-family: var(--font-montreal);
  font-weight: 500;
  font-size: 11.5px;
  color: var(--ink);
}

.trail-label span {
  font-style: normal;
  color: var(--ink);
  font-size: 13px;
}

/* ==========================================================================
   Main Editorial Column
   ========================================================================== */

.page {
  position: relative;
  z-index: 2;
  width: var(--measure);
  margin-left: var(--offset-x);
  padding-top: var(--offset-y);
  padding-bottom: 72px;
}

.hero {
  margin-bottom: 22px;
}

.name {
  margin: 0;
  font-family: var(--font-montreal);
  font-weight: 700;
  font-size: clamp(2.55rem, 4.35vw, 3.65rem);
  line-height: 0.98;
  letter-spacing: -0.042em;
  color: var(--ink);
}

/* Blurb */
.blurb {
  margin-bottom: 24px;
}

.blurb p {
  margin: 0 0 13px;
  color: var(--ink);
  font-weight: 400;
  letter-spacing: -0.008em;
}

.blurb p:last-child {
  margin-bottom: 0;
}

/* PP Kyoto upright editorial accents */
.kyoto {
  font-family: var(--font-kyoto);
  font-style: normal;
  font-weight: 400;
  font-size: 1.14em;
  letter-spacing: 0.004em;
  color: var(--ink);
}

/* Solid black links */
a {
  color: var(--ink);
  text-decoration: none;
  background-image: linear-gradient(var(--ink), var(--ink));
  background-repeat: no-repeat;
  background-position: 0 100%;
  background-size: 100% 1px;
  padding-bottom: 1px;
  transition: opacity 160ms ease, background-size 200ms ease;
}

.blurb a:hover {
  opacity: 0.65;
}

/* ==========================================================================
   Image & Video Carousel
   ========================================================================== */

.carousel-section {
  margin: 26px 0 32px;
}

.carousel {
  outline: none;
}

.carousel-viewport {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9.4;
  background: var(--surface-blob);
  border-radius: 0;
  overflow: hidden;
  user-select: none;
  border: 1px solid var(--ink);
}

.carousel-track {
  display: flex;
  width: 100%;
  height: 100%;
  transition: transform 520ms cubic-bezier(0.22, 1, 0.36, 1);
  will-change: transform;
}

.carousel-slide {
  flex: 0 0 100%;
  width: 100%;
  height: 100%;
  margin: 0;
  position: relative;
  background: var(--surface-blob);
}

.carousel-slide img,
.carousel-slide video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 650ms cubic-bezier(0.22, 1, 0.36, 1);
}

.carousel-viewport:hover .carousel-slide.is-active img {
  transform: scale(1.012);
}

/* Invisible left / right click zones for effortless navigation */
.carousel-hit {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 44%;
  border: 0;
  padding: 0;
  background: transparent;
  cursor: pointer;
  z-index: 2;
}

.carousel-hit--prev {
  left: 0;
  cursor: w-resize;
}

.carousel-hit--next {
  right: 0;
  cursor: e-resize;
}

.carousel-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 9px;
  color: var(--ink);
}

.carousel-caption {
  font-family: var(--font-kyoto);
  font-style: normal;
  font-size: 14.5px;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.carousel-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.carousel-nav-btn {
  appearance: none;
  border: 1px solid var(--ink);
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-montreal);
  font-size: 13px;
  line-height: 1;
  width: 28px;
  height: 24px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 140ms ease, color 140ms ease;
}

.carousel-nav-btn:hover {
  background: var(--ink);
  color: var(--bg);
}

/* ==========================================================================
   Projects List (Solid Black Rules + Montreal / Kyoto Pairing)
   ========================================================================== */

.projects {
  margin-bottom: 28px;
}

.section-label {
  margin: 0 0 12px;
  font-family: var(--font-montreal);
  font-style: normal;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.1;
  color: var(--ink);
}

.project-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--ink);
}

.project-item {
  display: grid;
  grid-template-columns: 126px 1fr;
  gap: 14px;
  align-items: baseline;
  padding: 10px 0;
  border-bottom: 1px solid var(--ink);
  transition: opacity 160ms ease;
}

.project-list:hover .project-item {
  opacity: 0.35;
}

.project-list:hover .project-item:hover {
  opacity: 1;
}

.project-name {
  font-family: var(--font-montreal);
  font-weight: 600;
  font-size: 14.5px;
  letter-spacing: -0.015em;
  width: fit-content;
  background-size: 0% 1px;
}

.project-item:hover .project-name {
  background-size: 100% 1px;
}

.project-desc {
  font-size: 14px;
  color: var(--ink);
  line-height: 1.45;
}

.project-desc .inline-sub {
  color: var(--ink);
}

.award {
  display: inline-block;
  margin-left: 6px;
  font-family: var(--font-kyoto);
  font-size: 14.5px;
  color: var(--ink);
}

.award .kyoto {
  font-size: 1em;
}

/* ==========================================================================
   Hackatime Heatmap
   ========================================================================== */

.heatmap-section {
  margin: 0 0 26px;
}

.heatmap-link {
  display: block;
  background-image: none;
  padding-bottom: 0;
}

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

/* ==========================================================================
   Footer Links
   ========================================================================== */

.links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  font-family: var(--font-montreal);
  font-size: 14.5px;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.links a {
  background-size: 0% 1px;
}

.links a:hover {
  background-size: 100% 1px;
}

.links .sep {
  color: var(--ink);
  user-select: none;
}

/* ==========================================================================
   Responsive Adjustments
   ========================================================================== */

@media (max-width: 960px) {
  :root {
    --offset-x: clamp(20px, 7vw, 64px);
    --offset-y: clamp(40px, 8vh, 72px);
    --measure: min(560px, calc(100vw - 2 * var(--offset-x)));
  }

  #trail-stage {
    display: none;
  }
}

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

@media (prefers-reduced-motion: reduce) {
  .carousel-track,
  .trail-card,
  .carousel-slide img {
    transition: none;
    animation: none;
  }
}
