/* ============================================================
   Ahmed Abdelgelel — Portfolio
   The whole page IS a Command Prompt window.
   Chrome: dark Win11 title bar · body: #0c0c0c, Consolas
   ============================================================ */

:root {
  --bg: #0c0c0c;            /* terminal body */
  --chrome-top: #252526;    /* title bar gradient top */
  --chrome-bottom: #1e1e1e; /* title bar gradient bottom */
  --bar-line: #101010;
  --text: #cccccc;          /* command output */
  --bright: #ffffff;        /* prompt line + typed input */
  --dim: #8a8a8a;           /* secondary text */
  --ghost: #4d4d4d;         /* "type 'help'" placeholder */
  --hover: rgba(255, 255, 255, 0.09);
  --btn-close: #e81123;
  --ok: #3ddc84;            /* status dot green */
  --mono: "Consolas", "Cascadia Code", "JetBrains Mono", ui-monospace,
          "Segoe UI Mono", "Liberation Mono", monospace;
  --chrome-font: "Segoe UI", "Inter", system-ui, sans-serif;
}

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

html { height: 100%; }

body {
  height: 100dvh;
  overflow: hidden;               /* the page is the window */
  background: var(--bg);
  color: var(--text);
  font-family: var(--mono);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

::selection { background: #424242; color: #fff; }

a { color: var(--bright); }

/* scrollbars — dark & thin like a real window */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #2e2e2e; }
::-webkit-scrollbar-thumb:hover { background: #3d3d3d; }
::-webkit-scrollbar-corner { background: transparent; }

/* ============================================================
   WINDOW CHROME — title bar + screen
   ============================================================ */
.terminal {
  height: 100dvh;
  display: flex;
  flex-direction: column;
}

.titlebar {
  flex: 0 0 auto;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-left: 12px;
  background: linear-gradient(to bottom, var(--chrome-top), var(--chrome-bottom));
  border-bottom: 1px solid var(--bar-line);
  user-select: none;
}

.titlebar__brand {
  display: flex;
  align-items: center;
  gap: 9px;
  font-family: var(--chrome-font);
  font-size: 12px;
  color: #e6e6e6;
  letter-spacing: 0.01em;
  white-space: nowrap;
  min-width: 0;
}

.titlebar__brand svg { flex: 0 0 auto; }

.titlebar__right {
  display: flex;
  align-items: center;
  gap: 14px;
  height: 100%;
}

/* --- status: green dot + "online" (cosmetic) --- */
.status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  color: #b8b8b8;
}

.status__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 6px var(--ok);
  animation: pulse 2.6s infinite;
}

@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 rgba(61, 220, 132, 0.55); }
  70%  { box-shadow: 0 0 0 7px rgba(61, 220, 132, 0); }
  100% { box-shadow: 0 0 0 0 rgba(61, 220, 132, 0); }
}

/* --- Win11 minimize / maximize / close --- */
.titlebar__controls {
  display: flex;
  align-self: stretch;
}

.titlebar__controls button {
  appearance: none;
  border: 0;
  background: transparent;
  width: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #d4d4d4;
  cursor: default;
  padding: 0;
  transition: background 0.12s ease;
}

.titlebar__controls button:hover { background: var(--hover); }
.titlebar__controls button:active { background: rgba(255, 255, 255, 0.16); }
.titlebar__controls .win-close:hover { background: var(--btn-close); }
.titlebar__controls .win-close:hover svg { color: #fff; }

/* ============================================================
   SCREEN — output scrolls above a pinned prompt row
   ============================================================ */
.screen {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 14px 16px 16px;
  overflow: hidden;
}

.screen__out {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}

/* every line of output: echo, boot text, command renderers */
.line {
  white-space: pre-wrap;          /* keep indentation, wrap when narrow */
  overflow-wrap: anywhere;
  color: var(--text);
}

.line b { color: var(--bright); font-weight: 700; }
.line .dim { color: var(--dim); }
.line a { color: var(--bright); text-decoration: none; border-bottom: 1px solid #555; }
.line a:hover { color: #fff; border-bottom-color: #fff; text-shadow: 0 0 8px rgba(255, 255, 255, 0.45); }

/* echoed command line — like real cmd: prompt then typed text */
.line--echo { color: var(--bright); }
.echo-prompt { color: var(--bright); }

/* experience block: role left, dates right (flex so it wraps on tiny screens) */
.jobrow {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 18px;
  color: var(--bright);
}
.jobrow__dates { margin-left: auto; color: var(--dim); white-space: nowrap; }

/* ============================================================
   PROMPT ROW — prompt + mirrored text + block cursor.
   The real <input> sits invisibly on top (screen readers and
   keyboard users get a true field; the mirror shows the look).
   ============================================================ */
.promptline {
  position: relative;
  flex: 0 0 auto;
  display: flex;
  align-items: baseline;
  gap: 1ch;
  margin-top: 14px;
  white-space: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
  opacity: 0;                        /* revealed by boot (.terminal.ready) */
  transition: opacity 0.25s ease, transform 0.25s ease;
  transform: translateY(3px);
}

.promptline::-webkit-scrollbar { display: none; }

.promptline__prompt { color: var(--bright); }

.promptline__text { color: var(--bright); }

.promptline__text.ghost { color: var(--ghost); }

/* blinking block cursor */
.cursor-block {
  display: inline-block;
  width: 0.62em;
  height: 1.02em;
  margin-left: 2px;
  background: #e8e8e8;
  vertical-align: text-bottom;
  animation: blink 1s steps(1) infinite;
}

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

.terminal.ready .promptline { opacity: 1; transform: none; }

/* the real field — visually absent, functionally a full <input> */
.term-input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  margin: 0;
  padding: 0;
  background: transparent;
  color: transparent;
  caret-color: transparent;
  outline: none;
  cursor: text;
  font: inherit;
}

/* ============================================================
   QUICK-COMMAND CHIPS — mobile only, pinned below the screen
   ============================================================ */
.chips {
  flex: 0 0 auto;
  display: flex;
  gap: 8px;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  background: #141414;
  border-top: 1px solid #242424;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.terminal.ready .chips { opacity: 1; }

.chips button {
  flex: 1;
  font-family: var(--mono);
  font-size: 12px;
  color: #d4d4d4;
  background: #1e1e1e;
  border: 1px solid #333;
  border-radius: 6px;
  padding: 8px 10px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.chips button:active { background: #333; border-color: #555; }
.chips button:focus-visible { outline: 1px solid #8a8a8a; outline-offset: 2px; }

/* ============================================================
   NO-JS FALLBACK — static page when scripts can't run
   ============================================================ */
.fallback {
  max-width: 680px;
  margin: 0 auto;
  padding: 56px 24px 64px;
  color: var(--text);
  font-family: var(--mono);
  font-size: 14px;
  overflow-y: auto;
  height: 100dvh;
}

.fallback__boot { color: var(--dim); white-space: pre-wrap; }

.fallback h1 { font-size: 22px; color: var(--bright); margin: 28px 0 6px; }
.fallback h2 { font-size: 15px; color: var(--bright); margin: 30px 0 10px; }
.fallback p { margin: 6px 0; line-height: 1.6; }
.fallback ul { list-style: none; margin: 8px 0 0; }
.fallback li { margin: 6px 0; line-height: 1.6; }
.fallback li::before { content: "› "; color: var(--dim); }
.fallback a { color: var(--bright); text-decoration: underline; text-underline-offset: 3px; }
.fallback .muted { color: var(--dim); }
.fallback__note { margin-top: 40px; padding-top: 14px; border-top: 1px solid #2a2a2a; color: var(--dim); font-size: 12px; }

.fallback .mono-head { color: var(--dim); letter-spacing: 0.05em; }

/* ---- visibility is driven by the inline boot guard in <head> ----
   default (no JS):   fallback visible, terminal hidden
   html.js:           terminal visible, fallback hidden (until boot guard
                      timeout declares a failed JS boot → fallback back) */
.terminal { display: none; }
html:not(.js) .fallback { display: block; }
html:not(.js) .terminal { display: none; }
html.js .fallback { display: none; }
html.js .terminal { display: flex; }
html.js.fallback-show .terminal { display: none; }
html.js.fallback-show .fallback { display: block; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (min-width: 641px) {
  .chips { display: none; }
}

@media (max-width: 640px) {
  .screen { padding: 12px 12px 10px; }
  .titlebar__brand { font-size: 11px; }
  .screen__out, .promptline { font-size: 13.5px; }
}

/* ============================================================
   REDUCED MOTION
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  .cursor-block, .status__dot { animation: none; }
  .promptline { transition: none; transform: none; }
  .chips { transition: none; }
}