/* ============================================================
   veskov.dev :: terminal theme
   ============================================================ */
:root {
  --bg:        #0b0f0b;
  --bg-panel:  #0e140e;
  --fg:        #b8ffcc;
  --green:     #46ff8a;
  --green-dim: #2ea864;
  --amber:     #ffb347;
  --red:       #ff5f56;
  --yellow:    #ffbd2e;
  --cyan:      #5be7e9;
  --dim:       #74957f;
  --border:    #1d2b20;
  --glow:      0 0 6px rgba(70, 255, 138, .35);
  --font:      'JetBrains Mono', ui-monospace, 'Cascadia Code', Menlo, Consolas, monospace;
}

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

body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.65;
  min-height: 100vh;
  overflow-x: hidden;
}

::selection { background: var(--green); color: #04140a; }

/* ---------- CRT effects ---------- */
.scanlines {
  position: fixed; inset: 0; z-index: 50; pointer-events: none;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0px, transparent 2px,
    rgba(0, 0, 0, .18) 3px, rgba(0, 0, 0, .18) 4px
  );
  mix-blend-mode: multiply;
}
.vignette {
  position: fixed; inset: 0; z-index: 51; pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 55%, rgba(0,0,0,.55) 100%);
}

/* ---------- Boot overlay ---------- */
#boot {
  position: fixed; inset: 0; z-index: 100;
  background: var(--bg);
  padding: 2rem;
  font-size: 14px;
  white-space: pre-wrap;
  color: var(--green);
  text-shadow: var(--glow);
  transition: opacity .5s ease;
}
#boot.done { opacity: 0; pointer-events: none; }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  padding: .2rem 0;
  background: rgba(14, 20, 14, .92);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(6px);
}
/* same column as #term, so the nav never drifts off to the window edge */
.topbar-inner {
  display: flex; align-items: center; gap: .55rem;
  width: 100%; max-width: 880px; margin: 0 auto;
  padding: 0 1.25rem;
}
.dot { width: 11px; height: 11px; border-radius: 50%; display: inline-block; }
.dot.red    { background: var(--red); }
.dot.yellow { background: var(--yellow); }
.dot.green  { background: #27c93f; }
.topbar-title { color: var(--dim); margin-left: .5rem; font-size: 13px; }
.topnav { margin-left: auto; display: flex; gap: 1.1rem; }
.topnav a {
  color: var(--green-dim); text-decoration: none; font-size: 13px;
  padding: .7rem .3rem; /* thumb-sized tap target, still optically centred */
  transition: color .15s, text-shadow .15s;
}
.topnav a:hover { color: var(--green); text-shadow: var(--glow); }

/* ---------- Terminal layout ---------- */
#term {
  max-width: 880px;
  margin: 0 auto;
  padding: 2rem 1.25rem 4rem;
}

.prompt { color: var(--green); text-shadow: var(--glow); font-weight: 700; }
.path   { color: var(--cyan); }
.dim    { color: var(--dim); }
.err    { color: var(--red); }

a { color: var(--cyan); text-decoration: none; }
a:hover { text-shadow: 0 0 6px rgba(91, 231, 233, .5); }

.cursor {
  display: inline-block; width: .62em; height: 1.15em;
  background: var(--green); vertical-align: text-bottom;
  margin-left: 2px;
  animation: blink 1.06s step-end infinite;
  box-shadow: var(--glow);
}
@keyframes blink { 50% { opacity: 0; } }

/* ---------- History entries ---------- */
.h-line { white-space: pre-wrap; word-break: break-word; }
.h-line .cmd { color: var(--fg); }

/* output block: appears instantly after a command is typed */
.out {
  margin: .35rem 0 1.6rem;
  white-space: pre-wrap; word-break: break-word;
}
.out p { margin-bottom: .9rem; max-width: 68ch; white-space: normal; }

/* ---------- whoami output ---------- */
.who-name {
  font-size: clamp(2.6rem, 8vw, 4.6rem);
  font-weight: 700; color: var(--green);
  text-shadow: var(--glow), 0 0 24px rgba(70,255,138,.18);
  letter-spacing: 0;
  line-height: 1.15;
  white-space: normal;
}
.who-sub { color: var(--fg); margin-top: .2rem; white-space: normal; }
.who-sub.dim { color: var(--dim); font-size: 14px; margin-top: .05rem; }

/* ---------- experience output ---------- */
.job { margin-bottom: 1.4rem; white-space: normal; max-width: 68ch; }
.job .j-role { color: var(--green); font-weight: 700; }
.job .j-org  { color: var(--cyan); font-size: 14px; }
.job .j-when { font-size: 13px; margin-bottom: .3rem; }
.job .j-desc { color: var(--fg); font-size: 15px; }

/* subtle glitch on hover, pointer only: on touch the effect would stick */
.glitch { position: relative; display: inline-block; }
@media (hover: hover) {
  .glitch:hover::before,
  .glitch:hover::after {
    content: attr(data-text);
    position: absolute; inset: 0; overflow: hidden;
  }
  .glitch:hover::before { color: var(--red);  animation: glitch-a .3s steps(2) infinite; }
  .glitch:hover::after  { color: var(--cyan); animation: glitch-b .3s steps(2) infinite; }
}
@keyframes glitch-a { 0%{transform:translate(2px,-1px)} 50%{transform:translate(-2px,1px)} 100%{transform:translate(1px,0)} }
@keyframes glitch-b { 0%{transform:translate(-2px,1px)} 50%{transform:translate(2px,-1px)} 100%{transform:translate(-1px,0)} }

/* ---------- about output ---------- */
.skill-row { display: flex; flex-wrap: wrap; gap: .5rem; margin: .3rem 0 .5rem; white-space: normal; }
.tag {
  border: 1px solid var(--border); border-radius: 4px;
  padding: .1rem .55rem; font-size: 13px; color: var(--green-dim);
  background: var(--bg-panel);
}
/* the three the job hunt actually runs on */
.tag.tag-core { border-color: var(--amber); color: var(--amber); }

/* ---------- projects output ---------- */
/* real terminals clip long lines, they do not reflow them */
.ls-block { font-size: 13px; margin-bottom: 1rem; white-space: pre; overflow-x: auto; }
.projects-grid {
  display: grid; gap: 1rem;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  white-space: normal;
}
.project {
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-panel);
  padding: 1rem 1.1rem;
  transition: border-color .2s, transform .2s, box-shadow .2s;
  display: flex; flex-direction: column; gap: .55rem;
}
.project:hover {
  border-color: var(--green-dim);
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(70, 255, 138, .07);
}
.project .p-name { color: var(--green); font-weight: 700; }
.project .p-name::before { content: "▸ "; color: var(--amber); }
.project .p-desc { color: var(--fg); font-size: 14px; flex: 1; }
.project .p-stack { color: var(--dim); font-size: 13px; }
.project .p-links { display: flex; gap: 1rem; font-size: 14px; }
.project .p-links a::before { content: "[→] "; color: var(--amber); }
.project .p-note { font-size: 13px; font-style: italic; }

/* ---------- contacts output ---------- */
.contact-row { display: flex; gap: 1rem; padding: .15rem 0; }
.contact-row .c-key { color: var(--amber); min-width: 92px; }

/* ---------- help output ---------- */
.help-row { display: grid; grid-template-columns: 12rem 1fr; gap: .5rem; }
.help-tip { margin-top: .9rem; }

/* ---------- live prompt ---------- */
/* no gap: the block cursor has to sit on the text, not a third of a word away */
#prompt-form {
  display: flex; align-items: center;
  margin: .25rem 0 3rem;
}
#prompt-form label { margin-right: .5rem; }
/* JS keeps the width at the length of the value, so the cursor follows the text */
#prompt-input {
  flex: 0 1 auto; min-width: 1ch; max-width: 100%;
  background: transparent; border: none; outline: none;
  color: var(--fg); font-family: var(--font); font-size: inherit;
  line-height: 1.65; padding: 0;
  caret-color: transparent; /* the .cursor block is the caret */
}
/* The input reserves one cell past the text so nothing clips; the block is pulled
   back onto it, which is where a real terminal parks its cursor. Same font and
   size as the input, so the 1ch cancels exactly whichever family wins.
   The block doubles as the prompt's focus indicator: hollow when the input does
   not have focus, solid and blinking when it does (or while the session types) */
#prompt-form .cursor {
  font-size: inherit; margin-left: -1ch;
  background: transparent; box-shadow: none;
  border: 1px solid var(--green); animation: none;
}
#prompt-form:focus-within .cursor,
#prompt-input[readonly] + .cursor {
  background: var(--green); border-color: var(--green);
  box-shadow: var(--glow);
  animation: blink 1.06s step-end infinite;
}

/* ---------- focus ---------- */
.topnav a:focus-visible,
#term a:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 2px;
  border-radius: 2px;
}

/* ---------- Footer ---------- */
footer { border-top: 1px solid var(--border); padding-top: 1.2rem; font-size: 13px; }

/* touch keyboards zoom into sub-16px inputs, so the whole terminal (prompt
   included, via inherit) steps up to 16px there; typed and committed lines
   stay the same size on every device */
@media (pointer: coarse) {
  body { font-size: 16px; }
}

@media (max-width: 560px) {
  .topbar-title { display: none; }
  .topnav { gap: .6rem; flex-wrap: wrap; justify-content: flex-end; }
  /* the bar is narrow: buy the bigger type back out of the horizontal padding */
  .topnav a { font-size: 13px; padding: .7rem 0; }
  .contact-row { flex-direction: column; gap: 0; }
  /* man-page shape: command, then its description indented underneath */
  .help-row { grid-template-columns: 1fr; gap: 0; margin-bottom: .45rem; }
  .help-row .help-desc { color: var(--dim); padding-left: 1.6rem; }
}

@media (prefers-reduced-motion: reduce) {
  .cursor,
  #prompt-form:focus-within .cursor,
  #prompt-input[readonly] + .cursor { animation: none; }
  .glitch:hover::before,
  .glitch:hover::after { animation: none; }
}

/* ---------- noscript fallback: classes only, so a CSP without
   'unsafe-inline' for styles can ship later ---------- */
.noscript-card { border: 1px solid var(--border); padding: 1.2rem; margin: 1.5rem 0; }
.noscript-card .ns-name { color: var(--green); font-weight: 700; }
.noscript-card p + p { margin-top: 1rem; }

/* ---------- a11y utility ---------- */
.visually-hidden {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0, 0, 0, 0); clip-path: inset(50%);
  white-space: nowrap; border: 0;
}
