/* ----------------------------------------------------------------
   Theme tokens. Dark is the default; light overrides via [data-theme].
   ---------------------------------------------------------------- */
:root {
  --bg: #0d0d10;
  --surface: #141418;
  --surface-2: #1c1c22;
  --border: #26262b;
  --text: #f2f2f0;
  --text-2: #9a9aa2;
  --text-3: #6b6b73;
  --accent: #5dcaa5;
  --window-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, "SF Mono", Menlo, Monaco, monospace;
}

[data-theme="light"] {
  --bg: #f3f3f0;
  --surface: #ffffff;
  --surface-2: #f1f1ee;
  --border: #e6e6e2;
  --text: #1a1a1a;
  --text-2: #56564f;
  --text-3: #8a8a82;
  --accent: #1d9e75;
  --window-shadow: 0 18px 50px rgba(20, 20, 20, 0.14);
}

/* ----------------------------------------------------------------
   Base
   ---------------------------------------------------------------- */
* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  background: var(--surface);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 15px;
  line-height: 1.7;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  transition: background 0.2s ease, color 0.2s ease;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ----------------------------------------------------------------
   Full-screen terminal window (macOS style).
   Fills the viewport with a small margin so the rounded corners show.
   ---------------------------------------------------------------- */
.terminal-window {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  overflow: hidden;
}

.terminal-bar {
  position: relative;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}

.dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

.dot-red { background: #ff5f56; }
.dot-yellow { background: #ffbd2e; }
.dot-green { background: #27c93f; }

.terminal-title {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: var(--text-3);
  pointer-events: none;
}

.terminal-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 32px;
  scrollbar-width: none;
}

.terminal-body::-webkit-scrollbar { width: 0; height: 0; }

.terminal-body--center {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.terminal-content {
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
}

.terminal-content--wide { max-width: 900px; }

/* ----------------------------------------------------------------
   Terminal prompt lines
   ---------------------------------------------------------------- */
.cmd {
  color: var(--text-3);
  font-size: 13px;
  margin-bottom: 4px;
}

.prompt { color: var(--accent); }

.prompt-final { margin-bottom: 0; }

/* ----------------------------------------------------------------
   Home hero
   ---------------------------------------------------------------- */
.name {
  font-size: 28px;
  font-weight: 500;
  margin: 2px 0 20px;
}

.about {
  color: var(--text-2);
  max-width: 520px;
  margin-bottom: 20px;
}

.cursor {
  display: inline-block;
  width: 8px;
  height: 15px;
  background: var(--text);
  vertical-align: -2px;
  animation: blink 1.1s steps(1) infinite;
}

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

.links {
  display: flex;
  gap: 24px;
  font-size: 14px;
  margin-bottom: 20px;
}

/* ----------------------------------------------------------------
   Projects page header
   ---------------------------------------------------------------- */
.projects-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 32px;
}

.page-title {
  font-size: 22px;
  font-weight: 500;
  margin-top: 2px;
}

.back { font-size: 14px; }

/* ----------------------------------------------------------------
   Projects grid
   ---------------------------------------------------------------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 18px;
}

.card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  color: inherit;
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  text-decoration: none;
}

.card-image {
  position: relative;
  aspect-ratio: 16 / 10;
  background: var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
}

.card-mono {
  font-size: 32px;
  font-weight: 500;
  color: var(--text-3);
}

.card-image img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.card-body {
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.card-name {
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 6px;
}

.card-desc {
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.6;
  margin-bottom: 12px;
  flex: 1;
}

.card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.card-open {
  font-size: 12px;
  color: var(--accent);
}

.card-platform {
  display: inline-flex;
  color: var(--text-3);
}

.card-platform svg {
  width: 17px;
  height: 17px;
  display: block;
}

.card:hover .card-platform { color: var(--text-2); }

/* ----------------------------------------------------------------
   Theme toggle button (lives in the terminal title bar)
   ---------------------------------------------------------------- */
.theme-toggle {
  margin-left: auto;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-2);
  cursor: pointer;
  z-index: 1;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.theme-toggle:hover {
  color: var(--text);
  border-color: var(--text-3);
}

.theme-toggle svg { width: 15px; height: 15px; }

/* Show the icon for the theme you would switch TO */
.icon-sun { display: block; }
.icon-moon { display: none; }
[data-theme="light"] .icon-sun { display: none; }
[data-theme="light"] .icon-moon { display: block; }

/* ----------------------------------------------------------------
   Small screens
   ---------------------------------------------------------------- */
@media (max-width: 560px) {
  .terminal-title { display: none; }
}

@media (max-width: 480px) {
  .terminal-body { padding: 22px 18px; }
  .name { font-size: 24px; }
  .links { gap: 18px; }
}

/* ----------------------------------------------------------------
   Home intro typing animation.
   Applies only while <html> has the "intro" class (added by JS once
   per session). Otherwise everything shows normally.
   ---------------------------------------------------------------- */
.intro .reveal { opacity: 0; }

.intro .reveal.show {
  opacity: 1;
  transition: opacity 0.25s ease;
}

/* Blinking caret shown on the element currently being typed */
.typing-active::after {
  content: "";
  display: inline-block;
  width: 0.5em;
  height: 1em;
  background: var(--text);
  vertical-align: -2px;
  margin-left: 2px;
  animation: blink 1.1s steps(1) infinite;
}

/* ----------------------------------------------------------------
   Projects page: header typing + cards revealing on scroll.
   The "projects-anim" class is added by JS only when motion is allowed.
   ---------------------------------------------------------------- */
.projects-anim .reveal { opacity: 0; }

.projects-anim .reveal.show {
  opacity: 1;
  transition: opacity 0.25s ease;
}

.reveal-card {
  opacity: 0;
  transform: translateY(16px);
}

.reveal-card.in {
  opacity: 1;
  transform: none;
  transition: opacity 0.5s ease, transform 0.5s ease;
}
