/* behickilinckaya.com — terminal theme
   Colours come from the theme variables below; the `theme` command switches them. */

:root {
  --font: ui-monospace, "Cascadia Code", "Cascadia Mono", "JetBrains Mono", "SF Mono", Menlo, Consolas, "Liberation Mono", "DejaVu Sans Mono", monospace;
  --bg: #030806;
  --fg: #c3f7d2;
  --dim: #6b9a78;
  --accent-rgb: 57 255 136;   /* phosphor green */
  --accent2-rgb: 255 176 0;   /* amber */
  --danger: #ff6b6b;
  --accent: rgb(var(--accent-rgb));
  --accent2: rgb(var(--accent2-rgb));
  --glow: 0 0 6px rgb(var(--accent-rgb) / .55), 0 0 18px rgb(var(--accent-rgb) / .18);
}
[data-theme="amber"] { --bg: #0a0702; --fg: #ffe2b0; --dim: #a08050; --accent-rgb: 255 176 0;   --accent2-rgb: 77 225 255; }
[data-theme="cyan"]  { --bg: #02070a; --fg: #c8f4ff; --dim: #5f8f9c; --accent-rgb: 77 225 255;  --accent2-rgb: 255 95 200; }
[data-theme="mono"]  { --bg: #070707; --fg: #e8e8e8; --dim: #8a8a8a; --accent-rgb: 235 235 235; --accent2-rgb: 255 255 255; }

*, *::before, *::after { box-sizing: border-box; }

html {
  font-size: clamp(14px, 0.35vw + 13px, 16px);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100svh;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  line-height: 1.6;
  overflow-x: hidden;
}

/* CRT: scanlines + vignette, above everything, never clickable */
body::before,
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 50;
}
body::before {
  background: repeating-linear-gradient(to bottom,
    transparent 0, transparent 2px,
    rgb(0 0 0 / .2) 3px, transparent 4px);
}
body::after {
  background: radial-gradient(ellipse at center, transparent 55%, rgb(0 0 0 / .6) 100%);
}

::selection { background: var(--accent); color: var(--bg); }

a { color: var(--accent); text-decoration: none; }
a:hover { background: var(--accent); color: var(--bg); }

:focus-visible { outline: 2px solid var(--accent2); outline-offset: 2px; }

p { margin: 0 0 .7rem; }
.dim { color: var(--dim); }
.clock { color: var(--accent2); white-space: nowrap; }
.small { font-size: .85em; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- background rain ---------- */
#rain {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  opacity: .3;
  pointer-events: none;
}
.no-rain #rain { display: none; }

/* ---------- terminal window ---------- */
.term {
  position: relative;
  z-index: 1;
  width: min(940px, calc(100% - 32px));
  margin: clamp(16px, 6vh, 64px) auto;
  border: 1px solid rgb(var(--accent-rgb) / .35);
  border-radius: 10px;
  background: rgb(0 0 0 / .72);
  box-shadow:
    0 0 0 1px rgb(0 0 0 / .6),
    0 0 50px rgb(var(--accent-rgb) / .12),
    inset 0 0 90px rgb(0 0 0 / .65);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
  animation: flicker 7s infinite;
}

.term-bar {
  position: sticky;
  top: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .55rem .9rem;
  border-bottom: 1px solid rgb(var(--accent-rgb) / .2);
  border-radius: 10px 10px 0 0;
  background: rgb(0 0 0 / .85);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  font-size: .8rem;
}
.dots { display: inline-flex; gap: 6px; }
.dots i { width: 11px; height: 11px; border-radius: 50%; background: #ff5f56; }
.dots i:nth-child(2) { background: #ffbd2e; }
.dots i:nth-child(3) { background: #27c93f; }
.term-title {
  flex: 1;
  text-align: center;
  color: var(--dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.term-status { display: inline-flex; align-items: center; gap: .4rem; color: var(--dim); }
.led {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent);
  box-shadow: var(--glow);
  animation: pulse 2s ease-in-out infinite;
}

.term-body { padding: clamp(16px, 4vw, 36px); }

/* ---------- command blocks ---------- */
.block { margin: 0 0 2.4rem; scroll-margin-top: 4rem; }

.cmd {
  margin: 0 0 .7rem;
  font-size: 1rem;
  font-weight: normal;
  line-height: 1.5;
  overflow-wrap: anywhere;
}
.ps1 { color: var(--accent); white-space: nowrap; text-shadow: var(--glow); }
.ps1 .c { color: var(--fg); text-shadow: none; }
.ps1 .path { color: var(--accent2); text-shadow: none; }
.typed-cmd { color: var(--fg); }

.out { padding-left: 0; }
.out p { max-width: 72ch; }

/* ---------- whoami ---------- */
.glitch {
  position: relative;
  display: inline-block;
  margin: .2rem 0 .5rem;
  font-size: clamp(1.9rem, 7.6vw, 3.7rem);
  line-height: 1.1;
  letter-spacing: .04em;
  color: var(--accent);
  text-shadow: var(--glow);
  text-wrap: balance;
}
.glitch::before,
.glitch::after {
  content: attr(data-text);
  position: absolute;
  inset: 0;
  pointer-events: none;
  clip-path: inset(100% 0 0 0);
}
.glitch::before {
  color: var(--accent2);
  text-shadow: -2px 0 rgb(var(--accent2-rgb) / .7);
  animation: glitch-a 4.6s steps(1, end) infinite;
}
.glitch::after {
  color: #ff3e6c;
  text-shadow: 2px 0 rgb(255 62 108 / .7);
  animation: glitch-b 4.6s steps(1, end) infinite;
}
.glitch:hover::before,
.glitch:hover::after { animation-duration: .7s; }

.roles-line { font-size: 1.08em; letter-spacing: .02em; margin-bottom: .2rem; }
.roles-line .sep { color: var(--accent2); }
.tagline { color: var(--dim); }
.rotator { color: var(--accent); min-height: 1.6em; }
.cursor { display: inline-block; margin-left: 1px; animation: blink 1s steps(1, end) infinite; }

/* ---------- role cards ---------- */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 14px;
}
.card {
  padding: 14px 16px 10px;
  border: 1px solid rgb(var(--accent-rgb) / .25);
  border-radius: 6px;
  background: rgb(var(--accent-rgb) / .035);
  transition: border-color .2s, box-shadow .2s, transform .2s;
}
.card:hover {
  border-color: rgb(var(--accent-rgb) / .75);
  box-shadow: 0 0 22px rgb(var(--accent-rgb) / .18);
  transform: translateY(-2px);
}
.card-head { margin-bottom: .45rem; font-size: .9rem; }
.card-head .perm { color: var(--dim); }
.card-head strong { color: var(--accent); text-shadow: var(--glow); }
.card-title { font-weight: bold; margin-bottom: .2rem; }
.card .dim { font-size: .9em; }

.links { list-style: none; margin: .5rem 0 0; padding: 0; }
.links li { margin: 0; }
.links a {
  display: inline-block;
  padding: .3rem .25rem;
  margin-left: -.25rem;
  overflow-wrap: anywhere;
}
.links a::before { content: "↳ "; color: var(--dim); }
.links a:hover::before { color: inherit; }
.links .arrow { color: var(--dim); }
.links .target { color: var(--fg); }
.links a:hover .arrow,
.links a:hover .target { color: inherit; }

.timeline { list-style: none; margin: .4rem 0 .4rem; padding: 0; border-left: 1px dashed rgb(var(--accent-rgb) / .35); }
.timeline li {
  display: grid;
  grid-template-columns: 8.5ch 1fr;
  gap: .5rem;
  padding: .3rem 0 .3rem .7rem;
  position: relative;
}
.timeline li::before {
  content: "";
  position: absolute;
  left: -4px; top: .85rem;
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--dim);
}
.timeline .now::before { background: var(--accent); box-shadow: var(--glow); animation: pulse 2s ease-in-out infinite; }
.timeline .when { color: var(--dim); }
.timeline .now .when { color: var(--accent); }
.timeline .what strong { color: var(--accent2); }

.keeper > p.dim { margin: .7rem 0 .35rem; }
.sched { list-style: none; margin: 0 0 .5rem; padding: 0; font-size: .9em; }
.sched li { display: grid; grid-template-columns: 12ch 1fr; gap: .5rem; }
.sched .when { color: var(--accent2); }

/* ---------- contact form ---------- */
.msg-form { max-width: 640px; }
.msg-form label { display: block; margin-bottom: .35rem; color: var(--accent); }
.prompt-sym { color: var(--accent2); }

.msg-form textarea,
.msg-form input {
  width: 100%;
  padding: .7rem .8rem;
  border: 1px solid rgb(var(--accent-rgb) / .3);
  border-radius: 4px;
  background: rgb(0 0 0 / .45);
  color: var(--fg);
  caret-color: var(--accent);
  font: inherit;
  font-size: 16px; /* >=16px stops iOS from zooming in on focus */
}
.msg-form textarea { resize: vertical; min-height: 7.5rem; }
.msg-form textarea::placeholder,
.msg-form input::placeholder { color: var(--dim); opacity: .8; }
.msg-form textarea:focus,
.msg-form input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent), 0 0 18px rgb(var(--accent-rgb) / .2);
}
.row { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: .6rem; }
.row input { flex: 1 1 220px; width: auto; }

.btn {
  flex: 0 0 auto;
  min-height: 44px;
  padding: .55rem 1.1rem;
  border: 1px solid var(--accent);
  border-radius: 4px;
  background: transparent;
  color: var(--accent);
  font: inherit;
  cursor: pointer;
  text-shadow: var(--glow);
  transition: background .15s, color .15s;
}
.btn:hover:not(:disabled) { background: var(--accent); color: var(--bg); text-shadow: none; }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: wait; }

.form-meta { margin: .45rem 0 0; font-size: .82em; color: var(--dim); }
.form-status { min-height: 1.5em; margin: .4rem 0 0; }
.form-status.ok { color: var(--accent); }
.form-status.warn { color: var(--accent2); }
.form-status.err { color: var(--danger); }

/* ---------- interactive shell ---------- */
.shell { border-top: 1px dashed rgb(var(--accent-rgb) / .25); padding-top: 1.4rem; }
.shell-hint { margin-bottom: .8rem; }

.term-out .ln { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.term-out .ln.err { color: var(--danger); }
.term-out .ln.hi { color: var(--accent); }
.term-out .ln.warn { color: var(--accent2); }
.term-out .out { margin: .3rem 0 .9rem; }
.term-out .gap { height: .6rem; }
.term-out .help { display: grid; grid-template-columns: max-content 1fr; gap: .1rem 1.2rem; margin: .2rem 0 .8rem; }
.term-out .help dt { color: var(--accent); }
.term-out .help dd { margin: 0; color: var(--dim); }

.prompt {
  display: flex;
  align-items: baseline;
  gap: 1ch;
  margin: .2rem -.5rem 0;
  padding: .2rem .5rem;
  border-radius: 4px;
}
.prompt:focus-within { background: rgb(var(--accent-rgb) / .06); }
.prompt input {
  flex: 1;
  min-width: 0;
  padding: .2rem 0;
  border: 0;
  background: transparent;
  color: var(--fg);
  caret-color: var(--accent);
  font: inherit;
  font-size: 16px;
  outline: none;
}

.chips { display: flex; flex-wrap: wrap; gap: .45rem; margin-top: .9rem; }
.chips button {
  min-height: 36px;
  padding: .3rem .85rem;
  border: 1px solid rgb(var(--accent-rgb) / .35);
  border-radius: 999px;
  background: rgb(var(--accent-rgb) / .06);
  color: var(--accent);
  font: inherit;
  font-size: .85rem;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.chips button:hover,
.chips button:active { background: var(--accent); color: var(--bg); }

.foot { margin-top: 2.6rem; }
.foot p:last-child { margin: 0; }

/* ---------- boot overlay ---------- */
#boot {
  position: fixed;
  inset: 0;
  z-index: 100;
  flex-direction: column;
  justify-content: space-between;
  padding: max(20px, env(safe-area-inset-top)) 20px max(20px, env(safe-area-inset-bottom));
  background: #000;
  color: var(--accent);
  cursor: pointer;
  transition: opacity .35s ease;
  /* Safety net: even if main.js never runs, the overlay goes away. */
  animation: boot-fallback 0s linear 6s forwards;
}
.boot #boot { display: flex; }
.booted #boot { opacity: 0; pointer-events: none; }
#boot-log {
  margin: 0;
  font: inherit;
  font-size: clamp(11px, 2.9vw, 14px);
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  text-shadow: var(--glow);
}
#boot-log .ok { color: var(--accent); }
#boot-log .q { color: var(--accent2); }
#boot-log .dim { color: var(--dim); text-shadow: none; }
.boot-skip { margin: 0; color: var(--dim); font-size: .8rem; text-align: center; }

/* ---------- entrance animations ---------- */
.js .term-body > * { animation: rise .55s cubic-bezier(.2, .8, .2, 1) both; }
.js .term-body > :nth-child(2) { animation-delay: .1s; }
.js .term-body > :nth-child(3) { animation-delay: .2s; }
.js .term-body > :nth-child(4) { animation-delay: .3s; }
.js .term-body > :nth-child(5) { animation-delay: .4s; }
.js .term-body > :nth-child(6) { animation-delay: .5s; }
.term.power-on { animation: power-on .6s cubic-bezier(.2, .8, .2, 1) both; }

@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes blink { 50% { opacity: 0; } }
@keyframes pulse { 50% { opacity: .35; } }
@keyframes flicker {
  0%, 100% { opacity: 1; }
  41% { opacity: 1; } 42% { opacity: .96; } 43% { opacity: 1; }
  77% { opacity: 1; } 77.5% { opacity: .975; } 78% { opacity: 1; }
}
@keyframes power-on {
  0%   { transform: scale(1, .004); filter: brightness(4); }
  35%  { transform: scale(1, .004); filter: brightness(4); }
  70%  { transform: scale(1, 1);    filter: brightness(1.5); }
  100% { transform: none;           filter: none; }
}
@keyframes boot-fallback { to { visibility: hidden; opacity: 0; pointer-events: none; } }
@keyframes glitch-a {
  0%, 88%, 100% { clip-path: inset(100% 0 0 0); transform: none; }
  89% { clip-path: inset(12% 0 58% 0); transform: translate(-4px, -1px); }
  91% { clip-path: inset(62% 0 12% 0); transform: translate(4px, 1px); }
  93% { clip-path: inset(34% 0 40% 0); transform: translate(-2px, 0); }
  95% { clip-path: inset(80% 0 4% 0);  transform: translate(3px, 0); }
}
@keyframes glitch-b {
  0%, 89%, 100% { clip-path: inset(100% 0 0 0); transform: none; }
  90% { clip-path: inset(70% 0 8% 0);  transform: translate(3px, 1px); }
  92% { clip-path: inset(5% 0 75% 0);  transform: translate(-3px, 0); }
  94% { clip-path: inset(45% 0 30% 0); transform: translate(2px, -1px); }
  96% { clip-path: inset(20% 0 60% 0); transform: translate(-4px, 0); }
}

/* ---------- phones ---------- */
@media (max-width: 640px) {
  .term {
    width: 100%;
    min-height: 100svh;
    margin: 0;
    border-width: 0 0 1px;
    border-radius: 0;
  }
  .term-bar {
    border-radius: 0;
    padding-top: max(.55rem, env(safe-area-inset-top));
  }
  .term-body {
    padding-left: max(16px, env(safe-area-inset-left));
    padding-right: max(16px, env(safe-area-inset-right));
    padding-bottom: max(24px, env(safe-area-inset-bottom));
  }
  .term-status { display: none; }
  .cards { grid-template-columns: 1fr; }
  .card:hover { transform: none; }
  .row .btn { flex: 1 1 100%; }
  .prompt { flex-wrap: wrap; row-gap: 0; }
  .prompt input { flex-basis: 8ch; }
  #rain { opacity: .22; }
}

/* ---------- accessibility: no motion when asked ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
