/* Main CSS file for your Eleventy site */
:root {
  --primary: #2563eb;
  --secondary: #4f46e5;
  --dark: #1e293b;
  --light: #f8fafc;
  --gray: #64748b;
  --max-width: 1600px;
  --sidebar-width: 280px;
  --toc-width: 240px;
  --content-max-width: 800px;
}

/* Base styles */
body {
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu,
    Cantarell, sans-serif;
  line-height: 1.8;
  color: var(--dark);
  background-color: #ffffff;
  word-wrap: break-word;
  overflow-wrap: break-word;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
}

/* Typography */
h1,
h2,
h3,
h4,
h5,
h6 {
  line-height: 1.3;
  margin: 2.5rem 0 1.5rem;
  color: #1a202c;
  font-weight: 700;
  position: relative;
}

h1 {
  font-size: 2.5rem;
  border-bottom: 2px solid #e2e8f0;
  padding-bottom: 0.5rem;
  margin-top: 1.5rem;
}

h2 {
  font-size: 2rem;
  border-bottom: 1px solid #e2e8f0;
  padding-bottom: 0.3rem;
}

h3 {
  font-size: 1.5rem;
  color: #2d3748;
}

/* Code Block Component - Styled like Aha! Moment */
.code-block-container {
  /* Layout and Spacing */
  width: 100%;
  max-width: 1300px;
  margin: 2rem auto;
  position: relative;

  /* Border Styling */
  border: 2px dashed #d1d5db;
  border-radius: 0.25rem;
  background-color: #f9fafb;
  padding: 1.5rem;
  box-sizing: border-box;
}

.code-block-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.code-block-language {
  /* Label styling similar to Aha! Moment */
  position: absolute;
  top: -0.5rem;
  left: 1rem;
  padding: 0 0.5rem;
  background-color: white;
  font-size: 0.75rem;
  font-family: monospace;
  color: #6b7280;
  z-index: 10;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.code-block-copy {
  /* Button styling */
  background: #f3f4f6;
  color: #4b5563;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  padding: 0.25rem 0.75rem;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.code-block-copy:hover {
  background: #e5e7eb;
  border-color: #9ca3af;
}

.code-block-copy:active {
  background: #d1d5db;
}

/* Code content area */
.code-block-container pre {
  margin: 0;
  padding: 1.25rem;
  background-color: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  overflow-x: auto;
  font-family: "Fira Code", "Consolas", monospace;
  line-height: 1.5;
  font-size: 0.95em;
  color: #1e293b;
  white-space: pre;
  tab-size: 2;
}

/* Syntax highlighting colors for light theme */
.code-block-container .token.comment,
.code-block-container .token.prolog,
.code-block-container .token.doctype,
.code-block-container .token.cdata {
  color: #64748b;
  font-style: italic;
}

.code-block-container .token.punctuation {
  color: #94a3b8;
}

.code-block-container .token.property,
.code-block-container .token.tag,
.code-block-container .token.boolean,
.code-block-container .token.number,
.code-block-container .token.constant,
.code-block-container .token.symbol {
  color: #f59e0b;
}

.code-block-container .token.selector,
.code-block-container .token.attr-name,
.code-block-container .token.string,
.code-block-container .token.char,
.code-block-container .token.builtin {
  color: #10b981;
}

.code-block-container .token.operator,
.code-block-container .token.entity,
.code-block-container .token.url,
.code-block-container .language-css .token.string,
.code-block-container .style .token.string {
  color: #3b82f6;
}

.code-block-container .token.atrule,
.code-block-container .token.attr-value,
.code-block-container .token.keyword {
  color: #8b5cf6;
}

.code-block-container .token.function,
.code-block-container .token.class-name {
  color: #3b82f6;
}

.code-block-container .token.regex,
.code-block-container .token.important,
.code-block-container .token.variable {
  color: #f43f5e;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .code-block-container {
    margin-left: -1.25rem;
    margin-right: -1.25rem;
    border-left: none;
    border-right: none;
    border-radius: 0;
  }

  .code-block-container pre {
    border-radius: 0;
  }
}

/* Customizing inline code */
:not(pre) > code {
  background-color: #e9e9e9;
  padding: 0.2em 0.4em;
  border-radius: 4px;
  font-size: 0.9em;
  color: #d6336c;
}

/* Syntax highlighting colors */
.token.comment,
.token.prolog,
.token.doctype,
.token.cdata {
  color: #5c6370;
  font-style: italic;
}

.token.punctuation {
  color: #abb2bf;
}

.token.property,
.token.tag,
.token.boolean,
.token.number,
.token.constant,
.token.symbol,
.token.deleted {
  color: #d19a66;
}

.token.selector,
.token.attr-name,
.token.string,
.token.char,
.token.builtin,
.token.inserted {
  color: #98c379;
}

.token.operator,
.token.entity,
.token.url,
.language-css .token.string,
.style .token.string {
  color: #56b6c2;
}

.token.atrule,
.token.attr-value,
.token.keyword {
  color: #c678dd;
}

.token.function,
.token.class-name {
  color: #61afef;
}

.token.regex,
.token.important,
.token.variable {
  color: #e06c75;
}

/* Links */
a {
  color: var(--primary);
  text-decoration: none;
  transition: color 0.2s ease;
  border-bottom: 1px solid transparent;
}

a:hover {
  color: var(--secondary);
  border-bottom-color: currentColor;
  text-decoration: none;
}

/* Blockquotes */
blockquote {
  margin: 1.5rem 0;
  padding: 0.5rem 1.5rem;
  border-left: 4px solid #e2e8f0;
  color: #4a5568;
  font-style: italic;
}

/* Responsive design */
@media (max-width: 768px) {
  body {
    padding: 1.25rem;
  }

  h1 {
    font-size: 2rem;
    margin-top: 1rem;
  }

  h2 {
    font-size: 1.75rem;
  }

  pre {
    border-radius: 0;
    margin-left: -1.25rem;
    margin-right: -1.25rem;
    padding: 1rem;
  }
}

/* Print styles */
@media print {
  body {
    max-width: 100%;
    padding: 1cm;
    font-size: 12pt;
    line-height: 1.5;
  }

  h1,
  h2,
  h3 {
    page-break-after: avoid;
  }

  pre,
  blockquote,
  table,
  figure {
    page-break-inside: avoid;
  }
}

/* Styling for the Aha! Moment (CardWithLabel translation) */

/* The main container (mimicking 'w-full max-w-7xl mx-auto p-6 border-2 border-dashed border-gray-300 rounded relative') */
.aha-card-container {
  /* Layout and Spacing */
  position: relative;
  width: 100%;
  max-width: 100%;
  margin-left: auto;
  margin-right: auto;
  margin: 2rem 0;
  padding: 1rem;
  box-sizing: border-box;

  /* Border Styling */
  border: 2px dashed #d1d5db;
  border-radius: 0.25rem;

  /* Visual Enhancement */
  background-color: #f9fafb; /* light grey/off-white background */
  margin-top: 2rem;
  margin-bottom: 2rem;
}

/* The label wrapper (mimicking 'absolute -top-2 left-4 px-2 bg-white text-xs font-mono text-gray-500') */
.aha-card-label-wrapper {
  /* Positioning */
  position: absolute;
  top: -0.5rem; /* -top-2 */
  left: 1rem; /* left-4 */

  /* Spacing and Background */
  padding-left: 0.5rem; /* px-2 */
  padding-right: 0.5rem; /* px-2 */
  background-color: white; /* bg-white */

  /* Text Styling */
  font-size: 0.75rem; /* text-xs */
  font-family: monospace; /* font-mono */
  color: #6b7280; /* text-gray-500 */

  /* Ensure the label sits above the border */
  z-index: 10;
}

/* The content area (children) */
.aha-card-content {
  /* Keep text legible inside the card */
  font-size: 1.1rem;
  line-height: 1.6;
  margin: 0;
}

/* Resource Links - Blends Aha Moment with Hand-drawn Style */
.resource-links-container {
  margin: 2rem 0;
  border: 2px dashed #d1d5db;
  border-radius: 0.5rem;
  overflow: hidden;
  background-color: #f9fafb;
  position: relative;
  box-shadow: 3px 3px 0 0 rgba(0, 0, 0, 0.1);
}

.resource-links-label {
  background: linear-gradient(135deg, #fef08a 0%, #fde047 100%);
  padding: 0.5rem 1rem;
  font-weight: 800;
  color: #1c1917;
  border-bottom: 2px solid #1c1917;
  font-family: monospace;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  position: relative;
  transform: rotate(-0.5deg);
  margin: -1px -1px 0 -1px;
  box-shadow: 2px 2px 0 0 rgba(0, 0, 0, 0.1);
}

.resource-links-content {
  padding: 1.5rem;
  background-color: #f9fafb;
}

.resource-links-table {
  width: 100%;
  border-collapse: collapse;
  position: relative;
}

.resource-link-column {
  padding: 0.75rem;
  text-align: center;
  border-right: 2px dashed #e5e7eb;
  position: relative;
}

.resource-link-column:last-child {
  border-right: none;
}

.resource-link-column::before {
  content: "";
  position: absolute;
  left: -1px;
  top: 20%;
  height: 60%;
  width: 2px;
  background: linear-gradient(to bottom, transparent, #d1d5db, transparent);
  opacity: 0.6;
}

.resource-link-column:first-child::before {
  display: none;
}

.resource-link {
  color: #1e40af;
  text-decoration: none;
  font-weight: 600;
  display: block;
  padding: 0.75rem 1rem;
  border-radius: 0.375rem;
  transition: all 0.2s ease-in-out;
  background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
  border: 1.5px solid #1e40af;
  box-shadow: 2px 2px 0 0 rgba(30, 64, 175, 0.3);
  position: relative;
  transform: rotate(0.5deg);
}

.resource-link:hover {
  background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
  text-decoration: none;
  transform: translateY(-2px) rotate(0deg);
  box-shadow: 3px 3px 0 0 rgba(30, 64, 175, 0.4);
}

/* Add hand-drawn imperfections */
.resource-links-container::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 20% 80%, rgba(0, 0, 0, 0.1) 1px, transparent 1px),
    radial-gradient(circle at 80% 20%, rgba(0, 0, 0, 0.1) 1px, transparent 1px);
  background-size: 10px 10px;
  opacity: 0.3;
  border-radius: 0.5rem;
}

/* Responsive design for mobile */
@media (max-width: 768px) {
  .resource-links-table {
    display: block;
  }

  .resource-links-table tr {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
  }

  .resource-link-column {
    border-right: none;
    border-bottom: 2px dashed #e5e7eb;
    padding: 0.5rem;
  }

  .resource-link-column:last-child {
    border-bottom: none;
  }

  .resource-link-column::before {
    display: none;
  }
}
