:root {
  --bg-dark: #0a0a0a;
  --header-bg: rgba(11, 11, 11, 0.96);
  --border-subtle: rgba(255, 255, 255, 0.1);
  --accent: #e85325;
  --accent-hover: #d1461a;
  --text-white: #ffffff;
  --text-muted: rgba(255, 255, 255, 0.72);
  --header-height: 72px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  background-color: var(--bg-dark);
  color: var(--text-white);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* ================= HEADER ================= */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-height);
  background: var(--header-bg);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-subtle);
}

.header-inner {
  max-width: 1380px;
  height: 100%;
  margin: 0 auto;
  padding: 0 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

/* Logo */
.brand-logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  flex-shrink: 0;
}

.logo-text {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--accent);
  line-height: 1;
}

/* Minimal White Tab Menu Links */
.main-nav {
  flex: 1;
  min-width: 0;
  display: flex;
  justify-content: center;
}

.nav-list {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 34px;
}

.nav-link {
  position: relative;
  background: none;
  border: none;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 14px;
  font-weight: 400;
  letter-spacing: 0.01em;
  padding: 10px 4px;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: color 0.2s ease;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}

.nav-link:hover {
  color: var(--text-white);
}

.nav-link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
  border-radius: 4px;
}

.nav-link.active {
  color: var(--text-white);
  font-weight: 500;
}

.nav-link.active::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1.5px;
  background-color: var(--text-white);
  border-radius: 2px;
}

/* Right Actions: Let's talk + White Square Hamburger */
.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.btn-cta {
  background-color: var(--accent);
  color: #ffffff;
  border: none;
  border-radius: 6px;
  padding: 10px 20px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.15s ease;
  white-space: nowrap;
}

.btn-cta:hover {
  background-color: var(--accent-hover);
}

.btn-cta:active {
  transform: scale(0.98);
}

.btn-hamburger {
  width: 40px;
  height: 40px;
  background-color: #efefef;
  border: none;
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.btn-hamburger:hover {
  background-color: #ffffff;
}

.btn-hamburger span {
  display: block;
  width: 16px;
  height: 2px;
  background-color: #141414;
  border-radius: 1px;
}

/* ================= PDF STAGE ================= */
.pdf-stage {
  position: relative;
  min-height: calc(100vh - var(--header-height));
  width: 100%;
  background-color: var(--bg-dark);
}

.pdf-pages {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: opacity 0.2s ease;
}

.pdf-tab-panel {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.pdf-tab-panel[hidden] {
  display: none;
}

.pdf-pages.is-loading {
  opacity: 0.25;
}

.pdf-canvas-wrap {
  width: 100%;
  overflow: hidden;
  line-height: 0;
}

.pdf-canvas-wrap canvas,
.pdf-canvas-wrap img {
  width: 100%;
  height: auto;
  display: block;
}

/* Loading Spinner */
.pdf-loader {
  position: fixed;
  top: calc(var(--header-height) + 40px);
  left: 50%;
  transform: translateX(-50%);
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  z-index: 20;
  background: rgba(20, 20, 20, 0.9);
  padding: 18px 28px;
  border-radius: 10px;
  border: 1px solid var(--border-subtle);
  font-size: 13px;
  color: var(--text-muted);
}

.pdf-loader.visible {
  display: flex;
}

.spinner {
  width: 24px;
  height: 24px;
  border: 2.5px solid rgba(255, 255, 255, 0.15);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Fallback Card */
.pdf-fallback {
  min-height: calc(100vh - var(--header-height));
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
}

.pdf-fallback[hidden] {
  display: none;
}

.fallback-card {
  max-width: 480px;
  text-align: center;
  background: #141414;
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 36px 28px;
}

.fallback-card h2 {
  font-size: 20px;
  margin-bottom: 12px;
}

.fallback-card p {
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-muted);
  margin-bottom: 24px;
}

.fallback-card code {
  background: rgba(255, 255, 255, 0.08);
  padding: 2px 6px;
  border-radius: 4px;
  color: #fff;
}

.fallback-upload-btn {
  display: inline-block;
}

/* ================= DRAWER ================= */
.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  z-index: 190;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.drawer-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.nav-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 310px;
  max-width: 88vw;
  background: #121212;
  border-left: 1px solid var(--border-subtle);
  z-index: 200;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 28px;
  transform: translateX(100%);
  transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}

.nav-drawer.open {
  transform: translateX(0);
}

.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-subtle);
}

.drawer-title {
  font-size: 15px;
  font-weight: 600;
}

.drawer-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
}

.drawer-close:hover {
  color: #fff;
}

.drawer-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.45);
  margin-bottom: 12px;
}

.drawer-nav-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.drawer-link {
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 15px;
  padding: 10px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.drawer-link:hover,
.drawer-link.active {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.drawer-link.active {
  border-left: 2px solid var(--accent);
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  color: var(--text-white);
  cursor: pointer;
}

.toggle-row input {
  accent-color: var(--accent);
  width: 16px;
  height: 16px;
}

.tool-hint {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.5);
  margin-top: 6px;
  line-height: 1.4;
}

.btn-upload {
  display: inline-block;
  padding: 9px 14px;
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  font-size: 13px;
  color: #fff;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.04);
}

.btn-upload:hover {
  background: rgba(255, 255, 255, 0.1);
}

/* ================= CONTACT MODAL ================= */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  z-index: 300;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-backdrop.open {
  display: flex;
}

.modal-card {
  width: 100%;
  max-width: 440px;
  background: #141414;
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 28px;
}

.modal-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 24px;
  cursor: pointer;
}

.modal-sub {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 20px;
  line-height: 1.5;
}

.modal-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.modal-form input,
.modal-form textarea {
  width: 100%;
  background: #0d0d0d;
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  padding: 11px 14px;
  color: #fff;
  font-family: inherit;
  font-size: 14px;
}

.modal-form input:focus,
.modal-form textarea:focus {
  outline: none;
  border-color: var(--accent);
}

.full-width {
  width: 100%;
}

/* ================= RESPONSIVE ================= */
@media (max-width: 980px) {
  .header-inner {
    padding: 0 20px;
  }

  .main-nav {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .main-nav::-webkit-scrollbar {
    display: none;
  }

  .nav-list {
    gap: 20px;
    margin: 0 auto;
  }
}

@media (max-width: 640px) {
  .site-header {
    height: auto;
    min-height: 52px;
  }

  .header-inner {
    padding: 6px max(10px, env(safe-area-inset-right)) 6px max(10px, env(safe-area-inset-left));
    gap: 10px;
  }

  .main-nav {
    overflow-x: visible;
  }

  .nav-list {
    flex-wrap: wrap;
    justify-content: center;
    gap: 4px 8px;
    width: 100%;
  }

  .nav-link {
    font-size: clamp(10px, 3vw, 10px);
    padding: 6px 8px;
    min-height: 34px;
  }
}

@media (max-width: 380px) {
  .nav-list {
    gap: 2px 6px;
  }

  .nav-link {
    font-size: 8px;
    padding: 3px 3px;
    min-height: 26px;
  }

  .btn-cta {
    padding: 9px 14px;
    font-size: 13px;
  }
}