/* ========================================
   Halfwoods - Dark aesthetic with smooth animations
   Inspired by blueyard.com
   ======================================== */

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

/* ========================================
   Skip Link (Accessibility)
   ======================================== */

.skip-link {
  position: absolute;
  top: -100px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--fg);
  color: var(--bg);
  padding: 0.75rem 1.5rem;
  text-decoration: none;
  font-family: var(--heading);
  font-size: 0.85rem;
  z-index: 9999;
  border-radius: 2px;
  transition: top 0.2s ease;
}

.skip-link:focus {
  top: 1rem;
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

:root {
  --bg: #0a0a0a;
  --fg: #e8e8e8;
  --fg-dim: #888;
  --fg-dimmer: #555;
  --border: #2a2a2a;
  --heading: 'Outfit', -apple-system, system-ui, sans-serif;
  --sans: 'Outfit', -apple-system, system-ui, sans-serif;

  /* Section accent colors */
  --accent-home: #e8e8e8;
  --accent-about: #d4a574;
  --accent-writing: #e07a5f;
  --accent-photos: #6b9b6b;
  --accent-videos: #7c6bbf;
  --accent-contact: #5f9ea0;

  /* Current page accent (default) */
  --accent: var(--accent-home);
}

/* Page-specific accent colors */
body.page-home { --accent: var(--accent-home); }
body.page-about { --accent: var(--accent-about); }
body.page-writing { --accent: var(--accent-writing); }
body.page-photos { --accent: var(--accent-photos); }
body.page-videos { --accent: var(--accent-videos); }
body.page-contact { --accent: var(--accent-contact); }

html {
  height: 100%;
}

body {
  min-height: 100%;
  font-family: var(--sans);
  background: var(--bg);
  color: var(--fg);
  line-height: 1.6;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* Smooth scroll for Lenis */
html.lenis, html.lenis body {
  height: auto;
}

.lenis.lenis-smooth {
  scroll-behavior: auto !important;
}

.lenis.lenis-smooth [data-lenis-prevent] {
  overscroll-behavior: contain;
}

.lenis.lenis-stopped {
  overflow: hidden;
}

.lenis.lenis-scrolling iframe {
  pointer-events: none;
}

/* ========================================
   Canvas Background
   ======================================== */

#generative-bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
}

::selection {
  background: var(--fg);
  color: var(--bg);
}

/* ========================================
   Loading Screen
   ======================================== */

.loader {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  transition: opacity 0.5s ease, visibility 0.5s ease;
}

.loader.loaded {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.loader-text {
  font-family: var(--heading);
  font-size: 1.2rem;
  color: var(--fg);
  text-transform: lowercase;
  letter-spacing: 0.1em;
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}

/* ========================================
   Floating Navigation
   ======================================== */

.nav-floating {
  position: fixed;
  bottom: 3rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 2.5rem;
  padding: 1rem 2rem;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 2px;
  z-index: 100;
}

.nav-floating a {
  color: var(--fg-dim);
  text-decoration: none;
  font-family: var(--heading);
  font-size: 0.8rem;
  letter-spacing: 0.05em;
  text-transform: lowercase;
  position: relative;
  transition: color 0.2s ease;
}

.nav-floating a::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 1px;
  background: var(--fg);
  transition: width 0.3s ease;
}

.nav-floating a:hover {
  color: #fff;
}

.nav-floating a:hover::after {
  width: 100%;
}

/* Nav accent colors on hover */
.nav-floating a[href="index.html"]:hover::after,
.nav-floating a[href="/"]:hover::after { background: var(--accent-home); }
.nav-floating a[href="about.html"]:hover::after { background: var(--accent-about); }
.nav-floating a[href="writing.html"]:hover::after { background: var(--accent-writing); }
.nav-floating a[href="photos.html"]:hover::after { background: var(--accent-photos); }
.nav-floating a[href="videos.html"]:hover::after { background: var(--accent-videos); }
.nav-floating a[href="contact.html"]:hover::after { background: var(--accent-contact); }

/* Active nav state */
.nav-floating a.active {
  color: var(--fg);
}

.nav-floating a.active::after {
  width: 100%;
  background: var(--accent);
}

/* ========================================
   Page Transitions
   ======================================== */

.page-transition {
  opacity: 0;
  transform: translateY(20px);
}

.page-transition.visible {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

/* ========================================
   Homepage
   ======================================== */

.home-hero {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 1;
}

.home-title {
  font-family: var(--heading);
  font-size: clamp(2.5rem, 8vw, 5rem);
  font-weight: 400;
  text-transform: lowercase;
  letter-spacing: 0.1em;
  opacity: 0;
  transform: translateY(30px);
}

.home-title.animate {
  animation: fadeSlideUp 0.8s ease forwards;
  animation-delay: 0.3s;
}

.home-tagline {
  font-family: var(--sans);
  font-size: 1rem;
  color: var(--fg-dim);
  margin-top: 1rem;
  opacity: 0;
  transform: translateY(20px);
}

.home-tagline.animate {
  animation: fadeSlideUp 0.8s ease forwards;
  animation-delay: 0.5s;
}

@keyframes fadeSlideUp {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ========================================
   Content Pages
   ======================================== */

.page {
  min-height: 100vh;
  padding: 6rem 2rem 8rem;
  max-width: 700px;
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

.page-header {
  margin-bottom: 3rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.page-title {
  font-family: var(--heading);
  font-size: 1.5rem;
  font-weight: 400;
  color: var(--accent);
}

.page-back {
  display: inline-block;
  color: var(--fg-dim);
  text-decoration: none;
  font-size: 0.85rem;
  font-family: var(--heading);
  margin-bottom: 1rem;
  transition: color 0.2s ease, transform 0.2s ease;
}

.page-back:hover {
  color: var(--fg);
  transform: translateX(-4px);
}

.post-date {
  display: block;
  font-family: var(--heading);
  font-size: 0.85rem;
  color: var(--fg-dimmer);
  margin-top: 0.5rem;
}

/* Animation classes for entrance */
.animate-in {
  opacity: 0;
  transform: translateY(40px);
}

.animate-in.visible {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

/* Staggered children animation */
.stagger-children > * {
  opacity: 0;
  transform: translateY(30px);
}

.stagger-children.visible > * {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

/* ========================================
   About Page
   ======================================== */

.page-content p {
  margin-bottom: 1.5rem;
  color: var(--fg);
  font-weight: 300;
  font-size: 1.05rem;
  line-height: 1.75;
}

.page-content a {
  color: var(--fg);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: var(--accent);
  transition: text-decoration-color 0.15s ease;
}

.page-content a:hover {
  text-decoration-color: var(--fg);
}

/* Empty state message */
.empty-state {
  color: var(--fg-dim);
  font-style: italic;
}

/* ========================================
   Writing List
   ======================================== */

.writing-list {
  list-style: none;
  margin-top: 1rem;
}

.writing-list li {
  padding: 1.5rem 0;
  border-bottom: 1px solid var(--border);
  position: relative;
  transition: padding-left 0.3s ease;
}

.writing-list li:first-child {
  border-top: 1px solid var(--border);
}

.writing-list li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  width: 0;
  height: 100%;
  background: var(--accent-writing);
  transition: width 0.3s ease;
}

.writing-list li:hover {
  padding-left: 1rem;
}

.writing-list li:hover::before {
  width: 3px;
}

.writing-list a {
  text-decoration: none;
  display: block;
}

.writing-list h3 {
  font-weight: 400;
  font-size: 1.1rem;
  margin-bottom: 0.25rem;
  color: var(--fg);
  transition: color 0.2s ease;
}

.writing-list a:hover h3 {
  color: #fff;
}

.writing-list .date {
  font-size: 0.8rem;
  color: var(--fg-dimmer);
  font-family: var(--heading);
}

/* ========================================
   Photos Landing - Clean Gallery Links
   ======================================== */

.photo-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 2rem;
}

.photo-card {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem 2rem;
  background: var(--bg);
  border: 1px solid var(--border);
  text-decoration: none;
  transition: all 0.25s ease;
}

.photo-card:hover {
  border-color: var(--accent-photos);
  background: rgba(107, 155, 107, 0.05);
}

.photo-card-title {
  font-family: var(--heading);
  font-size: 1.1rem;
  font-weight: 400;
  color: var(--fg);
  letter-spacing: 0.05em;
  text-transform: lowercase;
  transition: color 0.25s ease;
}

.photo-card:hover .photo-card-title {
  color: var(--accent-photos);
}

.photo-card-arrow {
  display: none;
}

/* ========================================
   Photo Gallery (Full-screen scroll)
   ======================================== */

.gallery-back {
  position: fixed;
  top: 2rem;
  left: 2rem;
  color: var(--fg-dim);
  text-decoration: none;
  font-family: var(--heading);
  font-size: 0.85rem;
  z-index: 50;
  padding: 0.5rem 1rem;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-radius: 2px;
  transition: color 0.2s ease, background 0.2s ease;
}

.gallery-back:hover {
  color: var(--fg);
  background: rgba(0, 0, 0, 0.7);
}

.photo-scroll {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10vh 2rem 8rem;
  gap: 15vh;
  position: relative;
  z-index: 1;
}

.photo-scroll img {
  width: 80vw;
  max-width: 1400px;
  height: auto;
  display: block;
  opacity: 1;
  transform: scale(1);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

/* Animation enhancement - images start visible, animate if JS runs */
.photo-scroll.animated img {
  opacity: 0;
  transform: scale(0.95);
}

.photo-scroll.animated img.visible {
  opacity: 1;
  transform: scale(1);
}

/* ========================================
   Video Grid
   ======================================== */

.video-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
  margin-top: 2rem;
}

.video-item {
  aspect-ratio: 16/9;
  background: #111;
  border: 1px solid var(--border);
  border-radius: 2px;
  overflow: hidden;
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.5s ease, transform 0.5s ease, border-color 0.3s ease;
}

.video-item.visible {
  opacity: 1;
  transform: translateY(0);
}

.video-item:hover {
  border-color: var(--accent-videos);
}

.video-item iframe {
  width: 100%;
  height: 100%;
  border: none;
}

.video-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--fg-dimmer);
  font-family: var(--heading);
  font-size: 0.9rem;
}

/* ========================================
   Contact Links
   ======================================== */

.contact-links {
  display: flex;
  flex-direction: column;
  margin-top: 1rem;
  border-top: 1px solid var(--border);
}

.contact-link {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.25rem 0;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  color: var(--fg);
  font-size: 1rem;
  transition: padding-left 0.3s ease, color 0.2s ease;
}

.contact-link:hover {
  padding-left: 0.75rem;
  color: #fff;
}

.contact-link span:last-child {
  color: var(--fg-dim);
  font-family: var(--heading);
  font-size: 0.9rem;
  transition: transform 0.3s ease, color 0.3s ease;
}

.contact-link:hover span:last-child {
  transform: translateX(4px);
  color: var(--accent-contact);
}

/* ========================================
   Responsive - Mobile
   ======================================== */

@media (max-width: 600px) {
  body {
    font-size: 14px;
  }

  .nav-floating {
    bottom: 1rem;
    gap: 1rem;
    padding: 0.75rem 1rem;
  }

  .nav-floating a {
    font-size: 0.7rem;
  }

  .page {
    padding: 4rem 1.5rem 6rem;
  }

  .page-title {
    font-size: 1.25rem;
  }

  .photo-scroll {
    padding: 6vh 1rem 6rem;
    gap: 10vh;
  }

  .photo-scroll img {
    width: 95vw;
  }

  .photo-cards {
    grid-template-columns: 1fr;
  }

  .photo-card {
    padding: 2.5rem 1.5rem;
  }

  .video-grid {
    grid-template-columns: 1fr;
  }

  .gallery-back {
    top: 1rem;
    left: 1rem;
    font-size: 0.75rem;
    padding: 0.4rem 0.75rem;
  }
}

/* ========================================
   Responsive - Tablet
   ======================================== */

@media (min-width: 601px) and (max-width: 1024px) {
  .photo-scroll {
    gap: 12vh;
  }

  .photo-scroll img {
    width: 85vw;
    max-width: 900px;
  }

}

/* ========================================
   Reduced Motion
   ======================================== */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .photo-scroll img {
    opacity: 1;
    transform: none;
  }

  .animate-in, .stagger-children > * {
    opacity: 1;
    transform: none;
  }
}
