/* =========================================================================
   baran.karaboga — personal site
   Minimal, dark, enterprise-grade. Plain CSS, no dependencies.
   ========================================================================= */

/* ---- Design tokens ---------------------------------------------------- */
:root {
  --bg:            #0a0c10;
  --surface:       #11151c;
  --surface-2:     #151a22;
  --border:        rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.16);

  --text:          #e8ebf1;
  --text-soft:     #b9c0cd;
  --text-muted:    #8e97a6;

  --accent:        #5fd3bc;
  --accent-soft:   #8fe3d3;
  --accent-line:   rgba(95, 211, 188, 0.42);
  --accent-glow:   rgba(95, 211, 188, 0.16);

  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

  --container: 980px;
  --radius:    12px;

  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

/* ---- Reset / base ----------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.65;
  letter-spacing: 0.1px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow-x: hidden;
}

/* Whisper-faint structural grid — static, fades out below the fold */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  background-image:
    linear-gradient(to right, rgba(255, 255, 255, 0.018) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.018) 1px, transparent 1px);
  background-size: 72px 72px;
  -webkit-mask-image: radial-gradient(ellipse 80% 60% at 50% -10%, #000 25%, transparent 80%);
  mask-image: radial-gradient(ellipse 80% 60% at 50% -10%, #000 25%, transparent 80%);
  pointer-events: none;
}

svg { display: block; }
a { color: inherit; text-decoration: none; }

h1, h2, h3 {
  line-height: 1.18;
  font-weight: 700;
  letter-spacing: -0.02em;
}

::selection { background: var(--accent-glow); color: #fff; }

/* ---- Accessibility helpers ------------------------------------------- */
.skip-link {
  position: absolute;
  left: 16px;
  top: -64px;
  z-index: 1000;
  background: var(--accent);
  color: #05231d;
  padding: 10px 16px;
  border-radius: 8px;
  font-weight: 600;
  transition: top 0.2s var(--ease);
}
.skip-link:focus { top: 16px; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}
main:focus { outline: none; }

/* ---- Layout ----------------------------------------------------------- */
.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: clamp(22px, 6vw, 40px);
}

main { flex: 1 0 auto; }

/* ---- Header / nav ----------------------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(10, 12, 16, 0.55);
  backdrop-filter: saturate(160%) blur(12px);
  -webkit-backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s var(--ease), background 0.3s var(--ease);
}
.site-header.is-scrolled {
  border-bottom-color: var(--border);
  background: rgba(10, 12, 16, 0.74);
}

.nav__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 64px;
}

/* Logo — CLI-style identity */
.logo {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-family: var(--font-mono);
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  padding: 6px 2px;
  border-radius: 6px;
}
.logo__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
  flex: none;
  transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease);
}
.logo:hover .logo__dot {
  transform: scale(1.2);
  box-shadow: 0 0 0 4px rgba(95, 211, 188, 0.22), 0 0 12px rgba(95, 211, 188, 0.55);
}
.logo__sep { color: var(--accent); }
.logo__text { transition: color 0.2s var(--ease); }
.logo:hover .logo__text { color: #fff; }
/* Terminal-style blinking caret after the namespace */
.logo__text::after {
  content: "";
  display: inline-block;
  width: 7px;
  height: 1.05em;
  margin-left: 5px;
  vertical-align: -0.12em;
  background: var(--accent);
  border-radius: 1px;
  animation: caret-blink 1.15s steps(1) infinite;
}
@keyframes caret-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

.nav__links {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0;
}
.nav__link {
  position: relative;
  display: inline-block;
  padding: 8px 14px;
  font-size: 0.94rem;
  color: var(--text-muted);
  border-radius: 7px;
  transition: color 0.2s var(--ease);
}
.nav__link::after {
  content: "";
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 4px;
  height: 1.5px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.28s var(--ease);
}
.nav__link:hover { color: var(--text); }
.nav__link:hover::after { transform: scaleX(1); }
.nav__link[aria-current="page"] { color: var(--text); }
.nav__link[aria-current="page"]::after { transform: scaleX(1); }

/* Mobile toggle */
.nav__toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 44px;
  height: 44px;
  padding: 0 11px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 9px;
  cursor: pointer;
}
.nav__toggle-bar {
  display: block;
  height: 2px;
  width: 100%;
  background: var(--text);
  border-radius: 2px;
  transition: transform 0.3s var(--ease), opacity 0.2s var(--ease);
}
.nav__toggle[aria-expanded="true"] .nav__toggle-bar:nth-child(1) { transform: translateY(3.5px) rotate(45deg); }
.nav__toggle[aria-expanded="true"] .nav__toggle-bar:nth-child(2) { transform: translateY(-3.5px) rotate(-45deg); }

/* ---- Home intro ------------------------------------------------------- */
.intro {
  position: relative;
  z-index: 1;
  padding-block: clamp(56px, 12vh, 120px) clamp(48px, 8vh, 88px);
}
.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;
}
.intro__text {
  font-size: clamp(1.15rem, 2vw, 1.45rem);
  line-height: 1.7;
  color: var(--text-soft);
  max-width: 56ch;
  margin-bottom: 0;
}
/* Full-page network field — fixed interactive canvas backdrop on every page */
.net-bg {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  pointer-events: none;
}

/* ---- Inner pages (About / Contact) ----------------------------------- */
.page {
  padding-block: clamp(48px, 9vh, 104px);
}
.page__title {
  font-size: clamp(1.7rem, 3.6vw, 2.2rem);
  margin-bottom: 28px;
  position: relative;
  padding-left: 18px;
}
.page__title::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.16em;
  bottom: 0.16em;
  width: 3px;
  border-radius: 3px;
  background: var(--accent);
}

.prose p {
  color: var(--text-soft);
  font-size: 1.06rem;
  line-height: 1.72;
  margin-bottom: 18px;
  max-width: 64ch;
}
.prose p:last-child { margin-bottom: 0; }

/* "I like CSS animations" line — a small CRT buzz that stays readable,
   then breaks down like a dying TV on hover. (Yes, this is on-brand.) */
.tv-glitch {
  position: relative;
  display: inline-block;
  font-weight: 700;
  color: var(--text);
  animation: tv-buzz 4s steps(1) infinite;
}
/* Idle: mostly calm, with a couple of quick flickers to invite a hover */
@keyframes tv-buzz {
  0%, 100% { text-shadow:  0.5px 0 rgba(255, 40, 90, 0.35), -0.5px 0 rgba(60, 220, 255, 0.35); transform: translate(0, 0); }
  48%      { text-shadow: -0.5px 0 rgba(255, 40, 90, 0.35),  0.5px 0 rgba(60, 220, 255, 0.35); transform: translate(0, 0); }
  /* brief glitch blip */
  50%      { text-shadow:   -1px 0 rgba(255, 40, 90, 0.55),    1px 0 rgba(60, 220, 255, 0.55); transform: translate(0.6px, -0.4px); }
  52%      { text-shadow:  1.2px 0 rgba(255, 40, 90, 0.55), -1.2px 0 rgba(60, 220, 255, 0.55); transform: translate(-0.5px, 0.3px) skewX(-1deg); }
  54%      { text-shadow:  0.5px 0 rgba(255, 40, 90, 0.35), -0.5px 0 rgba(60, 220, 255, 0.35); transform: translate(0, 0); }
  /* second, shorter blip */
  86%      { text-shadow:  0.5px 0 rgba(255, 40, 90, 0.35), -0.5px 0 rgba(60, 220, 255, 0.35); transform: translate(0, 0); }
  88%      { text-shadow:    1px 0 rgba(255, 40, 90, 0.5),    -1px 0 rgba(60, 220, 255, 0.5); transform: translate(-0.5px, 0.3px); }
  90%      { text-shadow:  0.5px 0 rgba(255, 40, 90, 0.35), -0.5px 0 rgba(60, 220, 255, 0.35); transform: translate(0, 0); }
}

/* Two colour-split copies, hidden until hover — the glitch slices */
.tv-glitch::before,
.tv-glitch::after {
  content: attr(data-text);
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
}

.tv-glitch:hover {
  animation: tv-buzz-hard 0.18s steps(2) infinite;
}
@keyframes tv-buzz-hard {
  0%   { text-shadow:  1.5px 0 rgba(255, 40, 90, 0.7), -1.5px 0 rgba(60, 220, 255, 0.7); transform: translate(0, 0); }
  25%  { text-shadow:   -2px 0 rgba(255, 40, 90, 0.7),    2px 0 rgba(60, 220, 255, 0.7); transform: translate(1px, -1px) skewX(-2deg); }
  50%  { text-shadow:    2px 0 rgba(255, 40, 90, 0.7),   -2px 0 rgba(60, 220, 255, 0.7); transform: translate(-1px, 1px); }
  75%  { text-shadow:   -1px 0 rgba(255, 40, 90, 0.7),    1px 0 rgba(60, 220, 255, 0.7); transform: translate(1px, 0) skewX(2deg); }
  100% { text-shadow:  1.5px 0 rgba(255, 40, 90, 0.7), -1.5px 0 rgba(60, 220, 255, 0.7); transform: translate(0, 0); }
}
.tv-glitch:hover::before {
  opacity: 0.85;
  color: rgba(60, 220, 255, 0.9);
  animation: glitch-slice-1 0.5s steps(3) infinite;
}
.tv-glitch:hover::after {
  opacity: 0.85;
  color: rgba(255, 40, 90, 0.9);
  animation: glitch-slice-2 0.4s steps(3) infinite reverse;
}
@keyframes glitch-slice-1 {
  0%   { clip-path: inset(0 0 85% 0);   transform: translate(-3px, 0); }
  30%  { clip-path: inset(40% 0 40% 0); transform: translate(3px, 0); }
  60%  { clip-path: inset(70% 0 10% 0); transform: translate(-2px, 0); }
  100% { clip-path: inset(10% 0 75% 0); transform: translate(2px, 0); }
}
@keyframes glitch-slice-2 {
  0%   { clip-path: inset(75% 0 5% 0);  transform: translate(3px, 0); }
  35%  { clip-path: inset(15% 0 55% 0); transform: translate(-3px, 0); }
  70%  { clip-path: inset(55% 0 25% 0); transform: translate(2px, 0); }
  100% { clip-path: inset(35% 0 45% 0); transform: translate(-2px, 0); }
}

.sub-title {
  font-size: 0.82rem;
  font-weight: 600;
  font-family: var(--font-mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin-top: clamp(40px, 6vw, 56px);
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.sub-title::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* Focus areas — compact inline list with accent separators */
.focus-inline {
  list-style: none;
  padding: 0;
  margin: 0;
  max-width: 74ch;
  line-height: 1.95;
}
.focus-inline li {
  display: inline;
  font-size: 1rem;
  color: var(--text-soft);
  transition: color 0.2s var(--ease);
}
.focus-inline li:not(:last-child)::after {
  content: "·";
  color: var(--accent);
  margin: 0 11px;
  opacity: 0.75;
}
.focus-inline li:hover { color: var(--text); }

/* ---- Contact ---------------------------------------------------------- */
.contact__lead {
  color: var(--text-soft);
  font-size: 1.1rem;
  max-width: 52ch;
  margin-bottom: 30px;
}
.contact__email {
  display: inline-flex;
  align-items: center;
  gap: 13px;
  flex-wrap: wrap;
  overflow-wrap: anywhere;
  font-family: var(--font-mono);
  font-size: clamp(1.05rem, 2.4vw, 1.4rem);
  font-weight: 600;
  color: var(--text);
  padding: 16px 22px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  transition: transform 0.22s var(--ease), border-color 0.22s var(--ease),
              box-shadow 0.28s var(--ease), color 0.22s var(--ease);
}
.contact__email-icon { color: var(--accent); display: inline-flex; flex: none; }
.contact__email:hover {
  transform: translateY(-2px);
  border-color: var(--accent-line);
  color: #fff;
  box-shadow: 0 18px 40px -24px var(--accent-glow);
}

/* ---- Footer ----------------------------------------------------------- */
.site-footer {
  flex-shrink: 0;
  border-top: 1px solid var(--border);
  padding-block: 26px;
  margin-top: 40px;
}
.footer__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px 24px;
}
.footer__tagline {
  color: var(--text-muted);
  font-size: 0.92rem;
  max-width: 60ch;
  transition: opacity 0.5s var(--ease);
}
.footer__tagline.is-fading { opacity: 0; }
.footer__year {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text-muted);
  white-space: nowrap;
}

/* ---- Entrance animation ---------------------------------------------- */
@keyframes rise {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: none; }
}
.stagger > * {
  animation: rise 0.55s var(--ease) both;
}
.stagger > *:nth-child(2) { animation-delay: 0.07s; }
.stagger > *:nth-child(3) { animation-delay: 0.14s; }
.stagger > *:nth-child(4) { animation-delay: 0.21s; }
.stagger > *:nth-child(5) { animation-delay: 0.28s; }

/* ---- Responsive ------------------------------------------------------- */
@media (max-width: 640px) {
  .nav__toggle { display: flex; }
  .nav {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: rgba(12, 15, 21, 0.98);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    visibility: hidden;
    clip-path: inset(0 0 100% 0);
    transition: clip-path 0.32s var(--ease), visibility 0s linear 0.32s;
    pointer-events: none;
  }
  .nav.is-open {
    visibility: visible;
    clip-path: inset(0 0 0 0);
    pointer-events: auto;
    transition: clip-path 0.32s var(--ease), visibility 0s;
  }
  .nav__links {
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    padding: 14px clamp(22px, 6vw, 40px) 18px;
  }
  .nav__link { padding: 12px 6px; font-size: 1rem; }
  .nav__link::after { left: 6px; right: auto; bottom: 8px; }

  .footer__inner { gap: 12px 20px; }
}

/* ---- Reduced motion --------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .stagger > * { animation: none; opacity: 1; transform: none; }
}
