/* Index page styles */
body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow-x: hidden;
  background: var(--color-bg);
  transition: background 0.5s ease;
  /* Mirror the topbar's left formula so text & nav share the same left edge */
  padding-left: max(var(--content-padding), calc(50% - var(--content-width) / 2));
  padding-right: max(var(--content-padding), calc(50% - var(--content-width) / 2));
}
main {
  flex: 1;
  padding: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  position: relative;
  z-index: 10;
  pointer-events: none;
}
.intro {
  max-width: 600px;
  margin: 0;
  background: transparent;
  transition: all 0.8s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: auto;
}

/* Toggle */
.chaos-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
  margin-left: var(--space-2);
}
.toggle-track {
  width: 64px;
  height: 32px;
  background: rgba(0, 0, 0, 0.1);
  border: 1px solid var(--color-border);
  border-radius: 999px;
  position: relative;
  transition: all 0.3s ease;
}
.toggle-thumb {
  width: 27px;
  height: 27px;
  background: var(--color-text-subtle);
  border-radius: 50%;
  position: absolute;
  top: 2px;
  left: 2px;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}
.chaos-toggle:hover .toggle-track {
  background: rgba(0, 0, 0, 0.15);
  border-color: var(--color-text-muted);
}
.chaos-toggle:hover .toggle-thumb {
  background: var(--color-text);
}

/* Chaos mode toggle */
body.chaos-mode .toggle-track {
  background: rgba(255, 107, 107, 0.2);
  border-color: #ff6b6b;
}
body.chaos-mode .toggle-thumb {
  background: #ff6b6b;
  transform: translateX(30px);
}

/* Card mode in chaos */
body.chaos-mode .intro {
  position: fixed;
  top: 30px;
  right: var(--space-8);
  width: 320px;
  max-width: calc(100vw - var(--space-12));
  background: #0a0a0a;
  border: 1px solid #333;
  padding: var(--space-6);
  border-radius: var(--radius-lg);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  margin: 0;
  transform-origin: bottom right;
  color: #fff;
  z-index: 100 !important;
  pointer-events: auto;
}
body.chaos-mode .intro * {
  pointer-events: auto;
}
body.chaos-mode .chaos-toggle {
  pointer-events: auto;
  cursor: pointer;
  position: relative;
  z-index: 101;
}
body.chaos-mode .intro p:nth-of-type(2) {
  display: none;
}
body.chaos-mode .nav-links {
  margin-top: var(--space-4);
  gap: var(--space-3);
}
body.chaos-mode .greeting {
  font-size: 1.5rem;
  margin-bottom: var(--space-2);
  color: #fff;
}
body.chaos-mode .lead {
  font-size: 0.9rem;
  margin-bottom: var(--space-3);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  color: #ccc;
}
body.chaos-mode footer {
  display: none;
}
body.chaos-mode .name {
  background: linear-gradient(135deg, #ff0080, #7928ca, #00c6ff);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Standard styles */
.greeting {
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-bottom: var(--space-4);
  line-height: 1.1;
  transition: all 0.5s ease;
}
.name {
  transition: all 0.5s ease;
}
.lead {
  font-size: 1.2rem;
  color: var(--color-text-muted);
  line-height: 1.5;
  margin-bottom: var(--space-4);
  transition: all 0.5s ease;
}
.nav-links {
  margin-top: var(--space-8);
  display: flex;
  gap: var(--space-6);
  flex-wrap: wrap;
}
.nav-links a {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  color: var(--color-text);
  text-decoration: none;
  padding-bottom: 2px;
  border-bottom: 1px solid var(--color-border);
  transition: all 0.2s ease;
}
body.chaos-mode .nav-links a {
  color: #999;
  border-color: #444;
}
.nav-links a:hover {
  color: var(--color-accent);
  border-bottom-color: var(--color-accent);
}
body.chaos-mode .nav-links a:hover {
  color: #fff;
  border-color: #fff;
}
.resume-btn {
  background: var(--color-accent-light);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 2px 10px;
  font-weight: 500;
}
.resume-btn:hover {
  background: var(--color-border);
}
body.chaos-mode .resume-btn {
  background: #222;
  border-color: #555;
}
body.chaos-mode .resume-btn:hover {
  background: #333;
  border-color: #888;
}
.footer {
  padding: var(--space-6) 0;
  text-align: center;
  position: relative;
  z-index: 10;
}
.footer p {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--color-text-subtle);
  margin: 0;
}

.skyline {
  display: flex;
  flex-direction: row;
  align-items: flex-end;
  gap: var(--space-2);
  width: 100%;
  height: clamp(15vh, 27vh, 30vh);
}

.skyline > img {
  height: 100%;
  width: 80%;
  max-width: 100%;
  display: block;
  object-fit: cover;
}

.skyline-stack {
  display: flex;
  flex-direction: column;
  height: 100%;
  justify-content: flex-end;
  gap: 0;
  flex: 1;
  min-width: 0;
}

.skyline-stack img {
  height: 50%;
  width: auto;
  max-width: 100%;
  display: block;
  object-fit: contain;
}

body.chaos-mode .skyline {
  display: none;
}

/* home page carousel */
.home-carousel {
  width: 100%;
  max-width: 900px;
  margin: var(--space-10) auto var(--space-6);
}

.carousel-stage {
  position: relative;
  width: 100%;
  aspect-ratio: 21 / 9;
  overflow: hidden;
  border-radius: var(--radius-lg);
  background: var(--color-border);
}

.carousel-frame {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 0.8s ease;
}

.carousel-frame.active {
  opacity: 1;
}

.carousel-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.carousel-pips {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: var(--space-4);
}

.carousel-pip {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--color-border);
  transition: all 0.3s ease;
  cursor: pointer;
}

.carousel-pip.on {
  background: var(--color-text);
  width: 18px;
  border-radius: 3px;
}

@media (max-width: 768px) {
  /* keep intro normal on mobile even in chaos mode — widgets are hidden anyway */
  body.chaos-mode .intro {
    position: static;
    width: auto;
    max-width: 100%;
    top: auto;
    right: auto;
    background: transparent;
    border: none;
    padding: 0;
    border-radius: 0;
    box-shadow: none;
    color: var(--color-text);
    transform: none;
  }
  body.chaos-mode .greeting {
    font-size: clamp(2rem, 5vw, 3rem);
    color: var(--color-text);
  }
  body.chaos-mode .lead {
    font-size: 1.2rem;
    -webkit-line-clamp: unset;
    color: var(--color-text-muted);
  }
  body.chaos-mode .nav-links {
    gap: var(--space-6);
  }
  body.chaos-mode .nav-links a {
    color: var(--color-text);
    border-color: var(--color-border);
  }

  /* widgets still hidden on mobile */
  .widget-pong,
  .widget-music {
    display: none;
  }

.skyline {
    height: 20vh;
  }
  .skyline > img {
    width: 70%;
  }

  .home-carousel {
    margin: var(--space-8) 0 var(--space-4);
  }
  .carousel-stage {
    aspect-ratio: 21/9;
  }
  .carousel-pips {
    margin-top: var(--space-3);
  }
}
