/* ============================================================
   MEMORIES OF SCHOOL — SMP IT. BCA
   File: css/styles.css
   ============================================================ */

:root {
  --bg: #ffffff; --bg-soft: #f8f9fb; --bg-muted: #f1f3f7;
  --text: #0f172a; --text-muted: #64748b; --text-light: #94a3b8;
  --border: #e5e7eb; --border-soft: #eef1f5;
  --accent: #0f172a; --accent-hover: #1e293b;
  --danger: #dc2626;
  --radius: 12px; --radius-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(15,23,42,0.04);
  --shadow: 0 4px 12px rgba(15,23,42,0.06);
  --shadow-lg: 0 12px 32px rgba(15,23,42,0.08);
  --max: 1200px;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
*, *::before, *::after { -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }

/* FIX: Mencegah layar bisa digeser ke samping (scroll horizontal) */
html { scroll-behavior: smooth; overflow-x: hidden; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg); color: var(--text); line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden; width: 100%;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button {
  font-family: inherit; cursor: pointer; color: inherit;
  background: none; border: none; -webkit-appearance: none; appearance: none;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
  user-select: none; -webkit-user-select: none;
}
.container { max-width: var(--max); margin: 0 auto; padding: 0 24px; }

/* ============ NAVBAR ============ */
.nav {
  position: sticky; top: 0; z-index: 100;
  background: rgba(255,255,255,0.85); backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px); border-bottom: 1px solid var(--border-soft);
  width: 100%;
}
.nav-inner {
  display: flex; align-items: center; justify-content: space-between;
  height: 68px; gap: 12px; width: 100%;
}
.brand {
  display: flex; align-items: center; gap: 10px;
  font-weight: 600; font-size: 15px; letter-spacing: -0.01em;
  flex-shrink: 0; white-space: nowrap;
}
.brand-mark { width: 32px; height: 32px; background: var(--accent); color: #fff; border-radius: 8px; display: grid; place-items: center; flex-shrink: 0; }
.brand-mark svg { width: 18px; height: 18px; }
.nav-links { display: flex; gap: 32px; align-items: center; }
.nav-links a { font-size: 14px; color: var(--text-muted); transition: color 0.2s; white-space: nowrap; }
.nav-links a:hover { color: var(--text); }
.nav-actions { display: flex; gap: 8px; align-items: center; flex-shrink: 0; }

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 16px; border-radius: 8px; font-size: 14px; font-weight: 500;
  border: 1px solid transparent; transition: all 0.2s; white-space: nowrap;
}
.btn svg { width: 16px; height: 16px; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-ghost { color: var(--text-muted); background: transparent; }
.btn-ghost:hover { color: var(--text); background: var(--bg-soft); }
.btn-outline { border-color: var(--border); color: var(--text); background: #fff; }
.btn-outline:hover { border-color: var(--text-muted); }
.btn-sm { padding: 7px 10px; }
.mobile-toggle { display: none; background: none; border: none; padding: 8px; color: var(--text); }

/* ===== USER MENU (navbar saat login) ===== */
.user-menu { display: flex; align-items: center; gap: 8px; }
.user-chip {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 12px 4px 4px; background: var(--bg-soft);
  border-radius: 999px; border: 1px solid var(--border-soft);
}
.user-avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--accent); color: #fff;
  display: grid; place-items: center; font-size: 12px; font-weight: 600;
  flex-shrink: 0;
}
.user-name { font-size: 13px; font-weight: 500; max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ============ HERO ============ */
.hero { padding: 96px 0 80px; text-align: center; position: relative; }
.hero-badge {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 14px; background: var(--bg-soft);
  border: 1px solid var(--border-soft); border-radius: 999px;
  font-size: 13px; color: var(--text-muted); margin-bottom: 28px;
}
.hero-badge svg { width: 14px; height: 14px; }
.hero h1 { font-size: clamp(32px, 6vw, 64px); line-height: 1.1; letter-spacing: -0.03em; font-weight: 700; max-width: 800px; margin: 0 auto 24px; }
.hero h1 em { font-style: normal; color: var(--text-muted); }
.hero p { font-size: 16px; color: var(--text-muted); max-width: 560px; margin: 0 auto 40px; line-height: 1.7; }
.hero-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* ============ STATS ============ */
.stats { padding: 0 0 96px; }
.stats-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px;
  background: var(--border-soft); border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg); overflow: hidden;
}
.stat { background: #fff; padding: 32px 24px; text-align: center; }
.stat-value { font-size: 32px; font-weight: 700; letter-spacing: -0.02em; margin-bottom: 4px; }
.stat-label { font-size: 13px; color: var(--text-muted); }

/* ============ SECTION ============ */
.section { padding: 96px 0; }
.section-header { margin-bottom: 48px; display: flex; justify-content: space-between; align-items: end; gap: 24px; flex-wrap: wrap; }
.section-header.center { flex-direction: column; align-items: center; text-align: center; }
.eyebrow {
  font-size: 13px; font-weight: 500; color: var(--text-muted);
  letter-spacing: 0.05em; text-transform: uppercase;
  margin-bottom: 12px; display: flex; align-items: center; gap: 8px;
}
.eyebrow::before { content: ''; width: 24px; height: 1px; background: var(--text-light); }
.section-header.center .eyebrow::before { display: none; }
.section-title { font-size: clamp(24px, 5vw, 36px); font-weight: 700; letter-spacing: -0.02em; line-height: 1.2; }
.section-desc { color: var(--text-muted); font-size: 15px; max-width: 460px; margin-top: 8px; }
.header-right { display: flex; flex-direction: column; align-items: flex-end; gap: 14px; }

/* ============ GALLERY ============ */
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 32px; }
.filter {
  padding: 7px 16px; border-radius: 999px; font-size: 13px;
  background: #fff; border: 1px solid var(--border);
  color: var(--text-muted); transition: all 0.2s;
}
.filter:hover { color: var(--text); border-color: var(--text-light); }
.filter.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.gallery { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.gallery-card {
  border-radius: var(--radius-lg); overflow: hidden;
  background: var(--bg-soft); border: 1px solid var(--border-soft);
  transition: transform 0.3s, box-shadow 0.3s;
}
.gallery-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.gallery-media { aspect-ratio: 4/3; overflow: hidden; background: var(--bg-muted); position: relative; }
.gallery-media img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.5s; }
.gallery-card:hover .gallery-media img { transform: scale(1.04); }
.gallery-badge {
  position: absolute; top: 12px; left: 12px;
  background: rgba(255,255,255,0.95); color: var(--text);
  padding: 4px 10px; border-radius: 6px; font-size: 11px; font-weight: 500;
  backdrop-filter: blur(8px); z-index: 2;
}
.photo-delete-btn {
  position: absolute; top: 12px; right: 12px;
  width: 32px; height: 32px; border-radius: 50%;
  background: rgba(255,255,255,0.95); color: var(--danger);
  display: grid; place-items: center; z-index: 2;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  transition: background 0.2s, color 0.2s, transform 0.2s;
  backdrop-filter: blur(8px);
}
.photo-delete-btn:hover { background: var(--danger); color: #fff; transform: scale(1.08); }
.photo-delete-btn:active { transform: scale(0.92); }
.photo-delete-btn svg { width: 15px; height: 15px; }
.gallery-info { padding: 18px 20px; }
.gallery-date { font-size: 12px; color: var(--text-light); margin-bottom: 4px; display: flex; align-items: center; gap: 6px; }
.gallery-date svg { width: 12px; height: 12px; }
.gallery-title { font-size: 15px; font-weight: 600; margin-bottom: 4px; }
.gallery-desc { font-size: 13px; color: var(--text-muted); line-height: 1.5; }

/* ============ TIMELINE ============ */
.timeline-wrap { max-width: 760px; margin: 0 auto; position: relative; }
.timeline-wrap::before { content: ''; position: absolute; left: 16px; top: 8px; bottom: 8px; width: 1px; background: var(--border); }
.tl-item { position: relative; padding-left: 56px; padding-bottom: 40px; }
.tl-item:last-child { padding-bottom: 0; }
.tl-dot { position: absolute; left: 8px; top: 6px; width: 17px; height: 17px; border-radius: 50%; background: #fff; border: 2px solid var(--accent); z-index: 1; }
.tl-year {
  display: inline-block; font-size: 12px; font-weight: 600; color: var(--accent);
  letter-spacing: 0.05em; margin-bottom: 8px;
  background: var(--bg-soft); padding: 3px 10px;
  border-radius: 6px; border: 1px solid var(--border-soft);
}
.tl-title { font-size: 18px; font-weight: 600; margin-bottom: 6px; letter-spacing: -0.01em; }
.tl-desc { font-size: 14px; color: var(--text-muted); line-height: 1.7; max-width: 560px; }
.tl-photo { margin-top: 14px; max-width: 420px; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border-soft); }
.tl-photo img { width: 100%; aspect-ratio: 16/10; object-fit: cover; }

/* ============ MEMORY WALL ============ */
.wall { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.wall-card {
  padding: 24px; background: #fff; border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg); display: flex; flex-direction: column;
  transition: border-color 0.2s, transform 0.2s;
}
.wall-card:hover { border-color: var(--border); transform: translateY(-2px); }
.wall-text { font-size: 15px; line-height: 1.7; color: var(--text); margin-bottom: 20px; flex: 1; }
.wall-text::before { content: '"'; font-size: 32px; line-height: 0; color: var(--text-light); vertical-align: -8px; margin-right: 4px; }
.wall-author { display: flex; align-items: center; gap: 12px; padding-top: 16px; border-top: 1px solid var(--border-soft); }
.avatar {
  width: 36px; height: 36px; border-radius: 50%; background: var(--bg-muted);
  overflow: hidden; flex-shrink: 0; display: grid; place-items: center;
  font-size: 13px; font-weight: 600; color: var(--text-muted);
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.wall-author-info { flex: 1; min-width: 0; }
.wall-author-name { font-size: 13px; font-weight: 600; margin-bottom: 1px; }
.wall-author-meta { font-size: 12px; color: var(--text-light); }
.reaction-btn {
  background: none; border: none; padding: 4px 8px; border-radius: 6px;
  font-size: 12px; color: var(--text-muted);
  display: inline-flex; align-items: center; gap: 4px;
  transition: background 0.15s, color 0.15s, transform 0.12s;
}
.reaction-btn:hover { background: var(--bg-soft); color: var(--text); }
.reaction-btn svg { width: 14px; height: 14px; }
.reaction-btn.liked { color: #e11d48; }

/* ============ DIRECTORY ============ */
.directory { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.dir-card { padding: 24px 20px; text-align: center; border: 1px solid var(--border-soft); border-radius: var(--radius-lg); transition: border-color 0.2s, transform 0.2s; }
.dir-card:hover { border-color: var(--border); transform: translateY(-2px); }
.dir-avatar { width: 64px; height: 64px; margin: 0 auto 14px; border-radius: 50%; background: var(--bg-muted); overflow: hidden; display: grid; place-items: center; font-size: 20px; font-weight: 600; color: var(--text-muted); }
.dir-avatar img { width: 100%; height: 100%; object-fit: cover; }
.dir-name { font-size: 14px; font-weight: 600; margin-bottom: 2px; }
.dir-role { font-size: 12px; color: var(--text-muted); }

/* ============ GUESTBOOK ============ */
.guestbook-wrap { display: grid; grid-template-columns: 1fr 1.2fr; gap: 48px; align-items: start; }
.gb-form { background: var(--bg-soft); padding: 32px; border-radius: var(--radius-lg); border: 1px solid var(--border-soft); position: sticky; top: 90px; }
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; font-weight: 500; margin-bottom: 6px; color: var(--text); }
.field input, .field textarea, .field select {
  width: 100%; padding: 11px 14px;
  border: 1px solid var(--border); border-radius: 8px;
  font-family: inherit; font-size: 14px;
  background: #fff; color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
  resize: vertical;
}
.field input:focus, .field textarea:focus, .field select:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15,23,42,0.08);
}
.field textarea { min-height: 100px; }
.field-hint { display: block; font-size: 12px; color: var(--text-light); margin-top: 6px; line-height: 1.5; }
.gb-form .btn { width: 100%; justify-content: center; }
.gb-list { display: flex; flex-direction: column; gap: 16px; }
.gb-item { padding: 20px; background: #fff; border: 1px solid var(--border-soft); border-radius: var(--radius); }
.gb-head { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.gb-name { font-size: 14px; font-weight: 600; }
.gb-date { font-size: 12px; color: var(--text-light); }
.gb-text { font-size: 14px; color: var(--text-muted); line-height: 1.7; }

/* ============ FOOTER ============ */
.footer { border-top: 1px solid var(--border-soft); padding: 40px 0; margin-top: 32px; }
.footer-inner { display: flex; justify-content: space-between; align-items: center; gap: 24px; flex-wrap: wrap; font-size: 13px; color: var(--text-muted); }
.footer-links { display: flex; gap: 24px; }
.footer-links a:hover { color: var(--text); }

/* ============ REVEAL ============ */
.reveal { opacity: 0; transform: translateY(20px); transition: opacity 0.6s ease, transform 0.6s ease; }
.reveal.visible { opacity: 1; transform: translateY(0); }

/* ===== MODAL ===== */
.modal {
  position: fixed; inset: 0; z-index: 1000;
  display: grid; place-items: center; padding: 24px;
}
.modal[hidden] { display: none; }
.modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(15,23,42,0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  animation: fadeIn 0.2s ease;
}
.modal-box {
  position: relative; background: #fff;
  width: 100%; max-width: 440px;
  border-radius: var(--radius-lg);
  padding: 32px;
  box-shadow: 0 24px 64px rgba(15,23,42,0.2);
  animation: slideUp 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  max-height: 90vh; overflow-y: auto;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(20px) scale(0.98); } to { opacity: 1; transform: translateY(0) scale(1); } }
.modal-close {
  position: absolute; top: 12px; right: 12px;
  width: 32px; height: 32px; border-radius: 8px;
  color: var(--text-muted); display: grid; place-items: center;
  transition: background 0.15s;
}
.modal-close:hover { background: var(--bg-soft); color: var(--text); }
.modal-close svg { width: 18px; height: 18px; }
.modal-tabs { display: flex; gap: 4px; margin-bottom: 24px; padding: 4px; background: var(--bg-soft); border-radius: 10px; }
.modal-tab {
  flex: 1; padding: 9px; border-radius: 7px;
  font-size: 14px; font-weight: 500; color: var(--text-muted);
  transition: all 0.2s;
}
.modal-tab.active { background: #fff; color: var(--text); box-shadow: var(--shadow-sm); }
.modal-title { font-size: 20px; font-weight: 600; letter-spacing: -0.01em; margin-bottom: 20px; }
.auth-form .btn { width: 100%; justify-content: center; margin-top: 4px; }
.auth-hint { font-size: 13px; color: var(--text-muted); text-align: center; margin-top: 16px; }
.auth-hint a { color: var(--accent); font-weight: 500; text-decoration: underline; text-underline-offset: 2px; }
.upload-preview {
  margin-top: 10px; border-radius: 8px; overflow: hidden;
  border: 1px solid var(--border-soft); background: var(--bg-muted);
}
.upload-preview img { width: 100%; max-height: 200px; object-fit: cover; }

/* ===== TOAST ===== */
.toast {
  position: fixed; bottom: 24px; left: 50%;
  transform: translateX(-50%) translateY(120px);
  background: var(--accent); color: #fff;
  padding: 12px 22px; border-radius: 10px;
  font-size: 14px; font-weight: 500;
  z-index: 2000; opacity: 0;
  transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
  max-width: calc(100vw - 48px);
  text-align: center;
  box-shadow: 0 12px 32px rgba(15,23,42,0.25);
}
.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }
.toast.error { background: var(--danger); }

/* ===== FOCUS & PRESS STATE ===== */
.btn:focus-visible, .filter:focus-visible, .reaction-btn:focus-visible,
.mobile-toggle:focus-visible, .nav-links a:focus-visible, .footer-links a:focus-visible,
.modal-tab:focus-visible, .modal-close:focus-visible, .photo-delete-btn:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px; border-radius: inherit;
}
.btn:active, .filter:active, .reaction-btn:active, .mobile-toggle:active { transform: scale(0.96); transition-duration: 0.06s; }
.reaction-btn:active { background: var(--bg-muted); transform: scale(0.92); }

/* ============ RESPONSIVE ============ */
@media (max-width: 900px) {
  .nav-links { display: none; }
  .nav-links.open {
    display: flex; position: absolute; top: 68px; left: 0; right: 0;
    background: #fff; flex-direction: column; padding: 20px 24px;
    gap: 16px; border-bottom: 1px solid var(--border-soft);
    box-shadow: var(--shadow-lg); width: 100%;
  }
  .mobile-toggle { display: block; }
  #btnLogin { display: none; }
  .user-name { display: none; }
  .user-chip { padding: 0; border: none; background: transparent; }
  .user-avatar { width: 32px; height: 32px; border: 1px solid var(--border); }

  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .gallery { grid-template-columns: repeat(2, 1fr); }
  .wall { grid-template-columns: 1fr; }
  .directory { grid-template-columns: repeat(3, 1fr); }
  .guestbook-wrap { grid-template-columns: 1fr; }
  .gb-form { position: static; }
  .header-right { align-items: flex-start; }
}

@media (max-width: 720px) {
  .hero { padding: 64px 0 48px; }
  .section { padding: 64px 0; }
  .stats { padding: 0 0 64px; }
  .gallery { grid-template-columns: 1fr; }
  .directory { grid-template-columns: repeat(2, 1fr); }
  .gb-form { padding: 24px; }
  .footer-inner { flex-direction: column; text-align: center; }
  .modal-box { padding: 24px; }
}

@media (max-width: 480px) {
  .stat { padding: 24px 16px; }
  .stat-value { font-size: 26px; }
  .hero-actions { flex-direction: column; }
  .hero-actions .btn { justify-content: center; }
  .header-right .btn { width: 100%; justify-content: center; }
}

@media (max-width: 420px) {
  .brand span:last-child { display: none; }
  #btnRegister .reg-text { display: none; }
  #btnRegister { padding: 8px; border-radius: 50%; width: 36px; height: 36px; justify-content: center; }
  #btnRegister svg { margin: 0; }
}