/* ============================================
   HAND-DRAWN MARKDOWN CONVERTER STYLES
   ============================================ */

/* Google Fonts Import */
@import url('https://fonts.googleapis.com/css2?family=Patrick+Hand&family=Indie+Flower&family=Kalam:wght@400;700&family=Courier+Prime&display=swap');

/* ============================================
   CSS VARIABLES
   ============================================ */
:root {
  /* Colors - Paper & Ink Theme */
  --paper-bg: #fdfbf7;
  --paper-lines: #e8e4dc;
  --ink-dark: #2c3e50;
  --ink-light: #5d6d7e;
  --accent-yellow: #ffeaa7;
  --accent-cyan: #81ecec;
  --accent-pink: #ffb8d0;
  --accent-green: #b8e994;
  --accent-orange: #fdcb6e;
  --error-red: #ff7675;
  --success-green: #00b894;

  /* Typography */
  --font-heading: 'Patrick Hand', cursive;
  --font-body: 'Indie Flower', cursive;
  --font-code: 'Courier Prime', monospace;
  --font-alt: 'Kalam', cursive;

  /* Spacing */
  --spacing-xs: 0.5rem;
  --spacing-sm: 1rem;
  --spacing-md: 1.5rem;
  --spacing-lg: 2rem;
  --spacing-xl: 3rem;

  /* Border radius for wobbly effect */
  --wobbly-1: 255px 15px 225px 15px / 15px 225px 15px 255px;
  --wobbly-2: 15px 225px 15px 255px / 255px 15px 225px 15px;
  --wobbly-3: 225px 15px 255px 15px / 15px 255px 15px 225px;
  --wobbly-4: 30px 60px 30px 60px / 60px 30px 60px 30px;
}

/* ============================================
   RESET & BASE STYLES
   ============================================ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  font-size: 1.2rem;
  line-height: 1.7;
  color: var(--ink-dark);
  background-color: var(--paper-bg);
  background-image:
    linear-gradient(var(--paper-lines) 1px, transparent 1px),
    linear-gradient(90deg, var(--paper-lines) 1px, transparent 1px);
  background-size: 25px 25px;
  min-height: 100vh;
}

/* ============================================
   TYPOGRAPHY
   ============================================ */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 400;
  line-height: 1.3;
  color: var(--ink-dark);
}

h1 {
  font-size: 3rem;
  margin-bottom: var(--spacing-md);
  position: relative;
  display: inline-block;
}

h1::after {
  content: '';
  position: absolute;
  bottom: 5px;
  left: 0;
  width: 100%;
  height: 8px;
  background: var(--accent-yellow);
  z-index: -1;
  transform: rotate(-1deg);
}

h2 {
  font-size: 2rem;
  margin-bottom: var(--spacing-sm);
}

h3 {
  font-size: 1.5rem;
  margin-bottom: var(--spacing-xs);
}

p {
  margin-bottom: var(--spacing-sm);
}

a {
  color: var(--ink-dark);
  text-decoration: underline;
  text-decoration-style: wavy;
  text-decoration-color: var(--accent-cyan);
  text-underline-offset: 3px;
  transition: all 0.2s ease;
}

a:hover {
  background: var(--accent-yellow);
  color: var(--ink-dark);
  text-decoration: none;
}

/* ============================================
   LAYOUT
   ============================================ */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--spacing-md);
}

.main-wrapper {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ============================================
   HEADER & NAVIGATION
   ============================================ */
header {
  background: var(--paper-bg);
  padding: var(--spacing-md) 0;
  border-bottom: 3px solid var(--ink-dark);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--spacing-sm);
}

.logo {
  font-family: var(--font-heading);
  font-size: 2.5rem;
  color: var(--ink-dark);
  text-decoration: none;
  position: relative;
  display: inline-block;
}

.logo::before {
  content: '';
  position: absolute;
  top: -5px;
  left: -10px;
  width: 40px;
  height: 40px;
  background: var(--accent-pink);
  border-radius: 50%;
  z-index: -1;
  opacity: 0.5;
}

.logo:hover {
  background: none;
  transform: rotate(2deg);
}

.logo span {
  color: var(--ink-light);
}

nav {
  display: flex;
  flex-wrap: wrap;
  gap: var(--spacing-sm);
}

.nav-link {
  font-family: var(--font-heading);
  font-size: 1.2rem;
  padding: 8px 16px;
  background: var(--paper-bg);
  border: 2px solid var(--ink-dark);
  border-radius: var(--wobbly-2);
  text-decoration: none;
  position: relative;
  transition: all 0.2s ease;
}

.nav-link::before {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  right: 2px;
  bottom: 2px;
  border: 1px dashed var(--ink-light);
  border-radius: var(--wobbly-2);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.nav-link:hover {
  background: var(--accent-yellow);
  transform: translateY(-2px) rotate(1deg);
}

.nav-link:hover::before {
  opacity: 1;
}

.nav-link.active {
  background: var(--accent-cyan);
  border-color: var(--ink-dark);
  font-weight: bold;
}

/* ============================================
   HERO SECTION
   ============================================ */
.hero {
  padding: var(--spacing-xl) 0;
  text-align: center;
}

.hero h1 {
  font-size: 3.5rem;
  margin-bottom: var(--spacing-md);
}

.hero p {
  font-size: 1.4rem;
  max-width: 700px;
  margin: 0 auto var(--spacing-lg);
  color: var(--ink-light);
}

.hero-illustration {
  max-width: 400px;
  margin: var(--spacing-lg) auto;
  padding: var(--spacing-lg);
  background: white;
  border: 3px solid var(--ink-dark);
  border-radius: var(--wobbly-1);
  position: relative;
}

.hero-illustration::before {
  content: '';
  position: absolute;
  top: -15px;
  left: 50%;
  transform: translateX(-50%);
  width: 60px;
  height: 30px;
  background: var(--accent-yellow);
  border-radius: 50% 50% 0 0;
  border: 3px solid var(--ink-dark);
  border-bottom: none;
}

/* ============================================
   TOOL GRID
   ============================================ */
.tools-section {
  padding: var(--spacing-xl) 0;
}

.tools-section h2 {
  text-align: center;
  margin-bottom: var(--spacing-xl);
}

.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: var(--spacing-lg);
  padding: var(--spacing-md) 0;
}

.tool-card {
  background: var(--paper-bg);
  border: 3px solid var(--ink-dark);
  border-radius: var(--wobbly-1);
  padding: var(--spacing-lg);
  text-align: center;
  text-decoration: none;
  color: var(--ink-dark);
  position: relative;
  transition: all 0.3s ease;
  box-shadow: 5px 5px 0 var(--ink-dark);
}

.tool-card::before {
  content: '';
  position: absolute;
  top: 10px;
  left: 10px;
  right: 10px;
  bottom: 10px;
  border: 2px dashed var(--ink-light);
  border-radius: var(--wobbly-1);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.tool-card:hover {
  transform: translateY(-5px) rotate(-1deg);
  background: white;
}

.tool-card:hover::before {
  opacity: 1;
}

.tool-card:hover {
  box-shadow: 8px 8px 0 var(--ink-dark);
}

.tool-icon {
  font-size: 3rem;
  margin-bottom: var(--spacing-sm);
  display: block;
}

.tool-card h3 {
  margin-bottom: var(--spacing-xs);
  font-size: 1.8rem;
}

.tool-card p {
  font-size: 1.1rem;
  color: var(--ink-light);
  margin: 0;
}

/* ============================================
   CONVERTER INTERFACE
   ============================================ */
.converter-section {
  padding: var(--spacing-xl) 0;
}

.converter-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--spacing-lg);
  margin-top: var(--spacing-lg);
}

@media (max-width: 768px) {
  .converter-container {
    grid-template-columns: 1fr;
  }
}

.converter-panel {
  background: white;
  border: 3px solid var(--ink-dark);
  border-radius: var(--wobbly-4);
  overflow: hidden;
}

.panel-header {
  background: var(--accent-green);
  padding: var(--spacing-sm) var(--spacing-md);
  border-bottom: 3px solid var(--ink-dark);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.panel-header h3 {
  margin: 0;
  font-size: 1.3rem;
}

.panel-content {
  padding: var(--spacing-md);
  min-height: 400px;
}

textarea {
  width: 100%;
  height: 380px;
  font-family: var(--font-code);
  font-size: 1rem;
  border: 2px dashed var(--ink-light);
  border-radius: var(--wobbly-2);
  padding: var(--spacing-sm);
  resize: none;
  background: #fafafa;
  color: var(--ink-dark);
  line-height: 1.6;
}

textarea:focus {
  outline: none;
  border-color: var(--ink-dark);
  border-style: solid;
}

textarea::placeholder {
  font-family: var(--font-body);
  font-style: italic;
  color: var(--ink-light);
}

/* Preview panel */
.preview-content {
  font-family: var(--font-body);
  line-height: 1.8;
  overflow-y: auto;
  height: 380px;
  padding: var(--spacing-sm);
  background: #fafafa;
  border: 2px dashed var(--ink-light);
  border-radius: var(--wobbly-2);
}

.preview-content h1,
.preview-content h2,
.preview-content h3 {
  margin-top: var(--spacing-md);
  margin-bottom: var(--spacing-xs);
}

.preview-content h1:first-child,
.preview-content h2:first-child,
.preview-content h3:first-child {
  margin-top: 0;
}

.preview-content code {
  font-family: var(--font-code);
  background: var(--paper-lines);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.9em;
}

.preview-content pre {
  background: var(--ink-dark);
  color: #eee;
  padding: var(--spacing-sm);
  border-radius: var(--wobbly-2);
  overflow-x: auto;
  margin: var(--spacing-sm) 0;
}

.preview-content pre code {
  background: none;
  padding: 0;
  color: inherit;
}

.preview-content blockquote {
  border-left: 4px solid var(--accent-cyan);
  padding-left: var(--spacing-sm);
  margin: var(--spacing-sm) 0;
  font-style: italic;
  color: var(--ink-light);
}

.preview-content ul,
.preview-content ol {
  margin: var(--spacing-sm) 0;
  padding-left: var(--spacing-lg);
}

.preview-content a {
  font-family: var(--font-code);
}

.preview-content img {
  max-width: 100%;
  border: 2px solid var(--ink-dark);
  border-radius: var(--wobbly-2);
}

/* ============================================
   BUTTONS
   ============================================ */
.btn {
  font-family: var(--font-heading);
  font-size: 1.2rem;
  padding: 12px 28px;
  border: 3px solid var(--ink-dark);
  border-radius: var(--wobbly-2);
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-xs);
  transition: all 0.2s ease;
  position: relative;
}

.btn-primary {
  background: var(--accent-yellow);
  color: var(--ink-dark);
}

.btn-primary:hover {
  background: var(--accent-orange);
  transform: translateY(-3px) rotate(2deg);
  box-shadow: 4px 4px 0 var(--ink-dark);
}

.btn-secondary {
  background: var(--accent-cyan);
  color: var(--ink-dark);
}

.btn-secondary:hover {
  background: #63d9e0;
  transform: translateY(-3px) rotate(-2deg);
  box-shadow: 4px 4px 0 var(--ink-dark);
}

.btn-success {
  background: var(--success-green);
  color: white;
}

.btn-success:hover {
  background: #00a383;
  transform: translateY(-3px);
  box-shadow: 4px 4px 0 var(--ink-dark);
}

.btn-group {
  display: flex;
  flex-wrap: wrap;
  gap: var(--spacing-sm);
  margin-top: var(--spacing-md);
  justify-content: center;
}

/* ============================================
   FEATURES SECTION
   ============================================ */
.features-section {
  padding: var(--spacing-xl) 0;
  background: rgba(255,255,255,0.5);
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--spacing-lg);
}

.feature-box {
  background: var(--paper-bg);
  border: 3px solid var(--ink-dark);
  border-radius: var(--wobbly-3);
  padding: var(--spacing-lg);
  text-align: center;
  position: relative;
}

.feature-box::before {
  content: '';
  position: absolute;
  top: -20px;
  left: 50%;
  transform: translateX(-50%);
  width: 50px;
  height: 50px;
  background: var(--accent-yellow);
  border: 3px solid var(--ink-dark);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}

.feature-icon {
  font-size: 2rem;
  margin-bottom: var(--spacing-sm);
}

/* ============================================
   TESTIMONIALS
   ============================================ */
.testimonials-section {
  padding: var(--spacing-xl) 0;
}

.testimonials-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: var(--spacing-lg);
}

.testimonial-card {
  background: white;
  border: 3px solid var(--ink-dark);
  border-radius: var(--wobbly-1);
  padding: var(--spacing-lg);
  position: relative;
}

.testimonial-card::before {
  content: '"';
  position: absolute;
  top: -10px;
  left: 20px;
  font-size: 4rem;
  font-family: var(--font-heading);
  color: var(--accent-cyan);
  line-height: 1;
}

.testimonial-author {
  margin-top: var(--spacing-sm);
  font-weight: bold;
  color: var(--ink-light);
}

/* ============================================
   CTA SECTION
   ============================================ */
.cta-section {
  padding: var(--spacing-xl) 0;
  text-align: center;
  background: linear-gradient(180deg, transparent, rgba(129, 236, 236, 0.2));
}

.cta-section h2 {
  margin-bottom: var(--spacing-md);
}

.cta-section p {
  max-width: 600px;
  margin: 0 auto var(--spacing-lg);
}

/* ============================================
   FOOTER
   ============================================ */
footer {
  background: var(--ink-dark);
  color: var(--paper-bg);
  padding: var(--spacing-xl) 0;
  margin-top: auto;
}

.footer-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--spacing-md);
}

.footer-logo {
  font-family: var(--font-heading);
  font-size: 1.8rem;
  color: var(--paper-bg);
  text-decoration: none;
}

.footer-links {
  display: flex;
  gap: var(--spacing-md);
  flex-wrap: wrap;
}

.footer-links a {
  color: var(--paper-bg);
  text-decoration: none;
  font-family: var(--font-heading);
}

.footer-links a:hover {
  background: var(--accent-yellow);
  color: var(--ink-dark);
}

.footer-bottom {
  margin-top: var(--spacing-lg);
  padding-top: var(--spacing-md);
  border-top: 2px dashed var(--ink-light);
  text-align: center;
  font-size: 1rem;
  color: var(--ink-light);
}

/* ============================================
   PAGE HEADER
   ============================================ */
.page-header {
  padding: var(--spacing-xl) 0;
  text-align: center;
}

.page-header h1 {
  font-size: 3rem;
}

.page-header p {
  font-size: 1.3rem;
  max-width: 700px;
  margin: 0 auto;
  color: var(--ink-light);
}

.breadcrumb {
  font-family: var(--font-heading);
  margin-bottom: var(--spacing-md);
  color: var(--ink-light);
}

.breadcrumb a {
  text-decoration: none;
}

.breadcrumb span {
  margin: 0 8px;
}

/* ============================================
   SPECIFIC PAGE STYLES
   ============================================ */
.page-content {
  padding: var(--spacing-lg) 0;
}

.info-box {
  background: var(--accent-yellow);
  border: 2px solid var(--ink-dark);
  border-radius: var(--wobbly-2);
  padding: var(--spacing-md);
  margin: var(--spacing-lg) 0;
}

.info-box h3 {
  margin-top: 0;
}

.tips-list {
  list-style: none;
  padding: 0;
}

.tips-list li {
  padding: var(--spacing-sm) 0;
  padding-left: var(--spacing-lg);
  position: relative;
}

.tips-list li::before {
  content: '-->';
  position: absolute;
  left: 0;
  color: var(--ink-light);
  font-family: var(--font-code);
}

/* ============================================
   ANIMATIONS
   ============================================ */
@keyframes wiggle {
  0%, 100% { transform: rotate(-1deg); }
  50% { transform: rotate(1deg); }
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}

.animate-wiggle {
  animation: wiggle 0.5s ease-in-out;
}

.animate-bounce {
  animation: bounce 1s ease-in-out infinite;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
  h1 {
    font-size: 2.2rem;
  }

  h2 {
    font-size: 1.6rem;
  }

  .hero h1 {
    font-size: 2.5rem;
  }

  .header-content {
    flex-direction: column;
    text-align: center;
  }

  nav {
    justify-content: center;
  }

  .tool-card {
    padding: var(--spacing-md);
  }

  .footer-content {
    flex-direction: column;
    text-align: center;
  }
}

@media (max-width: 480px) {
  html {
    font-size: 14px;
  }

  .container {
    padding: 0 var(--spacing-sm);
  }

  .btn {
    padding: 10px 20px;
    font-size: 1rem;
  }
}
