/* ============================================================
   page.css: the layout of the project and note pages (projects/, notes/),
   which tools/make_pages.js generates from js/content.js.

   It loads after style.css and reuses it: the write-up uses the same
   .article-body styles as the detail dialog on index.html (headings,
   paragraphs, lists, fact lists, screenshots, demo video), so a page and
   its dialog look alike. This file only adds the page frame: the top bar,
   the sheet, the previous/next links and the footer.
   ============================================================ */

/* Shared width of every block on the page. */
.page-bar,
.page-sheet,
.page-nav,
.page-footer {
  width: min(880px, calc(100% - 32px));
  margin-left: auto;
  margin-right: auto;
}

/* Top bar: the brand on the left; "All projects" (or "All notes") and the theme switch on the right. */
.page-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 20px;
}

/* style.css reorders .brand in the main header on phones; on these pages it always stays first, on the left. */
.page-bar .brand {
  order: 0;
}

.page-bar-links {
  display: flex;
  align-items: center;
  gap: 10px;
}

.page-bar-links .button {
  min-height: 42px;
  padding: 0 16px;
  font-size: 14px;
}

/* The sheet: one card holding the whole write-up. */
.page-sheet {
  margin-top: 16px;
  padding: clamp(28px, 6vw, 56px) clamp(22px, 6vw, 60px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-md);
}

.page-sheet h1 {
  margin: 0 0 10px;
  font-size: clamp(32px, 5vw, 48px);
  line-height: 1.1;
  letter-spacing: -.04em;
}

.page-tagline {
  margin: 0 0 18px;
  color: var(--dim);
  font: 500 12.5px var(--font-mono);
  letter-spacing: .06em;
  text-transform: uppercase;
}

.page-lead {
  margin: 0;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.75;
}

.page-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
}

/* The write-up. .article-body (style.css) gives it the dialog's styles; here sections use h2 instead of h3. */
.page-body {
  margin-top: 32px;
  padding: 28px 0 0;
  border-top: 1px solid var(--border);
}

.page-body h2 {
  margin: 30px 0 10px;
  font-size: 20px;
  letter-spacing: -.02em;
}

.page-body > h2:first-child {
  margin-top: 0;
}

.page-body .shots h2,
.page-body .demo h2 {
  margin-top: 26px;
}

/* Previous and next: two cards side by side, the next one on the right. */
.page-nav {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 20px;
}

.page-nav-link {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 72px;
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  transition: border-color .2s ease;
}

.page-nav-link:hover {
  border-color: var(--brand-line);
}

.page-nav-link small {
  color: var(--dim);
  font: 500 12px var(--font-mono);
  letter-spacing: .06em;
  text-transform: uppercase;
}

.page-nav-link b {
  color: var(--text);
  font-size: 15px;
  line-height: 1.4;
}

.page-nav-link.next {
  grid-column: 2;
  text-align: right;
}

/* Footer: a short line of links, and the visit-counting note (shown only while counting is on). */
.page-footer {
  margin-top: 28px;
  margin-bottom: 40px;
  color: var(--dim);
  font-size: 13.5px;
}

.page-footer p {
  margin: 0 0 6px;
}

.page-footer a {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  color: var(--muted);
}

.page-footer a:hover {
  color: var(--text);
}

/* Phones: the previous and next cards stack. */
@media (max-width: 640px) {
  .page-bar-links .button {
    padding: 0 12px;
  }

  .page-nav {
    grid-template-columns: minmax(0, 1fr);
  }

  .page-nav-link.next {
    grid-column: auto;
  }

  .page-lead {
    font-size: 16px;
  }
}

/* Print: only the write-up, black on white. */
@media print {
  .page-bar,
  .page-nav,
  .page-footer,
  .page-actions {
    display: none !important;
  }

  .page-sheet {
    width: auto;
    margin: 0;
    padding: 0;
    border: 0;
    box-shadow: none;
    background: white;
  }
}
