/* ===== BIẾN MÀU & CƠ BẢN (tông sáng: trời xanh – đồi xanh – nâu ấm) ===== */
:root {
  --bg: #f6fbff;
  --bg-tint: #eaf6ff;
  --card: #ffffff;
  --border: #dbeafe;
  --text: #0f172a;
  --muted: #475569;
  --accent: #0ea5e9;
  --accent-2: #22c55e;
  --warm: #b45309;
  --radius: 20px;
  --shadow: 0 10px 30px rgba(14, 116, 144, .12);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: "Be Vietnam Pro", system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }
img, video { max-width: 100%; display: block; }

/* ===== STICKER (emoji viền trắng kiểu bế hình) ===== */
.sticker {
  position: absolute;
  font-size: 2.6rem;
  line-height: 1;
  user-select: none;
  pointer-events: none;
  filter:
    drop-shadow(3px 0 0 #fff) drop-shadow(-3px 0 0 #fff)
    drop-shadow(0 3px 0 #fff) drop-shadow(0 -3px 0 #fff)
    drop-shadow(0 6px 8px rgba(15, 23, 42, .18));
  animation: wobble 4s ease-in-out infinite;
  z-index: 3;
}
@keyframes wobble {
  0%, 100% { transform: rotate(var(--r, 0deg)) translateY(0); }
  50%      { transform: rotate(calc(var(--r, 0deg) + 8deg)) translateY(-8px); }
}

/* ===== NAV ===== */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 50;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 6%;
  transition: background .3s, box-shadow .3s;
}
.nav.scrolled, .nav.menu-open {
  background: rgba(255, 255, 255, .9);
  backdrop-filter: blur(10px);
  box-shadow: 0 2px 20px rgba(15, 23, 42, .06);
}
.nav__logo { font-size: 1.6rem; font-weight: 800; }
.nav__logo span { color: var(--accent); }
.nav__links { display: flex; gap: 32px; }
.nav__links a { color: var(--muted); font-weight: 600; transition: color .2s; }
.nav__links a:hover, .nav__links a.active { color: var(--accent); }
.nav__toggle { display: none; background: none; border: 0; cursor: pointer; padding: 6px; }
.nav__toggle span { display: block; width: 24px; height: 2px; background: var(--text); margin: 5px 0; }

/* ===== BUTTONS ===== */
.btn {
  display: inline-block;
  padding: 13px 28px;
  border-radius: 999px;
  font-weight: 700;
  transition: transform .2s, box-shadow .2s, background .2s;
}
.btn:hover { transform: translateY(-3px); }
.btn--primary {
  background: linear-gradient(135deg, #0ea5e9, #38bdf8);
  color: #fff;
  box-shadow: 0 10px 24px rgba(14, 165, 233, .35);
}
.btn--ghost { background: #fff; border: 2px solid var(--border); }
.btn--ghost:hover { border-color: var(--accent); color: var(--accent); }

/* ===== HERO ===== */
.hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  overflow: hidden;
  background: linear-gradient(180deg, #bae6fd 0%, #e0f2fe 55%, #f0f9ff 100%);
  padding: 110px 6% 180px;
}
.hero__inner {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 1150px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  align-items: center;
  gap: 48px;
}
.hero__hello { color: var(--accent); font-weight: 700; font-size: 1.1rem; }
.hero__name {
  font-size: clamp(3.2rem, 9vw, 5.8rem);
  font-weight: 800;
  line-height: 1.05;
  margin: 6px 0 12px;
  background: linear-gradient(135deg, #0c4a6e 20%, #0ea5e9 70%, #22c55e);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero__role { font-size: 1.25rem; color: var(--muted); min-height: 2em; }
#typing { color: var(--text); font-weight: 700; }
.cursor { color: var(--accent); animation: blink 1s step-end infinite; }
@keyframes blink { 50% { opacity: 0; } }
.hero__note {
  font-family: "Caveat", cursive;
  font-size: 1.7rem;
  color: var(--warm);
  margin-top: 8px;
}
.hero__actions { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 26px; }

/* Ảnh polaroid */
.hero__photo { position: relative; justify-self: center; }
.polaroid {
  position: relative;
  width: min(340px, 72vw);
  background: #fff;
  padding: 14px 14px 0;
  border-radius: 14px;
  box-shadow: 0 25px 50px rgba(12, 74, 110, .25);
  transform: rotate(3deg);
  transition: transform .4s;
}
.polaroid:hover { transform: rotate(0deg) scale(1.03); }
.polaroid img,
.hero__avatar-fallback {
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  object-position: center 40%;
  border-radius: 8px;
}
.polaroid__caption {
  font-family: "Caveat", cursive;
  font-size: 1.6rem;
  text-align: center;
  color: var(--muted);
  padding: 6px 0 10px;
}
.tape {
  position: absolute;
  top: -14px; left: 50%;
  width: 110px; height: 32px;
  background: rgba(253, 224, 71, .75);
  transform: translateX(-50%) rotate(-4deg);
  box-shadow: 0 2px 4px rgba(0, 0, 0, .08);
  z-index: 2;
}
.hero__avatar-fallback {
  display: none;
  place-items: center;
  background: var(--bg-tint);
  font-size: 7rem;
  font-weight: 800;
  color: var(--accent);
}
.no-img img { display: none; }
.no-img .hero__avatar-fallback { display: grid; }

.sticker--plane  { top: -26px; left: -46px; font-size: 3.2rem; --r: -12deg; }
.sticker--pin    { bottom: 70px; right: -30px; --r: 10deg; animation-delay: -1s; }
.sticker--camera { bottom: -18px; left: -30px; --r: -8deg; animation-delay: -2s; }
.sticker--spark  { top: 30%; right: -40px; font-size: 2rem; animation-delay: -3s; }

/* Mây, mặt trời, đồi */
.sun {
  position: absolute;
  top: 90px; right: 8%;
  width: 110px; height: 110px;
  border-radius: 50%;
  background: radial-gradient(circle, #fde68a 30%, #fcd34d 60%, transparent 70%);
  box-shadow: 0 0 80px 30px rgba(253, 230, 138, .55);
  opacity: .85;
}
.cloud {
  position: absolute;
  width: 180px; height: 56px;
  background: #fff;
  border-radius: 999px;
  opacity: .9;
  animation: drift linear infinite;
  z-index: 1;
}
.cloud::before, .cloud::after {
  content: "";
  position: absolute;
  background: #fff;
  border-radius: 50%;
}
.cloud::before { width: 80px; height: 80px; top: -40px; left: 28px; }
.cloud::after  { width: 100px; height: 100px; top: -55px; right: 22px; }
.cloud--1 { top: 18%; animation-duration: 55s; }
.cloud--2 { top: 48%; transform: scale(.7); animation-duration: 75s; animation-delay: -30s; }
.cloud--3 { top: 8%;  transform: scale(.55); animation-duration: 65s; animation-delay: -12s; opacity: .7; }
@keyframes drift {
  from { left: -260px; }
  to   { left: 110%; }
}
.hero__hills {
  position: absolute;
  bottom: -1px; left: 0;
  width: 100%;
  height: 200px;
  z-index: 1;
}

/* ===== SECTION ===== */
.section { max-width: 1200px; margin: 0 auto; padding: 90px 6%; position: relative; }
.section--tint {
  max-width: none;
  background: linear-gradient(180deg, #f0fdf4, #ecfeff);
}
.section--tint > * { max-width: 1080px; margin-left: auto; margin-right: auto; }
.section__title {
  font-size: clamp(1.9rem, 4vw, 2.6rem);
  font-weight: 800;
  text-align: center;
  margin-bottom: 52px;
  position: relative;
}
.section__title span { color: var(--accent); }
.section__title::after {
  content: "";
  display: block;
  width: 70px; height: 6px;
  margin: 12px auto 0;
  border-radius: 6px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
}

/* ===== ABOUT ===== */
.about { display: grid; grid-template-columns: 1fr 1.1fr; gap: 56px; align-items: center; }
.about__text p { color: var(--muted); margin-bottom: 16px; font-size: 1.05rem; }
.about__text strong { color: var(--text); }
.about__facts { list-style: none; display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }
.about__facts li {
  background: #fff;
  border: 2px solid var(--border);
  padding: 8px 16px;
  border-radius: 999px;
  font-weight: 600;
  font-size: .95rem;
  transition: transform .2s, border-color .2s;
}
.about__facts li:hover { transform: translateY(-3px) rotate(-2deg); border-color: var(--accent); }
.about__video { position: relative; }
.about__video video {
  border-radius: var(--radius);
  border: 8px solid #fff;
  background: #e0f2fe;
  box-shadow: 0 25px 50px rgba(12, 74, 110, .18);
  aspect-ratio: 16 / 9;
  object-fit: cover;
}
.sticker--clap { top: -30px; right: -18px; font-size: 3rem; --r: 12deg; }
.about__caption {
  text-align: center;
  font-family: "Caveat", cursive;
  font-size: 1.5rem;
  color: var(--muted);
  margin-top: 10px;
}

/* ===== SKILLS ===== */
.skills { display: grid; grid-template-columns: 1fr 1fr; gap: 20px 32px; margin-bottom: 56px; }
.skill {
  background: #fff;
  padding: 18px 22px;
  border-radius: 16px;
  box-shadow: var(--shadow);
}
.skill__head { display: flex; justify-content: space-between; font-weight: 700; margin-bottom: 10px; }
.skill__head span:last-child { color: var(--accent); }
.skill__bar { height: 12px; background: #e0f2fe; border-radius: 999px; overflow: hidden; }
.skill__fill {
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--c1, #0ea5e9), var(--c2, #38bdf8));
  transition: width 1.4s cubic-bezier(.2, .8, .2, 1);
}

.cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 22px; }
.card {
  background: #fff;
  border-radius: 24px;
  padding: 28px 22px;
  text-align: center;
  box-shadow: var(--shadow);
  transition: transform .3s, box-shadow .3s;
}
.card:nth-child(odd)  { --tilt: -2deg; }
.card:nth-child(even) { --tilt: 2deg; }
.card:hover {
  transform: translateY(-8px) rotate(var(--tilt));
  box-shadow: 0 20px 40px rgba(14, 116, 144, .2);
}
.card__icon {
  width: 92px; height: 92px;
  margin: 0 auto 16px;
  display: grid;
  place-items: center;
  font-size: 2.8rem;
  border-radius: 50%;
  background: var(--bg, #e0f2fe);
  transition: transform .4s;
}
.card:hover .card__icon { transform: scale(1.12) rotate(-8deg); }
.card h3 { font-size: 1.1rem; margin-bottom: 8px; }
.card p { color: var(--muted); font-size: .95rem; }

/* ===== CONTACT ===== */
.contact-box {
  position: relative;
  max-width: 860px;
  margin: 0 auto;
  background: linear-gradient(135deg, #e0f2fe, #dcfce7);
  border-radius: 32px;
  padding: 48px 32px;
  text-align: center;
}
.sticker--mail { top: -28px; left: 24px; font-size: 3rem; --r: -12deg; }
.sticker--hand { bottom: -22px; right: 28px; font-size: 2.8rem; --r: 10deg; animation-delay: -2s; }
.contact__intro { color: var(--muted); margin-bottom: 28px; font-size: 1.05rem; }
.contact { display: flex; justify-content: center; flex-wrap: wrap; gap: 16px; }
.contact__item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #fff;
  padding: 14px 24px;
  border-radius: 999px;
  font-weight: 700;
  box-shadow: 0 6px 18px rgba(15, 23, 42, .08);
  transition: transform .3s, box-shadow .3s, color .3s;
  max-width: 100%;
}
.contact__item span { overflow-wrap: anywhere; }
.contact__item svg { width: 26px; height: 26px; flex-shrink: 0; }
.contact__item--fb svg   { fill: #1877f2; }
.contact__item--gh svg   { fill: #0f172a; }
.contact__item--mail svg { fill: #ea4335; }
.contact__item:hover { transform: translateY(-4px); box-shadow: 0 12px 28px rgba(15, 23, 42, .14); color: var(--accent); }

/* ===== FOOTER & TO-TOP ===== */
.footer {
  text-align: center;
  padding: 32px 6%;
  color: var(--muted);
  font-size: .9rem;
  background: #fff;
  border-top: 1px solid var(--border);
}
.to-top {
  position: fixed;
  right: 20px; bottom: 20px;
  width: 48px; height: 48px;
  border-radius: 50%;
  border: 3px solid #fff;
  background: var(--accent);
  color: #fff;
  font-size: 1.3rem;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(14, 165, 233, .4);
  opacity: 0;
  pointer-events: none;
  transition: opacity .3s;
  z-index: 40;
}
.to-top.show { opacity: 1; pointer-events: auto; }

/* ===== BẢNG CHỈNH SỬA (?edit) ===== */
[hidden] { display: none !important; }
.edit-fab {
  position: fixed;
  left: 20px; bottom: 20px;
  z-index: 60;
  padding: 12px 20px;
  border: 3px solid #fff;
  border-radius: 999px;
  background: #f59e0b;
  color: #fff;
  font: 700 1rem "Be Vietnam Pro", sans-serif;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(245, 158, 11, .4);
}
.editor {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  z-index: 70;
  width: min(420px, 100%);
  display: flex;
  flex-direction: column;
  background: #fff;
  box-shadow: -10px 0 40px rgba(15, 23, 42, .18);
  animation: slide-in .3s ease-out;
}
@keyframes slide-in { from { transform: translateX(100%); } }
.editor__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  background: linear-gradient(135deg, #e0f2fe, #dcfce7);
}
.editor__head h2 { font-size: 1.15rem; }
.editor__close {
  width: 36px; height: 36px;
  border: 0;
  border-radius: 50%;
  background: #fff;
  font-size: 1.4rem;
  cursor: pointer;
}
.editor__body { flex: 1; overflow-y: auto; padding: 8px 20px 20px; }
.editor fieldset { border: 0; margin-top: 18px; }
.editor legend { font-weight: 800; margin-bottom: 10px; }
.editor small { color: var(--muted); font-weight: 500; }
.editor label { display: block; font-size: .88rem; font-weight: 600; color: var(--muted); margin-bottom: 10px; }
.editor input {
  display: block;
  width: 100%;
  margin-top: 4px;
  padding: 10px 12px;
  border: 2px solid var(--border);
  border-radius: 12px;
  font: 500 .95rem "Be Vietnam Pro", sans-serif;
  color: var(--text);
  background: #f8fafc;
  transition: border-color .2s, background .2s;
}
.editor input:focus { outline: none; border-color: var(--accent); background: #fff; }
.hobby-row {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  padding: 10px;
  margin-bottom: 10px;
  border-radius: 14px;
  background: #f0f9ff;
}
.hobby-row input { margin-top: 0; }
.hobby-row__icon.hobby-row__icon { width: 54px; flex-shrink: 0; text-align: center; font-size: 1.4rem; padding: 8px 4px; }
.hobby-row__text { flex: 1; display: grid; gap: 6px; min-width: 0; }
.hobby-row__del {
  border: 0;
  background: #fee2e2;
  border-radius: 10px;
  width: 38px; height: 38px;
  flex-shrink: 0;
  cursor: pointer;
}
.editor__add {
  width: 100%;
  padding: 10px;
  border: 2px dashed var(--accent);
  border-radius: 12px;
  background: none;
  color: var(--accent);
  font: 700 .95rem "Be Vietnam Pro", sans-serif;
  cursor: pointer;
}
.editor__foot { padding: 14px 20px 18px; border-top: 1px solid var(--border); background: #fff; }
.editor__hint { font-size: .82rem; color: var(--muted); margin-bottom: 12px; line-height: 1.5; }
.editor__hint code { background: #f1f5f9; padding: 1px 6px; border-radius: 6px; }
.editor__actions { display: flex; gap: 10px; }
.editor__actions .btn { flex: 1; padding: 11px 12px; border: 0; cursor: pointer; font: 700 .95rem "Be Vietnam Pro", sans-serif; text-align: center; }
.editor__actions .btn--ghost { border: 2px solid var(--border); }
@media (max-width: 640px) {
  .editor { top: auto; height: 62vh; border-radius: 22px 22px 0 0; animation-name: slide-up; }
  .editor__body { padding-top: 0; }
  .editor__hint { display: none; }
  .edit-fab { left: 16px; bottom: 16px; }
}
@keyframes slide-up { from { transform: translateY(100%); } }

/* ===== HIỆU ỨNG XUẤT HIỆN ===== */
.reveal { opacity: 0; transform: translateY(30px); transition: opacity .8s, transform .8s; }
.reveal.visible { opacity: 1; transform: none; }

/* ===== RESPONSIVE ===== */
@media (max-width: 900px) {
  .hero__inner { grid-template-columns: 1fr; text-align: center; gap: 56px; }
  .hero__photo { order: -1; }
  .polaroid { width: min(260px, 64vw); }
  .hero__actions { justify-content: center; }
  .sun { top: 70px; width: 80px; height: 80px; }
  .about { grid-template-columns: 1fr; }
  .cards { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
  .nav { padding: 14px 16px; }
  .nav__toggle { display: block; }
  .nav__links {
    position: absolute;
    top: 100%; left: 0; right: 0;
    flex-direction: column;
    gap: 0;
    background: rgba(255, 255, 255, .97);
    box-shadow: 0 10px 20px rgba(15, 23, 42, .08);
    max-height: 0;
    overflow: hidden;
    transition: max-height .3s;
  }
  .nav__links.open { max-height: 300px; }
  .nav__links a { padding: 14px 16px; }
  .hero { padding: 100px 16px 150px; }
  .hero__name { font-size: 2.6rem; }
  .hero__hills { height: 130px; }
  .section { padding: 64px 16px; }
  .skills { grid-template-columns: 1fr; }
  .cards { grid-template-columns: 1fr; }
  .contact-box { padding: 44px 18px; }
  .contact { flex-direction: column; }
  .sticker { font-size: 2.1rem; }
  .sticker--plane { left: -22px; font-size: 2.5rem; }
  .sticker--pin, .sticker--spark { right: -16px; }
  .sticker--camera { left: -16px; }
  .sticker--clap { right: -6px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .reveal { opacity: 1; transform: none; }
}
