@import url("layout.css");

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

html,
body {
  margin: 0;
  padding: 0;
}

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

/* =========================
   Theme + Typography
========================= */
:root {
  --bg-1: #121935; /* lighter midnight navy */
  --bg-2: #090d1b; /* dark midnight navy */
  --bg-3: #090d1b; /* dark midnight navy */
  --line: rgba(255, 255, 255, 0.18);
  --mist: rgba(255, 255, 255, 0.78);
  --card: rgba(255, 255, 255, 0.1);
  --card-strong: rgba(255, 255, 255, 0.16);

  --font-main: "Instrument Sans", sans-serif;
  --font-accent: "Oxygen Mono", monospace;
}

body {
  min-height: 100vh;
  overflow: hidden;
  color: var(--mist);
  font-family: var(--font-main);
  line-height: 1.6;
  background:
    radial-gradient(
      ellipse 68% 48% at 52% 10%,
      rgba(34, 47, 96, 0.72) 0%,
      rgba(28, 39, 83, 0.46) 38%,
      transparent 72%
    ),
    radial-gradient(
      ellipse 52% 42% at 12% 90%,
      rgba(31, 48, 105, 0.52) 0%,
      rgba(18, 25, 53, 0.24) 44%,
      transparent 76%
    ),
    radial-gradient(
      circle at 88% 66%,
      rgba(42, 57, 116, 0.28) 0%,
      transparent 36%
    ),
    radial-gradient(
      ellipse 38% 32% at 70% 46%,
      rgba(62, 24, 108, 0.26) 0%,
      transparent 62%
    ),
    radial-gradient(
      ellipse 28% 38% at 26% 60%,
      rgba(18, 50, 108, 0.28) 0%,
      transparent 58%
    ),
    radial-gradient(
      ellipse 18% 18% at 54% 78%,
      rgba(46, 34, 92, 0.20) 0%,
      transparent 52%
    ),
    linear-gradient(180deg, var(--bg-1) 0%, var(--bg-2) 58%, var(--bg-3) 100%);
}

h1, h2, h3, h4, h5, h6,
p {
  margin: 0;
  font-weight: 400;
  font-family: var(--font-main);
}

a {
  color: inherit;
  text-decoration: none;
  transition: color 0.3s ease;
}

/* SVG fractal-noise tile inside the canvas stacking context so it can't overlay UI chrome */
main#projectCanvas::before,
.about-main::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.18;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='4' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 200px 200px;
  background-repeat: repeat;
}

/* =========================
   Header / Nav Pill
========================= */
header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 20;
  height: 90px;
  pointer-events: none;
}

.nav-pill {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
  backdrop-filter: blur(18px);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.18);
  pointer-events: auto;
  transition: background 380ms ease, backdrop-filter 380ms ease, box-shadow 380ms ease;
}

.nav-identity {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  text-decoration: none;
  flex-shrink: 0;
}

.profile-pic {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid rgba(255, 255, 255, 0.25);
  flex-shrink: 0;
}

.nav-name {
  font-family: var(--font-accent);
  font-size: 0.8rem;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  white-space: nowrap;
}

.nav-separator {
  width: 1px;
  height: 18px;
  background: var(--line);
  flex-shrink: 0;
}

.nav-pill ul {
  list-style: none;
  display: flex;
  gap: 4px;
}

.nav-pill ul a {
  position: relative;
  padding: 0 10px;
  font-family: var(--font-accent);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(255, 255, 255, 0.72);
  transition: color 280ms ease;
  white-space: nowrap;
}

.nav-pill ul a::before,
.nav-pill ul a::after {
  position: absolute;
  top: 50%;
  font-family: var(--font-accent);
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.9);
  opacity: 0;
  filter: blur(4px) brightness(2);
  transition: opacity 280ms ease, filter 280ms ease, transform 280ms ease;
  pointer-events: none;
}

.nav-pill ul a::before {
  content: '[';
  left: 0;
  transform: translateY(-50%) translateX(4px);
}

.nav-pill ul a::after {
  content: ']';
  right: 0;
  transform: translateY(-50%) translateX(-4px);
}

.nav-pill ul a:hover,
.nav-pill ul a[aria-current="page"] {
  color: #fff;
}

.nav-pill ul a:hover::before,
.nav-pill ul a[aria-current="page"]::before {
  opacity: 1;
  filter: blur(0) brightness(1);
  transform: translateY(-50%) translateX(0);
}

.nav-pill ul a:hover::after,
.nav-pill ul a[aria-current="page"]::after {
  opacity: 1;
  filter: blur(0) brightness(1);
  transform: translateY(-50%) translateX(0);
}

/* =========================
   Canvas + Nodes
========================= */
main#projectCanvas {
  position: relative;
  width: 100vw;
  height: 100vh;
  padding-top: 90px;
  isolation: isolate;
}

.node {
  position: absolute;
  left: var(--x);
  top: var(--y);
  transform: translate(-50%, -50%);
  z-index: 2;
}

.node-label {
  position: absolute;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%) translateY(0);
  text-align: center;
  pointer-events: none;
  white-space: nowrap;
  z-index: 1;
  opacity: 1;
  transition: opacity 220ms ease, transform 220ms ease;
}

.node-label-title {
  font-family: var(--font-main);
  font-size: 16px;
  line-height: 1.2;
  color: #fff;
}

.node-label-tags {
  margin-top: 3px;
  font-family: var(--font-accent);
  font-size: 12px;
  line-height: 1.2;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.78);
}

.node-btn {
  position: relative;
  width: 16px;
  height: 16px;
  border: 1px solid rgba(255, 255, 255, 0.62);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.2);
  cursor: pointer;
  touch-action: none;
  transition: transform 180ms ease, box-shadow 180ms ease, background 180ms ease;
}

.node-btn:hover,
.node-btn:focus-visible {
  transform: scale(1.12);
  background: rgba(255, 255, 255, 0.34);
  box-shadow: 0 0 0 6px rgba(255, 255, 255, 0.12);
  outline: none;
}

.node:hover .node-btn,
.node:focus-within .node-btn {
  /* delay matches transition duration so animation picks up where the transition left off */
  animation: star-pulse 2s ease-in-out 180ms infinite;
  outline: none;
}

/* Hover card — portalled to body so position: fixed escapes overflow: hidden */
.node-card {
  position: fixed;
  z-index: 15;
  transform: translateY(8px);
  width: 500px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(9, 13, 30, 0.88);
  backdrop-filter: blur(16px);
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  transition: opacity 220ms ease, transform 220ms ease;
  white-space: normal;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.38);
}

.node-card-media {
  width: 100%;
  height: 269px;
  background: linear-gradient(180deg, #121a36 0%, #121a33 100%);
  background-size: cover;
  background-position: center;
}

.node-card-content {
  padding: 24px;
  background: rgba(6, 9, 22, 0.52);
}

.node-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.node-card .name,
.mobile-card .name {
  margin: 0;
  font-family: var(--font-main);
  font-size: 20px;
  font-weight: 400;
  line-height: 1.2;
  color: #fff;
}

.node-card .desc,
.mobile-card .desc {
  margin: 0;
  font-family: var(--font-main);
  font-size: 16px;
  font-weight: 400;
  line-height: 1.2;
  color: rgba(255, 255, 255, 0.92);
}

.node-card .tag-pill,
.mobile-card .tag-pill {
  margin: 0;
  display: inline-block;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: transparent;
  white-space: nowrap;

  font-family: var(--font-accent);
  font-size: 12px;
  font-weight: 400;
  line-height: 1;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.95);
}

.node-card.node-card--visible {
  opacity: 1;
  transform: translateY(0);
}

/* Entrance slides up from below when card is above the node */
.node-card.node-card--below {
  transform: translateY(-8px);
}

.node-card.node-card--below.node-card--visible {
  transform: translateY(0);
}

.node:hover .node-label,
.node:focus-within .node-label {
  opacity: 0;
  transform: translateX(-50%) translateY(-6px);
}

/* =========================
   Weather card
========================= */
.weather-card {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 25;
  width: max-content;
  max-width: calc(100vw - 32px);
  padding: 8px 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
  backdrop-filter: blur(18px);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.18);
  transition: background 380ms ease, backdrop-filter 380ms ease, box-shadow 380ms ease;
}

#weatherStatus {
  margin: 0;
  font-family: var(--font-accent);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.78);
  white-space: nowrap;
  line-height: 1;
}

.clock-widget {
  position: fixed;
  left: 16px;
  bottom: 16px;
  z-index: 25;
  padding: 8px 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
  backdrop-filter: blur(18px);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.18);
  transition: background 380ms ease, backdrop-filter 380ms ease, box-shadow 380ms ease;
  font-family: var(--font-accent);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.78);
  white-space: nowrap;
  line-height: 1;
}

/* =========================
   Modal
========================= */
.modal {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.46);
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease;
}

.modal.open {
  opacity: 1;
  pointer-events: auto;
}

.modal-panel {
  width: min(560px, calc(100vw - 28px));
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(11, 29, 42, 0.94);
  backdrop-filter: blur(10px);
  padding: 24px;
}

.modal-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 16px;
}

.modal-title {
  margin: 0;
  font-family: var(--font-main);
  font-size: 24px;
  font-weight: 400;
  line-height: 1.2;
  color: #fff;
}

.modal-tag {
  margin: 6px 0 0;
  display: inline-block;
  padding: 8px 12px;
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 16px;
  background: transparent;

  font-family: var(--font-accent);
  font-size: 12px;
  font-weight: 400;
  line-height: 1;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.78);
}

.modal-desc {
  margin: 0;
  font-family: var(--font-main);
  font-size: 16px;
  font-weight: 400;
  line-height: 1.2;
  color: rgba(255, 255, 255, 0.86);
}

.modal-close {
  border: 1px solid var(--line);
  background: transparent;
  color: #fff;
  border-radius: 10px;
  padding: 6px 10px;
  cursor: pointer;
  font: inherit;
}

/* =========================
   Motion + Responsive
========================= */
@keyframes float {
  0%, 100% { transform: translateY(-2px); }
  50% { transform: translateY(6px); }
}

@keyframes star-pulse {
  0%, 100% {
    transform: scale(1.12);
    background: rgba(255, 255, 255, 0.34);
    box-shadow:
      0 0 6px 2px rgba(255, 255, 255, 0.30),
      0 0 0 6px rgba(255, 255, 255, 0.12);
  }
  50% {
    transform: scale(1.32);
    background: rgba(255, 255, 255, 0.60);
    box-shadow:
      0 0 18px 6px rgba(255, 255, 255, 0.55),
      0 0 0 13px rgba(255, 255, 255, 0.16);
  }
}

/* =========================
   About page
========================= */
body.page-about {
  overflow-y: auto;
}

.about-main {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 100px 24px 60px;
}

.about-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  max-width: 420px;
  width: 100%;
  text-align: center;
}

.about-photo {
  width: 160px;
  height: 160px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--line);
  margin-bottom: 8px;
}

.about-greeting {
  font-family: var(--font-accent);
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: #fff;
}

.about-tagline {
  font-family: var(--font-accent);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(255, 255, 255, 0.55);
  line-height: 1.5;
}

.about-bio {
  font-family: var(--font-main);
  font-size: 1rem;
  line-height: 1.75;
  color: var(--mist);
  margin-top: 8px;
  text-align: left;
}

.about-link {
  align-self: flex-start;
  position: relative;
  padding: 0;
  font-family: var(--font-accent);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(255, 255, 255, 0.72);
  transition: color 280ms ease;
}

.about-link::before,
.about-link::after {
  position: absolute;
  top: 50%;
  font-family: var(--font-accent);
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.9);
  opacity: 0;
  filter: blur(4px) brightness(2);
  transition: opacity 280ms ease, filter 280ms ease, transform 280ms ease;
  pointer-events: none;
}

.about-link::before {
  content: '[';
  left: -10px;
  transform: translateY(-50%) translateX(-4px);
}

.about-link::after {
  content: ']';
  right: -10px;
  transform: translateY(-50%) translateX(4px);
}

.about-link:hover {
  color: #fff;
}

.about-link:hover::before {
  opacity: 1;
  filter: blur(0) brightness(1);
  transform: translateY(-50%) translateX(0);
}

.about-link:hover::after {
  opacity: 1;
  filter: blur(0) brightness(1);
  transform: translateY(-50%) translateX(0);
}

/* =========================
   Mobile project stack
========================= */
.mobile-stack {
  display: none;
  flex-direction: column;
  gap: 20px;
  padding: 100px 16px 48px;
  max-width: 500px;
  margin: 0 auto;
  min-height: 100vh;
}

.mobile-card {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(9, 13, 30, 0.88);
  backdrop-filter: blur(16px);
  overflow: hidden;
  cursor: pointer;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.38);
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 480ms ease, transform 480ms ease, box-shadow 200ms ease;
}

.mobile-card--visible {
  opacity: 1;
  transform: translateY(0);
}

.mobile-card .node-card-media {
  height: auto; /* let the img drive the height so ratio is preserved */
}

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

/* Fast press response overrides the slow entrance transition */
.mobile-card:active {
  transform: scale(0.97);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.26);
  transition: transform 100ms ease, box-shadow 100ms ease;
}

@media (max-width: 720px) {
  header {
    padding: 10px 16px;
  }

  body {
    overflow-y: auto;
    overflow-x: hidden;
  }

  main#projectCanvas {
    display: none;
  }

  .mobile-stack {
    display: flex;
  }

  /* Darken nav + weather when scrolled over lighter card content */
  .nav-pill.nav-scrolled {
    background: rgba(8, 12, 28, 0.82);
    backdrop-filter: blur(22px);
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.42);
  }

  .weather-card.card-scrolled {
    background: rgba(8, 12, 28, 0.78);
    backdrop-filter: blur(22px);
  }

  .clock-widget.card-scrolled {
    background: rgba(8, 12, 28, 0.78);
    backdrop-filter: blur(22px);
  }

  .clock-widget {
    left: 10px;
    bottom: 10px;
    border-radius: 12px;
    line-height: 1.5;
  }

  /* Full-width pill: pin pic left, nav links right — eliminates overflow by design */
  .nav-name {
    display: none;
  }

  .nav-pill {
    left: 12px;
    right: 12px;
    transform: translateY(-50%);
    width: auto;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 16px;
  }

  .nav-separator {
    display: none;
  }

  .nav-pill ul {
    gap: 4px;
  }

  .nav-pill ul a {
    font-size: 0.78rem;
    letter-spacing: 0.06em;
    padding: 0 5px;
  }

  .profile-pic {
    width: 32px;
    height: 32px;
  }

  /* Stack weather info vertically on narrow screens */
  .weather-card {
    right: 10px;
    bottom: 10px;
    max-width: calc(100vw - 20px);
    border-radius: 16px;
  }

  #weatherStatus {
    white-space: normal;
    max-width: 180px;
    text-align: center;
    line-height: 1.6;
  }

  .node-card {
    width: min(500px, calc(100vw - 32px));
  }

  .mobile-card .desc {
    font-size: 14px;
    line-height: 1.5;
  }
}

/* Network connection layer: sits behind .node elements */
.connection-layer {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}

.edge {
  fill: none;
  stroke: rgba(255, 255, 255, 0.95);
  stroke-linecap: round;
  stroke-width: 2;
  stroke-dasharray: 0 14;
  opacity: 0.55;
  animation: dash-flow 1s linear infinite;
}

@keyframes dash-flow {
  to {
    stroke-dashoffset: -14;
  }
}

/* =========================
   Page transitions
========================= */
body {
  animation: page-enter 550ms ease-out both;
}

body.page-exiting {
  animation: page-exit 220ms ease-in forwards;
  pointer-events: none;
}

/* Shimmer on html so it renders above body and isn't dimmed by body's opacity */
html::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: rgba(160, 200, 255, 0.05);
  pointer-events: none;
  animation: page-shimmer 700ms ease-out both;
}

@keyframes page-enter {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes page-exit {
  from { opacity: 1; }
  to   { opacity: 0; }
}

@keyframes page-shimmer {
  0%   { opacity: 1; }
  100% { opacity: 0; }
}