@import url('https://fonts.googleapis.com/css2?family=Share+Tech+Mono&family=VT323&display=swap');

:root {
  --green:      #00ff41;
  --green-dim:  #00b32c;
  --green-dark: #003b00;
  --bg:         #0a0a0a;
  --bg-box:     #050f05;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html { scrollbar-color: var(--green-dim) var(--bg); }

body {
  background-color: var(--bg);
  color: var(--green);
  font-family: 'Share Tech Mono', 'Courier New', monospace;
  font-size: 1rem;
  line-height: 1.6;
  min-height: 100vh;
  position: relative;
}

/* scanline overlay */
body::after {
  content: '';
  pointer-events: none;
  position: fixed;
  inset: 0;
  background: repeating-linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0.03) 0px,
    rgba(255, 255, 255, 0.03) 2px,
    transparent 2px,
    transparent 4px
  );
  z-index: 9999;
}

#container {
  max-width: 900px;
  margin: 0 auto;
  padding: 1.5rem 1rem;
}

/* --- terminal box --- */
.box {
  background: var(--bg-box);
  border: 1px solid var(--green-dim);
  margin-bottom: 1.5rem;
}

.box-title {
  background: var(--green-dim);
  color: var(--bg);
  font-family: 'VT323', monospace;
  font-size: 1.1rem;
  padding: 0.15rem 0.6rem;
  letter-spacing: 0.05em;
}

.box-body {
  padding: 1rem 1.2rem;
}

/* --- header --- */
header {
  margin-bottom: 1.5rem;
}

.site-title {
  font-family: 'VT323', monospace;
  font-size: 3rem;
  color: var(--green);
  letter-spacing: 0.05em;
  line-height: 1;
}

.site-title::after {
  content: '_';
  animation: blink 1s step-end infinite;
}

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

.site-subtitle {
  color: var(--green-dim);
  font-size: 0.875rem;
  margin-top: 0.25rem;
}

/* --- nav --- */
nav {
  margin-top: 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.5rem;
  border-top: 1px solid var(--green-dark);
  padding-top: 0.75rem;
}

nav a {
  color: var(--green-dim);
  text-decoration: none;
  font-size: 0.95rem;
}

nav a::before { content: '> '; }

nav a:hover,
nav a.active {
  color: var(--green);
  text-shadow: 0 0 8px var(--green);
}

/* --- typography --- */
h2 {
  font-family: 'VT323', monospace;
  font-size: 1.6rem;
  margin-bottom: 0.5rem;
  color: var(--green);
}

p { margin-bottom: 0.75rem; }
p:last-child { margin-bottom: 0; }

a {
  color: var(--green);
  text-decoration: underline;
}

a:hover { text-shadow: 0 0 8px var(--green); }

ul {
  list-style: none;
  padding-left: 0;
}

ul li::before {
  content: '// ';
  color: var(--green-dim);
}

/* --- footer --- */
footer {
  border-top: 1px solid var(--green-dark);
  padding-top: 0.75rem;
  font-size: 0.8rem;
  color: var(--green-dim);
}

/* --- collapsible box --- */
.collapsible-toggle {
  width: 100%;
  background: var(--green-dim);
  border: none;
  color: var(--bg);
  font-family: 'VT323', monospace;
  font-size: 1.1rem;
  padding: 0.15rem 0.6rem;
  letter-spacing: 0.05em;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  text-align: left;
}

.collapsible-toggle:hover {
  background: var(--green);
}

.collapsible-icon {
  font-size: 1.2rem;
  line-height: 1;
  flex-shrink: 0;
}

.collapsible-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s ease;
}

.collapsible-body.open {
  max-height: 300px;
}

/* blinking cursor during and after typing */
#writeup-text.typing::after,
#writeup-text.done::after {
  content: '▋';
  color: var(--green);
  animation: blink 1s step-end infinite;
}

#writeup-text {
  white-space: pre-wrap;
}

@keyframes blink-out {
  0%   { opacity: 1; }
  25%  { opacity: 0; }
  50%  { opacity: 1; }
  75%  { opacity: 0; }
  100% { opacity: 0; }
}

.collapsible-body.blinking {
  animation: blink-out 0.35s steps(1, end) forwards;
}

/* ============================================================
   GALLERY
   ============================================================ */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1.25rem;
}

.photo-card {
  background: var(--bg-box);
  border: 1px solid var(--green-dim);
  display: flex;
  flex-direction: column;
}

.photo-card-title {
  background: var(--green-dim);
  color: var(--bg);
  font-family: 'VT323', monospace;
  font-size: 0.9rem;
  padding: 0.1rem 0.5rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.photo-card img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  display: block;
  position: relative;
  z-index: 10000;
  filter: sepia(0.15) contrast(1.05);
  transition: filter 0.2s;
}

.photo-card img:hover { filter: none; }

.photo-card-caption {
  padding: 0.5rem 0.6rem;
  font-size: 0.8rem;
  color: var(--green-dim);
  border-top: 1px solid var(--green-dark);
}

.photo-card-caption span {
  display: block;
  color: var(--green);
  font-size: 0.875rem;
}

/* gallery filter bar */
.gallery-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
  font-size: 0.875rem;
  color: var(--green-dim);
  align-items: center;
}

.gallery-controls span { margin-right: 0.5rem; }

.filter-btn {
  background: none;
  border: 1px solid var(--green-dark);
  color: var(--green-dim);
  font-family: 'Share Tech Mono', monospace;
  font-size: 0.8rem;
  padding: 0.2rem 0.6rem;
  cursor: pointer;
}

.filter-btn:hover,
.filter-btn.active {
  border-color: var(--green);
  color: var(--green);
  text-shadow: 0 0 6px var(--green);
}

/* ============================================================
   LIGHTBOX
   ============================================================ */
#lightbox {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 20000;
  background: rgba(0, 0, 0, 0.77);
  align-items: center;
  justify-content: center;
}

#lightbox.active {
  display: flex;
}

#lightbox-inner {
  position: relative;
  max-width: 92vw;
  max-height: 92vh;
}

#lightbox-img {
  display: block;
  max-width: 92vw;
  max-height: 88vh;
  object-fit: contain;
  border: 1px solid var(--green-dim);
  box-shadow: 0 0 40px rgba(0, 255, 65, 0.15);
}

#lightbox-close {
  position: absolute;
  top: -2rem;
  right: 0;
  background: none;
  border: none;
  color: var(--green);
  font-family: 'Share Tech Mono', monospace;
  font-size: 1.1rem;
  cursor: pointer;
  line-height: 1;
  padding: 0.2rem 0.4rem;
}

#lightbox-close:hover {
  text-shadow: 0 0 8px var(--green);
}

/* ============================================================
   MOBILE
   ============================================================ */
@media (max-width: 600px) {
  .site-title {
    font-size: 2rem;
  }

  nav {
    gap: 0.25rem 1rem;
  }

  .gallery-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 0.75rem;
  }

  .gallery-controls {
    flex-wrap: wrap;
    gap: 0.4rem;
  }

  .box-body {
    padding: 0.75rem;
  }

  /* larger tap targets for filter buttons */
  .filter-btn {
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
  }

  /* lightbox: full-width on small screens */
  #lightbox-img {
    max-width: 98vw;
    max-height: 80vh;
  }

  #lightbox-close {
    font-size: 1.4rem;
    padding: 0.4rem 0.6rem;
  }
}
