/* ==========================================================================
   Bayraktar Yekta Ersoy — Retro Terminal Portfolio
   Local monospace font only, CSS-variable color themes, CRT effects
   ========================================================================== */

@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url("../fonts/jetbrains-mono-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122;
}
@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url("../fonts/jetbrains-mono-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+1E00-1E9F, U+2020, U+2113;
}

/* ---- Color themes (terminal phosphors) ---- */
:root {
  --font-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --radius: 10px;
  --ease: cubic-bezier(.2,.8,.3,1);

  --term-bg: #04120a;
  --term-bg-2: #071a0f;
  --term-fg: #4bff8e;
  --term-fg-bright: #b6ffd2;
  --term-dim: #2f8a58;
  --term-accent: #7cf9c2;
  --term-accent-2: #ffd166;
  --term-error: #ff6b6b;
  --term-link: #7cf9c2;
  --term-border: rgba(75,255,142,.28);
  --term-glow: 0 0 6px rgba(75,255,142,.55), 0 0 1px rgba(75,255,142,.9);
  --scan-opacity: .1;
  --vignette-opacity: .55;
}
:root[data-theme="amber"] {
  --term-bg: #140b00;
  --term-bg-2: #1c1000;
  --term-fg: #ffb000;
  --term-fg-bright: #ffd685;
  --term-dim: #a06a12;
  --term-accent: #ffcf6b;
  --term-accent-2: #6bd1ff;
  --term-error: #ff6b6b;
  --term-link: #ffcf6b;
  --term-border: rgba(255,176,0,.3);
  --term-glow: 0 0 6px rgba(255,176,0,.5), 0 0 1px rgba(255,176,0,.9);
}
:root[data-theme="blue"] {
  --term-bg: #030914;
  --term-bg-2: #05122199;
  --term-bg-2: #05132199;
  --term-fg: #4fd6ff;
  --term-fg-bright: #c3f2ff;
  --term-dim: #2f7fa0;
  --term-accent: #8fe9ff;
  --term-accent-2: #ffd166;
  --term-error: #ff6b6b;
  --term-link: #8fe9ff;
  --term-border: rgba(79,214,255,.3);
  --term-glow: 0 0 6px rgba(79,214,255,.5), 0 0 1px rgba(79,214,255,.9);
}
:root[data-theme="white"] {
  --term-bg: #0b0b0c;
  --term-bg-2: #131315;
  --term-fg: #eaeaea;
  --term-fg-bright: #ffffff;
  --term-dim: #7b7b82;
  --term-accent: #ffffff;
  --term-accent-2: #ffd166;
  --term-error: #ff6b6b;
  --term-link: #ffffff;
  --term-border: rgba(255,255,255,.25);
  --term-glow: 0 0 4px rgba(255,255,255,.35);
  --scan-opacity: .06;
}

* { box-sizing: border-box; }
html, body {
  height: 100%;
  margin: 0;
  background: var(--term-bg);
  overscroll-behavior: none;
}
body {
  font-family: var(--font-mono);
  color: var(--term-fg);
  font-size: 15px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  transition: background .5s var(--ease), color .5s var(--ease);
}
::selection { background: var(--term-fg); color: var(--term-bg); }
a { color: var(--term-link); }
button { font-family: inherit; }

/* thin themed scrollbars */
* { scrollbar-width: thin; scrollbar-color: var(--term-dim) transparent; }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-thumb { background: var(--term-dim); border-radius: 6px; }
*::-webkit-scrollbar-track { background: transparent; }

.hidden { display: none !important; }

/* WCAG-standard accessible-hiding: stays in the accessibility tree and
   readable by search engines/screen readers, unlike display:none. Used
   for the server-rendered SEO/fallback content in index.php. */
.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.noscript-fallback {
  font-family: monospace;
  color: #4bff8e;
  background: #04120a;
  padding: 40px;
  min-height: 100vh;
}

/* =========================== BOOT SCREEN =========================== */
#boot-screen {
  position: fixed; inset: 0;
  background: #000;
  color: #4bff8e;
  z-index: 3000;
  font-family: var(--font-mono);
  font-size: 14px;
  padding: 28px 30px;
  white-space: pre-wrap;
  overflow: hidden;
  transition: opacity .5s var(--ease), visibility .5s var(--ease);
}
#boot-screen.done { opacity: 0; visibility: hidden; pointer-events: none; }
#boot-lines div { opacity: 0; animation: bootLineIn .12s forwards; }
@keyframes bootLineIn { to { opacity: 1; } }
.boot-skip {
  position: absolute;
  bottom: 22px; right: 26px;
  font-size: 12px;
  color: #2f8a58;
  opacity: 0;
  animation: fadeInSlow 1s forwards 1.1s;
}
@keyframes fadeInSlow { to { opacity: 1; } }

/* =========================== TERMINAL APP =========================== */
#terminal-app {
  height: 100dvh;
  display: flex;
  flex-direction: column;
  background: radial-gradient(140% 140% at 50% 0%, var(--term-bg-2), var(--term-bg) 60%);
}

.term-titlebar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--term-border);
  background: rgba(0,0,0,.25);
}
.term-dots { display: flex; gap: 7px; }
.term-dots .dot { width: 11px; height: 11px; border-radius: 50%; display: inline-block; opacity: .85; }
.term-dots .dot.red { background: #ff5f56; }
.term-dots .dot.yellow { background: #ffbd2e; }
.term-dots .dot.green { background: #27c93f; }
.term-title {
  font-size: 12.5px;
  color: var(--term-dim);
  letter-spacing: .02em;
}
.term-titlebar-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 14px;
}
.term-clock { font-size: 12px; color: var(--term-dim); }
.term-iconbtn {
  background: transparent;
  border: 1px solid var(--term-border);
  color: var(--term-fg);
  border-radius: 6px;
  width: 28px; height: 28px;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
  font-size: 14px;
  transition: border-color .2s, transform .2s;
}
.term-iconbtn:hover { border-color: var(--term-fg); transform: translateY(-1px); }
.term-langbtn { width: auto; padding: 0 8px; font-size: 10.5px; font-weight: 700; letter-spacing: .03em; }

.term-quickbar {
  flex: 0 0 auto;
  display: flex;
  gap: 8px;
  padding: 10px 16px;
  overflow-x: auto;
  border-bottom: 1px solid var(--term-border);
  background: rgba(0,0,0,.15);
}
.term-quickbar::-webkit-scrollbar { height: 5px; }
.qchip {
  flex: 0 0 auto;
  background: transparent;
  border: 1px solid var(--term-border);
  color: var(--term-dim);
  border-radius: 100px;
  padding: 6px 14px;
  font-size: 12.5px;
  font-family: var(--font-mono);
  cursor: pointer;
  transition: color .2s, border-color .2s, background .2s, transform .2s;
  white-space: nowrap;
}
.qchip:hover, .qchip:focus-visible {
  color: var(--term-bg);
  background: var(--term-fg);
  border-color: var(--term-fg);
  transform: translateY(-1px);
  outline: none;
}
.qchip::before { content: "$ "; opacity: .6; }

.term-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 20px 22px 10px;
}

/* banner */
.term-banner { margin-bottom: 18px; }
.banner-rule { height: 1px; background: var(--term-border); margin: 8px 0; }
.banner-name {
  font-size: clamp(1.15rem, 3.4vw, 1.8rem);
  font-weight: 800;
  letter-spacing: .04em;
  color: var(--term-fg-bright);
  text-shadow: var(--term-glow);
}
.banner-role { color: var(--term-accent); font-size: .92rem; margin-top: 4px; }
.banner-meta { color: var(--term-dim); font-size: .82rem; margin-top: 10px; }

/* command blocks printed to output */
.term-line { white-space: pre-wrap; word-break: break-word; }
.term-cmd-line { color: var(--term-fg-bright); margin-top: 22px; }
.term-cmd-line .p-user { color: var(--term-accent); }
.term-cmd-line .p-at, .term-cmd-line .p-colon, .term-cmd-line .p-dollar { color: var(--term-dim); }
.term-cmd-line .p-path { color: var(--term-accent-2); }
.term-cmd-line .typed-cmd { color: var(--term-fg-bright); }

.term-out { margin: 8px 0 4px; color: var(--term-fg); }
.term-out .o-line {
  white-space: pre-wrap;
  word-break: break-word;
  opacity: 0;
  animation: lineIn .35s var(--ease) forwards;
}
@keyframes lineIn { from { opacity: 0; transform: translateY(3px);} to { opacity: 1; transform: translateY(0);} }
.o-dim { color: var(--term-dim); }
.o-accent { color: var(--term-accent); }
.o-accent2 { color: var(--term-accent-2); }
.o-bright { color: var(--term-fg-bright); font-weight: 700; }
.o-error { color: var(--term-error); }
.o-link { color: var(--term-link); text-decoration: underline; text-underline-offset: 3px; }
.o-link:hover { text-shadow: var(--term-glow); }
.o-tag {
  display: inline-block;
  border: 1px solid var(--term-border);
  border-radius: 100px;
  padding: 2px 10px;
  font-size: .78em;
  color: var(--term-dim);
  margin: 3px 6px 3px 0;
}

/* section heading rule inside output */
.o-heading {
  color: var(--term-fg-bright);
  font-weight: 700;
  border-bottom: 1px dashed var(--term-border);
  padding-bottom: 4px;
  margin-top: 4px;
  display: block;
}

/* neofetch / github card */
.term-card {
  display: flex;
  gap: 18px;
  border: 1px solid var(--term-border);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin: 10px 0;
  background: rgba(255,255,255,.02);
  flex-wrap: wrap;
}
.term-card img {
  width: 64px; height: 64px;
  border-radius: 8px;
  border: 1px solid var(--term-border);
  object-fit: cover;
  flex-shrink: 0;
}
.term-card .card-body { min-width: 220px; flex: 1; }
.term-card dl { display: grid; grid-template-columns: auto 1fr; gap: 3px 14px; margin: 0; }
.term-card dt { color: var(--term-accent); }
.term-card dd { margin: 0; color: var(--term-fg); }

.term-skel {
  height: 14px; width: 60%;
  background: linear-gradient(100deg, var(--term-border) 25%, transparent 50%, var(--term-border) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.3s infinite;
  border-radius: 3px;
  margin: 4px 0;
}
@keyframes shimmer { to { background-position: -200% 0; } }

/* blinking cursor used at end of static text spans */
.blink-cursor {
  display: inline-block;
  width: .55em; height: 1em;
  background: var(--term-fg);
  vertical-align: text-bottom;
  animation: blink 1s steps(1) infinite;
  margin-left: 2px;
}
@keyframes blink { 50% { opacity: 0; } }

/* =========================== INPUT LINE =========================== */
.term-inputline {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 22px calc(12px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--term-border);
  background: rgba(0,0,0,.2);
}
.term-inputline .prompt { white-space: nowrap; }
.term-inputline .p-user { color: var(--term-accent); }
.term-inputline .p-at, .term-inputline .p-colon, .term-inputline .p-dollar { color: var(--term-dim); }
.term-inputline .p-path { color: var(--term-accent-2); }
#term-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--term-fg-bright);
  font-family: var(--font-mono);
  font-size: 15px;
  caret-color: var(--term-fg);
  min-width: 0;
}
#term-input::placeholder { color: var(--term-dim); }

/* =========================== CRT EFFECTS =========================== */
.crt-scanlines {
  position: fixed; inset: 0;
  z-index: 900;
  pointer-events: none;
  background: repeating-linear-gradient(
    to bottom,
    rgba(0,0,0,0) 0px,
    rgba(0,0,0,0) 1px,
    rgba(0,0,0,.55) 2px,
    rgba(0,0,0,0) 3px
  );
  opacity: var(--scan-opacity);
  mix-blend-mode: multiply;
}
.crt-vignette {
  position: fixed; inset: 0;
  z-index: 899;
  pointer-events: none;
  background: radial-gradient(120% 90% at 50% 45%, transparent 55%, rgba(0,0,0,var(--vignette-opacity)) 100%);
}

/* toast */
.mini-toast {
  position: fixed;
  bottom: 76px; left: 50%;
  transform: translateX(-50%) translateY(14px);
  background: var(--term-bg-2);
  border: 1px solid var(--term-border);
  color: var(--term-fg-bright);
  padding: 10px 18px;
  border-radius: 100px;
  font-size: .82rem;
  z-index: 1200;
  opacity: 0;
  pointer-events: none;
  transition: opacity .3s var(--ease), transform .3s var(--ease);
}
.mini-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* responsive */
@media (max-width: 640px) {
  body { font-size: 13.5px; }
  .term-titlebar { padding: 8px 10px; gap: 8px; }
  .term-title { font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 34vw; }
  .term-titlebar-actions { gap: 8px; }
  .term-clock { font-size: 10.5px; }
  .term-quickbar { padding: 8px 10px; gap: 6px; -webkit-overflow-scrolling: touch; }
  .qchip { padding: 6px 12px; font-size: 12px; }
  .term-body { padding: 14px 12px 6px; }
  .term-inputline { padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); }
  .term-card { flex-direction: column; padding: 14px; }
  .term-card img { width: 48px; height: 48px; }
  .term-card .card-body { min-width: 0; width: 100%; }
  .term-card dl { grid-template-columns: auto 1fr; font-size: 12.5px; }
  .banner-name { letter-spacing: .02em; }
  /* 16px prevents iOS Safari from auto-zooming the page on input focus */
  #term-input { font-size: 16px; }
}

@media (max-width: 380px) {
  .term-title { display: none; }
  .banner-name { font-size: 1.5rem; }
  .qchip { padding: 5px 10px; font-size: 11.5px; }
}

@media (hover: none) and (pointer: coarse) {
  .qchip { -webkit-tap-highlight-color: transparent; }
  .term-iconbtn { -webkit-tap-highlight-color: transparent; }
}

@media (prefers-reduced-motion: reduce) {
  .term-out .o-line, #boot-lines div, .blink-cursor { animation: none !important; opacity: 1 !important; }
}
