/* Typewriter Theme Custom Styles */

/* Import typewriter-style fonts */
@import url('https://fonts.googleapis.com/css2?family=Courier+Prime:ital,wght@0,400;0,700;1,400;1,700&family=Special+Elite&display=swap');

:root {
  --md-text-font: "Courier Prime", "Courier New", monospace;
  --md-code-font: "Courier Prime", "Courier New", monospace;
}

/* Vintage paper texture for light mode */
[data-md-color-scheme="default"] {
  --md-default-bg-color: #f4f1e8;
  --md-default-fg-color: #2b2b2b;
  --md-typeset-a-color: #8b4513;
  --md-primary-fg-color: #5c4033;
  --md-accent-fg-color: #d2691e;
}

/* Old terminal look for dark mode */
[data-md-color-scheme="slate"] {
  --md-default-bg-color: #0a0a0a;
  --md-default-fg-color: #00ff00;
  --md-typeset-a-color: #00ff00;
  --md-primary-fg-color: #000000;
  --md-accent-fg-color: #ffff00;
  --md-code-bg-color: #1a1a1a;
  --md-code-fg-color: #00ff00;
}

/* Reduce large margins and improve spacing */
.md-main__inner {
  margin-top: 0;
}

.md-content {
  max-width: 900px;
  padding: 1rem 1.5rem;
}

.md-typeset {
  font-size: 0.9rem;
  line-height: 1.6;
}

/* Main content area - add paper texture */
.md-main {
  font-family: "Courier Prime", "Courier New", monospace;
}

/* Headers with typewriter style */
.md-typeset h1,
.md-typeset h2,
.md-typeset h3,
.md-typeset h4 {
  font-family: "Special Elite", "Courier Prime", monospace;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  border-bottom: 2px solid currentColor;
  padding-bottom: 0.3em;
}

/* Simulate typewriter underline for links */
.md-typeset a {
  text-decoration: underline;
  text-decoration-style: solid;
  text-underline-offset: 2px;
  transition: all 0.2s;
}

.md-typeset a:hover {
  text-decoration-thickness: 2px;
  text-shadow: 1px 1px 2px rgba(0,0,0,0.1);
}

/* Code blocks - terminal style */
.md-typeset code {
  background-color: rgba(0,0,0,0.05);
  border: 1px solid rgba(0,0,0,0.1);
  padding: 0.1em 0.3em;
  border-radius: 2px;
  font-family: "Courier Prime", monospace;
}

[data-md-color-scheme="slate"] .md-typeset code {
  background-color: rgba(0,255,0,0.1);
  border-color: #00ff00;
  color: #00ff00;
}

/* Paper-like content container */
.md-content {
  background: linear-gradient(
    to bottom,
    transparent 0%,
    transparent calc(100% - 1px),
    rgba(139, 69, 19, 0.1) 100%
  );
  background-size: 100% 1.5em;
}

/* Typewriter cursor effect for headings */
.md-typeset h1::after {
  content: "▮";
  animation: blink 1s infinite;
  margin-left: 0.3em;
  opacity: 0.7;
}

@keyframes blink {
  0%, 49% { opacity: 1; }
  50%, 100% { opacity: 0; }
}

/* Vintage paper texture overlay */
[data-md-color-scheme="default"] .md-content__inner::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: 
    repeating-linear-gradient(
      0deg,
      rgba(139, 69, 19, 0.03) 0px,
      rgba(139, 69, 19, 0.03) 1px,
      transparent 1px,
      transparent 2px
    );
  pointer-events: none;
  opacity: 0.3;
  z-index: -1;
}

/* Old terminal scanlines effect for dark mode */
[data-md-color-scheme="slate"] .md-content__inner::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: repeating-linear-gradient(
    0deg,
    rgba(0, 255, 0, 0.05) 0px,
    rgba(0, 255, 0, 0.05) 1px,
    transparent 1px,
    transparent 2px
  );
  pointer-events: none;
  animation: scanline 8s linear infinite;
  z-index: -1;
}

@keyframes scanline {
  0% { transform: translateY(0); }
  100% { transform: translateY(10px); }
}

/* Blockquotes - like old paper notes */
.md-typeset blockquote {
  border-left: 4px solid var(--md-accent-fg-color);
  background-color: rgba(139, 69, 19, 0.05);
  font-style: italic;
  padding: 0.5em 1em;
  margin: 1em 0;
}

/* Tables - old ledger style */
.md-typeset table {
  border: 2px solid currentColor;
  font-family: "Courier Prime", monospace;
}

.md-typeset table th {
  background-color: rgba(0,0,0,0.1);
  font-weight: 700;
  border-bottom: 2px solid currentColor;
}

/* Navigation - typewriter keys style */
.md-tabs__link {
  font-family: "Special Elite", monospace;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

/* Buttons - typewriter key style */
.md-button {
  border: 2px solid currentColor;
  font-family: "Special Elite", monospace;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  transition: all 0.2s;
}

.md-button:hover {
  transform: translateY(-2px);
  box-shadow: 3px 3px 0 currentColor;
}

/* Search bar - vintage style */
.md-search__input {
  background-color: rgba(255,255,255,0.9);
  border: 1px solid rgba(0,0,0,0.2);
  font-family: "Courier Prime", monospace;
}

[data-md-color-scheme="slate"] .md-search__input {
  background-color: rgba(0,0,0,0.8);
  border-color: #00ff00;
  color: #00ff00;
}

/* Footer - old newspaper style */
.md-footer {
  font-family: "Courier Prime", monospace;
  border-top: 3px double currentColor;
}

/* Emoji styling to fit theme */
.md-typeset img.twemoji {
  filter: grayscale(30%) sepia(20%);
}

[data-md-color-scheme="slate"] .md-typeset img.twemoji {
  filter: brightness(0.8) hue-rotate(90deg);
}

/* Wrapped images in projects page */
.md-typeset img[style*="float"] {
  box-shadow: 3px 3px 8px rgba(0,0,0,0.3);
  border-radius: 4px;
}

[data-md-color-scheme="slate"] .md-typeset img[style*="float"] {
  box-shadow: 0 0 10px rgba(0,255,0,0.2);
}

/* Better spacing for project sections */
.md-typeset hr {
  border-top: 2px solid currentColor;
  margin: 2em 0;
  opacity: 0.3;
}

/* ============================================ */
/* MOBILE RESPONSIVE STYLES */
/* ============================================ */

/* Mobile-specific optimizations */
@media screen and (max-width: 76.1875em) {
  /* Reduce padding on mobile */
  .md-content {
    padding: 0.5rem 1rem;
  }
  
  /* Smaller fonts on mobile */
  .md-typeset {
    font-size: 0.85rem;
  }
  
  .md-typeset h1 {
    font-size: 1.5rem;
  }
  
  .md-typeset h2 {
    font-size: 1.3rem;
  }
}

/* Tablet and smaller screens */
@media screen and (max-width: 60em) {
  /* Make floating images stack on smaller screens */
  .md-typeset img[style*="float"] {
    float: none !important;
    display: block;
    margin: 1rem auto !important;
    max-width: 100%;
    width: auto !important;
  }
  
  /* Profile photo on mobile */
  .md-typeset img[alt*="Mohamed Elobaid"] {
    width: 200px !important;
    margin: 0 auto 1rem auto !important;
  }
}

/* Phone screens */
@media screen and (max-width: 480px) {
  /* Even smaller text on phones */
  .md-typeset {
    font-size: 0.8rem;
    line-height: 1.5;
  }
  
  .md-typeset h1 {
    font-size: 1.3rem;
  }
  
  .md-typeset h2 {
    font-size: 1.1rem;
  }
  
  /* Smaller profile photo on phones */
  .md-typeset img[alt*="Mohamed Elobaid"] {
    width: 150px !important;
  }
  
  /* Stack navigation links vertically */
  .md-typeset a {
    display: inline-block;
    margin: 0.2rem 0;
  }
  
  /* Make code blocks scroll horizontally on small screens */
  .md-typeset pre {
    overflow-x: auto;
  }
  
  /* Adjust button sizes for mobile */
  .md-button {
    padding: 0.5em 1em;
    font-size: 0.9rem;
  }
  
  /* Reduce margins on mobile */
  .md-content {
    padding: 0.5rem 0.8rem;
  }
  
  /* Better table display on mobile */
  .md-typeset table {
    display: block;
    overflow-x: auto;
    font-size: 0.75rem;
  }
}

/* Very small phones */
@media screen and (max-width: 360px) {
  .md-typeset {
    font-size: 0.75rem;
  }
  
  .md-typeset h1 {
    font-size: 1.2rem;
  }
  
  .md-typeset img[alt*="Mohamed Elobaid"] {
    width: 120px !important;
  }
}
