/* --- Global Styles & Theme --- */
:root {
  --background-color: #1a1a1a;
  --primary-gray: #2b2b2b;
  --secondary-gray: #404040;
  --text-color: #e0e0e0;
  --highlight-color: #00aaff;
  --font-family: 'Consolas', 'Menlo', 'monospace';
}

/* The body tag should ONLY have basic styles */
body {
  background-color: var(--background-color);
  color: var(--text-color);
  font-family: var(--font-family);
  margin: 0;
  padding: 0;
  line-height: 1.6;
}

/* The wrapper handles the sticky footer layout */
.wrapper {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* The main content area grows to push the footer down */
main {
  flex-grow: 1;
}

.container {
  max-width: 900px;
  margin: 20px auto;
  padding: 0 20px;
}

a {
  color: var(--highlight-color);
  text-decoration: none;
  transition: color 0.2s ease-in-out;
}

a:hover {
  color: #ffffff;
}

/* --- Header Styles --- */
.site-header {
  background-color: var(--primary-gray);
  border-bottom: 1px solid var(--secondary-gray);
  padding: 1rem 0;
}

.site-header .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 0 auto;
}

.site-header .logo {
  font-size: 1.5rem;
  font-weight: bold;
  color: #ffffff;
}

.site-header .logo a:hover {
  color: var(--highlight-color);
}

.site-header nav ul {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  gap: 25px;
}

.site-header nav a {
  font-size: 1.1rem;
}

/* --- Footer Styles --- */
.site-footer {
  background-color: var(--primary-gray);
  border-top: 1px solid var(--secondary-gray);
  padding: 2rem 0;
  text-align: center;
  font-size: 0.9rem;
  color: var(--secondary-gray);
}

.site-footer .social-links a {
    margin: 0 10px;
    font-size: 1rem;
}

.site-footer p {
    color: #888;
    margin-top: 1rem;
}

/* --- Styles for Writeups Page --- */
.page-title {
  text-align: center;
  margin-bottom: 2rem;
  font-size: 2rem;
  color: #ffffff;
}

.writeups-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
}

.writeup-card {
  background-color: var(--primary-gray);
  border: 1px solid var(--secondary-gray);
  border-radius: 8px;
  padding: 1.5rem;
  display: block;
  transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
  color: var(--text-color);
}

.writeup-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 5px 15px rgba(0, 170, 255, 0.1);
  border-color: var(--highlight-color);
}

.writeup-card h3 {
  margin-top: 0;
  margin-bottom: 0.5rem;
  color: #ffffff;
  font-size: 1.3rem;
}

.writeup-card .writeup-description {
  font-size: 0.95rem;
  color: var(--text-color);
  margin-bottom: 1rem;
}

.writeup-card .writeup-tag {
  display: inline-block;
  background-color: var(--secondary-gray);
  color: #ccc;
  padding: 0.25rem 0.6rem;
  border-radius: 5px;
  font-size: 0.8rem;
  margin-right: 0.5rem;
}

/* --- Styles for Tools Page --- */
.search-container {
  margin-bottom: 2rem;
  display: flex;
  justify-content: center;
}

.search-input {
  width: 100%;
  max-width: 500px;
  padding: 0.8rem 1rem;
  font-size: 1rem;
  color: var(--text-color);
  background-color: var(--primary-gray);
  border: 1px solid var(--secondary-gray);
  border-radius: 8px;
  font-family: var(--font-family);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.search-input:focus {
  outline: none;
  border-color: var(--highlight-color);
  box-shadow: 0 0 10px rgba(0, 170, 255, 0.2);
}

.tools-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

.tool-card {
  background-color: var(--primary-gray);
  border: 1px solid var(--secondary-gray);
  border-radius: 8px;
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  transition: transform 0.2s ease-in-out, border-color 0.2s ease-in-out;
  color: var(--text-color);
}

.tool-card:hover {
  transform: scale(1.02);
  border-color: var(--highlight-color);
}

.tool-card .tool-name {
  margin: 0;
  color: #ffffff;
  font-size: 1.2rem;
  flex-shrink: 0;
  width: 200px;
}

.tool-card .tool-description {
  margin: 0;
  font-size: 0.95rem;
  color: #a0a0a0;
  border-left: 2px solid var(--secondary-gray);
  padding-left: 1.5rem;
}

#on-index {
  border: 1px solid #ddd;
  border-radius: 4px;
  padding: 5px;
  width: 150px;
  box-shadow: 0 0 2px 1px rgba(0, 140, 186, 0.5);

  display: inline-block !important;
  margin: 0 !important;
}

main.container img,
main.container p img,
.container img[role="img"],
.container img[aria-label] {
  display: block !important;
  max-width: 100% !important;   /* never overflow horizontally */
  height: auto !important;      /* keep aspect ratio */
  margin: 1rem auto !important; /* center and add breathing room */
  object-fit: contain !important;
  max-height: 60vh !important;  /* prevent enormous tall images */
  border-radius: 6px !important;
}


.container p:has(img) {
    text-align: center;
}

div.sourceCode {
    /* Hide the scrollbar if it appears here */
    overflow-x: hidden !important;
    /* Force the div to wrap to the parent's width */
    max-width: 100% !important;
}

.sourceCode > code > span {
    /* Ensure the individual lines wrap if necessary */
    white-space: pre-wrap !important;
}

/* 4. Tidy up code block to ensure the background covers the full width */
.sourceCode code {
    /* Set the code block to be a block element covering the full width of the <pre> */
    display: block !important;
    min-width: 100% !important;
}

pre {
    /* Preserve line breaks and sequences of whitespace, but allow wrapping */
    white-space: pre-wrap;
    /* Allow very long strings (like base64 or tokens) to break anywhere */
    word-break: break-all;
    /* Fallback for older browsers */
    word-wrap: break-word;
    /* Important: Set a background to distinguish it from the text */
    overflow-x: hidden !important;

    background-color: var(--primary-gray); /* Use your existing variable */
    padding: 1rem;
    border-radius: 4px;
    overflow-x: auto; /* Keep this as a fallback for ultra-long lines */
}

/* Ensure inline <code> tags also inherit the text color */
:not(pre) > code {
    background-color: var(--secondary-gray);
    padding: 0.2em 0.4em;
    border-radius: 3px;
    color: var(--text-color);
}
