/* =========================================================
   style.css (PUBLIC PAGES ONLY) - FINAL
   - Depends on base.css for:
     :root tokens, reset, body, .btn*, .container-xl, .card
   - This file defines site/public layout:
     header, hero, sections, works, services, news, contact, footer, responsive
   - Includes:
     ✅ Stable auth dropdown (ログアウトが消えない)
     ✅ Attachments compact button rules (post.html)
========================================================= */

/* =========================
   SECTION / TYPOGRAPHY (public)
========================= */
.section{ padding: 56px 0; }
.section-alt{ background: #fff; }

.section-head{ margin-bottom: 18px; }
.section-kicker{
  font-size: 12px;
  letter-spacing: .08em;
  color: var(--muted);
  margin-bottom: 6px;
}
.section-title{ font-size: 22px; font-weight: 700; }
.section-title-lg{
  font-size: 26px;
  font-weight: 800;
  line-height: 1.3;
}
.row-between{
  display:flex;
  align-items:flex-end;
  justify-content:space-between;
  gap: 14px;
}

/* =========================
   HEADER (sticky)
========================= */
.site-header{
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255,255,255,.85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.header-inner{
  height: 68px;
  display:flex;
  align-items:center;
  gap: 18px;
}

.brand{
  display:flex;
  align-items:center;
  gap: 10px;
  min-width: 220px;
}

.brand-mark{
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: var(--primary);
  color:#fff;
  display:flex;
  align-items:center;
  justify-content:center;
  font-weight: 800;
}

.brand-mark-sm{
  width: 34px;
  height: 34px;
  border-radius: 12px;
}

.brand-name{
  font-weight: 800;
  letter-spacing: .02em;
}

.brand-sub{
  font-size: 11px;
  color: var(--muted);
  margin-top: -2px;
}

.site-nav{
  display:flex;
  align-items:center;
  gap: 18px;
  flex: 1;
  justify-content: flex-end;
  white-space: nowrap;
}

.site-nav a{
  font-size: 14px;
  color: #1f2937;
  padding: 6px 6px;
  border-radius: 8px;
}

.site-nav a:hover{
  background: rgba(11,42,74,.06);
}

.header-right{
  display:flex;
  align-items:center;
}

/* =========================
   AUTH MENU (Header)
   ✅ Dropdown doesn't vanish quickly (hover area + bridge + delay)
   - HTML expected:
     <div class="auth-menu is-logged-in">
       <a id="auth-main-btn">...</a>
       <div class="auth-dropdown">...</div>
     </div>
========================= */
.auth-menu{
  position: relative;
  display: inline-block;
}

/* Default hidden (use opacity/visibility, not display:none) */
.auth-dropdown{
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  left: auto
  z-index: 1000;

  min-width: 120px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow);
  padding: 6px;

  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  pointer-events: none;

  /* open fast, close slightly slower */
  transition: opacity .12s ease, transform .12s ease, visibility 0s linear .18s;
}

/* Bridge area so cursor can move from button to dropdown without closing */
.auth-dropdown::before{
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: -12px;
  height: 12px;
}

/* Show only when logged-in */
.auth-menu.is-logged-in:hover .auth-dropdown,
.auth-menu.is-logged-in:focus-within .auth-dropdown{
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  pointer-events: auto;
  transition: opacity .12s ease, transform .12s ease, visibility 0s;
}

.auth-logout-btn{
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;   /* 👈 QUAN TRỌNG: chữ nằm giữa */
  padding: 6px 10px;

  background: #fff;
  border: 0;
  border-radius: 10px;

  font-weight: 700;
  cursor: pointer;
}

.auth-logout-btn:hover{
  background: #f8fafc;
}

/* =========================
   HERO
========================= */
.hero{
  position: relative;
  overflow: hidden;
  padding: 76px 0 48px;
  background: #fff;
  border-bottom: 1px solid var(--border);
}

.hero-bg{
  position:absolute;
  inset:0;
  background:
    radial-gradient(circle at 20% 30%, rgba(46,204,113,.18), transparent 55%),
    radial-gradient(circle at 80% 30%, rgba(11,42,74,.14), transparent 55%),
    linear-gradient(135deg, #ffffff 0%, #f3f7ff 100%);
  pointer-events:none;
}

.hero-inner{
  position:relative;
  display:grid;
  grid-template-columns: 1.2fr .8fr;
  align-items:center;
  gap: 28px;
  min-height: 420px;
}

.hero-title{
  font-size: 34px;
  font-weight: 900;
  line-height: 1.15;
  letter-spacing: .01em;
}

.hero-sub{
  margin-top: 12px;
  color: var(--muted);
  font-weight: 700;
  letter-spacing: .06em;
  font-size: 12px;
}

.hero-actions{
  margin-top: 20px;
  display:flex;
  gap: 10px;
  flex-wrap: wrap;
}

.hero-badge{
  position: relative;
  width: 220px;
  height: 220px;
  margin-left: auto;
  display:flex;
  align-items:center;
  justify-content:center;
}

.hero-badge-ring{
  position:absolute;
  inset: 0;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(11,42,74,.12), transparent 60%);
  outline: 10px solid rgba(11,42,74,.06);
}

.hero-badge-core{
  width: 72px;
  height: 72px;
  border-radius: 999px;
  background: #111827;
  color:#fff;
  display:flex;
  align-items:center;
  justify-content:center;
  font-weight: 800;
  font-size: 12px;
}

/* =========================
   WORKS (cards-row)
========================= */
.cards-row{
  display:flex;
  gap: 16px;
  overflow:auto;
  padding-bottom: 8px;
  scroll-snap-type: x mandatory;
}

.card{ /* safety if base missing */
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow:hidden;
}

.cards-row .card{
  scroll-snap-align: start;
  min-width: 240px;
}

.card-thumb{
  height: 120px;
  background: linear-gradient(135deg, rgba(11,42,74,.15), rgba(46,204,113,.12));
}

.card-body{ padding: 12px 12px 14px; }
.card-title{ font-weight: 800; font-size: 14px; }
.card-desc{
  color: var(--muted);
  font-size: 13px;
  margin-top: 2px;
}

/* =========================
   ABOUT (split)
========================= */
.split{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px;
  align-items:center;
}

.lead{ margin-top: 12px; color: #334155; }

.pill-group{
  margin-top: 16px;
  display:flex;
  gap: 10px;
  flex-wrap: wrap;
}

.pill{
  display:inline-flex;
  align-items:center;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #fff;
  color: #111827;
  font-size: 13px;
  font-weight: 700;
}

.illustration{
  height: 280px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: linear-gradient(135deg, #f8fafc, #ffffff);
  position: relative;
  overflow:hidden;
}

.cube{
  position: absolute;
  width: 160px;
  height: 160px;
  right: 40px;
  top: 50px;
  border-radius: 22px;
  background: linear-gradient(135deg, rgba(11,42,74,.18), rgba(46,204,113,.14));
  border: 1px solid rgba(15,23,42,.08);
}
.cube.cube-sm{
  width: 90px;
  height: 90px;
  right: 190px;
  top: 130px;
  opacity: .9;
}
.cube.cube-xs{
  width: 54px;
  height: 54px;
  right: 140px;
  top: 30px;
  opacity: .85;
}

/* =========================
   SERVICES (grid-4)
========================= */
.grid-4{
  display:grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}

.svc-card{
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px;
  min-height: 140px;
}

.svc-icon{
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: rgba(11,42,74,.08);
  display:flex;
  align-items:center;
  justify-content:center;
  font-size: 18px;
}

.svc-title{ margin-top: 10px; font-size: 14px; font-weight: 900; }
.svc-desc{ margin-top: 6px; font-size: 13px; color: var(--muted); }

/* =========================
   RECRUIT
========================= */
.recruit{
  background: linear-gradient(135deg, #081e33, #0b2a4a);
  color:#fff;
  padding: 54px 0;
}

.recruit-inner{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap: 16px;
}

.recruit-kicker{
  font-size: 12px;
  letter-spacing: .08em;
  opacity: .85;
}

.recruit-title{
  margin-top: 8px;
  font-size: 26px;
  font-weight: 900;
}

.recruit-desc{
  margin-top: 8px;
  color: rgba(255,255,255,.85);
}

/* =========================
   NEWS
========================= */
.news-list{
  margin-top: 10px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow:hidden;
}

.news-item{
  display:grid;
  grid-template-columns: 120px 1fr 24px;
  gap: 12px;
  align-items:center;
  padding: 12px 14px;
  border-top: 1px solid var(--border);
}
.news-item:first-child{ border-top: none; }

.news-date{
  color: var(--muted);
  font-weight: 700;
  font-size: 13px;
}
.news-title{
  font-weight: 700;
  font-size: 14px;
  color: #111827;
}
.news-arrow{
  text-align:right;
  color: #94a3b8;
  font-weight: 900;
}

/* =========================
   CONTACT (inline)
========================= */
.contact-float{
  padding: 18px 0 30px;
}

.contact-inner{
  display:flex;
  gap: 10px;
  justify-content: flex-start;
  align-items:center;
  flex-wrap: wrap;
}

.contact-chip{
  display:inline-flex;
  align-items:center;
  gap: 10px;
  padding: 10px 16px;
  border-radius: 999px;
  background: #ffffff;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  font-weight: 800;
  font-size: 14px;
}

.contact-chip-dark{
  background: #111827;
  color:#fff;
  border-color: rgba(255,255,255,.12);
}

.chip-ic{
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: rgba(11,42,74,.08);
  display:flex;
  align-items:center;
  justify-content:center;
  font-weight: 900;
}

.contact-chip-dark .chip-ic{
  background: rgba(255,255,255,.14);
}

/* =========================
   FOOTER
========================= */
.site-footer{
  margin-top: 40px;
  background: #0b1220;
  color: rgba(255,255,255,.9);
  padding-top: 32px;
}

.footer-grid{
  display:grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 18px;
  padding-bottom: 18px;
}

.footer-brand{
  display:flex;
  align-items:center;
  gap: 10px;
}

.footer-text{
  margin-top: 8px;
  font-size: 13px;
  color: rgba(255,255,255,.75);
}

.footer-links{
  display:flex;
  flex-direction:column;
  gap: 10px;
  font-size: 14px;
  color: rgba(255,255,255,.85);
}

.footer-links a{
  display:block;
  line-height: 1.8;
  color: rgba(255,255,255,.85);
}
.footer-links a:hover{ text-decoration: underline; }

.footer-bottom{
  border-top: 1px solid rgba(255,255,255,.12);
  padding: 14px 0;
  text-align: center;
  color: rgba(255,255,255,.75);
}

/* =========================
   OPTIONAL: Public "muted outline" button
========================= */
.btn-outline-gray{
  background: #fff;
  color: #555;
  border: 2px solid #bbb;
  padding: 10px 26px;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: all .2s ease;
}
.btn-outline-gray:hover{
  background: #f3f3f3;
  border-color: #999;
  color: #333;
}

/* =========================
   ATTACHMENTS (post.html)
   ✅ Small button + aligned left + list aligned left
   - Expected HTML structure:
     <section class="attach-wrap">
       <div class="attach-head-wrap">
         <div id="attach-head" class="attach-head attach-head--compact">...</div>
       </div>
       <div id="attach-body" class="attach-body attach-body--compact">
         <div id="attach-list" class="attach-list"></div>
       </div>
     </section>
========================= */
.attach-wrap{ margin-top: 28px; }

.attach-head-wrap{
  display: flex;
  justify-content: flex-start; /* align left */
}

.attach-head--compact{
  display: inline-flex;       /* important: do not stretch */
  align-items: center;
  justify-content: center;
  width: 100px;               /* <-- change here if needed */
  padding: 10px 8px;
  border-radius: 16px;
}

/* If you use hint and want it hidden */
.attach-hint--hidden{ display: none; }

/* List container (can be wider than the button) */
.attach-body--compact{
  width: 500px;               /* change to 100px if you want ultra compact */
  margin: 12px 0 0;           /* align left (no auto centering) */
  border-radius: 16px;
}

/* Prevent invisible min-width constraints */
.attach-head, .attach-body{ min-width: 0; }

/* Clickable feedback */
#attach-head{
  cursor: pointer;
  user-select: none;
}
#attach-head:hover{ background: #f8fafc; }
#attach-head:active{ background: #f1f5f9; }

/* =========================
   RESPONSIVE
========================= */
@media (max-width: 980px){
  .site-nav{ gap: 10px; }
  .hero-inner{ grid-template-columns: 1fr; }
  .hero-badge{ margin-left: 0; }
  .split{ grid-template-columns: 1fr; }
  .grid-4{ grid-template-columns: repeat(2, 1fr); }
  .recruit-inner{ flex-direction: column; align-items:flex-start; }
  .footer-grid{ grid-template-columns: 1fr; }

  /* Make attachments list fluid on small screens */
  .attach-body--compact{ width: 100%; max-width: 100%; }
}

@media (max-width: 560px){
  .site-nav{ display:none; } /* nếu muốn hamburger, làm sau */
  .brand{ min-width: auto; }
  .hero-title{ font-size: 28px; }
  .news-item{ grid-template-columns: 92px 1fr 18px; }
}
