/* ============================================
   fatihakdogan.com — quiet retro, paper zine
   ============================================ */

:root {
  --paper: #faf7ef;
  --ink: #1a1a1a;
  --muted: #5d594e;
  --line: #d8d3c4;
  --accent: #1d6f42;

  --font-pixel: 'Press Start 2P', monospace;
  --font-mono: 'IBM Plex Mono', monospace;
}

:root[data-theme="dark"] {
  --paper: #131410;
  --ink: #e8e4d8;
  --muted: #999485;
  --line: #2e2f29;
  --accent: #4cc97a;
}
* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 16px;
  line-height: 1.65;
  font-variant-numeric: tabular-nums;
}

/* paper grain */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
}

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

a { color: inherit; }

.wrap {
  max-width: 880px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ---------- TERMINAL TITLEBAR ---------- */
body { padding-top: 30px; }

.titlebar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 200;
  height: 30px;
  background: var(--ink);
  color: var(--paper);
  display: flex;
  align-items: center;
  padding: 0 14px;
  font-size: 12px;
  user-select: none;
  opacity: 0;
  animation: appear 0.4s ease-out 1.3s forwards;
}

.tb-dots { display: flex; gap: 7px; }

.tb-dots i {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.tb-dots i:nth-child(1) { background: #dd6155; }
.tb-dots i:nth-child(2) { background: #d9a440; }
.tb-dots i:nth-child(3) { background: #3f9e5f; }

.tb-title {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  opacity: 0.75;
}

.section { scroll-margin-top: 44px; }

/* ---------- TERMINAL INTRO ---------- */
.intro {
  position: fixed;
  inset: 0;
  z-index: 150;
  background: #101110;
  padding: 64px max(24px, calc((100% - 832px) / 2));
  font-size: 13px;
  color: #4cc97a;
  clip-path: inset(0 0 0 0);
  transition: clip-path 0.5s cubic-bezier(0.7, 0, 0.3, 1);
}

.intro.done { clip-path: inset(0 0 100% 0); }

.intro-cursor {
  display: inline-block;
  width: 8px;
  height: 1.05em;
  margin-left: 2px;
  background: #4cc97a;
  vertical-align: -0.15em;
  animation: blink 1s steps(1) infinite;
}

/* ---------- ENTRANCE ---------- */
@keyframes fade-up {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

@keyframes type { to { width: 100%; } }

@keyframes appear { to { opacity: 1; } }

.hero .prompt {
  display: inline-block;
  overflow: hidden;
  white-space: nowrap;
  width: 0;
  max-width: 100%;
  animation: type 0.6s steps(24, end) 0.1s forwards;
}

.hero h1 { opacity: 0; animation: fade-up 0.4s ease-out 0.7s forwards; }
.hero .sub { opacity: 0; animation: fade-up 0.4s ease-out 0.85s forwards; }
.hero-links { opacity: 0; animation: fade-up 0.4s ease-out 1s forwards; }

/* scroll-triggered reveal (class added by JS) */
.reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.reveal.in { opacity: 1; transform: none; }

/* ---------- HERO ---------- */
.hero {
  min-height: 70svh;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 56px;
  padding-top: 96px;
  padding-bottom: 64px;
}

.hero-text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

/* pixel-by-pixel loading photo (drawn by JS) */
.pixel-photo {
  flex-shrink: 0;
  width: 204px;
  height: 204px;
  mix-blend-mode: multiply;
  opacity: 0;
  animation: appear 0.4s ease-out 0.7s forwards, float 7s ease-in-out infinite;
}

:root[data-theme="dark"] .pixel-photo {
  mix-blend-mode: normal;
  filter: brightness(0.88) sepia(0.08);
  border: 1px solid var(--line);
  border-radius: 2px;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

@media (max-width: 700px) {
  .pixel-photo { display: none; }
}

.hero .prompt {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 28px;
}

.hero h1 {
  font-family: var(--font-pixel);
  font-size: clamp(20px, 4.2vw, 38px);
  line-height: 1.5;
  font-weight: 400;
  letter-spacing: 0.01em;
}

.hero h1 .cursor {
  display: inline-block;
  width: 0.55em;
  height: 0.9em;
  margin-left: 0.2em;
  background: var(--accent);
  vertical-align: -0.05em;
  animation: blink 1.1s steps(1) 0.75s infinite;
  opacity: 0;
}

@keyframes blink {
  0%, 49% { opacity: 1; }
  50%, 100% { opacity: 0; }
}

.hero .sub {
  margin-top: 32px;
  color: var(--muted);
  max-width: 46ch;
  text-wrap: pretty;
}

.hero-links {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 32px;
  margin-top: 48px;
  font-size: 14px;
}

/* sliding underline */
.hero-links a,
.footer a {
  text-decoration: none;
  background-image: linear-gradient(var(--accent), var(--accent));
  background-repeat: no-repeat;
  background-position: 0 100%;
  background-size: 0% 1px;
  transition: background-size 0.25s ease, color 0.2s ease;
  padding-bottom: 3px;
}

.hero-links a { border-bottom: 1px solid var(--line); }

.hero-links a:hover,
.footer a:hover {
  color: var(--accent);
  background-size: 100% 1px;
}

/* ---------- SECTIONS ---------- */
.section { padding: 64px 0; }

.section + .section { border-top: 1px dashed var(--line); }

.section-title {
  font-family: var(--font-pixel);
  font-size: 11px;
  font-weight: 400;
  color: var(--accent);
  letter-spacing: 0.06em;
  margin-bottom: 40px;
}

.section-title::before { content: "// "; }

/* ---------- REPO LIST ---------- */
.repo-list { display: flex; flex-direction: column; }

.repo {
  display: block;
  text-decoration: none;
  padding: 22px 0 22px 26px;
  border-bottom: 1px solid var(--line);
  position: relative;
}

.repo:first-child { border-top: 1px solid var(--line); }

.repo::before {
  content: "►";
  position: absolute;
  left: 0;
  top: 22px;
  font-size: 12px;
  color: var(--accent);
  opacity: 0;
  transform: translateX(-6px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.repo:hover::before { opacity: 1; transform: none; }

.repo-head {
  display: flex;
  align-items: baseline;
  gap: 16px;
  flex-wrap: wrap;
}

.repo-name { font-weight: 600; transition: color 0.2s ease; }

.repo-meta { font-size: 13px; color: var(--muted); }

.repo:hover .repo-name { color: var(--accent); }

.repo-stats {
  margin-left: auto;
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
  min-width: 9ch;
  text-align: right;
}

.repo-desc {
  color: var(--muted);
  font-size: 14px;
  margin-top: 6px;
  max-width: 62ch;
  text-wrap: pretty;
}

.tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }

.tag {
  font-size: 12px;
  line-height: 1.8;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 2px;
  padding: 0 8px;
}

/* ---------- ARTICLES ---------- */
.article-list { display: flex; flex-direction: column; gap: 44px; }

.article {
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 28px;
  text-decoration: none;
  align-items: start;
}

.article-thumb {
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--paper);
}

.article-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: grayscale(1) sepia(0.45) hue-rotate(75deg) saturate(1.6) brightness(0.96) contrast(1.05);
  transition: filter 0.35s ease, transform 0.35s ease;
}

.article:hover .article-thumb img {
  filter: none;
  transform: scale(1.03);
}

.article-title {
  font-size: 16px;
  font-weight: 600;
  line-height: 1.5;
  transition: color 0.2s ease;
  text-wrap: balance;
}

.article:hover .article-title { color: var(--accent); }

.article-date {
  font-size: 13px;
  color: var(--muted);
  margin-top: 8px;
}

@media (max-width: 560px) {
  .article { grid-template-columns: 1fr; gap: 16px; }
  .article-thumb { max-width: 240px; }
}

/* ---------- FOOTER ---------- */
.footer {
  border-top: 1px dashed var(--line);
  padding: 36px 0 56px;
  font-size: 13px;
  color: var(--muted);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

/* ---------- VIM STATUSLINE ---------- */
body { padding-bottom: calc(30px + env(safe-area-inset-bottom)); }

.statusline {
  opacity: 0;
  animation: appear 0.4s ease-out 1.3s forwards;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  gap: 20px;
  background: var(--ink);
  color: var(--paper);
  font-size: 12px;
  line-height: 1.3;
  padding: 5px 16px calc(5px + env(safe-area-inset-bottom)) 16px;
  user-select: none;
}

.statusline .mode { font-weight: 600; }
.statusline .file {
  flex: 1;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  opacity: 0.75;
}
.statusline .pos { opacity: 0.75; }

.statusline #sl-pos {
  display: inline-block;
  min-width: 3ch;
  text-align: right;
}

.statusline .sl-cmd {
  background: none;
  border: none;
  color: inherit;
  font: inherit;
  opacity: 0.75;
  cursor: pointer;
  padding: 0;
  min-width: 13ch;
  text-align: left;
  transition: opacity 0.2s ease;
}

.statusline .sl-cmd:hover { opacity: 1; }

/* ---------- ERROR PAGE ---------- */
.error-page {
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  gap: 20px;
}

.error-page h1 {
  font-family: var(--font-pixel);
  font-size: clamp(18px, 4vw, 32px);
  font-weight: 400;
}

.error-page a { color: var(--accent); }

/* ---------- MOTION SAFETY ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-delay: 0s !important;
    transition: none !important;
  }
  .hero .prompt { width: 100%; }
  .hero h1, .hero .sub, .hero-links, .pixel-photo, .statusline, .titlebar { opacity: 1; }
  .reveal { opacity: 1; transform: none; }
}
