/* ============================================
   Personal Site - Hand-Drawn / Sketchy Style
   Inspired by Red Bull cartoons
   ============================================ */

/* Fonts */
@import url('https://fonts.googleapis.com/css2?family=Caveat:wght@400;500;600;700&family=Patrick+Hand&family=Gaegu:wght@300;400;700&display=swap');

/* CSS Variables */
:root {
  --bg-primary: #f5f0e6;
  --bg-paper: #faf8f3;
  --text-primary: #2a2a2a;
  --text-secondary: #555;
  --accent: #3d7c47;
  --accent-light: #d4e6d7;
  --sketch-color: #2a2a2a;
  --highlight: #ffeb3b;
  --max-width: 900px;
}

/* Reset & Base */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Patrick Hand', cursive;
  font-size: 20px;
  line-height: 1.7;
  color: var(--text-primary);
  background-color: var(--bg-primary);
  background-image:
    url("data:image/svg+xml,%3Csvg width='100' height='100' viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M11 18c3.866 0 7-3.134 7-7s-3.134-7-7-7-7 3.134-7 7 3.134 7 7 7zm48 25c3.866 0 7-3.134 7-7s-3.134-7-7-7-7 3.134-7 7 3.134 7 7 7zm-43-7c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zm63 31c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3z' fill='%23e0ddd4' fill-opacity='0.4' fill-rule='evenodd'/%3E%3C/svg%3E");
  min-height: 100vh;
}

/* Typography - Handwritten feel */
h1, h2, h3, h4 {
  font-family: 'Caveat', cursive;
  font-weight: 700;
  line-height: 1.2;
  color: var(--text-primary);
}

h1 {
  font-size: clamp(3.5rem, 10vw, 6rem);
  margin-bottom: 1rem;
  position: relative;
  display: inline-block;
}

h2 {
  font-size: clamp(2.5rem, 6vw, 3.5rem);
  margin-bottom: 1rem;
}

h3 {
  font-size: 1.8rem;
  margin-bottom: 0.5rem;
}

p {
  font-family: 'Patrick Hand', cursive;
  font-size: 1.25rem;
  margin-bottom: 1.25rem;
  color: var(--text-secondary);
}

/* Sketchy underline effect */
.sketch-underline {
  position: relative;
  display: inline-block;
}

.sketch-underline::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: -5px;
  right: -5px;
  height: 12px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 15'%3E%3Cpath d='M0,10 Q25,5 50,10 T100,10 T150,10 T200,10' stroke='%233d7c47' stroke-width='3' fill='none' stroke-linecap='round'/%3E%3C/svg%3E") repeat-x;
  background-size: 100px 12px;
  z-index: -1;
}

/* Links */
a {
  color: var(--accent);
  text-decoration: none;
  position: relative;
  transition: all 0.2s ease;
}

a:hover {
  color: var(--text-primary);
}

/* Sketchy box effect */
.sketch-box {
  position: relative;
  background: var(--bg-paper);
  padding: 2rem;
  border: 3px solid var(--sketch-color);
  border-radius: 3px 15px 5px 12px;
  box-shadow: 4px 4px 0 var(--sketch-color);
  transform: rotate(-0.5deg);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.sketch-box:hover {
  transform: rotate(0.5deg) translateY(-3px);
  box-shadow: 6px 6px 0 var(--sketch-color);
}

/* Layout */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem;
}

.page {
  min-height: 100vh;
  padding: 7rem 0 4rem;
}

/* Navigation - Hand-drawn style */
nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: var(--bg-paper);
  border-bottom: 3px solid var(--sketch-color);
  box-shadow: 0 4px 0 var(--sketch-color);
}

nav .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 80px;
}

.nav-logo {
  font-family: 'Caveat', cursive;
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-primary);
  transform: rotate(-2deg);
  transition: transform 0.3s ease;
}

.nav-logo:hover {
  color: var(--text-primary);
  transform: rotate(2deg) scale(1.05);
}

.nav-links {
  display: flex;
  gap: 2rem;
  list-style: none;
}

.nav-links a {
  font-family: 'Patrick Hand', cursive;
  font-size: 1.3rem;
  color: var(--text-primary);
  padding: 0.5rem 1rem;
  border: 2px solid transparent;
  border-radius: 3px 10px 5px 8px;
  transition: all 0.2s ease;
}

.nav-links a:hover,
.nav-links a.active {
  border-color: var(--sketch-color);
  background: var(--highlight);
  transform: rotate(-1deg);
}

.nav-links .linkedin-link {
  background: var(--accent);
  color: white !important;
  border: 2px solid var(--sketch-color);
  box-shadow: 2px 2px 0 var(--sketch-color);
}

.nav-links .linkedin-link:hover {
  background: var(--text-primary);
  transform: rotate(1deg) translateY(-2px);
  box-shadow: 3px 3px 0 var(--sketch-color);
}

/* Mobile nav toggle */
.nav-toggle {
  display: none;
  background: none;
  border: 2px solid var(--sketch-color);
  color: var(--text-primary);
  font-size: 1.5rem;
  padding: 0.5rem;
  cursor: pointer;
  border-radius: 5px;
}

/* Hero Section */
.hero {
  min-height: 85vh;
  display: flex;
  align-items: center;
  padding-top: 80px;
  position: relative;
  overflow: hidden;
}

.hero-content {
  max-width: 600px;
  position: relative;
  z-index: 2;
}

.hero h1 {
  transform: rotate(-1deg);
  margin-bottom: 1.5rem;
  opacity: 0;
  animation: sketchIn 0.8s ease forwards;
}

.hero h1 .accent {
  color: var(--accent);
  position: relative;
}

.hero h1 .accent::before {
  content: '';
  position: absolute;
  bottom: 5px;
  left: -5px;
  right: -5px;
  height: 15px;
  background: var(--highlight);
  z-index: -1;
  transform: rotate(-1deg);
}

.hero .subtitle {
  font-size: 1.5rem;
  color: var(--text-secondary);
  margin-bottom: 2rem;
  opacity: 0;
  animation: sketchIn 0.8s ease 0.2s forwards;
  transform: rotate(0.5deg);
}

@keyframes sketchIn {
  from {
    opacity: 0;
    transform: translateY(20px) rotate(-3deg);
  }
  to {
    opacity: 1;
    transform: translateY(0) rotate(-1deg);
  }
}

/* Newsletter form */
.newsletter-form {
  margin-top: 2rem;
  max-width: 400px;
  opacity: 0;
  animation: sketchIn 0.8s ease 0.4s forwards;
  background: var(--bg-paper);
  padding: 1rem;
  border: 3px solid var(--sketch-color);
  border-radius: 5px 15px 8px 12px;
  box-shadow: 4px 4px 0 var(--sketch-color);
  transform: rotate(0.5deg);
}

/* Photo slideshow - Polaroid style */
.photo-slideshow {
  position: absolute;
  right: 5%;
  top: 50%;
  transform: translateY(-50%) rotate(3deg);
  width: 350px;
  padding: 15px 15px 50px 15px;
  background: white;
  border: 3px solid var(--sketch-color);
  box-shadow: 8px 8px 0 var(--sketch-color);
  z-index: 1;
}

.photo-slideshow::before {
  content: 'adventures ↓';
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  font-family: 'Caveat', cursive;
  font-size: 1.4rem;
  color: var(--text-secondary);
}

.photo-slideshow .photo-frame {
  width: 100%;
  height: 400px;
  overflow: hidden;
  border: 2px solid var(--sketch-color);
}

.photo-slideshow img {
  position: absolute;
  top: 15px;
  left: 15px;
  width: calc(100% - 30px);
  height: 400px;
  object-fit: cover;
  opacity: 0;
  transition: opacity 1s ease;
  border: 2px solid var(--sketch-color);
}

.photo-slideshow img.active {
  opacity: 1;
}

/* Doodle decorations */
.doodle {
  position: absolute;
  pointer-events: none;
  opacity: 0.6;
}

/* Cards - Notebook paper style */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 2rem;
}

/* Article Cards */
.article-card {
  display: block;
  background: var(--bg-paper);
  border: 3px solid var(--sketch-color);
  border-radius: 3px 12px 5px 10px;
  padding: 1.5rem;
  box-shadow: 5px 5px 0 var(--sketch-color);
  transition: all 0.3s ease;
  transform: rotate(-0.5deg);
  position: relative;
}

.article-card:nth-child(even) {
  transform: rotate(0.5deg);
}

.article-card::before {
  content: '📝';
  position: absolute;
  top: -15px;
  right: 20px;
  font-size: 1.5rem;
}

.article-card:hover {
  transform: rotate(0deg) translateY(-5px);
  box-shadow: 8px 8px 0 var(--sketch-color);
}

.article-card h3 {
  font-family: 'Caveat', cursive;
  font-size: 1.8rem;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.article-card .date {
  font-family: 'Patrick Hand', cursive;
  font-size: 1rem;
  color: var(--accent);
  margin-bottom: 0.75rem;
}

.article-card .excerpt {
  font-family: 'Patrick Hand', cursive;
  font-size: 1.1rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 0;
}

/* Photo Gallery - Scattered polaroids */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 2.5rem;
  padding: 1rem;
}

.gallery-item {
  position: relative;
  background: white;
  padding: 12px 12px 45px 12px;
  border: 3px solid var(--sketch-color);
  box-shadow: 5px 5px 0 var(--sketch-color);
  cursor: pointer;
  transition: all 0.3s ease;
}

.gallery-item:nth-child(3n+1) { transform: rotate(-2deg); }
.gallery-item:nth-child(3n+2) { transform: rotate(1.5deg); }
.gallery-item:nth-child(3n+3) { transform: rotate(-1deg); }

.gallery-item:hover {
  transform: rotate(0deg) scale(1.03) translateY(-5px);
  box-shadow: 10px 10px 0 var(--sketch-color);
  z-index: 10;
}

.gallery-item img {
  width: 100%;
  height: 220px;
  object-fit: cover;
  border: 2px solid var(--sketch-color);
}

.gallery-item::after {
  content: '✦';
  position: absolute;
  bottom: 12px;
  right: 15px;
  font-size: 1.2rem;
  color: var(--accent);
}

/* Lightbox */
.lightbox {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(42, 42, 42, 0.95);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.4s ease, visibility 0.4s ease;
}

.lightbox.active {
  opacity: 1;
  visibility: visible;
}

.lightbox img {
  max-width: 90vw;
  max-height: 85vh;
  object-fit: contain;
  background: white;
  padding: 15px 15px 50px 15px;
  border: 4px solid var(--sketch-color);
  box-shadow: 10px 10px 0 rgba(0,0,0,0.3);
  transform: rotate(1deg);
}

.lightbox-close {
  position: absolute;
  top: 2rem;
  right: 2rem;
  background: var(--highlight);
  border: 3px solid var(--sketch-color);
  color: var(--text-primary);
  width: 50px;
  height: 50px;
  font-size: 1.5rem;
  font-family: 'Caveat', cursive;
  cursor: pointer;
  box-shadow: 3px 3px 0 var(--sketch-color);
  transition: all 0.2s ease;
}

.lightbox-close:hover {
  transform: rotate(10deg);
  box-shadow: 5px 5px 0 var(--sketch-color);
}

/* Loading state */
.loading {
  text-align: center;
  padding: 3rem;
  font-family: 'Patrick Hand', cursive;
  font-size: 1.3rem;
  color: var(--text-secondary);
}

.loading::after {
  content: ' ✏️';
  animation: wiggle 0.5s ease infinite;
}

@keyframes wiggle {
  0%, 100% { transform: rotate(-5deg); }
  50% { transform: rotate(5deg); }
}

/* Prose content */
.prose {
  max-width: 650px;
}

.prose p {
  font-size: 1.3rem;
  line-height: 1.8;
  margin-bottom: 1.5rem;
}

.prose h1 {
  transform: rotate(-1deg);
  margin-bottom: 2rem;
}

.prose h1::after {
  content: '';
  display: block;
  width: 150px;
  height: 8px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 150 10'%3E%3Cpath d='M0,5 Q20,2 40,5 T80,5 T120,5 T150,5' stroke='%233d7c47' stroke-width='4' fill='none' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat;
  margin-top: 0.5rem;
}

/* Footer */
footer {
  padding: 3rem 0;
  border-top: 3px dashed var(--sketch-color);
  text-align: center;
  background: var(--bg-paper);
}

footer p {
  font-family: 'Caveat', cursive;
  font-size: 1.3rem;
  color: var(--text-secondary);
  margin-bottom: 0;
}

/* Responsive */
@media (max-width: 768px) {
  .nav-links {
    position: fixed;
    top: 80px;
    left: 0;
    right: 0;
    background: var(--bg-paper);
    flex-direction: column;
    padding: 1.5rem;
    gap: 1rem;
    border-bottom: 3px solid var(--sketch-color);
    box-shadow: 0 4px 0 var(--sketch-color);
    transform: translateY(-150%);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
  }

  .nav-links.active {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
  }

  .nav-toggle {
    display: block;
  }

  .hero {
    min-height: auto;
    padding: 120px 0 60px;
  }

  h1 {
    font-size: 2.8rem;
  }

  .page {
    padding: 6rem 0 3rem;
  }

  .photo-slideshow {
    display: none;
  }

  .gallery-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
  }

  .gallery-item {
    padding: 8px 8px 35px 8px;
  }

  .gallery-item img {
    height: 150px;
  }
}

@media (max-width: 480px) {
  .gallery-grid {
    grid-template-columns: 1fr;
  }
}

/* Hand-drawn arrow decoration */
.arrow-doodle {
  display: inline-block;
  margin-left: 0.5rem;
}

/* Highlight text */
.highlight {
  background: var(--highlight);
  padding: 0 5px;
  transform: rotate(-0.5deg);
  display: inline-block;
}

/* Tape effect for polaroids */
.tape {
  position: absolute;
  width: 60px;
  height: 25px;
  background: rgba(255, 235, 59, 0.7);
  top: -12px;
  left: 50%;
  transform: translateX(-50%) rotate(-2deg);
  border: 1px solid rgba(0,0,0,0.1);
}
