/* pages.css — shared layout and components for all inner pages.
   Loaded after main.css on every page in pages/.
   ─────────────────────────────────────────────────────────────── */

/* ── page header / nav ───────────────────────────────────────────────────── */
.p-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(7,8,11,0.94);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}

.p-nav-inner {
  max-width: 1320px;
  margin: 0 auto;
  padding: 0 28px;
  height: 54px;
  display: flex;
  align-items: center;
  gap: 24px;
}

.p-nav-back {
  display: flex;
  align-items: center;
  gap: 7px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text3);
  text-decoration: none;
  padding: 4px 8px;
  border-radius: 5px;
  transition: color 0.15s, background 0.15s;
  border: 1px solid transparent;
  flex-shrink: 0;
}

.p-nav-back:hover {
  color: var(--text2);
  background: var(--surface);
  border-color: var(--border);
}

.p-nav-divider {
  width: 1px;
  height: 18px;
  background: var(--border);
  flex-shrink: 0;
}

.p-nav-title {
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.p-nav-links {
  display: flex;
  gap: 2px;
  margin-left: 16px;
}

.p-nav-link {
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 500;
  color: var(--text3);
  text-decoration: none;
  padding: 5px 10px;
  border-radius: 5px;
  transition: color 0.15s, background 0.15s;
}

.p-nav-link:hover { color: var(--text2); background: var(--surface); }
.p-nav-link.active { color: var(--accent); background: var(--accent-lo); }

.p-status-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text3);
}

/* ── page main ───────────────────────────────────────────────────────────── */
.p-main {
  max-width: 1320px;
  margin: 0 auto;
  padding: 36px 28px 80px;
}

/* ── page hero bar ───────────────────────────────────────────────────────── */
.p-hero {
  margin-bottom: 36px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}

.p-hero-text {}

.p-page-title {
  font-family: var(--serif);
  font-size: 32px;
  font-weight: 300;
  color: var(--text);
  letter-spacing: -0.02em;
  margin-bottom: 4px;
}

.p-page-sub {
  font-size: 13px;
  color: var(--text3);
  line-height: 1.5;
  max-width: 560px;
}

.p-hero-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-shrink: 0;
}

/* ── auth forms ──────────────────────────────────────────────────────────── */
.p-auth-wrap {
  min-height: calc(100vh - 54px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
}

.p-auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 40px;
}

.p-auth-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 32px;
}

.p-auth-title {
  font-family: var(--serif);
  font-size: 26px;
  font-weight: 300;
  color: var(--text);
  letter-spacing: -0.02em;
  margin-bottom: 6px;
}

.p-auth-sub {
  font-size: 13px;
  color: var(--text3);
  margin-bottom: 28px;
}

.p-field {
  margin-bottom: 16px;
}

.p-field-label {
  display: block;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 6px;
}

.p-input {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: 7px;
  padding: 10px 14px;
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.p-input::placeholder { color: var(--text3); }

.p-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-lo);
}

.p-input-mono {
  font-family: var(--mono);
  font-size: 12px;
}

.p-submit {
  width: 100%;
  margin-top: 8px;
  background: var(--accent);
  color: #000;
  border: none;
  border-radius: 7px;
  padding: 11px;
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

.p-submit:hover { background: #fbbf24; }

.p-submit:disabled {
  background: var(--border2);
  color: var(--text3);
  cursor: not-allowed;
}

.p-auth-footer {
  text-align: center;
  margin-top: 20px;
  font-size: 13px;
  color: var(--text3);
}

.p-auth-footer a {
  color: var(--accent);
  text-decoration: none;
}

.p-form-error {
  display: none;
  background: var(--red-lo);
  border: 1px solid var(--red);
  border-radius: 7px;
  padding: 10px 14px;
  font-size: 13px;
  color: var(--red);
  margin-bottom: 16px;
}

.p-form-success {
  display: none;
  background: var(--green-lo);
  border: 1px solid var(--green);
  border-radius: 7px;
  padding: 10px 14px;
  font-size: 13px;
  color: var(--green);
  margin-bottom: 16px;
}

/* ── cite.html reference layout ──────────────────────────────────────────── */
.p-ref-grid {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 32px;
  align-items: start;
}

.p-ref-toc {
  position: sticky;
  top: 80px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
}

.p-toc-title {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.p-toc-link {
  display: block;
  font-size: 12px;
  color: var(--text3);
  text-decoration: none;
  padding: 5px 8px;
  border-radius: 5px;
  transition: color 0.15s, background 0.15s;
  margin-bottom: 2px;
}

.p-toc-link:hover { color: var(--text2); background: var(--surface2); }
.p-toc-link.active { color: var(--accent); background: var(--accent-lo); }

.p-ref-content {}

.p-ref-section {
  margin-bottom: 48px;
  scroll-margin-top: 80px;
}

.p-ref-section-title {
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 400;
  color: var(--text);
  letter-spacing: -0.01em;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.p-cmd-block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 12px;
}

.p-cmd-header {
  background: var(--surface2);
  padding: 8px 16px;
  border-bottom: 1px solid var(--border);
  font-family: var(--mono);
  font-size: 12px;
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.p-cmd-header .cmd-desc {
  font-size: 11px;
  color: var(--text3);
  font-family: var(--sans);
}

.p-cmd-body {
  padding: 14px 16px;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.7;
  color: var(--text2);
  white-space: pre;
}

.p-cmd-body .prompt,
.p-cmd-body .ok,
.p-cmd-body .muted,
.p-cmd-body .arg {
  display: block;
}

.p-cmd-body .prompt { color: var(--accent); }
.p-cmd-body .ok     { color: var(--green); }
.p-cmd-body .muted  { color: var(--text3); }
.p-cmd-body .arg    { color: var(--blue); }

.p-flags-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.p-flags-table th {
  text-align: left;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  padding: 6px 10px;
  border-bottom: 1px solid var(--border);
}

.p-flags-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  color: var(--text2);
}

.p-flags-table td:first-child {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--accent);
}

/* ── responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .p-ref-grid { grid-template-columns: 1fr; }
  .p-ref-toc  { position: static; }
}

@media (max-width: 640px) {
  .p-main    { padding: 24px 16px 60px; }
  .p-nav-inner { padding: 0 16px; gap: 12px; }
  /* Show nav links as a horizontally-scrollable strip below the main bar */
  .p-nav-links {
    display: flex;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    gap: 2px;
    padding: 0 16px 6px;
    border-top: 1px solid var(--border);
    background: rgba(7,8,11,0.94);
  }
  .p-nav-links::-webkit-scrollbar { display: none; }
  .p-nav {
    /* Extend sticky nav to cover the link strip */
    padding-bottom: 0;
  }
}

/* ── account split button ────────────────────────────────────────────────── */
.p-account-btn {
  position: relative;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px;
  border-radius: 7px;
  border: 1px solid var(--border2);
  background: var(--surface);
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 500;
  color: var(--text2);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
  user-select: none;
  flex-shrink: 0;
}

.p-account-btn:hover {
  border-color: var(--accent);
  color: var(--text);
}

.p-account-btn.open {
  border-color: var(--accent);
  background: var(--surface2);
}

.p-account-caret {
  font-size: 9px;
  color: var(--text3);
  transition: transform 0.2s;
}

.p-account-btn.open .p-account-caret { transform: rotate(180deg); }

.p-account-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 180px;
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: 9px;
  box-shadow: 0 12px 32px rgba(0,0,0,0.5);
  padding: 6px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-6px);
  transition: opacity 0.15s, transform 0.15s;
  z-index: 200;
}

.p-account-btn.open .p-account-dropdown {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.p-account-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 6px;
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 500;
  color: var(--text2);
  text-decoration: none;
  transition: background 0.1s, color 0.1s;
}

.p-account-item:hover {
  background: var(--surface2);
  color: var(--text);
}

.p-account-item i {
  font-size: 12px;
  width: 14px;
  color: var(--text3);
}

.p-account-item:hover i { color: var(--text2); }

.p-account-signup {
  color: var(--accent);
}

.p-account-signup i { color: var(--accent); opacity: 0.8; }
.p-account-signup:hover { background: var(--accent-lo); color: var(--accent); }
.p-account-signup:hover i { color: var(--accent); }

.p-account-divider {
  height: 1px;
  background: var(--border);
  margin: 4px 0;
}

.p-account-signout { color: var(--red); }
.p-account-signout i { color: var(--red); opacity: 0.8; }
.p-account-signout:hover { background: var(--red-lo); color: var(--red); }
.p-account-signout:hover i { color: var(--red); }

/* ── nav icon button (theme toggle, etc.) ────────────────────────────────── */
.p-nav-iconbtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  background: var(--accent-lo);
  border: 1px solid var(--accent);
  color: var(--accent);
  cursor: pointer;
  font-size: 13px;
  transition: background 0.12s;
}
.p-nav-iconbtn:hover { background: var(--accent); color: #000; }
.p-nav-iconbtn i { line-height: 1; }

/* ── Feature 9: notification bell ────────────────────────────────────────── */
.notif-bell {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text3);
  cursor: pointer;
  font-size: 13px;
  transition: background 0.12s, color 0.12s;
  text-decoration: none;
}
.notif-bell:hover, .notif-bell.has-notif { color: var(--accent); border-color: var(--accent); background: var(--accent-lo); }
.notif-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: var(--red);
  color: #fff;
  font-family: var(--mono);
  font-size: 8px;
  min-width: 14px;
  height: 14px;
  border-radius: 99px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 2px;
  pointer-events: none;
}

/* ── shared modal ────────────────────────────────────────────────────────── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  z-index: 300;
  align-items: center;
  justify-content: center;
}
.modal-overlay.open { display: flex; }
.modal-box {
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: 12px;
  padding: 32px;
  width: 100%;
  max-width: 440px;
}
.modal-title {
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 300;
  color: var(--text);
  margin-bottom: 4px;
  letter-spacing: -0.01em;
}
.modal-sub { font-size: 12px; color: var(--text3); margin-bottom: 24px; }

/* ── notification feed ───────────────────────────────────────────────────── */
.notif-feed { display: flex; flex-direction: column; }
.notif-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.1s;
  border-bottom: 1px solid var(--border);
}
.notif-row:last-child { border-bottom: none; }
.notif-row:hover { background: var(--surface); }
.notif-row.unread { background: var(--accent-lo); }
.notif-row.unread:hover { background: color-mix(in srgb, var(--accent) 15%, transparent); }
.notif-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--surface2);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: var(--text3);
  flex-shrink: 0;
}
.notif-body { flex: 1; min-width: 0; font-size: 13px; }
.notif-repo { font-family: var(--mono); font-size: 12px; color: var(--accent); }
.notif-action { color: var(--text3); font-size: 12px; }
.notif-time { font-family: var(--mono); font-size: 11px; color: var(--text3); margin-top: 3px; }
.notif-read-btn {
  background: none;
  border: none;
  color: var(--text3);
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 4px;
  font-size: 11px;
  flex-shrink: 0;
  transition: color 0.12s;
}
.notif-read-btn:hover { color: var(--green); }
