/* ============================================================
   tomiwa.sh — interactive terminal portfolio
   ============================================================ */

:root {
  --bg: #05080d;
  --panel: #0b1017;
  --panel-2: #0e141d;
  --chrome: #0a0f16;
  --border: #1c2733;
  --text: #c6d0da;
  --muted: #6b7a8d;
  --bright: #e8eef5;
  --prompt: #4ade80;     /* phosphor green */
  --accent: #38bdf8;     /* cyan */
  --accent-2: #f5b547;   /* amber */
  --pink: #f472b6;
  --danger: #f87171;
  --glow: rgba(56, 189, 248, 0.30);
  --scanline: rgba(0, 0, 0, 0.22);
  --radius: 14px;
  --mono: "Berkeley Mono", "JetBrains Mono", ui-monospace, "SF Mono",
          "Fira Code", Menlo, Consolas, "Liberation Mono", monospace;
}

/* Theme: amber phosphor */
:root[data-theme="amber"] {
  --bg: #0a0600;
  --panel: #130c02;
  --panel-2: #170f03;
  --chrome: #0f0902;
  --border: #33240c;
  --text: #f1c47a;
  --muted: #9a7636;
  --bright: #ffe4af;
  --prompt: #ffb000;
  --accent: #ffcb5b;
  --accent-2: #ff8a3d;
  --glow: rgba(255, 176, 0, 0.28);
}

/* Theme: matrix green */
:root[data-theme="matrix"] {
  --bg: #000800;
  --panel: #021004;
  --panel-2: #031606;
  --chrome: #020d03;
  --border: #0d3312;
  --text: #7dffb0;
  --muted: #2f8a4d;
  --bright: #d6ffe4;
  --prompt: #00ff66;
  --accent: #46ffa0;
  --accent-2: #b6ff6a;
  --glow: rgba(0, 255, 102, 0.25);
}

/* Theme: light (paper) */
:root[data-theme="light"] {
  --bg: #e8e6df;
  --panel: #faf9f6;
  --panel-2: #f1efe9;
  --chrome: #eceae3;
  --border: #d6d3c8;
  --text: #2f3a3f;
  --muted: #7c8a90;
  --bright: #11181c;
  --prompt: #0e8a52;
  --accent: #0b76c4;
  --accent-2: #b4690e;
  --glow: rgba(11, 118, 196, 0.12);
  --scanline: rgba(0, 0, 0, 0.03);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--mono);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

/* Ambient animated backdrop: grid + drifting glow */
.backdrop {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(1200px 600px at 75% -10%, var(--glow), transparent 60%),
    radial-gradient(900px 500px at 10% 110%, var(--glow), transparent 55%);
  opacity: 0.9;
}
.backdrop::before {
  content: "";
  position: absolute;
  inset: -2px;
  background-image:
    linear-gradient(to right, var(--border) 1px, transparent 1px),
    linear-gradient(to bottom, var(--border) 1px, transparent 1px);
  background-size: 44px 44px;
  opacity: 0.25;
  mask-image: radial-gradient(circle at 50% 40%, #000 0%, transparent 75%);
  -webkit-mask-image: radial-gradient(circle at 50% 40%, #000 0%, transparent 75%);
  animation: drift 32s linear infinite;
}
@keyframes drift {
  from { background-position: 0 0, 0 0; }
  to   { background-position: 44px 88px, 44px 88px; }
}

/* ---------- Layout ---------- */
.stage {
  position: relative;
  z-index: 1;
  height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(8px, 2.5vh, 40px) clamp(8px, 2.5vw, 40px);
}

.window {
  width: min(960px, 100%);
  height: min(760px, 100%);
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow:
    0 40px 120px -30px rgba(0, 0, 0, 0.75),
    0 0 0 1px rgba(255, 255, 255, 0.02) inset,
    0 0 60px -20px var(--glow);
  overflow: hidden;
  position: relative;
}

/* Title bar */
.titlebar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: linear-gradient(180deg, var(--panel-2), var(--chrome));
  border-bottom: 1px solid var(--border);
  user-select: none;
  flex-shrink: 0;
}
.dots { display: inline-flex; gap: 8px; }
.dots > * { width: 12px; height: 12px; border-radius: 50%; display: inline-block; border: 0; }
.dots > :nth-child(1) { background: #ff5f57; }
.dots > :nth-child(2) { background: #febc2e; }
.dots > :nth-child(3) { background: #28c840; }
.dots a.close { cursor: pointer; position: relative; }
.dots a.close:hover::after { content: "×"; position: absolute; inset: 0; display: grid; place-items: center; font: 700 10px/1 var(--mono); color: #5a0d08; }
.title {
  flex: 1;
  text-align: center;
  color: var(--muted);
  font-size: 12.5px;
  letter-spacing: 0.03em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.title b { color: var(--text); font-weight: 600; }
.titlebar .clock { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; min-width: 58px; text-align: right; }

/* Terminal body */
.terminal {
  flex: 1;
  overflow-y: auto;
  padding: 18px 20px 8px;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.terminal::-webkit-scrollbar { width: 10px; }
.terminal::-webkit-scrollbar-thumb { background: var(--border); border-radius: 10px; }
.terminal::-webkit-scrollbar-track { background: transparent; }

/* CRT overlays on the window */
.window::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0 2px,
    var(--scanline) 2px 3px
  );
  mix-blend-mode: multiply;
  opacity: 0.6;
  z-index: 5;
}
.window::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 6;
  box-shadow: inset 0 0 120px -40px rgba(0, 0, 0, 0.9);
}

/* Output blocks */
.line { white-space: pre-wrap; word-break: break-word; }
.line + .line { margin-top: 1px; }
.block { margin: 6px 0 14px; }

.cmd-echo { color: var(--text); margin-top: 10px; }
.cmd-echo .p { color: var(--prompt); }
.cmd-echo .path { color: var(--accent); }
.cmd-echo .typed { color: var(--bright); }

.muted { color: var(--muted); }
.accent { color: var(--accent); }
.amber { color: var(--accent-2); }
.green { color: var(--prompt); }
.pink { color: var(--pink); }
.bright { color: var(--bright); font-weight: 600; }
.err { color: var(--danger); }

a, .link {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px dotted color-mix(in srgb, var(--accent) 50%, transparent);
  cursor: pointer;
}
a:hover, .link:hover { color: var(--bright); border-bottom-color: var(--bright); }

/* Banner */
.banner {
  color: var(--prompt);
  text-shadow: 0 0 12px color-mix(in srgb, var(--prompt) 55%, transparent);
  font-size: clamp(7px, 1.9vw, 12px);
  line-height: 1.05;
  margin: 2px 0 10px;
  white-space: pre;
  overflow-x: auto;
}

/* Key/value + tables used by commands */
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 2px 18px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; color: var(--text); }

.job { margin: 0 0 18px; padding-left: 14px; border-left: 2px solid var(--border); }
.job .head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; }
.job .co { color: var(--bright); font-weight: 700; }
.job .ti { color: var(--accent); }
.job .dates { color: var(--muted); margin-left: auto; font-size: 13px; }
.job .sub { color: var(--muted); font-size: 13px; }
.job ul { margin: 7px 0 8px; padding-left: 18px; }
.job li { margin: 2px 0; }
.job li::marker { color: var(--prompt); }

.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.tag {
  font-size: 11.5px;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 1px 7px;
  background: color-mix(in srgb, var(--panel-2) 60%, transparent);
}

.card {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-top: 8px;
  padding: 8px;
  max-width: 460px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel-2);
  text-decoration: none;
  transition: border-color .15s ease, transform .15s ease;
}
.card:hover { border-color: var(--accent); transform: translateY(-1px); }
.card img { width: 104px; height: 58px; object-fit: cover; border-radius: 6px; flex-shrink: 0; }
.card .meta { color: var(--muted); font-size: 11.5px; }
.card .ti { color: var(--bright); font-weight: 600; font-size: 13.5px; line-height: 1.3; }

.proj { margin: 0 0 14px; }
.proj .n { color: var(--bright); font-weight: 700; }
.proj .b { color: var(--text); }
.proj .l { margin-top: 3px; display: flex; gap: 14px; flex-wrap: wrap; }

.cols { display: flex; flex-wrap: wrap; gap: 4px 26px; }
.cols .c { color: var(--text); }
.cols .c::before { content: "▹ "; color: var(--prompt); }

/* Input line */
.inputline {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 2px 20px 18px;
  flex-shrink: 0;
}
.inputline .p { color: var(--prompt); white-space: nowrap; }
.inputline .path { color: var(--accent); }
.field {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
  min-width: 0;
}
#mirror {
  color: var(--bright);
  white-space: pre;
  max-width: 100%;
  overflow: hidden;
}
#cmd {
  all: unset;
  position: absolute;
  inset: 0;
  width: 100%;
  color: transparent;
  font-family: var(--mono);
  font-size: 15px;
  caret-color: transparent;
}
.caret {
  width: 9px;
  height: 1.05em;
  background: var(--prompt);
  box-shadow: 0 0 10px var(--prompt);
  display: inline-block;
  margin-left: 1px;
  animation: blink 1.05s steps(1) infinite;
  flex-shrink: 0;
  align-self: center;
}
.inputline.focused .caret { opacity: 1; }
.inputline:not(.focused) .caret { opacity: 0.35; animation: none; }
@keyframes blink { 50% { opacity: 0; } }

/* Hint / command chips */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 20px 14px;
  flex-shrink: 0;
}
.chip {
  font-size: 12px;
  color: var(--muted);
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px 11px;
  cursor: pointer;
  transition: all .15s ease;
  user-select: none;
}
.chip:hover { color: var(--bright); border-color: var(--accent); }
.chip b { color: var(--accent); font-weight: 600; }

/* Boot overlay */
.boot {
  position: absolute;
  inset: 0;
  z-index: 10;
  background: var(--panel);
  padding: 22px 24px;
  overflow: hidden;
  color: var(--text);
}
.boot .ok { color: var(--prompt); }
.boot .skip { position: absolute; bottom: 16px; right: 20px; color: var(--muted); font-size: 12px; }

/* Accessible / print content, hidden visually */
.sr-content {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* Responsive */
@media (max-width: 680px) {
  body { font-size: 13.5px; }
  .stage { padding: 0; }
  .window { height: 100dvh; border-radius: 0; border: 0; }
  .job .dates { margin-left: 0; width: 100%; }
  #cmd { font-size: 16px; } /* avoid iOS zoom */
}

@media (prefers-reduced-motion: reduce) {
  .backdrop::before { animation: none; }
  .caret { animation: none; }
}

/* spacing utilities (keeps markup free of inline styles for a strict CSP) */
.mt4 { margin-top: 4px !important; } .mt6 { margin-top: 6px !important; } .mt8 { margin-top: 8px !important; } .mt10 { margin-top: 10px !important; }
