/* Reset and base styles */
* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  min-height: 100vh;
  font-family: 'Courier New', 'Monaco', 'Consolas', monospace;
  line-height: 1.4;
}

/* Theme system */
body {
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* Default black theme */
body.theme-black {
  background-color: #000;
  color: #ccc;
}

body.theme-black .tile:hover,
body.theme-black .tile:focus {
  background-color: #333;
  color: #fff;
}

/* Green CRT theme */
body.theme-green {
  background-color: #001100;
  color: #00ff00;
}

body.theme-green .tile:hover,
body.theme-green .tile:focus {
  background-color: #003300;
  color: #00ff88;
}

/* Blue DOS theme */
body.theme-blue {
  background-color: #000055;
  color: #aaaaff;
}

body.theme-blue .tile:hover,
body.theme-blue .tile:focus {
  background-color: #0000aa;
  color: #ffffff;
}

/* Layout */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */
.header {
  text-align: center;
  margin-top: 15vh;
  margin-bottom: 8vh;
}

.header h1 {
  font-size: 2.5rem;
  margin: 0;
  letter-spacing: 3px;
  text-transform: none;
  font-weight: normal;
}

/* Grid layout */
.tiles-grid {
  display: grid;
  gap: 20px;
  grid-template-columns: 1fr;
  justify-items: center;
}

/* Multi-column layout when 4+ projects */
.tiles-grid.has-many {
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  max-width: 900px;
  margin: 0 auto;
}

/* Individual tile */
.tile {
  display: block;
  text-decoration: none;
  color: inherit;
  width: 100%;
  max-width: 400px;
  padding: 10px;
  border: 1px solid currentColor;
  transition: all 0.3s ease;
  cursor: pointer;
  border-radius: 0;
}

.tile:hover,
.tile:focus {
  outline: none;
  transform: translateY(-2px);
  border-width: 2px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

/* Tile content */
.tile-content {
  font-family: inherit;
  white-space: pre-line;
  word-wrap: break-word;
  padding: 10px;
  text-align: left;
}

/* First line (project title) styling */
.tile-content .project-title {
  font-weight: bold;
}

/* Expanded state */
.tile.expanded .tile-content {
  min-height: auto;
}

/* Mobile responsiveness */
@media (max-width: 768px) {
  .container {
    padding: 15px;
  }
  
  .header {
    margin-top: 10vh;
    margin-bottom: 6vh;
  }
  
  .header h1 {
    font-size: 1.8rem;
    letter-spacing: 2px;
  }
  
  .tile {
    max-width: 100%;
    padding: 15px;
  }
  
  .tiles-grid.has-many {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .header {
    margin-top: 8vh;
    margin-bottom: 5vh;
  }
  
  .header h1 {
    font-size: 1.5rem;
    letter-spacing: 1.5px;
  }
  
  .container {
    padding: 10px;
  }
}

/* Touch device adjustments */
@media (hover: none) and (pointer: coarse) {
  .tile {
    transition: background-color 0.2s ease;
  }
}

/* Accessibility */
.tile:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 2px;
}

/* Loading state */
.loading {
  text-align: center;
  padding: 40px;
  font-style: italic;
}

/* Error state */
.error {
  text-align: center;
  padding: 40px;
  color: #ff6666;
}

/* Noscript fallback */
.noscript-message {
  text-align: center;
  padding: 40px;
  border: 2px solid currentColor;
  margin: 20px;
}