/* ════════════════════════════════════════════════
   layout.css — nav, drawer, pages, grid
   ════════════════════════════════════════════════ */

/* ─── CUSTOM CURSOR ─── */
#cursor-dot {
  position: fixed;
  width: 6px;
  height: 6px;
  background: var(--accent);
  border-radius: 50%;
  pointer-events: none;
  z-index: var(--z-cursor);
  transform: translate(-50%, -50%);
  transition: width var(--t-fast), height var(--t-fast), opacity var(--t-fast);
  will-change: transform;
}
#cursor-ring {
  position: fixed;
  width: 30px;
  height: 30px;
  border: 1.5px solid rgba(184, 50, 40, 0.35);
  border-radius: 50%;
  pointer-events: none;
  z-index: calc(var(--z-cursor) - 1);
  transform: translate(-50%, -50%);
  transition: width var(--t-base), height var(--t-base), border-color var(--t-base);
  will-change: transform;
}
.cursor-hover #cursor-dot  { width: 12px; height: 12px; }
.cursor-hover #cursor-ring { width: 48px; height: 48px; border-color: rgba(184,50,40,0.5); }
.cursor-click #cursor-dot  { width: 4px; height: 4px; }

/* ─── TOP NAVBAR ─── */
.topnav {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 60px;
  background: rgba(244, 240, 232, 0.94);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--rule);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--sp-10);
  z-index: var(--z-nav);
}

.nav-logo {
  display: flex;
  align-items: baseline;
  gap: var(--sp-3);
}
.nav-logo-name {
  font-family: var(--font-serif);
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: 0.2px;
}
.nav-logo-sep {
  width: 1px;
  height: 14px;
  background: var(--rule);
  align-self: center;
}
.nav-logo-sub {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 1.5px;
  text-transform: uppercase;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: var(--sp-6);
}
.nav-link {
  font-family: var(--font-sans);
  font-size: 12.5px;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0.2px;
  transition: color var(--t-base);
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
}
.nav-link:hover { color: var(--accent); }

.nav-btn {
  background: var(--ink);
  color: var(--paper);
  border: none;
  padding: 8px 20px;
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.3px;
  border-radius: 2px;
  transition: background var(--t-base);
}
.nav-btn:hover { background: var(--accent); }

/* Hamburger */
.hamburger {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 36px;
  height: 36px;
  padding: 7px;
  border-radius: 3px;
  border: 1px solid transparent;
  background: none;
  cursor: pointer;
  transition: background var(--t-base), border-color var(--t-base);
}
.hamburger:hover {
  background: var(--paper-2);
  border-color: var(--rule);
}
.ham-line {
  width: 100%;
  height: 1.5px;
  background: var(--ink);
  border-radius: 2px;
  transform-origin: center;
  transition:
    transform var(--t-slow) var(--ease),
    opacity var(--t-base),
    width var(--t-slow) var(--ease);
}
.hamburger.is-open .ham-line:nth-child(1) { transform: translateY(6.5px) rotate(45deg); }
.hamburger.is-open .ham-line:nth-child(2) { opacity: 0; width: 0; }
.hamburger.is-open .ham-line:nth-child(3) { transform: translateY(-6.5px) rotate(-45deg); }

/* ─── DRAWER OVERLAY ─── */
.drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(14, 12, 10, 0.45);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: var(--z-overlay);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--t-slow) var(--ease);
}
.drawer-overlay.is-open {
  opacity: 1;
  pointer-events: all;
}

/* ─── DRAWER ─── */
.drawer {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: 320px;
  background: var(--ink);
  z-index: var(--z-drawer);
  transform: translateX(100%);
  transition: transform var(--t-slow) cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  will-change: transform;
}
.drawer.is-open { transform: translateX(0); }

/* Red accent stripe on left edge */
.drawer::before {
  content: '';
  position: absolute;
  top: 0; left: 0; bottom: 0;
  width: 3px;
  background: linear-gradient(180deg, var(--accent) 0%, transparent 50%, var(--stamp-blue) 100%);
  pointer-events: none;
}

.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 28px 18px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  flex-shrink: 0;
}
.drawer-file-id {
  font-family: var(--font-mono);
  font-size: 9.5px;
  color: rgba(255,255,255,0.2);
  letter-spacing: 2.5px;
  text-transform: uppercase;
}
.drawer-close {
  width: 32px; height: 32px;
  border: 1px solid rgba(255,255,255,0.1);
  background: none;
  color: rgba(255,255,255,0.35);
  font-size: 15px;
  border-radius: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: border-color var(--t-base), color var(--t-base), background var(--t-base);
}
.drawer-close:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(184,50,40,0.1);
}

.drawer-profile {
  padding: 24px 28px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  flex-shrink: 0;
}
.drawer-avatar {
  width: 52px; height: 52px;
  background: var(--accent);
  border-radius: 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-serif);
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 14px;
  position: relative;
}
.drawer-avatar::after {
  content: '';
  position: absolute;
  inset: -4px;
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 5px;
}
.drawer-name {
  font-family: var(--font-serif);
  font-size: 15px;
  font-weight: 700;
  color: rgba(255,255,255,0.9);
  margin-bottom: 4px;
}
.drawer-role {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--accent);
  letter-spacing: 1.5px;
  text-transform: uppercase;
}

.drawer-nav {
  flex: 1;
  padding: 16px 20px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.1) transparent;
}
.drawer-nav-label {
  font-family: var(--font-mono);
  font-size: 9px;
  color: rgba(255,255,255,0.18);
  letter-spacing: 2.5px;
  text-transform: uppercase;
  padding: 0 8px;
  margin: 16px 0 6px;
}
.drawer-nav-label:first-child { margin-top: 0; }

.drawer-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 11px 12px;
  border-radius: 3px;
  cursor: pointer;
  background: none;
  border: none;
  width: 100%;
  text-align: left;
  position: relative;
  overflow: hidden;
  transition: background var(--t-base);
  color: inherit;
}
.drawer-item::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 0;
  background: var(--accent);
  transition: width var(--t-base) var(--ease);
}
.drawer-item:hover::before,
.drawer-item.is-active::before { width: 2px; }
.drawer-item:hover,
.drawer-item.is-active { background: rgba(255,255,255,0.04); }

.di-num {
  font-family: var(--font-mono);
  font-size: 10px;
  color: rgba(255,255,255,0.18);
  width: 20px;
  flex-shrink: 0;
}
.di-label {
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 500;
  color: rgba(255,255,255,0.6);
  flex: 1;
  transition: color var(--t-base);
}
.drawer-item:hover .di-label,
.drawer-item.is-active .di-label { color: rgba(255,255,255,0.92); }
.di-tag {
  font-family: var(--font-mono);
  font-size: 9px;
  color: rgba(255,255,255,0.14);
  letter-spacing: 0.5px;
  transition: color var(--t-base);
}
.drawer-item:hover .di-tag { color: rgba(255,255,255,0.28); }

.drawer-footer {
  padding: 18px 28px 24px;
  border-top: 1px solid rgba(255,255,255,0.06);
  flex-shrink: 0;
}
.drawer-status-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
}
.drawer-status-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: #22C55E;
  box-shadow: 0 0 8px rgba(34,197,94,0.6);
  flex-shrink: 0;
  animation: pulse-status 3s infinite;
}
@keyframes pulse-status {
  0%,85%,100% { opacity: 1; }
  92% { opacity: 0.3; }
}
.drawer-status-text {
  font-family: var(--font-mono);
  font-size: 10px;
  color: rgba(255,255,255,0.22);
  letter-spacing: 1px;
}
.drawer-status-text em {
  color: #22C55E;
  font-style: normal;
}

.drawer-socials {
  display: flex;
  gap: 8px;
}
.drawer-social {
  flex: 1;
  padding: 8px 6px;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 2px;
  background: none;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 10px;
  color: rgba(255,255,255,0.28);
  cursor: pointer;
  transition: border-color var(--t-base), color var(--t-base), background var(--t-base);
  letter-spacing: 0.5px;
  text-decoration: none;
  display: block;
}
.drawer-social:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(184,50,40,0.08);
}

/* ─── PAGE SHELL ─── */
/* Each "page" is full viewport — click nav to advance */
.page-shell {
  min-height: 100vh;
  width: 100%;
  position: relative;
  z-index: var(--z-base);
}

/* Fade-up reveal for scroll-within-page elements */
.reveal {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity var(--t-page) var(--ease), transform var(--t-page) var(--ease);
}
.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}
.reveal-delay-1 { transition-delay: 0.1s; }
.reveal-delay-2 { transition-delay: 0.2s; }
.reveal-delay-3 { transition-delay: 0.3s; }
.reveal-delay-4 { transition-delay: 0.4s; }

/* ─── SECTION WRAPPER ─── */
.section-wrap {
  padding: var(--sp-24) var(--sp-20);
  max-width: 1280px;
  margin: 0 auto;
  padding-top: calc(var(--sp-24) + 60px);
}

/* ─── SECTION HEADER ─── */
.sec-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: var(--sp-12);
  padding-bottom: var(--sp-6);
  border-bottom: 1px solid var(--rule);
}
.sec-eyebrow {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  margin-bottom: var(--sp-3);
}
.sec-num {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--accent);
  letter-spacing: 2px;
}
.sec-line {
  width: 28px; height: 1px;
  background: var(--rule-dark);
  flex-shrink: 0;
}
.sec-category {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 2.5px;
  text-transform: uppercase;
}
.sec-title {
  font-family: var(--font-serif);
  font-size: clamp(30px, 4vw, 46px);
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.5px;
  line-height: 1.1;
}
.sec-title em {
  color: var(--accent);
  font-style: italic;
}
.sec-action {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 1px;
  text-transform: uppercase;
  background: none;
  border: none;
  border-bottom: 1px solid transparent;
  cursor: pointer;
  padding-bottom: 1px;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: color var(--t-base), border-color var(--t-base);
}
.sec-action:hover {
  color: var(--accent);
  border-color: var(--accent);
}

/* ─── PAGE NAV BUTTONS ─── */
.page-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-8) var(--sp-20);
  border-top: 1px solid var(--rule);
  margin-top: var(--sp-16);
}
.page-nav-btn {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 1px;
  text-transform: uppercase;
  background: none;
  border: 1px solid var(--rule);
  padding: var(--sp-3) var(--sp-5);
  border-radius: 2px;
  cursor: pointer;
  transition: all var(--t-base);
}
.page-nav-btn:hover {
  border-color: var(--ink);
  color: var(--ink);
}
.page-nav-btn.primary {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}
.page-nav-btn.primary:hover {
  background: var(--accent);
  border-color: var(--accent);
}
.page-nav-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}
.page-nav-indicator {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--muted-2);
  letter-spacing: 1.5px;
}

/* ─── RESPONSIVE ─── */
@media (max-width: 768px) {
  .topnav { padding: 0 var(--sp-5); }
  .nav-link { display: none; }
  .nav-btn { display: none; }
  .section-wrap { padding: var(--sp-10) var(--sp-5); padding-top: calc(var(--sp-10) + 60px); }
  .page-nav { padding: var(--sp-6) var(--sp-5); }
  .drawer { width: 100%; }
  .sec-head { flex-direction: column; align-items: flex-start; gap: var(--sp-4); }
}

/* ════════════════════════════════════════════════
   MOBILE — full section responsive
   ════════════════════════════════════════════════ */

/* Section wrap tighter on small screens */
@media (max-width: 1024px) {
  .section-wrap { padding: var(--sp-16) var(--sp-10); padding-top: calc(var(--sp-16) + 60px); }
  .page-nav     { padding: var(--sp-6) var(--sp-10); }
}

@media (max-width: 640px) {
  .section-wrap { padding: var(--sp-8) var(--sp-5); padding-top: calc(var(--sp-8) + 60px); }
  .page-nav     { padding: var(--sp-5) var(--sp-5); flex-wrap: wrap; gap: var(--sp-3); }
  .page-nav-indicator { order: -1; width: 100%; text-align: center; }
  .sec-title    { font-size: clamp(24px, 7vw, 36px); }

  /* About grid → single column */
  #section-about  .section-wrap > div[style*="grid"] { display: block !important; }
  #section-about  .section-wrap > div > div:first-child { margin-bottom: var(--sp-8); }

  /* Contact grid → single column */
  #section-contact .section-wrap > div[style*="grid"] { display: block !important; }
  #section-contact .section-wrap > div > div:first-child { margin-bottom: var(--sp-8); }

  /* Drawer full width */
  .drawer { width: 100%; }

  /* Nav — hide text links */
  .nav-link { display: none; }
  .nav-btn  { display: none; }
  .topnav   { padding: 0 var(--sp-4); }
}

/* Proj grid responsive */
@media (max-width: 900px) {
  .proj-grid { grid-template-columns: 1fr 1fr !important; }
}
@media (max-width: 560px) {
  .proj-grid { grid-template-columns: 1fr !important; }
}

/* Cert grid responsive */
@media (max-width: 640px) {
  .cert-grid { grid-template-columns: 1fr !important; }
}

/* Skills grid responsive */
@media (max-width: 900px) {
  .skills-groups { grid-template-columns: repeat(2, 1fr) !important; }
}
@media (max-width: 560px) {
  .skills-groups { grid-template-columns: 1fr !important; }
}

/* Achievements grid responsive */
@media (max-width: 900px) {
  .achievements-grid { grid-template-columns: repeat(2, 1fr) !important; }
}
@media (max-width: 560px) {
  .achievements-grid { grid-template-columns: 1fr !important; }
}

/* Experience scroll on mobile */
@media (max-width: 640px) {
  .exp-item { width: 220px; }
}
