/*
Theme Name: DA-VE
Theme URI: https://da-ve.ai
Author: Barry
Description: Site-specific theme for da-ve.ai. Minimal, no dependencies, no opinions. Built to demonstrate the Ledger's central thesis: specific software beats general-purpose software at the one thing you actually need.
Version: 1.0.0
Requires at least: 6.0
Tested up to: 6.9
Requires PHP: 7.4
License: GPL-2.0-or-later
Text Domain: dave
*/

/* =============================================================
   DA-VE - site-specific stylesheet
   Reading-first blog, no fighting with a parent theme.

     1 Tokens
     2 Base
     3 Header
     4 Homepage feed (cover cards, B&W at 70%)
     5 Single post / page (reading column)
     6 Featured image (on the post)
     7 Share row (foot of single post)
     8 Pagination / Archive / The tally
     9 Responsive
   ============================================================= */

/* 1 - TOKENS --------------------------------------------------- */
:root {
  --ink:     #101419;
  --muted:   #53606d;
  --line:    #e3e7ea;
  --bg:      #ffffff;
  --bar:     #000000;
  --accent:  #1b64ff;
  --font:    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --pad:     clamp(20px, 5vw, 40px);
  --content: 44rem;
  --feed:    880px;
  --header-h: 84px;
}

/* 2 - BASE ----------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; overflow-x: hidden; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  /* Sticky footer — short pages were letting the footer ride up. Body
     becomes a flex column so the footer can claim leftover space below. */
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
}
img, svg, video { max-width: 100%; height: auto; }
a { color: inherit; }

/* 3 - HEADER --------------------------------------------------- */
.dave-header {
  background: var(--bar);
  color: #fff;
  padding: 14px var(--pad);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
}
.dave-logo a { display: inline-flex; }
.dave-logo-svg {
  display: block;
  width: auto;
  height: 56px;
  color: #fff;
}
.dave-nav {
  display: flex;
  gap: 32px;
  list-style: none;
  margin: 0;
  padding: 0;
}
.dave-nav a {
  color: #fff;
  text-decoration: none;
  font-weight: 600;
  line-height: 1;
  padding: 8px 0;
  display: inline-block;
}
.dave-nav a:hover,
.dave-nav a:focus { color: #fff; opacity: 0.62; }
.dave-menu-toggle {
  display: none;
  background: transparent;
  border: 0;
  color: #fff;
  cursor: pointer;
  padding: 4px;
}

/* 4 - HOMEPAGE FEED ------------------------------------------- */
.dave-post-feed { padding: 32px var(--pad) 56px; }

.dave-intro {
  position: relative;
  max-width: var(--feed);
  margin: 0 auto;
  padding: clamp(28px, 5vw, 52px) var(--pad);
  min-height: calc(100vh - var(--header-h));
  min-height: calc(100svh - var(--header-h));
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--ink);
  font-size: clamp(1.35rem, 2.2vw, 1.65rem);
  line-height: 1.5;
}
/* Scroll cue at the bottom of the hero splash — there is more below.
   The site's one bold-red note (#C8102E, Penguin/Pelican-style editorial red). */
.dave-intro::after {
  content: "";
  position: absolute;
  bottom: clamp(20px, 4vh, 40px);
  left: 50%;
  width: 28px;
  height: 16px;
  background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 14' fill='none' stroke='%23C8102E' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'><polyline points='3 3 12 12 21 3'/></svg>") no-repeat center;
  background-size: contain;
  transform: translateX(-50%);
  animation: dave-cue-bob 2.4s ease-in-out infinite;
}
@keyframes dave-cue-bob {
  0%, 100% { transform: translate(-50%, 0); }
  50%      { transform: translate(-50%, 6px); }
}
@media (prefers-reduced-motion: reduce) {
  .dave-intro::after { animation: none; }
}
/* Hide the hero splash on page 2+ of the feed — straight into the articles. */
body.dave-paged .dave-intro { display: none; }

.dave-feed-item {
  position: relative;
  overflow: hidden;
  border-radius: 14px;
  max-width: var(--feed);
  margin: 0 auto 32px;
  min-height: 480px;
  padding: clamp(32px, 5vw, 48px) clamp(28px, 4vw, 44px);
  background: #0f1217;
  color: #fff;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  box-sizing: border-box;
}
/* If WordPress wraps the group's children in an inner-container (older
   layout system), dissolve the wrapper so flex layout still works. */
.dave-feed-item > .wp-block-group__inner-container {
  display: contents;
}
.dave-feed-item .wp-block-post-featured-image {
  position: absolute;
  inset: 0;
  margin: 0;
  z-index: 0;
}
.dave-feed-item .wp-block-post-featured-image a {
  display: block;
  width: 100%;
  height: 100%;
}
.dave-feed-item .wp-block-post-featured-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.home .dave-feed-item .wp-block-post-featured-image img {
  filter: grayscale(70%);
}
.dave-feed-item::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 70%;
  background: linear-gradient(to top, rgba(0,0,0,0.94) 0%, rgba(0,0,0,0.75) 45%, rgba(0,0,0,0) 100%);
  z-index: 1;
  pointer-events: none;
}
.dave-feed-item .dave-kicker,
.dave-feed-item .dave-feed-title,
.dave-feed-item .wp-block-post-excerpt {
  position: relative;
  z-index: 2;
}
.dave-kicker {
  margin: 0 0 14px;
  color: #fff;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}
.dave-feed-title {
  margin: 6px 0 14px;
  font-size: clamp(1.9rem, 3vw, 2.5rem);
  line-height: 1.08;
}
.dave-feed-title a { color: #fff; text-decoration: none; }
.dave-feed-title a:hover { text-decoration: underline; text-underline-offset: 6px; }
.dave-feed-item .wp-block-post-excerpt__excerpt {
  color: rgba(255, 255, 255, 0.92);
  font-size: 1.1rem;
  line-height: 1.55;
  max-width: 38rem;
}
.dave-feed-item .wp-block-post-excerpt__more-link {
  display: inline-block;
  margin-top: 14px;
  color: #fff;
  font-weight: 400;
  text-decoration: underline;
}

/* 5 - SINGLE POST / PAGE -------------------------------------- */
.dave-article {
  max-width: var(--content);
  margin: 0 auto;
  padding: clamp(40px, 6vw, 76px) var(--pad);
}
.dave-article-title {
  margin: 0 0 26px;
  font-size: clamp(2.4rem, 6vw, 4rem);
  line-height: 1.06;
}
.dave-article-content p {
  font-size: 1.18rem;
  line-height: 1.75;
}
.dave-article-content h2 { margin: 2em 0 0.6em; font-size: 1.7rem; line-height: 1.2; }
.dave-article-content h3 { margin: 1.8em 0 0.5em; font-size: 1.35rem; line-height: 1.25; }
.dave-article-content a { color: var(--ink); text-underline-offset: 3px; }
.dave-article-content blockquote {
  border-left: 3px solid var(--line);
  margin: 1.5em 0;
  padding: 0.2em 0 0.2em 1.2em;
  color: var(--muted);
}
.dave-article-content pre,
.dave-article-content .wp-block-code {
  background: #0f1217;
  color: #f4f5f6;
  border-radius: 8px;
  padding: 18px 20px;
  font-size: 0.95rem;
  line-height: 1.55;
  overflow-x: auto;
}
.dave-article-content .wp-block-table { margin: 1.5em 0; }
.dave-article-content .wp-block-table table { border-collapse: collapse; width: 100%; }
.dave-article-content .wp-block-table th,
.dave-article-content .wp-block-table td {
  border-bottom: 1px solid var(--line);
  padding: 8px 12px;
  text-align: left;
  vertical-align: top;
}
.dave-article-content .wp-block-list {
  font-size: 1.18rem;
  line-height: 1.75;
}

/* 6 - FEATURED IMAGE (on the post) ---------------------------- */
.dave-featured-image {
  max-width: var(--content);
  margin: var(--pad) auto 0;
}
.dave-featured-image img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 10px;
}

/* 7 - SHARE / SUBSCRIBE ROW (foot of single post) ------------- */
.dave-share-row {
  max-width: var(--content);
  margin: 0 auto;
  padding: 0 var(--pad) clamp(40px, 6vw, 76px);
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}
.dave-share {
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 500;
  padding: 10px 22px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  transition: background 120ms ease, color 120ms ease, border-color 120ms ease;
}
a.dave-share {
  color: var(--ink);
}
.dave-share:hover {
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
}
.dave-share:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.dave-share.is-confirmed {
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
}

/* Site footer (every page) */
.dave-site-footer {
  text-align: center;
  padding: 48px var(--pad);
  color: var(--muted);
  font-size: 0.9rem;
  /* Claim leftover space so the footer pins to the bottom on short pages. */
  margin-top: auto;
}
.dave-site-footer a {
  color: var(--muted);
  text-decoration: none;
}
.dave-site-footer a:hover {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* Quiet performance HUD — three numbers under the copyright line. */
.dave-hud {
  margin-top: 6px;
  font-size: 0.72rem;
  color: var(--muted);
  opacity: 0.65;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
}
.dave-hud:empty { display: none; }
.dave-hud span {
  cursor: help;
  border-bottom: 1px dotted transparent;
}
.dave-hud span:hover {
  border-bottom-color: currentColor;
}

/* 8 - PAGINATION / ARCHIVE / THE TALLY ------------------------ */

/* Homepage feed pagination — prev | numbers | next */
.wp-block-query-pagination {
  display: flex;
  justify-content: center;
  align-items: baseline;
  gap: 24px;
  max-width: var(--feed);
  margin: 0 auto;
  padding: 32px var(--pad) 8px;
  font-weight: 500;
}
.wp-block-query-pagination a {
  color: var(--ink);
  text-decoration: none;
}
.wp-block-query-pagination a:hover {
  text-decoration: underline;
  text-underline-offset: 4px;
}
.wp-block-query-pagination-numbers {
  display: inline-flex;
  gap: 14px;
}
.wp-block-query-pagination-numbers .page-numbers {
  color: var(--muted);
}
.wp-block-query-pagination-numbers .page-numbers:hover {
  color: var(--ink);
  text-decoration: none;
}
.wp-block-query-pagination-numbers .page-numbers.current {
  color: var(--ink);
  font-weight: 700;
}

/* Archive page — flat chronological list */
.dave-archive .wp-block-post-template {
  list-style: none;
  padding: 0;
  margin: 24px 0 0;
}
.dave-archive-entry {
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}
.dave-archive-row {
  gap: 16px;
  align-items: baseline;
}
.dave-archive-title {
  margin: 0;
  font-size: 1.15rem;
  line-height: 1.35;
  flex: 1;
}
.dave-archive-excerpt {
  color: var(--muted);
  font-size: 0.98rem;
  line-height: 1.5;
  max-width: 64ch;
}
.dave-archive-excerpt p {
  margin: 4px 0 0;
}
.dave-archive-title a {
  color: var(--ink);
  text-decoration: none;
}
.dave-archive-title a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}
.dave-archive-date {
  color: var(--muted);
  font-size: 0.95rem;
  white-space: nowrap;
}

/* The tally — Ledger savings/earning table */
.dave-article-content .wp-block-table.dave-tally td:nth-child(n+2),
.dave-article-content .wp-block-table.dave-tally th:nth-child(n+2) {
  white-space: nowrap;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* 9 - RESPONSIVE ---------------------------------------------- */
@media (max-width: 780px) {
  :root { --header-h: 68px; }
  .dave-header { padding: 12px 16px; }
  .dave-logo-svg { height: 44px; }
  .dave-nav { display: none; }
  .dave-menu-toggle { display: inline-flex; }
  .dave-nav.is-open {
    display: flex;
    position: absolute;
    top: 100%;
    right: 16px;
    flex-direction: column;
    background: var(--bar);
    box-shadow: 0 14px 34px rgba(0,0,0,0.28);
    padding: 8px 0;
    z-index: 200;
    gap: 0;
  }
  .dave-nav.is-open li { display: block; }
  .dave-nav.is-open a { padding: 11px 26px; line-height: 1.4; }

  .dave-article {
    padding-left: 16px;
    padding-right: 16px;
  }

  .dave-featured-image {
    margin: 16px 0 0;
    padding: 0;
  }
  .dave-featured-image img { border-radius: 0; }

  .dave-post-feed {
    padding-top: 20px;
    padding-left: 16px;
    padding-right: 16px;
  }
  .dave-feed-item {
    margin-bottom: 20px;
    border-radius: 0;
    margin-left: -16px;
    margin-right: -16px;
    max-width: none;
    padding: 24px;
  }
  .dave-feed-item::after {
    height: 75%;
  }
  .dave-feed-item .wp-block-post-featured-image img { border-radius: 0; }
  .dave-feed-title { font-size: clamp(2.2rem, 9vw, 2.8rem); }
  .dave-feed-item .wp-block-post-excerpt__excerpt { font-size: 1rem; }
}
