/* =========================================================
   style.css — Tối, phẳng, không màu mè
   ========================================================= */

:root {
  --font-display: 'Bricolage Grotesque', 'Segoe UI', system-ui, sans-serif;
  --font-body: 'Instrument Sans', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;

  --bg: #0b0b0c;
  --surface: #141416;
  --surface-2: #1c1c1f;
  --border: #2a2a2e;
  --border-soft: #202024;

  --text: #f2f1ef;
  --text-dim: #a3a29e;
  --text-faint: #6d6c69;

  --radius: 4px;
  --maxw: 1120px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }
a { color: inherit; }

.wrap {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 24px;
}

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

/* ---------- Thanh trên ---------- */
.nav {
  border-bottom: 1px solid var(--border-soft);
}

.nav-in {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 14px;
}

.brand { font-weight: 600; text-decoration: none; letter-spacing: -.01em; }

.nav-links { margin-left: auto; display: flex; gap: 18px; }
.nav-links a { color: var(--text-dim); text-decoration: none; }
.nav-links a:hover { color: var(--text); }

/* ---------- Đầu trang: ảnh trái, tiêu đề phải ---------- */
.top {
  display: grid;
  grid-template-columns: minmax(0, 42%) minmax(0, 1fr);
  gap: 44px;
  align-items: start;
  padding: 56px 0 72px;
}

.headlines { padding: 0; }

.headline {
  font-family: var(--font-display);
  font-size: min(var(--headline-max, 72px), 11vw);
  line-height: 1;
  letter-spacing: -.04em;
  font-weight: 800;
  margin: 0;
  color: var(--headline-color, var(--text));
  text-wrap: balance;
}

.headline + .headline { margin-top: .06em; }

.intro {
  margin: 34px 0 0;
  color: var(--text-dim);
  font-size: clamp(16px, 1.6vw, 19px);
  max-width: 52ch;
  white-space: pre-wrap;   /* gõ xuống dòng thế nào, hiện đúng như vậy */
}

.links {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 28px;
  align-items: flex-start;
}

.link-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  text-decoration: none;
  color: inherit;
  border-bottom: 1px solid var(--border-soft);
  padding-bottom: 6px;
  max-width: 100%;
}
.link-item:hover { border-color: var(--text-faint); }

.link-label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.link-value {
  font-size: clamp(17px, 1.9vw, 22px);
  font-weight: 600;
  letter-spacing: -.015em;
  color: var(--text);
  word-break: break-word;
}
.link-item:hover .link-value { text-decoration: underline; text-underline-offset: 3px; }

/* ---------- Ảnh chính (cột trái) ---------- */
.main-figure { margin: 0; }

.main-media {
  position: relative;
  perspective: 760px;
  perspective-origin: 50% 45%;
}

/* Chữ nổi giữa ảnh: gradient đỏ + hiệu ứng thu phóng */
.main-overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 18px;
  pointer-events: none;
}

.main-overlay span {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(19px, 3.4vw, 40px);
  line-height: 1.05;
  letter-spacing: -.035em;
  text-align: center;
  text-wrap: balance;
  max-width: 100%;
  word-break: break-word;

  background: linear-gradient(100deg, #ff9d3d 0%, #ff2f2f 38%, #d10000 68%, #ff5252 100%);
  background-size: 220% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;

  filter: drop-shadow(0 3px 14px rgba(0, 0, 0, .75));
  animation: overlay-zoom 2.6s ease-in-out infinite alternate,
             overlay-sweep 6s linear infinite;
}

@keyframes overlay-zoom {
  from { transform: scale(1); }
  to   { transform: scale(1.14); }
}

@keyframes overlay-sweep {
  from { background-position: 0% 50%; }
  to   { background-position: 200% 50%; }
}

/* ---- 5 chữ rải khắp ảnh, nổi khối 3D, bay bổng ---- */
.float {
  position: absolute;
  pointer-events: none;
  transform-style: preserve-3d;
  max-width: 46%;
}

.float span {
  display: block;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(12px, 1.8vw, 22px);
  line-height: 1.1;
  letter-spacing: -.02em;
  white-space: nowrap;
  color: #ff4b3e;
  text-shadow:
    0 1px 0 #d92b20,
    0 2px 0 #b81f16,
    0 3px 0 #96170f,
    0 4px 0 #74100a,
    0 5px 0 #520b06,
    0 7px 16px rgba(0, 0, 0, .65);
  animation: float-drift 5.4s ease-in-out infinite alternate;
}

/* Rải quanh mép ảnh, chừa khoảng giữa cho chữ chính */
.f1 { left: 6%;  top: 7%;    transform: rotateX(14deg) rotateY(-20deg); }
.f2 { right: 5%; top: 20%;   transform: rotateX(10deg) rotateY(20deg); }
.f3 { left: 5%;  top: 33%;   transform: rotateX(-8deg) rotateY(-14deg); }
.f4 { right: 6%; top: 70%;   transform: rotateX(-12deg) rotateY(17deg); }
.f5 { left: 20%; bottom: 6%; transform: rotateX(16deg) rotateY(-6deg); }

.f1 span { animation-duration: 5.4s; animation-delay: 0s; }
.f2 span { animation-duration: 6.6s; animation-delay: -1.2s; }
.f3 span { animation-duration: 4.8s; animation-delay: -2.4s; }
.f4 span { animation-duration: 7.2s; animation-delay: -0.6s; }
.f5 span { animation-duration: 6.0s; animation-delay: -3.1s; }

@keyframes float-drift {
  from { transform: translate3d(0, 7px, 0)   rotate(-1.6deg); }
  to   { transform: translate3d(0, -11px, 0) rotate(1.6deg); }
}

.main-image {
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  border-radius: var(--radius);
  background: var(--surface);
}

.main-image-ph {
  width: 100%;
  aspect-ratio: 4 / 5;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  display: grid;
  place-items: center;
  color: var(--text-faint);
  font-size: 14px;
  text-align: center;
  padding: 20px;
}

.caption {
  margin: 12px 0 0;
  font-size: 14px;
  color: var(--text-faint);
}

/* ---------- Thư viện ảnh ---------- */
.gallery-head {
  display: flex;
  align-items: baseline;
  gap: 14px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border-soft);
  margin-bottom: 26px;
}

.gallery-head h2 {
  font-family: var(--font-display);
  font-size: 22px;
  letter-spacing: -.02em;
  margin: 0;
  font-weight: 700;
}

.gallery-head span { color: var(--text-faint); font-size: 14px; }

.gallery {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  padding-bottom: 80px;
}

.shot {
  border: 0;
  padding: 0;
  background: none;
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: zoom-in;
  display: block;
}

.shot img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: var(--radius);
  background: var(--surface);
  transition: opacity .18s;
}

.shot:hover img { opacity: .82; }
.shot figcaption { margin-top: 9px; font-size: 13.5px; color: var(--text-faint); }

/* ---------- Xem ảnh phóng to ---------- */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  place-items: center;
  background: rgba(6, 6, 7, .94);
  padding: 32px;
}
.lightbox.open { display: grid; }
.lightbox img { max-width: 100%; max-height: 82vh; object-fit: contain; border-radius: var(--radius); }
.lightbox .lb-cap { margin-top: 14px; color: var(--text-dim); font-size: 14px; text-align: center; }
.lb-close {
  position: absolute;
  top: 20px; right: 22px;
  background: none;
  border: 1px solid var(--border);
  color: var(--text-dim);
  width: 36px; height: 36px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
}
.lb-close:hover { color: var(--text); border-color: var(--text-dim); }

/* ---------- Chân trang ---------- */
footer.foot {
  border-top: 1px solid var(--border-soft);
  padding: 26px 0 48px;
  color: var(--text-faint);
  font-size: 13.5px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
footer.foot a { color: var(--text-faint); }

.empty {
  color: var(--text-faint);
  font-size: 14px;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 28px;
  text-align: center;
}

/* =========================================================
   TRANG QUẢN TRỊ
   ========================================================= */
.admin-head { padding: 40px 0 8px; }
.admin-head h1 {
  font-family: var(--font-display);
  margin: 0 0 8px;
  font-size: 32px;
  letter-spacing: -.03em;
}
.admin-head p { margin: 0; color: var(--text-dim); font-size: 14.5px; }

.section {
  padding: 30px 0;
  border-top: 1px solid var(--border-soft);
}

.section-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}

.section-head h2 {
  font-family: var(--font-display);
  margin: 0;
  font-size: 19px;
  letter-spacing: -.02em;
  flex: 1;
  font-weight: 700;
}

.field { margin-bottom: 16px; }
.field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dim);
  margin-bottom: 7px;
}
.hint { font-size: 12.5px; color: var(--text-faint); margin-top: 6px; }

input[type=text], input[type=url], textarea {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius);
  padding: 11px 13px;
  font: inherit;
  font-size: 15px;
}
input:focus, textarea:focus {
  outline: none;
  border-color: var(--text-faint);
}
textarea { resize: vertical; min-height: 92px; line-height: 1.6; }

.line-row {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 10px;
}
.line-row input {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -.02em;
}

.btn {
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  padding: 9px 15px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
}
.btn:hover { border-color: var(--text-faint); background: var(--surface-2); }
.btn.primary { background: var(--text); color: var(--bg); border-color: var(--text); font-weight: 600; }
.btn.primary:hover { background: #fff; }
.btn.icon { width: 34px; padding: 0; height: 34px; color: var(--text-dim); }
.btn.sm { font-size: 13px; padding: 7px 12px; }
.btn.danger { color: #e88; }
.btn.danger:hover { border-color: #e88; }

.item {
  display: grid;
  grid-template-columns: 132px 1fr auto;
  gap: 16px;
  align-items: start;
  padding: 16px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  margin-bottom: 12px;
}

.item-thumb {
  width: 132px;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border-soft);
}
.item-thumb-ph {
  width: 132px;
  aspect-ratio: 4 / 3;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  display: grid;
  place-items: center;
  color: var(--text-faint);
  font-size: 12px;
}
.item-actions { display: flex; gap: 6px; }

.preview-row { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 12px; }
.preview {
  width: 200px;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border-soft);
}
.preview-ph {
  width: 200px;
  aspect-ratio: 16 / 9;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  display: grid;
  place-items: center;
  color: var(--text-faint);
  font-size: 12.5px;
}

.toolbar {
  position: sticky;
  bottom: 0;
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  background: var(--bg);
  border-top: 1px solid var(--border);
  padding: 14px 0;
  margin-top: 20px;
}
.toolbar .spacer { flex: 1; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 88px;
  transform: translateX(-50%) translateY(16px);
  background: var(--text);
  color: var(--bg);
  padding: 10px 18px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: .2s;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.note {
  font-size: 13.5px;
  color: var(--text-dim);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-top: 18px;
}
.note b { color: var(--text); }

.backup-row { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------- Màn hình nhỏ ---------- */
@media (max-width: 900px) {
  .gallery { grid-template-columns: repeat(2, 1fr); gap: 14px; }
}

@media (max-width: 860px) {
  .top {
    grid-template-columns: 1fr;
    gap: 30px;
    padding: 34px 0 52px;
  }
  .main-image, .main-image-ph { aspect-ratio: 4 / 3; }
}

@media (max-width: 620px) {
  .gallery { grid-template-columns: 1fr; }
  .item { grid-template-columns: 1fr; }
  .item-thumb, .item-thumb-ph { width: 100%; }
  .nav-in { padding: 14px 20px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition-duration: .01ms !important; }
  .main-overlay span, .float span { animation: none; transform: none; }
}

/* =========================================================
   ĐĂNG NHẬP & TRẠNG THÁI KẾT NỐI
   ========================================================= */
.login-wrap {
  max-width: 380px;
  margin: 90px auto;
  padding: 0 24px;
}
.login-wrap h1 {
  font-family: var(--font-display);
  font-size: 28px;
  letter-spacing: -.03em;
  margin: 0 0 6px;
}
.login-wrap p.sub { margin: 0 0 26px; color: var(--text-dim); font-size: 14.5px; }
.login-wrap input[type=password] {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius);
  padding: 11px 13px;
  font: inherit;
  font-size: 15px;
}
.login-wrap input:focus { outline: none; border-color: var(--text-faint); }
.login-wrap .btn { width: 100%; justify-content: center; margin-top: 6px; }

.msg {
  font-size: 13.5px;
  border-radius: var(--radius);
  padding: 11px 14px;
  margin-bottom: 16px;
  border: 1px solid var(--border);
  color: var(--text-dim);
}
.msg.error { border-color: #a55; color: #e99; }
.msg.ok { border-color: #4a6; color: #8d9; }
.msg:empty { display: none; }

.who {
  font-size: 13px;
  color: var(--text-faint);
  display: flex;
  align-items: center;
  gap: 12px;
}

.loading {
  padding: 90px 0;
  text-align: center;
  color: var(--text-faint);
  font-size: 14px;
}

/* Lưới 5 ô nhập chữ rải trên ảnh (trang quản trị) */
.row-5 { display: grid; gap: 10px; grid-template-columns: repeat(5, 1fr); }
@media (max-width: 900px) { .row-5 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 520px) { .row-5 { grid-template-columns: 1fr; } }

.hint code {
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border-soft);
  border-radius: 3px;
  padding: 1px 5px;
}

/* ---- Ô chỉnh cỡ chữ & màu chữ tiêu đề (trang quản trị) ---- */
.style-row {
  display: grid;
  grid-template-columns: 1fr 260px;
  gap: 24px;
  align-items: start;
  margin-top: 22px;
  padding-top: 20px;
  border-top: 1px solid var(--border-soft);
}
@media (max-width: 760px) { .style-row { grid-template-columns: 1fr; gap: 18px; } }

input[type=range] {
  width: 100%;
  accent-color: var(--text);
  background: transparent;
  margin: 4px 0 0;
}

.color-row { display: flex; gap: 10px; align-items: center; }
input[type=color] {
  width: 54px;
  height: 42px;
  padding: 3px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  flex: none;
}

.preview-title {
  margin-top: 20px;
  padding: 20px;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  font-family: var(--font-display);
  font-weight: 800;
  letter-spacing: -.04em;
  line-height: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
