/* ============================================
   Terminal Section — Machine-readable homepage content
   Self-contained CRT monitor component.
   Phosphor color controlled by .terminal--green / .terminal--amber
   Bezel adapts to light/dark mode.

   All dimensions use em so everything scales proportionally
   from the font-size set on .terminal-section.
   ============================================ */

.terminal-section {
  max-width: 450px;
  margin: 60px auto 80px;
  padding: 0 20px;
  font-size: 14px; /* scaling anchor — everything inside is em-based */
  scroll-snap-align: none; /* don't participate in DG homepage snap flow */
}

.terminal-intro {
  text-align: center;
  margin-bottom: 1.25em;
  font-size: 0.95rem;
  color: var(--ink-muted, #777);
  line-height: 1.5;
}

/* --- "Why is this here?" tooltip --- */
.terminal-why {
  position: relative;
  cursor: help;
  color: var(--accent);
  text-decoration: underline dotted;
  text-decoration-color: var(--accent);
  text-underline-offset: 0.2em;
  white-space: nowrap;
}
.terminal-why::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 0.6em);
  left: 50%;
  transform: translateX(-50%);
  width: max-content;
  max-width: 360px;
  padding: 1em 1.25em;
  border-radius: 8px;
  background: var(--bg, #1a1a1a);
  color: var(--ink, #ccc);
  font-size: 0.875rem;
  line-height: 1.55;
  white-space: normal;
  box-shadow: 0 4px 16px rgb(0 0 0 / 35%);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 10;
}
.terminal-why:hover::after,
.terminal-why:focus::after {
  opacity: 1;
}

/* --- Monitor bezel --- */
/* Dark mode default: off-white 80s plastic */
.terminal-monitor {
  background: linear-gradient(175deg, #d4cdbf 0%, #c8c0b0 30%, #bab2a2 100%);
  border-radius: 0.875em;
  padding: 0.5em 1.75em 0.625em;
  box-shadow:
    0 0.375em 1.5em rgba(0,0,0,0.4),
    inset 0 0.0625em 0 rgba(255,255,255,0.3),
    inset 0 -0.0625em 0 rgba(0,0,0,0.1);
  position: relative;
}

/* Light mode: same off-white bezel as dark mode — looks better on both */

/* --- Titlebar --- */
.terminal-titlebar {
  display: flex;
  align-items: center;
  padding: 0.25em 0.5em 0.375em;
  margin-bottom: 0.25em;
}
.terminal-titlebar-text {
  flex: 1;
  text-align: center;
  font-size: 0.6em;
  color: #7a7264;
  font-family: 'Courier New', monospace;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* --- Screen --- */
.terminal-screen {
  background: #0a0a0a;
  border-radius: 0.5em;
  padding: 1.25em 1.125em;
  overflow-y: auto;
  position: relative;
  border: 0.125em solid #2a2520;
  aspect-ratio: 1 / 1;
}

/* Scanlines */
.terminal-screen::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 0, 0, 0.08) 2px,
    rgba(0, 0, 0, 0.08) 4px
  );
  pointer-events: none;
  border-radius: 0.375em;
  z-index: 1;
}

/* CRT vignette */
.terminal-screen::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: radial-gradient(
    ellipse at center,
    transparent 55%,
    rgba(0, 0, 0, 0.35) 100%
  );
  pointer-events: none;
  border-radius: 0.375em;
  z-index: 2;
}

/* --- Bottom bar (dots + LED) --- */
.terminal-bottombar {
  display: flex;
  align-items: center;
  padding: 0.5em 0.625em 0.125em;
}
.terminal-dots {
  display: flex;
  gap: 0.3125em;
}
.terminal-dot {
  width: 0.5em;
  height: 0.5em;
  border-radius: 50%;
}
.terminal-dot--red { background: #cc4b44; }
.terminal-dot--yellow { background: #c4a332; }
.terminal-dot--green { background: #3da84a; }
.terminal-bottombar-spacer { flex: 1; }

/* Power LED — color set by phosphor variant */
.terminal-led {
  width: 0.3125em;
  height: 0.3125em;
  border-radius: 50%;
}

/* --- Stand --- */
.terminal-stand {
  width: 3.75em;
  height: 0.875em;
  background: linear-gradient(to bottom, #b8b0a0, #a89e8e);
  margin: 0 auto;
  border-radius: 0 0 0.1875em 0.1875em;
  box-shadow: inset 0 0.0625em 0 rgba(255,255,255,0.15);
}
.terminal-base {
  width: 6.875em;
  height: 0.3125em;
  background: linear-gradient(to bottom, #a89e8e, #9e9686);
  margin: 0 auto;
  border-radius: 0 0 0.375em 0.375em;
  box-shadow: 0 0.125em 0.25em rgba(0,0,0,0.2);
}

/* --- Terminal text (shared) --- */
.terminal-screen p,
.terminal-screen h2,
.terminal-screen h3,
.terminal-screen ul,
.terminal-screen li,
.terminal-screen a {
  position: relative;
  z-index: 3;
  font-family: 'Courier New', Courier, monospace;
  line-height: 1.6;
}
.terminal-screen p {
  font-size: 0.75em;
  margin: 0 0 0.7em;
}
.terminal-screen h2 {
  font-size: 0.78em;
  margin: 1.2em 0 0.4em;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.terminal-screen h3 {
  font-size: 0.75em;
  margin: 1em 0 0.3em;
}
.terminal-screen ul {
  list-style: none;
  padding-left: 1em;
  margin: 0.3em 0 0.8em;
}
.terminal-screen li {
  font-size: 0.72em;
  margin-bottom: 0.3em;
}
.terminal-screen a {
  text-decoration: none;
}
.terminal-screen a:hover {
  text-decoration: underline;
}

/* Prompt + cursor */
.terminal-prompt {
  font-family: 'Courier New', monospace;
  font-size: 0.75em;
}
.terminal-cursor {
  display: inline-block;
  width: 0.4375em;
  height: 0.75em;
  vertical-align: text-bottom;
  animation: terminal-blink 1s step-end infinite;
}
@keyframes terminal-blink {
  50% { opacity: 0; }
}

/* Scrollbar */
.terminal-screen::-webkit-scrollbar { width: 0.3125em; }
.terminal-screen::-webkit-scrollbar-track { background: #0a0a0a; border-radius: 0.1875em; }
.terminal-screen::-webkit-scrollbar-thumb { border-radius: 0.1875em; }

/* --- Responsive: scale the whole monitor by adjusting font-size --- */
@media (max-width: 767px) {
  .terminal-section {
    max-width: 275px;
    margin: 40px auto 60px;
    font-size: 10px;
  }
}

@media (min-width: 768px) and (max-width: 1024px) {
  .terminal-section {
    max-width: 350px;
    font-size: 12px;
  }
}

/* ============================================
   GREEN PHOSPHOR (Tsunami Swami)
   ============================================ */
.terminal--green .terminal-screen {
  box-shadow:
    inset 0 0 3.125em rgb(0 255 65 / 30%),
    inset 0 0 0.25em rgb(0 255 65 / 95%),
    0 0 2em rgb(0 0 0 / 25%),
    0 0 0.25em rgb(0 0 0 / 25%);
}
.terminal--green .terminal-screen p,
.terminal--green .terminal-screen li { color: #33ff33; }
.terminal--green .terminal-screen h2 { color: #66ff66; }
.terminal--green .terminal-screen h2::before { content: '> '; color: #1a9f1a; }
.terminal--green .terminal-screen h3 { color: #44dd44; }
.terminal--green .terminal-screen li::before { content: '- '; color: #1a9f1a; }
.terminal--green .terminal-screen a { color: #22cc88; }
.terminal--green .terminal-prompt { color: #1a9f1a; }
.terminal--green .terminal-cursor { background: #33ff33; }
.terminal--green .terminal-led { background: #33ff33; box-shadow: 0 0 0.25em #33ff33; }
.terminal--green .terminal-screen::-webkit-scrollbar-thumb { background: #1a3a1a; }
.terminal--green .terminal-screen::-webkit-scrollbar-thumb:hover { background: #2a5a2a; }

/* ============================================
   AMBER PHOSPHOR (Digital Grease)
   ============================================ */
.terminal--amber .terminal-screen {
  box-shadow:
    inset 0 0 3.125em rgb(255 176 0 / 30%),
    inset 0 0 0.25em rgb(255 176 0 / 95%),
    0 0 2em rgb(0 0 0 / 25%),
    0 0 0.25em rgb(0 0 0 / 25%);
}
.terminal--amber .terminal-screen p,
.terminal--amber .terminal-screen li { color: #ffb000; }
.terminal--amber .terminal-screen h2 { color: #ffc832; }
.terminal--amber .terminal-screen h2::before { content: '> '; color: #996600; }
.terminal--amber .terminal-screen h3 { color: #e6a800; }
.terminal--amber .terminal-screen li::before { content: '- '; color: #996600; }
.terminal--amber .terminal-screen a { color: #0793ff; }
.terminal--amber .terminal-prompt { color: #996600; }
.terminal--amber .terminal-cursor { background: #ffb000; }
.terminal--amber .terminal-led { background: #ffb000; box-shadow: 0 0 0.25em #ffb000; }
.terminal--amber .terminal-screen::-webkit-scrollbar-thumb { background: #3a2a00; }
.terminal--amber .terminal-screen::-webkit-scrollbar-thumb:hover { background: #5a4a10; }
