/*
 * Base styles — Phase 2: common layout / navigation foundation.
 * Design direction (basic_design_v1.md §10): white base, minimal, mobile-first.
 */

/* --------------------------------------------------------------------------
   Reset / base
   -------------------------------------------------------------------------- */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: #ffffff;
  color: #1a1a1a;
  line-height: 1.6;
  min-height: 100vh;
}

a {
  color: inherit;
  text-decoration: none;
}

/* --------------------------------------------------------------------------
   App shell
   -------------------------------------------------------------------------- */

#app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* --------------------------------------------------------------------------
   Header / navigation
   -------------------------------------------------------------------------- */

#site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: #ffffff;
  border-bottom: 1px solid #e5e7eb;
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 1rem;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0.75rem 1rem;
}

.site-title {
  font-size: 1rem;
  font-weight: 600;
  color: #111827;
  white-space: nowrap;
}

#main-nav {
  display: flex;
  gap: 0.25rem;
  flex-wrap: wrap;
}

.nav-link {
  display: inline-block;
  padding: 0.375rem 0.75rem;
  border-radius: 0.375rem;
  font-size: 0.875rem;
  color: #4b5563;
  transition: background 0.15s, color 0.15s;
}

.nav-link:hover,
.nav-link[aria-current="page"] {
  background: #f3f4f6;
  color: #111827;
}

.nav-link[aria-current="page"] {
  font-weight: 500;
}

.nav-toggle {
  display: none;
  margin-left: auto;
  padding: 0.375rem 0.5rem;
  background: none;
  border: none;
  font-size: 1.25rem;
  cursor: pointer;
  color: #4b5563;
}

/* --------------------------------------------------------------------------
   Main content
   -------------------------------------------------------------------------- */

#main-content {
  flex: 1;
  max-width: 1100px;
  width: 100%;
  margin: 0 auto;
  padding: 1.5rem 1rem;
}

/* --------------------------------------------------------------------------
   Page skeleton (Phase 2: empty frame placeholders)
   -------------------------------------------------------------------------- */

.page-header {
  margin-bottom: 1.5rem;
}

.page-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: #111827;
}

.page-description {
  margin-top: 0.25rem;
  font-size: 0.875rem;
  color: #6b7280;
}

.page-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  border: 1px dashed #d1d5db;
  border-radius: 0.5rem;
  background: #f9fafb;
  color: #9ca3af;
  font-size: 0.875rem;
}

/* --------------------------------------------------------------------------
   Error display (G-07)
   -------------------------------------------------------------------------- */

.error-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 300px;
  text-align: center;
  gap: 0.75rem;
}

.error-code {
  font-size: 2rem;
  font-weight: 700;
  color: #d1d5db;
}

.error-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: #374151;
}

.error-message {
  font-size: 0.875rem;
  color: #6b7280;
  max-width: 400px;
}

.error-action {
  margin-top: 0.5rem;
}

.btn {
  display: inline-block;
  padding: 0.5rem 1rem;
  border-radius: 0.375rem;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid #d1d5db;
  background: #ffffff;
  color: #374151;
  transition: background 0.15s;
}

.btn:hover {
  background: #f3f4f6;
}

/* --------------------------------------------------------------------------
   Loading state
   -------------------------------------------------------------------------- */

.loading-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  color: #9ca3af;
  font-size: 0.875rem;
}

/* --------------------------------------------------------------------------
   Mobile layout
   -------------------------------------------------------------------------- */

@media (max-width: 640px) {
  .nav-toggle {
    display: block;
  }

  #main-nav {
    display: none;
    flex-direction: column;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #ffffff;
    border-bottom: 1px solid #e5e7eb;
    padding: 0.5rem 1rem 1rem;
    z-index: 99;
  }

  #main-nav.open {
    display: flex;
  }

  .nav-link {
    padding: 0.625rem 0.75rem;
    font-size: 1rem;
  }

  #site-header {
    position: relative;
  }
}
