/* ========== Gifty CMS Pages (Works / Blog / Admin) ========== */

/* shared sub-page nav */
.subpage-hero {
  padding: clamp(80px, 9vw, 120px) 0 clamp(40px, 5vw, 64px);
  border-bottom: 1px solid var(--line);
  position: relative;
  overflow: hidden;
}
.subpage-hero::before {
  content: "";
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 100%; height: 4px;
  background: var(--rainbow);
}
.subpage-hero .eyebrow { margin-bottom: 18px; }
.subpage-hero h1 {
  font-size: clamp(48px, 7vw, 96px);
  line-height: 1.05;
  letter-spacing: -0.04em;
  display: flex; align-items: baseline; gap: 16px;
  flex-wrap: wrap;
}
.subpage-hero h1 small {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  color: var(--ink-2);
  border: 1.5px solid var(--ink);
  padding: 6px 14px;
  border-radius: 999px;
  letter-spacing: 0;
}
.subpage-hero p {
  margin-top: 24px;
  font-size: 16px;
  color: var(--ink-2);
  max-width: 640px;
  line-height: 1.9;
}

.empty-state {
  padding: 80px 32px;
  text-align: center;
  background: var(--bg-alt);
  border: 1.5px dashed var(--line-2);
  border-radius: var(--radius-lg);
  color: var(--ink-2);
}
.empty-state h3 { margin-bottom: 8px; font-size: 22px; }
.empty-state p { font-size: 14px; }

/* ===== WORKS LIST ===== */
.works-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 32px;
}
.work-card {
  background: var(--paper);
  border: 1.5px solid var(--ink);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform .25s, box-shadow .25s;
  position: relative;
}
.work-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); }
.work-card::before {
  content: "";
  position: absolute;
  top: 0; left: 0; width: 100%; height: 4px;
  background: var(--rainbow);
  z-index: 2;
}
.work-card-gallery {
  display: grid;
  grid-template-columns: 1fr;
  background: var(--bg-alt);
}
.work-card-gallery.cols-2 { grid-template-columns: 1fr 1fr; }
.work-card-gallery img {
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  display: block;
  border-bottom: 1px solid var(--line);
}
.work-card-gallery.cols-2 img:first-child { border-right: 1px solid var(--line); }
.work-card-body {
  padding: 28px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.work-card-tags {
  display: flex; gap: 6px; flex-wrap: wrap;
}
.work-card-tag {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  padding: 4px 10px;
  background: var(--bg-alt);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink-2);
}
.work-card-client {
  font-family: var(--font-display);
  font-size: 14px;
  letter-spacing: 0.1em;
  color: var(--ink-3);
  font-weight: 700;
}
.work-card-title {
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 900;
  line-height: 1.55;
  letter-spacing: -0.01em;
}
.work-card-summary {
  font-size: 13.5px;
  color: var(--ink-2);
  line-height: 1.85;
  text-wrap: pretty;
}
.work-card-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-3);
  letter-spacing: 0.08em;
}

/* ===== BLOG LIST ===== */
.blog-list { display: flex; flex-direction: column; gap: 28px; }
.blog-row {
  display: grid;
  grid-template-columns: 200px 1fr auto;
  gap: 36px;
  padding: 32px 0;
  border-bottom: 1px solid var(--line);
  align-items: start;
  transition: padding .2s, background .2s;
  cursor: pointer;
}
.blog-row:hover { background: #fafafa; padding-inline: 12px; }
@media (max-width: 760px) {
  .blog-row { grid-template-columns: 1fr; gap: 16px; padding: 24px 0; }
  .blog-row .blog-cover { max-width: 240px; }
}
.blog-cover {
  width: 100%;
  aspect-ratio: 4 / 3;
  background: var(--bg-alt);
  border: 1.5px solid var(--ink);
  border-radius: var(--radius);
  overflow: hidden;
  position: relative;
}
.blog-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.blog-cover.empty {
  background: var(--rainbow);
  display: flex; align-items: center; justify-content: center;
  color: white;
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 32px;
  letter-spacing: -0.04em;
}
.blog-body { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.blog-meta-row {
  display: flex; gap: 12px; align-items: center;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--ink-3);
  letter-spacing: 0.14em;
  font-weight: 600;
}
.blog-cat {
  background: var(--ink);
  color: var(--bg);
  padding: 4px 10px;
  border-radius: 999px;
  letter-spacing: 0.12em;
}
.blog-title {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 900;
  line-height: 1.5;
  letter-spacing: -0.01em;
}
.blog-excerpt {
  font-size: 13.5px;
  color: var(--ink-2);
  line-height: 1.85;
  text-wrap: pretty;
  max-width: 640px;
}
.blog-arrow {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 900;
  color: var(--ink);
  align-self: center;
}

/* ===== ADMIN ===== */
.admin-shell { min-height: 100vh; display: flex; }
.admin-side {
  width: 240px;
  flex-shrink: 0;
  background: #000;
  color: #fff;
  padding: 32px 24px;
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
}
.admin-side .logo-wrap { display: flex; align-items: center; gap: 12px; margin-bottom: 40px; color: #fff; }
.admin-side .logo-wrap svg { color: #fff; }
.admin-side .logo-wrap small { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.2em; color: #999; }
.admin-nav { display: flex; flex-direction: column; gap: 4px; }
.admin-nav button {
  text-align: left;
  padding: 12px 14px;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 600;
  color: #ccc;
  display: flex; align-items: center; gap: 12px;
  transition: background .15s, color .15s;
}
.admin-nav button:hover { background: #1a1a1a; color: #fff; }
.admin-nav button.active { background: #fff; color: #000; }
.admin-nav button .num {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  font-weight: 700;
  opacity: 0.6;
}
.admin-side-footer {
  margin-top: auto;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  color: #777;
  padding-top: 24px;
  border-top: 1px solid #222;
  display: flex; flex-direction: column; gap: 10px;
}
.admin-side-footer a { color: #ccc; }
.admin-side-footer a:hover { color: #fff; }

.admin-main {
  flex: 1;
  padding: 48px 48px 80px;
  max-width: 100%;
  overflow-x: hidden;
}
@media (max-width: 760px) {
  .admin-shell { flex-direction: column; }
  .admin-side {
    width: 100%; height: auto; position: relative;
    padding: 20px;
  }
  .admin-side .logo-wrap { margin-bottom: 16px; }
  .admin-nav { flex-direction: row; flex-wrap: wrap; }
  .admin-side-footer { display: none; }
  .admin-main { padding: 32px 24px 64px; }
}

.admin-head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 36px;
  gap: 16px;
  flex-wrap: wrap;
}
.admin-head h1 {
  font-size: 36px;
  font-weight: 900;
  letter-spacing: -0.03em;
  line-height: 1.1;
}
.admin-head .h-sub {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  color: var(--ink-3);
  font-weight: 600;
  margin-top: 8px;
}

.admin-btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 11px 18px;
  background: var(--ink);
  color: var(--bg);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  transition: transform .15s, opacity .15s;
  border: 1.5px solid var(--ink);
  cursor: pointer;
}
.admin-btn:hover { transform: translateY(-1px); }
.admin-btn.ghost {
  background: transparent;
  color: var(--ink);
  border-color: var(--line-2);
}
.admin-btn.ghost:hover { border-color: var(--ink); }
.admin-btn.danger {
  background: #fff;
  color: #c93030;
  border-color: #f4baba;
}
.admin-btn.danger:hover { background: #fee; border-color: #ff3b3b; }
.admin-btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }

.admin-table {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.admin-row {
  display: grid;
  grid-template-columns: 80px 1fr 200px 120px;
  gap: 20px;
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
  align-items: center;
  transition: background .15s;
}
.admin-row:last-child { border-bottom: 0; }
.admin-row:hover { background: var(--bg-alt); }
.admin-row .thumb {
  width: 64px; height: 48px;
  border-radius: 6px;
  background: var(--bg-alt);
  overflow: hidden;
  position: relative;
}
.admin-row .thumb img { width: 100%; height: 100%; object-fit: cover; }
.admin-row .thumb.empty {
  background: var(--rainbow);
  display: flex; align-items: center; justify-content: center;
  color: white; font-family: var(--font-display); font-weight: 900;
}
.admin-row .name { font-family: var(--font-display); font-size: 15px; font-weight: 800; line-height: 1.35; }
.admin-row .meta { font-size: 12px; color: var(--ink-3); margin-top: 4px; font-family: var(--font-mono); letter-spacing: 0.08em; }
.admin-row .badges { display: flex; gap: 6px; flex-wrap: wrap; }
.admin-row .badges span {
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 3px 8px;
  background: var(--bg-alt);
  border-radius: 999px;
  letter-spacing: 0.06em;
  font-weight: 600;
}
.admin-row .actions { display: flex; gap: 6px; justify-content: flex-end; }
.admin-row .icon-btn {
  width: 32px; height: 32px;
  border-radius: 6px;
  border: 1px solid var(--line-2);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
  transition: background .15s, border-color .15s;
}
.admin-row .icon-btn:hover { border-color: var(--ink); background: var(--bg-alt); }
.admin-row .icon-btn.del:hover { background: #fee; border-color: #ff3b3b; color: #c93030; }

@media (max-width: 760px) {
  .admin-row {
    grid-template-columns: 64px 1fr;
    grid-template-areas: "thumb name" "thumb tags" "actions actions";
    padding: 14px;
  }
  .admin-row .thumb { grid-area: thumb; }
  .admin-row .col-name { grid-area: name; }
  .admin-row .badges { grid-area: tags; }
  .admin-row .actions { grid-area: actions; justify-content: flex-start; }
}

/* Modal */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 100;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 20px;
  overflow-y: auto;
  backdrop-filter: blur(4px);
}
.modal-card {
  background: var(--paper);
  width: 100%;
  max-width: 720px;
  border-radius: var(--radius-lg);
  border: 1.5px solid var(--ink);
  overflow: hidden;
  box-shadow: 0 30px 80px rgba(0,0,0,0.3);
  position: relative;
}
.modal-card::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0; height: 5px;
  background: var(--rainbow);
}
.modal-head {
  padding: 28px 32px 20px;
  border-bottom: 1px solid var(--line);
  display: flex; justify-content: space-between; align-items: center;
}
.modal-head h2 { font-size: 22px; font-weight: 900; letter-spacing: -0.02em; }
.modal-head .close {
  width: 36px; height: 36px;
  border-radius: 50%;
  border: 1px solid var(--line-2);
  font-size: 18px;
  display: flex; align-items: center; justify-content: center;
}
.modal-head .close:hover { background: var(--bg-alt); }

.modal-body { padding: 28px 32px; }
.modal-foot {
  padding: 20px 32px;
  border-top: 1px solid var(--line);
  background: var(--bg-alt);
  display: flex; justify-content: flex-end; gap: 10px;
}

.field { margin-bottom: 20px; }
.field label {
  display: block;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink);
  margin-bottom: 8px;
  font-weight: 700;
}
.field label .req { color: #ff3b3b; }
.field label .hint { color: var(--ink-3); font-weight: 500; letter-spacing: 0.08em; margin-left: 8px; text-transform: none; }
.field input[type="text"],
.field input[type="date"],
.field textarea,
.field select {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--line-2);
  border-radius: 8px;
  background: var(--bg);
  font-size: 14px;
  font-family: var(--font-body);
  transition: border-color .15s;
}
.field input:focus, .field textarea:focus, .field select:focus {
  outline: none;
  border-color: var(--ink);
}
.field textarea { min-height: 120px; resize: vertical; line-height: 1.75; }

.tags-input {
  display: flex; gap: 6px; flex-wrap: wrap;
  border: 1.5px solid var(--line-2);
  padding: 8px;
  border-radius: 8px;
  background: var(--bg);
  min-height: 48px;
  align-items: center;
}
.tags-input .tag-chip {
  display: inline-flex; gap: 8px; align-items: center;
  padding: 5px 12px;
  background: var(--ink);
  color: var(--bg);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}
.tags-input .tag-chip button {
  color: var(--bg);
  opacity: 0.7;
  font-size: 14px;
  line-height: 1;
}
.tags-input .tag-chip button:hover { opacity: 1; }
.tags-input input {
  border: none;
  padding: 6px 8px;
  background: transparent;
  flex: 1;
  min-width: 120px;
  font-size: 13px;
}
.tags-input input:focus { outline: none; }

.dropzone {
  border: 2px dashed var(--line-2);
  border-radius: 12px;
  padding: 32px;
  text-align: center;
  background: var(--bg-alt);
  cursor: pointer;
  transition: border-color .2s, background .2s;
}
.dropzone:hover, .dropzone.drag-over {
  border-color: var(--ink);
  background: var(--bg);
}
.dropzone p { margin: 8px 0 0; font-size: 13px; color: var(--ink-2); }
.dropzone .dz-icon {
  font-size: 32px;
  margin-bottom: 6px;
}
.dropzone .dz-rb {
  display: inline-block;
  width: 48px; height: 8px;
  background: var(--rainbow);
  border-radius: 4px;
  margin-bottom: 8px;
}

.image-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
  margin-top: 12px;
}
.image-item {
  position: relative;
  aspect-ratio: 4/5;
  border-radius: 10px;
  overflow: hidden;
  border: 1.5px solid var(--ink);
  background: var(--bg-alt);
}
.image-item img {
  width: 100%; height: 100%; object-fit: cover;
}
.image-item .img-actions {
  position: absolute;
  top: 6px; right: 6px;
  display: flex; gap: 4px;
}
.image-item .img-actions button {
  width: 28px; height: 28px;
  background: rgba(0,0,0,0.7);
  color: white;
  border-radius: 6px;
  font-size: 12px;
  display: flex; align-items: center; justify-content: center;
}
.image-item .img-actions button:hover { background: #000; }
.image-item .img-index {
  position: absolute;
  bottom: 6px; left: 6px;
  background: rgba(0,0,0,0.7);
  color: white;
  padding: 2px 8px;
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
}

.toast {
  position: fixed;
  bottom: 24px; left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--ink);
  color: var(--bg);
  padding: 14px 24px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  z-index: 200;
  box-shadow: 0 8px 30px rgba(0,0,0,0.2);
  opacity: 0;
  transition: opacity .2s, transform .25s;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.toast::before {
  content: "✓";
  display: inline-block;
  width: 20px; height: 20px;
  background: var(--rainbow);
  border-radius: 50%;
  color: white;
  text-align: center;
  line-height: 20px;
  margin-right: 8px;
  font-weight: 900;
}

.info-banner {
  background: var(--bg-alt);
  border: 1px solid var(--line);
  border-left: 4px solid var(--ink);
  padding: 16px 20px;
  border-radius: 8px;
  margin-bottom: 32px;
  font-size: 13.5px;
  color: var(--ink-2);
  line-height: 1.7;
}
.info-banner strong { color: var(--ink); display: block; margin-bottom: 4px; font-size: 13px; }

/* Blog detail */
.blog-detail { max-width: 760px; margin: 0 auto; }
.blog-detail-cover {
  width: 100%;
  aspect-ratio: 16/9;
  background: var(--bg-alt);
  border: 1.5px solid var(--ink);
  border-radius: var(--radius-lg);
  margin-bottom: 40px;
  overflow: hidden;
}
.blog-detail-cover img { width: 100%; height: 100%; object-fit: cover; }
.blog-detail-cover.empty {
  background: var(--rainbow);
  display: flex; align-items: center; justify-content: center;
  color: white;
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 64px;
  letter-spacing: -0.04em;
}
.blog-detail-meta { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.14em; color: var(--ink-3); margin-bottom: 12px; }
.blog-detail h1 { font-size: clamp(28px, 4vw, 44px); line-height: 1.35; margin-bottom: 16px; }
.blog-detail-body {
  font-size: 15.5px;
  line-height: 2;
  color: var(--ink-2);
  text-wrap: pretty;
  white-space: pre-wrap;
}

/* Work detail */
.work-detail { max-width: 1080px; margin: 0 auto; }
.work-detail-head { margin-bottom: 48px; max-width: 720px; }
.work-detail-tags { display: flex; gap: 6px; margin-bottom: 16px; flex-wrap: wrap; }
.work-detail h1 { font-size: clamp(28px, 4vw, 44px); line-height: 1.45; margin-bottom: 16px; }
.work-detail-summary { font-size: 16px; color: var(--ink-2); line-height: 2; text-wrap: pretty; }
.work-detail-images { display: grid; gap: 16px; }
.work-detail-images img {
  width: 100%; height: auto;
  border-radius: var(--radius);
  border: 1.5px solid var(--ink);
}
.work-detail-back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  color: var(--ink-3);
  font-weight: 700;
  margin-bottom: 32px;
  text-transform: uppercase;
}
.work-detail-back:hover { color: var(--ink); }
