/* ============================================================
   Hugo Marinho · portfolio
   terminal / build-in-public aesthetic
   ============================================================ */

:root {
  /* surfaces */
  --bg:        #07090a;
  --desktop:   #05060700;
  --window:    #0a0e0d;
  --window-2:  #0c1110;
  --titlebar:  #0e1413;
  --panel:     #0d1211;
  --panel-h:   #101817;
  --border:    #1a2422;
  --border-2:  #26332f;
  --border-h:  #2f4a3c;

  /* ink */
  --fg:        #cdd6cf;
  --fg-dim:    #82918a;
  --fg-faint:  #4a564f;

  /* phosphor */
  --green:     #4fe88d;
  --green-2:   #36c172;
  --green-dim: #1f6f45;
  --amber:     #e8b14f;
  --red:       #ff6f6f;
  --cyan:      #6fd6df;

  --glow:      0 0 22px rgba(79, 232, 141, .28);
  --glow-soft: 0 0 10px rgba(79, 232, 141, .18);

  --mono: "JetBrains Mono", ui-monospace, "SF Mono", "Cascadia Code",
          "Source Code Pro", Menlo, Consolas, "DejaVu Sans Mono", monospace;

  --maxw: 880px;
  --radius: 12px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--mono);
  font-size: 15px;
  line-height: 1.6;
  color: var(--fg);
  background:
    radial-gradient(1200px 700px at 50% -10%, #0c1512 0%, transparent 60%),
    radial-gradient(900px 600px at 100% 100%, #0a1310 0%, transparent 55%),
    var(--bg);
  background-attachment: fixed;
  padding: clamp(14px, 4vw, 56px) clamp(12px, 4vw, 32px);
  display: flex;
  justify-content: center;
  align-items: flex-start;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection { background: rgba(79, 232, 141, .26); color: #eafff2; }

/* skip link */
.skip {
  position: absolute; left: -9999px; top: 8px; z-index: 50;
  background: var(--green); color: #04150c; padding: 8px 14px;
  border-radius: 8px; font-weight: 700; text-decoration: none;
}
.skip:focus { left: 16px; }

/* ───────────────── CRT ambient overlays ───────────────── */
.crt { position: fixed; inset: 0; pointer-events: none; z-index: 40; }
.scanlines {
  background: repeating-linear-gradient(
    to bottom,
    rgba(0,0,0,0) 0,
    rgba(0,0,0,0) 2px,
    rgba(0,0,0,.16) 3px,
    rgba(0,0,0,0) 4px
  );
  mix-blend-mode: multiply;
  opacity: .5;
}
.vignette {
  background: radial-gradient(120% 120% at 50% 50%, transparent 58%, rgba(0,0,0,.55) 100%);
}

/* ───────────────── terminal window ───────────────── */
.window {
  width: 100%;
  max-width: var(--maxw);
  background:
    linear-gradient(180deg, var(--window) 0%, var(--window-2) 100%);
  border: 1px solid var(--border-2);
  border-radius: var(--radius);
  box-shadow:
    0 1px 0 rgba(255,255,255,.03) inset,
    0 40px 120px -40px rgba(0,0,0,.9),
    0 0 0 1px rgba(0,0,0,.4);
  overflow: clip;
  position: relative;
  z-index: 1;
}

.titlebar {
  display: flex; align-items: center; gap: 14px;
  padding: 11px 16px;
  background: linear-gradient(180deg, #121a18, #0d1413);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 5;
  backdrop-filter: blur(6px);
}
.lights { display: flex; gap: 8px; }
.light { width: 12px; height: 12px; border-radius: 50%; box-shadow: 0 0 0 1px rgba(0,0,0,.35) inset; }
.light.red { background: #ff5f57; }
.light.amber { background: #febc2e; }
.light.green { background: #28c840; }
.title {
  flex: 1; text-align: center; font-size: 12.5px; color: var(--fg-dim);
  letter-spacing: .3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.titlebar-spacer { width: 52px; }

.screen { padding: clamp(22px, 5vw, 48px) clamp(18px, 5vw, 52px) clamp(28px, 5vw, 44px); }

/* ───────────────── prompt lines ───────────────── */
.line {
  margin: 0 0 2px;
  font-size: 14px;
  display: flex; flex-wrap: wrap; align-items: baseline; gap: .5ch;
  color: var(--fg);
}
.prompt { color: var(--green); font-weight: 500; }
.path   { color: var(--cyan); }
.sigil  { color: var(--amber); font-weight: 700; }
.sigil.green { color: var(--green); }
.cmd    { color: var(--fg); }

/* the typed cursor (hero + footer) */
.cursor {
  display: inline-block; width: 8px; height: 1.05em;
  background: var(--green); margin-left: 3px;
  transform: translateY(2px);
  box-shadow: var(--glow-soft);
  animation: blink 1.05s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

.out { margin: 6px 0 0; }

/* ───────────────── hero ───────────────── */
.hero { margin-bottom: clamp(30px, 6vw, 52px); }
.hero-out { padding-left: 2px; }

.name {
  font-size: clamp(34px, 8vw, 60px);
  line-height: 1.02;
  margin: 14px 0 6px;
  font-weight: 700;
  letter-spacing: -.5px;
  color: #f1f7f2;
  text-shadow: 0 0 26px rgba(79,232,141,.18);
}
.role {
  margin: 0 0 18px;
  color: var(--green);
  font-size: clamp(15px, 2.6vw, 18px);
  font-weight: 500;
}
.role .sep { color: var(--fg-faint); margin: 0 .8ch; }

.bio { margin: 0 0 22px; }
.comment { margin: 0; color: var(--fg-dim); font-size: 14px; }
.comment.dim { color: var(--fg-faint); }

.cta-row { display: flex; flex-wrap: wrap; gap: 12px 22px; margin: 6px 0 0; }
.ghost-link {
  color: var(--green); text-decoration: none; font-size: 14px;
  border-bottom: 1px dashed rgba(79,232,141,.35); padding-bottom: 1px;
  transition: color .15s, border-color .15s, text-shadow .15s;
}
.ghost-link:hover { color: #8af3b3; border-color: var(--green); text-shadow: var(--glow-soft); }

/* ───────────────── blocks ───────────────── */
.block { margin: clamp(36px, 7vw, 60px) 0 0; }
.block > .line { margin-bottom: 4px; }

/* ───────────────── project grid ───────────────── */
.grid { list-style: none; margin: 20px 0 0; padding: 0; display: grid; gap: 16px; }

.card {
  border: 1px solid var(--border);
  border-radius: 10px;
  background:
    linear-gradient(180deg, var(--panel) 0%, #0a0f0e 100%);
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease, background .18s ease;
  position: relative;
  min-width: 0;
  container-type: inline-size;
}
.card::before {
  content: ""; position: absolute; inset: 0; border-radius: 10px;
  box-shadow: 0 0 0 1px transparent inset; pointer-events: none;
  transition: box-shadow .18s ease;
}
.card:hover {
  transform: translateY(-3px);
  border-color: var(--border-h);
  background: linear-gradient(180deg, var(--panel-h) 0%, #0a100e 100%);
  box-shadow: 0 18px 40px -24px rgba(0,0,0,.9), var(--glow-soft);
}
.card:hover::before { box-shadow: 0 0 0 1px rgba(79,232,141,.18) inset; }

.card-hit {
  display: block; padding: 18px 20px 20px; text-decoration: none; color: inherit;
  border-radius: 10px;
}
.card-hit.no-link { cursor: default; }
.card-hit:focus-visible { outline: 2px solid var(--green); outline-offset: 3px; }

.card-head {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 10px 14px;
  margin-bottom: 12px;
}
.card-name {
  font-size: 17px; font-weight: 700; margin: 0; color: #eaf3ec;
  letter-spacing: .2px; order: 2;
}
.status {
  order: 1; font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .8px; display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 9px; border-radius: 999px; white-space: nowrap;
}
.status .dot { width: 7px; height: 7px; border-radius: 50%; }
.status.live { color: var(--green); background: rgba(79,232,141,.08); border: 1px solid rgba(79,232,141,.22); }
.status.live .dot { background: var(--green); box-shadow: 0 0 8px var(--green); animation: pulse 2.4s ease-in-out infinite; }
.status.research { color: var(--amber); background: rgba(232,177,79,.08); border: 1px solid rgba(232,177,79,.22); }
.status.research .dot { background: var(--amber); box-shadow: 0 0 8px rgba(232,177,79,.6); }
.qualifier { color: var(--fg-dim); font-weight: 500; margin-left: 5px; letter-spacing: .4px; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .45; } }

.visit {
  order: 3; grid-column: 1 / -1; justify-self: start; font-size: 12.5px; color: var(--fg-dim);
  white-space: nowrap; transition: color .15s, text-shadow .15s;
}
.visit.muted { color: var(--fg-faint); }
.card:hover .visit:not(.muted) { color: var(--green); text-shadow: var(--glow-soft); }

/* wide cards: visit sits inline at the right; narrow cards stack it below the name */
@container (min-width: 500px) {
  .card-head { grid-template-columns: auto 1fr auto; }
  .visit { grid-column: auto; justify-self: end; }
}

.tagline { margin: 0 0 8px; font-size: 15px; font-weight: 500; color: #dfe9e1; }
.desc { margin: 0 0 14px; font-size: 13.5px; line-height: 1.62; color: var(--fg-dim); }
.meta {
  margin: 0 0 14px; font-size: 12px; color: var(--green-2);
  letter-spacing: .2px;
}

/* chips */
.chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 7px; }
.chips li {
  font-size: 11.5px; color: var(--fg-dim);
  background: rgba(255,255,255,.025);
  border: 1px solid var(--border);
  padding: 3px 9px; border-radius: 6px; letter-spacing: .2px;
  transition: border-color .15s, color .15s;
}
.card:hover .chips li { border-color: var(--border-2); }
.chips.stack { margin-top: 12px; }
.chips.stack li { font-size: 12px; padding: 4px 11px; }

/* ───────────────── about / contact ───────────────── */
.about { max-width: 64ch; }
.about p { margin: 0 0 14px; color: var(--fg); font-size: 14px; line-height: 1.72; }
.about p:last-child { margin-bottom: 0; color: var(--fg-dim); }

.contact { padding-left: 2px; }
.mail-row { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin: 8px 0; }
.arrow { color: var(--amber); }
.mail {
  color: var(--green); font-size: clamp(16px, 3.4vw, 21px); font-weight: 500;
  text-decoration: none; border-bottom: 1px solid rgba(79,232,141,.3); padding-bottom: 2px;
  transition: text-shadow .15s, border-color .15s;
}
.mail:hover { text-shadow: var(--glow); border-color: var(--green); }
.copy {
  font-family: var(--mono); font-size: 11px; text-transform: uppercase; letter-spacing: .6px;
  color: var(--fg-dim); background: rgba(255,255,255,.03);
  border: 1px solid var(--border-2); border-radius: 6px; padding: 4px 10px; cursor: pointer;
  transition: color .15s, border-color .15s, background .15s;
}
.copy:hover { color: var(--green); border-color: var(--border-h); }
.copy.copied { color: var(--green); border-color: var(--green-dim); }
.copy:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }
.link-row { display: flex; align-items: center; gap: 10px; margin: 2px 0 12px; }
.ext-link { color: var(--green); font-size: 15px; text-decoration: none; border-bottom: 1px solid rgba(79,232,141,.28); padding-bottom: 1px; transition: text-shadow .15s, border-color .15s; }
.ext-link:hover { text-shadow: var(--glow-soft); border-color: var(--green); }

/* ───────────────── footer ───────────────── */
.foot { margin-top: clamp(40px, 8vw, 64px); padding-top: 22px; border-top: 1px solid var(--border); }
.foot-note { margin-top: 12px; font-size: 12px; }

/* ───────────── interactive terminal + ascii game ───────────── */
#terminal { display: none; }
.terminal-ready #terminal { display: block; margin: clamp(30px, 6vw, 50px) 0; }
.repl-hint { margin: 0 0 10px; }
.repl-pane {
  border: 1px solid var(--border-2); border-radius: 10px;
  background: rgba(79, 232, 141, .02); padding: 12px 14px;
}
.repl-out { margin: 0; max-height: 230px; overflow-y: auto; overscroll-behavior: contain; }
.repl-out .echo { color: var(--fg); margin: 6px 0 0; font-size: 14px; word-break: break-word; }
.repl-out .echo .prompt { color: var(--green); }
.repl-out .echo .path { color: var(--cyan); }
.repl-out .echo .sigil { color: var(--amber); }
.repl-out .res { color: var(--fg-dim); white-space: pre-wrap; word-break: break-word; margin: 2px 0 8px; font-size: 13.5px; line-height: 1.5; }
.repl-out .res.muted { color: var(--fg-faint); }
.repl-line {
  display: flex; align-items: baseline; gap: .5ch; margin-top: 8px; font-size: 14px;
  padding: 5px 7px; margin-left: -7px; border-radius: 7px; transition: background .15s;
}
.repl-line:focus-within { background: rgba(79, 232, 141, .06); }
.repl-edit { position: relative; flex: 1; min-width: 0; display: inline-flex; align-items: baseline; overflow: hidden; }
.repl-in {
  flex: 1; min-width: 0; background: transparent; border: 0; outline: 0; padding: 0;
  font-family: var(--mono); font-size: 14px; color: var(--fg); caret-color: transparent;
}
.repl-mirror {
  position: absolute; left: 0; top: 0; visibility: hidden; white-space: pre; pointer-events: none;
  font-family: var(--mono); font-size: 14px;
}
.repl-cursor {
  position: absolute; left: 0; top: 50%; transform: translateY(-50%);
  width: 8px; height: 1.05em; background: var(--green); box-shadow: var(--glow-soft);
  pointer-events: none; animation: blink 1.05s steps(1) infinite;
}
.game-canvas {
  display: block; width: 100%; height: auto; border-radius: 7px;
  background: #070a08; touch-action: manipulation;
  -webkit-user-select: none; user-select: none;
}
.gaming .repl-out { max-height: 340px; }

/* ───────────────── reveal (JS only) ───────────────── */
.js .reveal { opacity: 0; transform: translateY(10px); }
.js .reveal.in { opacity: 1; transform: none; transition: opacity .55s ease, transform .55s ease; }

/* ───────────────── responsive ───────────────── */
@media (max-width: 560px) {
  body { padding: 0; align-items: stretch; }
  .window { border-radius: 0; border-left: 0; border-right: 0; min-height: 100vh; }
  .vignette { display: none; }
}

@media (min-width: 720px) {
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  /* first two featured cards span full width */
  .card:nth-child(1), .card:nth-child(2) { grid-column: 1 / -1; }
}

/* ───────────────── motion / a11y ───────────────── */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .cursor { animation: none; }
  .status.live .dot { animation: none; }
  .js .reveal { opacity: 1; transform: none; }
  .scanlines { opacity: .3; }
}
