/* ═══════════════════════════════════════════════════════════════════════
   TravelTeachings — Main Stylesheet v2.1
   Aesthetic: Editorial · Deep Navy + Warm Gold · Playfair + DM Sans
   ═══════════════════════════════════════════════════════════════════════ */

/* ── Variables ─────────────────────────────────────────────────────────── */
:root {
  --navy:       #0d1b2a;
  --navy-mid:   #1a2d42;
  --navy-light: #243b53;
  --gold:       #c9a84c;
  --gold-light: #e2c97e;
  --cream:      #f8f4ec;
  --white:      #ffffff;
  --grey-50:    #f9fafb;
  --grey-100:   #f1f3f6;
  --grey-300:   #d0d5dd;
  --grey-600:   #6b7280;
  --text:       #1a1a2e;
  --text-muted: #5a6273;
  --danger:     #d94040;
  --success:    #2d9c6a;

  --radius-sm:  6px;
  --radius:     12px;
  --radius-lg:  20px;
  --shadow-sm:  0 2px 8px rgba(13,27,42,.08);
  --shadow:     0 4px 24px rgba(13,27,42,.12);
  --shadow-lg:  0 12px 48px rgba(13,27,42,.18);

  --font-display: 'Playfair Display', Georgia, serif;
  --font-body:    'DM Sans', system-ui, sans-serif;

  --transition: .25s cubic-bezier(.4,0,.2,1);
  --header-h:   70px;
}

/* ── Reset ─────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; font-size: 16px; }
body {
  font-family: var(--font-body);
  color: var(--text);
  background: var(--cream);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a  { color: inherit; text-decoration: none; }
ul { list-style: none; }

/* ── Header ────────────────────────────────────────────────────────────── */
.site-header {
  position: sticky; top: 0; z-index: 1000;
  background: var(--navy);
  box-shadow: 0 2px 20px rgba(0,0,0,.25);
  height: var(--header-h);
}
.header-inner {
  max-width: 1200px; margin: 0 auto; padding: 0 24px;
  height: 100%; display: flex; align-items: center; justify-content: space-between;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-logo { height: 40px; width: 40px; object-fit: contain; border-radius: 8px; }
.brand-name {
  font-family: var(--font-display);
  font-size: 1.35rem; color: var(--white); letter-spacing: -.5px;
}
.brand-name em { color: var(--gold); font-style: normal; }

.main-nav ul { display: flex; gap: 4px; }
.main-nav a {
  display: block; padding: 8px 16px;
  font-size: .9rem; font-weight: 500; color: rgba(255,255,255,.8);
  border-radius: var(--radius-sm);
  transition: var(--transition);
}
.main-nav a:hover, .main-nav a.active {
  color: var(--white); background: rgba(201,168,76,.15);
}
.main-nav a.active { color: var(--gold); }

.hamburger {
  display: none; flex-direction: column; gap: 5px;
  background: none; border: none; cursor: pointer; padding: 6px;
}
.hamburger span {
  display: block; width: 24px; height: 2px; background: var(--white);
  border-radius: 2px; transition: var(--transition);
}

/* ── Hero ──────────────────────────────────────────────────────────────── */
.hero {
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-mid) 60%, #1e3a5f 100%);
  min-height: 520px; position: relative; overflow: hidden;
  display: flex; align-items: center;
}
.hero::before {
  content: '';
  position: absolute; inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23c9a84c' fill-opacity='0.04'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}
.hero-inner {
  max-width: 1200px; margin: 0 auto; padding: 80px 24px;
  display: grid; grid-template-columns: 1fr 1fr; gap: 60px; align-items: center;
  position: relative; z-index: 1;
}
.hero-eyebrow {
  font-size: .8rem; font-weight: 600; letter-spacing: 3px;
  text-transform: uppercase; color: var(--gold); margin-bottom: 16px;
}
.hero h1 {
  font-family: var(--font-display);
  font-size: clamp(2rem, 4vw, 3.2rem);
  color: var(--white); line-height: 1.15; margin-bottom: 20px;
}
.hero h1 em { color: var(--gold); font-style: normal; }
.hero p { color: rgba(255,255,255,.75); font-size: 1.05rem; max-width: 480px; margin-bottom: 32px; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 24px; border-radius: var(--radius);
  font-family: var(--font-body); font-size: .95rem; font-weight: 600;
  border: 2px solid transparent; cursor: pointer;
  transition: var(--transition); text-decoration: none;
}
.btn-primary { background: var(--gold); color: var(--navy); border-color: var(--gold); }
.btn-primary:hover { background: var(--gold-light); border-color: var(--gold-light); transform: translateY(-2px); box-shadow: 0 8px 24px rgba(201,168,76,.3); }
.btn-outline { background: transparent; color: var(--white); border-color: rgba(255,255,255,.4); }
.btn-outline:hover { background: rgba(255,255,255,.1); border-color: var(--white); }
.btn-danger { background: var(--danger); color: var(--white); border-color: var(--danger); font-size: .85rem; padding: 8px 16px; }
.btn-danger:hover { background: #b53030; }
.btn-sm { padding: 8px 16px; font-size: .85rem; }

.hero-image img {
  border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
  width: 100%; aspect-ratio: 4/3; object-fit: cover;
  border: 3px solid rgba(201,168,76,.3);
}

/* ── Stats Bar ─────────────────────────────────────────────────────────── */
.stats-bar {
  background: var(--white); border-bottom: 1px solid var(--grey-100);
  box-shadow: var(--shadow-sm);
}
.stats-inner {
  max-width: 1200px; margin: 0 auto; padding: 0 24px;
  display: flex; justify-content: center; gap: 0;
}
.stat-item {
  display: flex; align-items: center; gap: 12px;
  padding: 20px 40px; border-right: 1px solid var(--grey-100);
}
.stat-item:last-child { border-right: none; }
.stat-icon { font-size: 1.5rem; color: var(--gold); }
.stat-label { font-size: .75rem; text-transform: uppercase; letter-spacing: 1px; color: var(--text-muted); }
.stat-value { font-family: var(--font-display); font-size: 1.6rem; font-weight: 700; color: var(--navy); line-height: 1; }

/* ── Section Layout ────────────────────────────────────────────────────── */
.section { padding: 72px 24px; }
.section-inner { max-width: 1200px; margin: 0 auto; }
.section-header { margin-bottom: 48px; }
.section-header .eyebrow {
  font-size: .75rem; font-weight: 600; letter-spacing: 3px;
  text-transform: uppercase; color: var(--gold); margin-bottom: 8px;
}
.section-header h2 {
  font-family: var(--font-display); font-size: clamp(1.6rem, 3vw, 2.4rem);
  color: var(--navy); line-height: 1.2;
}
.section-header p { color: var(--text-muted); max-width: 560px; margin-top: 12px; }

/* ── Notes Category Layout ─────────────────────────────────────────────── */
.category-section { margin-bottom: 48px; }
.category-title {
  font-family: var(--font-display); font-size: 1.3rem; font-weight: 700;
  color: var(--navy); margin-bottom: 20px; padding-bottom: 12px;
  border-bottom: 3px solid var(--gold);
  display: flex; align-items: center; gap: 10px;
}
.category-title i { color: var(--gold); font-size: 1rem; }

/* ── Notes Grid — RESPONSIVE FIX ───────────────────────────────────────── */
.notes-grid {
  display: grid;
  /* min(100%, 300px) prevents overflow on narrow screens while
     keeping cards at least 300px wide on larger screens */
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
  gap: 16px;
}

/* Laptop / tablet: 2 columns when viewport is 900px–1200px */
@media (min-width: 900px) and (max-width: 1199px) {
  .notes-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Desktop: 3 columns */
@media (min-width: 1200px) {
  .notes-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.note-card {
  background: var(--white); border-radius: var(--radius); padding: 20px;
  box-shadow: var(--shadow-sm); border: 1px solid var(--grey-100);
  display: flex; align-items: flex-start; gap: 16px;
  transition: var(--transition);
  min-width: 0; /* critical: prevents flex children from overflowing */
}
.note-card:hover { box-shadow: var(--shadow); border-color: var(--gold-light); transform: translateY(-2px); }
.note-icon {
  width: 48px; height: 48px; border-radius: 10px;
  background: linear-gradient(135deg, #fff0d6, #ffe0a0);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; font-size: 1.4rem; color: var(--gold);
}
.note-body { flex: 1; min-width: 0; } /* min-width: 0 allows text to shrink */
.note-name {
  font-weight: 600;
  font-size: .9rem;
  color: var(--navy);
  /* CHANGED: allow full name to show — no truncation */
  white-space: normal;
  word-break: break-word;
  line-height: 1.35;
}
.note-meta { font-size: .78rem; color: var(--text-muted); margin-top: 4px; }
.note-actions {
  display: flex; gap: 8px; flex-shrink: 0;
  align-self: flex-start; /* stay top-aligned when name wraps */
}
.note-btn {
  width: 36px; height: 36px; border-radius: 8px; border: none;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: var(--transition); font-size: .9rem; text-decoration: none;
}
.note-btn-view { background: var(--grey-100); color: var(--navy-mid); }
.note-btn-view:hover { background: var(--navy); color: var(--white); }
.note-btn-dl   { background: var(--gold); color: var(--navy); }
.note-btn-dl:hover { background: var(--gold-light); transform: scale(1.05); }

/* ── Page Banner ───────────────────────────────────────────────────────── */
.page-banner {
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-mid) 100%);
  padding: 56px 24px;
}
.page-banner-inner { max-width: 1200px; margin: 0 auto; }
.breadcrumb { font-size: .85rem; color: rgba(255,255,255,.6); margin-bottom: 12px; }
.breadcrumb a { color: var(--gold); }
.breadcrumb span { margin: 0 6px; }
.page-banner h1 {
  font-family: var(--font-display); font-size: clamp(1.8rem, 3vw, 2.6rem);
  color: var(--white);
}

/* ── About Page ────────────────────────────────────────────────────────── */
.about-layout {
  display: grid; grid-template-columns: 320px 1fr; gap: 60px; align-items: start;
}
.author-card {
  background: var(--white); border-radius: var(--radius-lg); overflow: hidden;
  box-shadow: var(--shadow); position: sticky; top: calc(var(--header-h) + 20px);
}
.author-card img { width: 100%; aspect-ratio: 3/4; object-fit: cover; }
.author-card-body { padding: 24px; }
.author-name { font-family: var(--font-display); font-size: 1.3rem; font-weight: 700; color: var(--navy); }
.author-title { font-size: .85rem; color: var(--text-muted); margin-top: 4px; }
.author-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 16px; }
.tag {
  font-size: .75rem; padding: 4px 10px; border-radius: 20px;
  background: var(--grey-100); color: var(--text-muted); font-weight: 500;
}
.about-content h2 { font-family: var(--font-display); font-size: 1.5rem; color: var(--navy); margin-bottom: 16px; }
.about-content p { color: var(--text-muted); margin-bottom: 16px; line-height: 1.8; }
.about-content p + p { text-indent: 1.5em; }

/* ── Contact Form ──────────────────────────────────────────────────────── */
.contact-layout { display: grid; grid-template-columns: 1fr 1.4fr; gap: 60px; align-items: start; }
.contact-info h2 { font-family: var(--font-display); font-size: 1.6rem; color: var(--navy); margin-bottom: 16px; }
.contact-info p  { color: var(--text-muted); line-height: 1.8; margin-bottom: 24px; }
.info-item { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 16px; }
.info-item i { width: 40px; height: 40px; background: var(--navy); color: var(--gold); border-radius: 10px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.info-text strong { display: block; font-weight: 600; color: var(--navy); font-size: .9rem; }
.info-text span { font-size: .85rem; color: var(--text-muted); }

.card-form {
  background: var(--white); border-radius: var(--radius-lg); padding: 36px;
  box-shadow: var(--shadow);
}
.form-group { margin-bottom: 20px; }
.form-group label { display: block; font-size: .85rem; font-weight: 600; color: var(--navy); margin-bottom: 6px; }
.form-group input,
.form-group textarea,
.form-group select {
  width: 100%; padding: 12px 16px;
  border: 2px solid var(--grey-100); border-radius: var(--radius);
  font-family: var(--font-body); font-size: .95rem; color: var(--text);
  background: var(--grey-50); transition: var(--transition);
  outline: none;
}
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus { border-color: var(--gold); background: var(--white); box-shadow: 0 0 0 3px rgba(201,168,76,.15); }
.form-group textarea { resize: vertical; min-height: 140px; }
.alert {
  padding: 14px 18px; border-radius: var(--radius);
  font-size: .9rem; font-weight: 500; margin-bottom: 20px;
}
.alert-success { background: #d1fae5; color: #065f46; border-left: 4px solid var(--success); }
.alert-error   { background: #fee2e2; color: #7f1d1d; border-left: 4px solid var(--danger); }

/* ── Admin ─────────────────────────────────────────────────────────────── */
.admin-layout { display: grid; grid-template-columns: 260px 1fr; min-height: calc(100vh - var(--header-h)); }
.admin-sidebar {
  background: var(--navy); padding: 32px 0; position: sticky;
  top: var(--header-h); height: calc(100vh - var(--header-h)); overflow-y: auto;
}
.sidebar-section { margin-bottom: 32px; }
.sidebar-label { font-size: .7rem; font-weight: 600; letter-spacing: 2px; text-transform: uppercase; color: rgba(255,255,255,.35); padding: 0 24px; margin-bottom: 8px; }
.sidebar-link {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 24px; font-size: .9rem; color: rgba(255,255,255,.75);
  cursor: pointer; transition: var(--transition); border-left: 3px solid transparent;
}
.sidebar-link:hover, .sidebar-link.active {
  background: rgba(201,168,76,.1); color: var(--white);
  border-left-color: var(--gold);
}
.sidebar-link i { width: 20px; text-align: center; color: var(--gold); }
.admin-main { padding: 40px; background: var(--grey-50); }
.admin-panel { display: none; }
.admin-panel.active { display: block; }
.panel-title {
  font-family: var(--font-display); font-size: 1.6rem; color: var(--navy);
  margin-bottom: 32px; padding-bottom: 16px; border-bottom: 2px solid var(--grey-100);
}
.stat-card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 20px; margin-bottom: 32px; }
.stat-card {
  background: var(--white); border-radius: var(--radius); padding: 24px;
  box-shadow: var(--shadow-sm); border-top: 4px solid var(--gold);
}
.stat-card .num { font-family: var(--font-display); font-size: 2.2rem; font-weight: 800; color: var(--navy); }
.stat-card .lbl { font-size: .8rem; text-transform: uppercase; letter-spacing: 1px; color: var(--text-muted); margin-top: 4px; }
.data-table { width: 100%; border-collapse: collapse; background: var(--white); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm); }
.data-table th { background: var(--navy); color: var(--white); font-size: .8rem; font-weight: 600; text-transform: uppercase; letter-spacing: 1px; padding: 14px 16px; text-align: left; }
.data-table td { padding: 12px 16px; font-size: .9rem; border-bottom: 1px solid var(--grey-100); }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--grey-50); }

/* ── Login ─────────────────────────────────────────────────────────────── */
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--navy); }
.login-box {
  width: 400px; background: var(--white); border-radius: var(--radius-lg);
  padding: 48px 40px; box-shadow: var(--shadow-lg);
}
.login-logo { text-align: center; margin-bottom: 32px; }
.login-logo img { height: 56px; margin: 0 auto 12px; }
.login-logo h2 { font-family: var(--font-display); font-size: 1.4rem; color: var(--navy); }
.login-logo p  { font-size: .85rem; color: var(--text-muted); margin-top: 4px; }

/* ── Chatbot ───────────────────────────────────────────────────────────── */
#chat-fab {
  position: fixed; bottom: 28px; right: 28px; z-index: 999;
  width: 60px; height: 60px; border-radius: 50%;
  background: var(--navy); color: var(--gold);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem; cursor: pointer;
  box-shadow: 0 4px 20px rgba(0,0,0,.3);
  transition: var(--transition); border: 2px solid var(--gold);
}
#chat-fab:hover { transform: scale(1.08); background: var(--navy-mid); }
.chat-badge {
  position: absolute; top: -4px; right: -4px;
  background: var(--gold); color: var(--navy);
  font-size: .55rem; font-weight: 800; letter-spacing: 1px;
  padding: 2px 5px; border-radius: 10px;
}
#chat-widget {
  position: fixed; bottom: 100px; right: 28px; z-index: 998;
  width: 380px; background: var(--white); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); border: 1px solid var(--grey-100);
  display: flex; flex-direction: column; overflow: hidden;
  max-height: 520px; transition: var(--transition);
}
.chat-hidden { opacity: 0; pointer-events: none; transform: translateY(20px) scale(.97); }
.chat-header {
  background: var(--navy); padding: 16px 20px;
  display: flex; align-items: center; justify-content: space-between;
}
.chat-title { color: var(--white); font-weight: 600; font-size: .9rem; display: flex; gap: 8px; align-items: center; }
.chat-title i { color: var(--gold); }
#chat-close { background: none; border: none; color: rgba(255,255,255,.6); cursor: pointer; font-size: 1.1rem; transition: var(--transition); }
#chat-close:hover { color: var(--white); }
.chat-messages { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.msg { display: flex; }
.msg.bot .bubble { background: var(--grey-100); color: var(--text); border-radius: 4px 16px 16px 16px; }
.msg.user { justify-content: flex-end; }
.msg.user .bubble { background: var(--navy); color: var(--white); border-radius: 16px 4px 16px 16px; }
.bubble { padding: 10px 14px; font-size: .88rem; line-height: 1.6; max-width: 85%; }
.bubble.typing { padding: 14px 18px; }
.typing-dots { display: flex; gap: 4px; }
.typing-dots span {
  width: 6px; height: 6px; background: var(--text-muted); border-radius: 50%;
  animation: bounce .9s infinite;
}
.typing-dots span:nth-child(2) { animation-delay: .15s; }
.typing-dots span:nth-child(3) { animation-delay: .3s; }
@keyframes bounce { 0%,80%,100%{transform:translateY(0)} 40%{transform:translateY(-6px)} }
.chat-input-row {
  padding: 12px 16px; border-top: 1px solid var(--grey-100);
  display: flex; gap: 8px;
}
#chat-input {
  flex: 1; padding: 10px 14px; border: 2px solid var(--grey-100);
  border-radius: 30px; font-size: .88rem; font-family: var(--font-body);
  outline: none; transition: var(--transition);
}
#chat-input:focus { border-color: var(--gold); }
#chat-send {
  width: 40px; height: 40px; border-radius: 50%; border: none;
  background: var(--gold); color: var(--navy); cursor: pointer; font-size: .95rem;
  display: flex; align-items: center; justify-content: center; transition: var(--transition);
}
#chat-send:hover { background: var(--gold-light); }

/* ── Footer ────────────────────────────────────────────────────────────── */
.site-footer { background: var(--navy); color: rgba(255,255,255,.75); margin-top: auto; }
.footer-inner {
  max-width: 1200px; margin: 0 auto; padding: 60px 24px 40px;
  display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 48px;
}
.footer-logo { height: 240px; margin-bottom: 16px; }
.footer-brand p { font-size: .9rem; color: rgba(255,255,255,.55); line-height: 1.7; max-width: 300px; }
.footer-links h4, .footer-social h4 {
  font-size: .75rem; font-weight: 700; letter-spacing: 2px;
  text-transform: uppercase; color: var(--gold); margin-bottom: 16px;
}
.footer-links ul { display: flex; flex-direction: column; gap: 8px; }
.footer-links a { font-size: .9rem; color: rgba(255,255,255,.65); transition: var(--transition); }
.footer-links a:hover { color: var(--gold); }
.social-row { display: flex; gap: 10px; }
.social-row a {
  width: 38px; height: 38px; border-radius: 8px;
  background: rgba(255,255,255,.08); color: rgba(255,255,255,.75);
  display: flex; align-items: center; justify-content: center; font-size: .9rem;
  transition: var(--transition);
}
.social-row a:hover { background: var(--gold); color: var(--navy); }
.footer-bottom {
  max-width: 1200px; margin: 0 auto; padding: 20px 24px;
  border-top: 1px solid rgba(255,255,255,.08);
  display: flex; align-items: center; justify-content: space-between;
  font-size: .82rem; color: rgba(255,255,255,.4);
}
.admin-link { color: rgba(255,255,255,.3); transition: var(--transition); }
.admin-link:hover { color: var(--gold); }

/* ── Search bar ────────────────────────────────────────────────────────── */
.search-bar {
  background: var(--white); padding: 20px 24px;
  border-bottom: 1px solid var(--grey-100);
}
.search-inner { max-width: 1200px; margin: 0 auto; display: flex; gap: 12px; align-items: center; }
.search-input-wrap { flex: 1; position: relative; }
.search-input-wrap i { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--text-muted); font-size: .9rem; }
#search-input {
  width: 100%; padding: 11px 16px 11px 40px;
  border: 2px solid var(--grey-100); border-radius: 30px; font-family: var(--font-body); font-size: .9rem;
  transition: var(--transition); outline: none;
}
#search-input:focus { border-color: var(--gold); }
.filter-tags { display: flex; gap: 8px; flex-wrap: wrap; }
.filter-tag {
  padding: 6px 14px; font-size: .8rem; border-radius: 20px; cursor: pointer;
  border: 1px solid var(--grey-300); background: var(--white); color: var(--text-muted);
  transition: var(--transition);
}
.filter-tag.active, .filter-tag:hover { background: var(--navy); color: var(--white); border-color: var(--navy); }

/* ═══════════════════════════════════════════════════════════════════════
   RESPONSIVE BREAKPOINTS
   ═══════════════════════════════════════════════════════════════════════ */

/* ── Large tablet / small laptop (900px – 1199px) ──────────────────────── */
@media (max-width: 1199px) {
  .stat-item { padding: 20px 28px; }

  /* Notes: 2 columns on tablet/small laptop */
  .notes-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  /* Admin sidebar narrower */
  .admin-layout { grid-template-columns: 220px 1fr; }
  .admin-main { padding: 32px; }
}

/* ── Tablet (900px) ────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .hero-inner { grid-template-columns: 1fr; gap: 40px; }
  .hero-image { display: none; }

  .stats-inner { flex-wrap: wrap; justify-content: flex-start; }
  .stat-item {
    border-right: none; border-bottom: 1px solid var(--grey-100);
    flex: 1 1 160px; padding: 16px 24px;
  }

  .about-layout, .contact-layout { grid-template-columns: 1fr; }
  .author-card { position: static; }

  .footer-inner { grid-template-columns: 1fr 1fr; }

  /* Admin collapses to top bar */
  .admin-layout { grid-template-columns: 1fr; }
  .admin-sidebar {
    position: static; height: auto;
    display: flex; overflow-x: auto; padding: 12px 0;
  }
  .sidebar-link { white-space: nowrap; }

  /* Notes: still 2 columns on tablet */
  .notes-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  /* Search: stack on tablet */
  .search-inner { flex-direction: column; align-items: stretch; }
  .filter-tags { justify-content: flex-start; }
}

/* ── Mobile (640px) ────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  /* Nav: slide-in drawer */
  .main-nav {
    position: fixed; inset: var(--header-h) 0 0 0;
    background: var(--navy); padding: 32px 24px;
    flex-direction: column; align-items: flex-start;
    transform: translateX(100%); transition: var(--transition); z-index: 999;
  }
  .main-nav.open { transform: translateX(0); }
  .main-nav ul { flex-direction: column; gap: 4px; width: 100%; }
  .main-nav a { padding: 12px 16px; font-size: 1rem; }
  .hamburger { display: flex; }

  /* Hero */
  .hero-inner { padding: 48px 24px; }
  .hero-actions { flex-direction: column; }
  .hero-actions .btn { width: 100%; justify-content: center; }

  /* Notes: single column on mobile */
  .notes-grid { grid-template-columns: 1fr; }

  /* Note card: tighter on mobile */
  .note-card { padding: 14px; gap: 12px; }
  .note-icon { width: 40px; height: 40px; font-size: 1.2rem; }

  /* Chat widget */
  #chat-widget { width: calc(100vw - 32px); right: 16px; }
  #chat-fab { bottom: 20px; right: 20px; }

  /* Footer */
  .footer-inner { grid-template-columns: 1fr; gap: 32px; }
  .footer-bottom { flex-direction: column; gap: 8px; text-align: center; }

  /* Login */
  .login-box { width: 100%; margin: 16px; padding: 32px 24px; }

  /* Admin */
  .admin-main { padding: 20px 16px; }
  .stat-card-grid { grid-template-columns: repeat(2, 1fr); }

  /* Contact form */
  .card-form { padding: 24px 20px; }

  /* Section padding */
  .section { padding: 48px 20px; }
  .page-banner { padding: 40px 20px; }

  /* Data table scroll */
  .data-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
}

/* ── Small mobile (400px) ──────────────────────────────────────────────── */
@media (max-width: 400px) {
  .brand-name { font-size: 1.1rem; }
  .stat-card-grid { grid-template-columns: 1fr; }
  .note-btn { width: 32px; height: 32px; font-size: .8rem; }
}

/* ── Utility ───────────────────────────────────────────────────────────── */
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.text-gold { color: var(--gold); }
.text-navy { color: var(--navy); }
.mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; }
.mb-2 { margin-bottom: 16px; }

/* ── Scroll reveal animation ───────────────────────────────────────────── */
.reveal { opacity: 0; transform: translateY(24px); transition: opacity .5s ease, transform .5s ease; }
.reveal.visible { opacity: 1; transform: translateY(0); }