/* ============================================
   main.css — Dergi Arşivi Galerisi
   ============================================ */
@import url("https://fonts.googleapis.com/css2?family=Playfair+Display:wght@600;700&family=Inter:wght@400;500;600&display=swap");

:root {
  --bg:          #f7f5f0;
  --bg-card:     #ffffff;
  --bg-header:   #0e1f5c;
  --text:        #1a1714;
  --text-muted:  #8a8278;
  --border:      #e8e2d9;
  --accent:      #cc0022;
  --accent-dark: #a3001b;
  --accent-pale: #fff0f2;
  --shadow-sm:   0 2px 8px rgba(0,0,0,.07);
  --shadow-md:   0 8px 28px rgba(0,0,0,.13);
  --shadow-lg:   0 20px 60px rgba(0,0,0,.22);
  --radius:      10px;
  --tr:          .2s ease;
  --font-head:   "Playfair Display", Georgia, serif;
  --font-body:   "Inter", system-ui, sans-serif;
  --border-light: #e8e2d9;
  --bg-input:     #f8f7f5;
}

[data-theme="dark"] {
  --bg:          #100f0d;
  --bg-card:     #1c1a17;
  --bg-header:   #07122e;
  --text:        #ede8e0;
  --text-muted:  #6b6358;
  --border:      #2a2720;
  --shadow-sm:   0 2px 8px rgba(0,0,0,.35);
  --shadow-md:   0 8px 28px rgba(0,0,0,.55);
  --shadow-lg:   0 20px 60px rgba(0,0,0,.7);
  --accent-pale:  #2a0008;
  --border-light: #2a2720;
  --bg-input:     #1c1a17;
}

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

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  transition: background var(--tr), color var(--tr);
}

/* ---- Header ---- */
.site-header {
  background: var(--bg-header);
  position: sticky;
  top: 0;
  z-index: 50;
  border-bottom: 3px solid var(--accent);
  box-shadow: 0 3px 16px rgba(0,0,0,.35);
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: .75rem;
  text-decoration: none;
}

.brand-logo {
  width: 42px;
  height: 42px;
  object-fit: contain;
  flex-shrink: 0;
  filter: drop-shadow(0 1px 4px rgba(0,0,0,.4));
}

.brand-text { display: flex; flex-direction: column; }
.brand-name  { font-family: var(--font-head); font-size: 1rem; color: #f0ebe3; line-height: 1.1; }
.brand-sub   { font-size: .68rem; color: rgba(255,255,255,.4); letter-spacing: .06em; text-transform: uppercase; }

.header-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.stats-bar {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: .78rem;
  color: rgba(255,255,255,.45);
}
.stats-bar strong { color: rgba(255,255,255,.75); }
.stats-bar .sep   { opacity: .3; }

.theme-btn {
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.1);
  color: rgba(255,255,255,.7);
  width: 34px; height: 34px;
  border-radius: 7px;
  cursor: pointer;
  font-size: .9rem;
  transition: background var(--tr);
  display: flex; align-items: center; justify-content: center;
}
.theme-btn:hover { background: rgba(255,255,255,.15); }

.admin-link {
  font-size: .75rem;
  color: rgba(255,255,255,.4);
  text-decoration: none;
  padding: .3rem .7rem;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 6px;
  transition: all var(--tr);
}
.admin-link:hover { color: rgba(255,255,255,.8); border-color: rgba(255,255,255,.3); }

.register-link {
  font-size: .75rem;
  font-weight: 600;
  color: #fff;
  text-decoration: none;
  padding: .3rem .85rem;
  background: rgba(255,255,255,.15);
  border: 1px solid rgba(255,255,255,.3);
  border-radius: 6px;
  transition: all var(--tr);
}
.register-link:hover { background: rgba(255,255,255,.25); border-color: rgba(255,255,255,.5); }

/* ---- Error banner ---- */
.error-banner {
  background: #3b0f0f;
  color: #fca5a5;
  padding: .75rem 1.5rem;
  font-size: .85rem;
  display: none;
  text-align: center;
}

/* ---- Filter row ---- */
.filter-row {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
}

.filter-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: .75rem 1.5rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .6rem;
}

.filter-label {
  font-size: .72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-muted);
  margin-right: .25rem;
}

.filter-select {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: .35rem .75rem;
  font-size: .83rem;
  font-family: var(--font-body);
  cursor: pointer;
  transition: border-color var(--tr);
  appearance: none;
  padding-right: 1.6rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23999'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right .6rem center;
}
.filter-select:focus { outline: none; border-color: var(--accent); }

.filter-reset {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: 7px;
  width: 30px; height: 30px;
  font-size: .75rem;
  cursor: pointer;
  transition: all var(--tr);
  display: flex; align-items: center; justify-content: center;
}
.filter-reset:hover { border-color: var(--accent); color: var(--accent); }

/* ---- Gallery ---- */
.gallery-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1.5rem 3rem;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1.75rem;
}

/* ---- Magazine Card ---- */
.magazine-card {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-card);
  box-shadow: var(--shadow-sm);
  transition: transform var(--tr), box-shadow var(--tr);
}

.magazine-card:hover {
  transform: translateY(-8px) rotate(-0.5deg);
  box-shadow: var(--shadow-lg);
}

/* Book spine effect */
.magazine-card::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 6px;
  background: linear-gradient(to right, rgba(0,0,0,.18), transparent);
  border-radius: var(--radius) 0 0 var(--radius);
  pointer-events: none;
}
.magazine-card { position: relative; }

.card-cover {
  aspect-ratio: 3 / 4;
  width: 100%;
  position: relative;
  overflow: hidden;
  background: linear-gradient(145deg, #2a2520, #1a1510);
}

.card-cover img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
  transition: transform .4s ease;
}
.magazine-card:hover .card-cover img { transform: scale(1.04); }

/* ---- Stilize kapak (coverUrl yoksa) ---- */
.cover-styled {
  width: 100%; height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  position: relative;
  overflow: hidden;
  transition: transform .4s ease;
}
.magazine-card:hover .cover-styled { transform: scale(1.04); }

.cover-deco {
  position: absolute;
  top: 12px; left: 12px; right: 12px; bottom: 12px;
  border: 1.5px solid rgba(255,255,255,.15);
  border-radius: 6px;
  pointer-events: none;
}

.cover-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .45rem;
  padding: 1.5rem 1rem;
  text-align: center;
  z-index: 1;
}

.cover-icon {
  font-size: 2.2rem;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,.35));
}

.cover-title {
  font-family: 'Playfair Display', serif;
  font-size: 1.15rem;
  font-weight: 700;
  color: #fff;
  line-height: 1.25;
  text-shadow: 0 1px 4px rgba(0,0,0,.4);
  max-width: 90%;
  word-break: break-word;
}

.cover-issue {
  font-size: .7rem;
  font-weight: 600;
  color: rgba(255,255,255,.85);
  letter-spacing: .08em;
  text-transform: uppercase;
  border: 1px solid rgba(255,255,255,.25);
  padding: 2px 10px;
  border-radius: 10px;
}

.cover-year {
  font-size: .72rem;
  color: rgba(255,255,255,.55);
  font-weight: 500;
  letter-spacing: .06em;
}

.cover-stripe {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 4px;
  opacity: .7;
}

.badge-new {
  position: absolute;
  top: 8px; right: 8px;
  z-index: 5;
  background: var(--accent);
  color: #fff;
  font-size: .6rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  padding: 3px 7px;
  border-radius: 4px;
}

.card-info {
  padding: .75rem .85rem;
}

.card-title {
  font-family: var(--font-head);
  font-size: .88rem;
  font-weight: 600;
  line-height: 1.3;
  color: var(--text);
  margin-bottom: .3rem;
}

.card-meta {
  font-size: .72rem;
  color: var(--text-muted);
  display: flex;
  gap: .3rem;
  align-items: center;
  flex-wrap: wrap;
}
.card-meta .dot::before { content: '·'; }
.view-count {
  margin-left: auto;
  font-size: .68rem;
  color: var(--text-muted);
  opacity: .7;
  white-space: nowrap;
}

.card-desc {
  font-size: .72rem;
  color: var(--text-muted);
  line-height: 1.4;
  margin-bottom: .25rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ---- Empty state ---- */
.empty-state {
  text-align: center;
  padding: 5rem 2rem;
  color: var(--text-muted);
  grid-column: 1 / -1;
}
.empty-state .empty-icon { font-size: 3.5rem; opacity: .3; margin-bottom: 1rem; display: block; }
.empty-state h3 { font-family: var(--font-head); font-size: 1.2rem; margin-bottom: .5rem; }
.empty-state p { font-size: .88rem; }

/* ---- Skeleton ---- */
.skeleton-card {
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-card);
  box-shadow: var(--shadow-sm);
}
.skeleton-cover {
  aspect-ratio: 3/4;
  background: linear-gradient(90deg, var(--border) 25%, var(--bg) 50%, var(--border) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}
.skeleton-text {
  height: 12px;
  margin: .75rem .85rem .4rem;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--border) 25%, var(--bg) 50%, var(--border) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}
.skeleton-text.short { width: 55%; }

@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ---- Footer ---- */
.site-footer {
  text-align: center;
  padding: 1.75rem 2rem 1.5rem;
  font-size: .75rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .5rem;
}
.footer-row {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: .4rem;
}
.footer-credit {
  font-size: .7rem;
  opacity: .75;
  padding-top: .35rem;
  border-top: 1px dashed var(--border);
  width: 100%;
}
.site-footer a {
  color: var(--text-muted);
  text-decoration: none;
}
.site-footer a:hover {
  color: var(--accent);
  text-decoration: underline;
}
.footer-credit a:hover {
  color: var(--accent);
}
.footer-sep {
  opacity: .4;
}

/* ---- Kategori filtre barı ---- */
.category-filter-bar {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .65rem 1.5rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}
.category-filter-bar::-webkit-scrollbar { display: none; }
.filter-btn {
  flex-shrink: 0;
  padding: .32rem .9rem;
  border: 1.5px solid var(--border);
  border-radius: 999px;
  background: var(--bg-card);
  color: var(--text);
  font: 500 .78rem var(--font-body);
  cursor: pointer;
  transition: background var(--tr), border-color var(--tr), color var(--tr);
  white-space: nowrap;
}
.filter-btn:hover { border-color: var(--cat-color, var(--accent)); color: var(--cat-color, var(--accent)); }
.filter-btn--active {
  background: var(--cat-color, var(--accent));
  border-color: var(--cat-color, var(--accent));
  color: #fff;
}

/* ---- Kategori chip (kart üstü) ---- */
.card-cat { margin-bottom: .35rem; }
.category-chip {
  display: inline-block;
  padding: .18rem .55rem;
  border-radius: 999px;
  font-size: .65rem;
  font-weight: 600;
  color: #fff;
  letter-spacing: .02em;
  text-transform: uppercase;
}

/* ---- Admin kategori listesi ---- */
.cat-item {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .55rem .75rem;
  border: 1px solid var(--border-light, #e8e2d9);
  border-radius: 8px;
  margin-bottom: .5rem;
  background: var(--bg-input, #f8f7f5);
}
.cat-swatch {
  display: inline-block;
  width: 14px; height: 14px;
  border-radius: 4px;
  flex-shrink: 0;
}
.cat-name { font-size: .9rem; font-weight: 500; }

/* ---- Responsive ---- */
@media (max-width: 640px) {
  .gallery-grid { grid-template-columns: repeat(2, 1fr); gap: 1rem; }
  .gallery-container { padding: 1.25rem 1rem 2rem; }
  .stats-bar { display: none; }

  /* Yönetim linki: ikon olarak küçük tut, metin gizle */
  .admin-link { font-size: 0; padding: .35rem .5rem; }
  .admin-link::after { content: '⚙'; font-size: .85rem; }

  /* Kayıt ol: kısa tut mobilde */
  .register-link { font-size: .7rem; padding: .28rem .6rem; }

  /* Header daha sıkışık */
  .header-inner { padding: 0 .85rem; gap: .5rem; height: 56px; }
  .brand-sub { display: none; }

  /* Filter row yatay kaydırma */
  .filter-inner {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding: .65rem 1rem;
    touch-action: pan-x;
  }
  .filter-inner::-webkit-scrollbar { display: none; }
  .filter-label { flex-shrink: 0; }
  .filter-select { flex-shrink: 0; min-height: 36px; touch-action: manipulation; }

  /* Dokunma hedefleri */
  .filter-reset { width: 40px; height: 40px; flex-shrink: 0; }
  .theme-btn    { width: 40px; height: 40px; }
  .admin-link   { min-height: 40px; }

  /* 300ms gecikmeyi kaldır */
  .magazine-card, .theme-btn, .filter-reset,
  .filter-select, .admin-link, .register-link,
  .filter-btn { touch-action: manipulation; }

  /* Kart hover efekti mobile'da disabled */
  .magazine-card:hover { transform: none; box-shadow: var(--shadow-sm); }
}

@media (max-width: 480px) {
  .card-desc   { display: none; }
  .card-info   { padding: .6rem .7rem; }
  .card-title  { font-size: .82rem; }
}

@media (max-width: 360px) {
  .gallery-grid { grid-template-columns: 1fr; }
}

/* Dokunmatik ekranlarda basma geri bildirimi (hover yerine) */
@media (pointer: coarse) {
  .magazine-card:active {
    transform: scale(0.97);
    box-shadow: var(--shadow-md);
    transition: transform .08s ease, box-shadow .08s ease;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
