/* retr0rev — monochrome terminal portfolio */

:root {
  --ink: #050505;
  --bone: #e8e8e8;
  --phosphor: #ffffff;
  --static: #8f8f8f;
  --ghost: rgba(232, 232, 232, 0.16);
  --display: 'VT323', 'IBM Plex Mono', monospace;
  --mono: 'IBM Plex Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;
  --topbar-h: 44px;
  --dock-h: 56px;
}

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--ink);
  color: var(--bone);
  font-family: var(--mono);
  font-size: 15px;
  line-height: 1.65;
  padding-top: var(--topbar-h);
  padding-bottom: calc(var(--dock-h) + 24px);
  overflow-x: hidden;
}

::selection { background: var(--phosphor); color: var(--ink); }

* { scrollbar-width: thin; scrollbar-color: #3a3a3a transparent; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #333; }
::-webkit-scrollbar-thumb:hover { background: #555; }

a { color: inherit; text-decoration: underline; text-underline-offset: 3px; }
a:hover { color: var(--phosphor); }

:focus-visible { outline: 1px dashed var(--phosphor); outline-offset: 3px; }

/* atmosphere: three.js scene + CRT overlays */

#bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  opacity: 0.9;
}

.crt {
  position: fixed;
  inset: 0;
  z-index: 60;
  pointer-events: none;
  background:
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.028) 0 1px, transparent 1px 3px),
    radial-gradient(ellipse at center, transparent 55%, rgba(0, 0, 0, 0.55) 100%);
}

main, .topbar, .footer, .dock { position: relative; z-index: 1; }

/* boot overlay */

#boot {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: var(--ink);
  padding: clamp(16px, 4vw, 48px);
  transition: opacity 0.45s ease;
}
#boot.boot--done { opacity: 0; pointer-events: none; }
#boot-text {
  margin: 0;
  font-family: var(--mono);
  font-size: clamp(12px, 1.6vw, 15px);
  line-height: 2;
  color: var(--bone);
  white-space: pre-wrap;
}
#boot-text .boot-cursor { color: var(--phosphor); }
.boot-hint {
  position: absolute;
  left: clamp(16px, 4vw, 48px);
  bottom: clamp(16px, 4vw, 48px);
  color: var(--static);
  font-size: 12px;
  letter-spacing: 0.08em;
}

/* topbar */

.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 clamp(16px, 4vw, 40px);
  background: rgba(5, 5, 5, 0.92);
  border-bottom: 1px solid var(--ghost);
  font-size: 12.5px;
  letter-spacing: 0.04em;
}
.topbar-id { color: var(--phosphor); }
.topbar-right { display: flex; align-items: center; gap: 8px; color: var(--static); }
.status-dot {
  width: 7px;
  height: 7px;
  background: var(--phosphor);
  border-radius: 50%;
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.8);
}
@media (prefers-reduced-motion: no-preference) {
  .status-dot { animation: pulse 2.4s ease-in-out infinite; }
  @keyframes pulse { 50% { opacity: 0.35; } }
}
.topbar-sep { color: var(--static); }

/* hero */

main { max-width: 1120px; margin: 0 auto; padding: 0 clamp(20px, 5vw, 48px); }

.hero {
  min-height: calc(100svh - var(--topbar-h) - var(--dock-h) - 24px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(48px, 8vh, 96px) 0 clamp(32px, 6vh, 64px);
}

.hero-cmd {
  margin: 0 0 12px;
  color: var(--static);
  font-size: 14px;
  letter-spacing: 0.04em;
}
.hero-cmd .g { color: var(--phosphor); margin-right: 6px; }

.hero-name {
  margin: 0;
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(58px, 12.5vw, 168px);
  line-height: 0.88;
  letter-spacing: 0.01em;
  color: var(--phosphor);
  text-shadow: 0 0 28px rgba(255, 255, 255, 0.35), 0 0 2px rgba(255, 255, 255, 0.9);
  text-wrap: balance;
  will-change: transform;
}
.hero-name .ch { display: inline-block; }

html[lang="ar"] .hero-name {
  font-family: var(--mono), Tahoma, 'Segoe UI', sans-serif;
  letter-spacing: 0;
  line-height: 1.15;
}
html[lang="ar"] .hero-bio,
html[lang="ar"] .hero-alias {
  line-height: 2;
  letter-spacing: 0;
}
html[lang="ar"] .hero-cmd .g { margin-right: 0; margin-left: 6px; }

.hero-alias {
  margin: 18px 0 0;
  font-size: clamp(15px, 2.2vw, 19px);
  color: var(--static);
}
.hero-alias strong { color: var(--phosphor); font-weight: 600; }

.caret { color: var(--phosphor); margin-left: 4px; }
@media (prefers-reduced-motion: no-preference) {
  .caret { animation: blink 1.1s steps(1) infinite; }
  @keyframes blink { 50% { opacity: 0; } }
}

.hero-bio {
  margin: 20px 0 0;
  max-width: 56ch;
  color: var(--bone);
  font-size: clamp(14px, 1.8vw, 16.5px);
}

.hero-ls {
  margin-top: clamp(28px, 5vh, 52px);
  display: flex;
  flex-wrap: wrap;
  gap: 8px 26px;
  align-items: baseline;
  font-size: 15px;
}
.hero-ls-cmd { color: var(--static); letter-spacing: 0.04em; }
.hero-ls a {
  text-decoration: none;
  color: var(--bone);
  padding: 2px 6px;
  transition: background-color 0.12s ease, color 0.12s ease;
}
.hero-ls a:hover, .hero-ls a:focus-visible {
  color: var(--ink);
  background: var(--phosphor);
}

/* staged hero entrance */
.js .hero-cmd, .js .hero-name, .js .hero-alias, .js .hero-bio, .js .hero-ls {
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.55s ease, transform 0.55s ease;
}
.hero.hero--ready .hero-cmd   { opacity: 1; transform: none; transition-delay: 0s; }
.hero.hero--ready .hero-name  { opacity: 1; transform: none; transition-delay: 0.08s; }
.hero.hero--ready .hero-alias { opacity: 1; transform: none; transition-delay: 0.22s; }
.hero.hero--ready .hero-bio   { opacity: 1; transform: none; transition-delay: 0.32s; }
.hero.hero--ready .hero-ls    { opacity: 1; transform: none; transition-delay: 0.42s; }

/* sections */

.sec { padding: clamp(64px, 12vh, 128px) 0; border-top: 1px solid var(--ghost); }

.sec-head { margin-bottom: clamp(28px, 5vh, 48px); }
.sec-title {
  margin: 0;
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(30px, 4.6vw, 52px);
  line-height: 1;
  color: var(--phosphor);
}
.sec-meta {
  margin: 10px 0 0;
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--static);
}

/* scroll reveal initial states (JS only) */
.js .reveal-init { opacity: 0; transform: translateY(22px); }

/* project cards */

.cards {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px;
}
@media (max-width: 760px) { .cards { grid-template-columns: 1fr; } }

.card {
  border: 1px solid var(--ghost);
  padding: 22px 24px 24px;
  background: rgba(5, 5, 5, 0.72);
  color: var(--bone);
  transition: background-color 0.14s ease, color 0.14s ease, border-color 0.14s ease;
}
.card:hover, .card:focus-within {
  background: var(--bone);
  color: var(--ink);
  border-color: var(--bone);
}
.card-top {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  letter-spacing: 0.16em;
  color: var(--static);
}
.card:hover .card-top, .card:focus-within .card-top { color: rgba(5, 5, 5, 0.62); }
.card h3 {
  margin: 14px 0 10px;
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(28px, 3.4vw, 40px);
  line-height: 1;
  letter-spacing: 0.02em;
}
.card p { margin: 0 0 14px; font-size: 14px; }
.card .card-link { margin: 0; font-size: 13px; }
.card .card-link.dim { color: var(--static); }
.card:hover .card-link.dim, .card:focus-within .card-link.dim { color: rgba(5, 5, 5, 0.62); }
.card .card-link a { text-decoration: none; }
.card .card-link a:hover { text-decoration: underline; }

.tags {
  list-style: none;
  margin: 0 0 16px;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.tags li {
  font-size: 11.5px;
  letter-spacing: 0.06em;
  border: 1px solid currentColor;
  padding: 2px 8px;
  color: var(--static);
}
.card:hover .tags li, .card:focus-within .tags li { color: inherit; }

/* skills tree */

.tree {
  border: 1px solid var(--ghost);
  background: rgba(5, 5, 5, 0.72);
  padding: 20px 24px;
  overflow-x: auto;
}
.tree-row {
  display: grid;
  grid-template-columns: 170px 1fr;
  gap: 16px;
  padding: 7px 0;
  white-space: nowrap;
}
.tree-branch { color: var(--phosphor); }
.tree-items { color: var(--static); transition: color 0.14s ease; }
.tree-row:hover .tree-items { color: var(--bone); }
@media (max-width: 700px) {
  .tree-row {
    grid-template-columns: 118px 1fr;
    white-space: normal;
  }
  .tree-items { white-space: normal; }
}

/* man page */

.man {
  max-width: 72ch;
  border: 1px solid var(--ghost);
  background: rgba(5, 5, 5, 0.72);
  padding: 26px clamp(20px, 4vw, 44px);
}
.man h3 {
  margin: 24px 0 6px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--phosphor);
}
.man h3:first-child { margin-top: 0; }
.man p { margin: 0 0 10px; color: var(--bone); }
.man strong { color: var(--phosphor); font-weight: 600; }

/* contact */

.contact { max-width: 72ch; }
.contact-label {
  margin: 26px 0 4px;
  font-size: 11px;
  letter-spacing: 0.22em;
  color: var(--static);
}
.contact-label:first-child { margin-top: 0; }
.contact-email {
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
}
.contact-email a {
  font-family: var(--display);
  font-size: clamp(26px, 4.4vw, 44px);
  line-height: 1;
  text-decoration: none;
  color: var(--phosphor);
}
.contact-email a:hover { text-decoration: underline; text-underline-offset: 6px; }
.contact-gh { margin: 0; font-size: 16px; }
.contact-note { margin: 30px 0 0; color: var(--static); font-size: 14px; }

.copy-btn {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.12em;
  color: var(--bone);
  background: transparent;
  border: 1px solid var(--bone);
  padding: 7px 14px;
  cursor: pointer;
  transition: background-color 0.14s ease, color 0.14s ease;
}
.copy-btn:hover, .copy-btn:focus-visible { background: var(--phosphor); color: var(--ink); }

.lang-btn {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.12em;
  color: var(--bone);
  background: transparent;
  border: 1px solid var(--bone);
  padding: 4px 10px;
  cursor: pointer;
  transition: background-color 0.14s ease, color 0.14s ease;
}
.lang-btn:hover, .lang-btn:focus-visible { background: var(--phosphor); color: var(--ink); }

/* footer */

.footer {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
  justify-content: space-between;
  align-items: center;
  padding: 26px clamp(20px, 5vw, 48px);
  border-top: 1px solid var(--ghost);
  font-size: 11.5px;
  letter-spacing: 0.1em;
  color: var(--static);
}
.footer a { text-decoration: none; color: var(--bone); }
.footer a:hover { color: var(--phosphor); }

/* docked shell */

.dock {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 50;
  background: rgba(5, 5, 5, 0.94);
  border-top: 1px solid var(--ghost);
}
.dock-row {
  display: flex;
  align-items: center;
  gap: 10px;
  height: var(--dock-h);
  padding: 0 clamp(16px, 4vw, 40px);
}
.dock-prompt { color: var(--phosphor); font-size: 14px; white-space: nowrap; cursor: text; }
.dock-input {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: none;
  outline: none;
  color: var(--bone);
  font-family: var(--mono);
  font-size: 16px;
  caret-color: var(--phosphor);
}
.dock-input::placeholder { color: rgba(143, 143, 143, 0.55); }

.shell-out {
  max-height: 240px;
  overflow-y: auto;
  padding: 14px clamp(16px, 4vw, 40px) 10px;
  border-bottom: 1px solid var(--ghost);
  font-size: 13.5px;
  line-height: 1.7;
}
.shell-out .ln { margin: 0; white-space: pre-wrap; }
.shell-out .ln-sys { color: var(--static); }
.shell-out .ln-err { color: var(--phosphor); font-weight: 600; }
.shell-out .ln-ok { color: var(--phosphor); }

/* reduced motion: everything static, instantly */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .js .hero-cmd, .js .hero-name, .js .hero-alias, .js .hero-bio, .js .hero-ls,
  .js .reveal-init { opacity: 1; transform: none; }
}
