/* ============================================
   dylanberry.com v2
   Warm editorial design, strong typography,
   no AI-template vibes
   ============================================ */

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

:root {
  --bg: #FDFAF6;
  --bg-alt: #F5F0E8;
  --bg-code: #2B2B2B;
  --text: #1A1A1A;
  --text-secondary: #555;
  --text-tertiary: #888;
  --rule: #D4CFC6;
  --accent: #B44A2D;
  --accent-hover: #933D25;
  --link: #2858A5;
  --link-hover: #1A3D73;
  --mono: 'JetBrains Mono', 'SF Mono', 'Fira Code', monospace;
  --serif: 'Newsreader', 'Georgia', 'Times New Roman', serif;
  --sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --measure: 680px;
  --wide: 1080px;
  --transition: 0.15s ease;
}

html { scroll-behavior: smooth; }

body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  font-size: 17px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection {
  background: var(--accent);
  color: #fff;
}

a {
  color: var(--link);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
  transition: color var(--transition);
}
a:hover { color: var(--link-hover); }

img { max-width: 100%; height: auto; }

/* --- Layout --- */
.wrap { max-width: var(--wide); margin: 0 auto; padding: 0 32px; }
.wrap--narrow { max-width: var(--measure); margin: 0 auto; padding: 0 32px; }

/* --- Navigation --- */
.site-nav {
  padding: 24px 0;
  border-bottom: 1px solid var(--rule);
}
.site-nav .wrap {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 24px;
}
.site-nav__home {
  font-family: var(--mono);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.01em;
}
.site-nav__home:hover { color: var(--accent); }

.site-nav__links {
  display: flex;
  gap: 32px;
}
.site-nav__link {
  font-size: 0.9rem;
  color: var(--text-secondary);
  text-decoration: none;
  transition: color var(--transition);
}
.site-nav__link:hover,
.site-nav__link--active { color: var(--text); }

.site-nav__toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  color: var(--text);
}
.site-nav__toggle svg { display: block; }

/* --- Hero --- */
.hero {
  padding: 100px 0 80px;
}
.hero__intro {
  font-family: var(--mono);
  font-size: 0.82rem;
  color: var(--text-tertiary);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 20px;
}
.hero__title {
  font-family: var(--serif);
  font-size: clamp(2.4rem, 5vw, 3.6rem);
  font-weight: 500;
  line-height: 1.15;
  max-width: 780px;
  margin-bottom: 28px;
  letter-spacing: -0.02em;
  color: var(--text);
}
.hero__title em {
  font-style: italic;
  color: var(--accent);
}
.hero__blurb {
  font-size: 1.1rem;
  color: var(--text-secondary);
  max-width: 560px;
  line-height: 1.75;
  margin-bottom: 36px;
}
.hero__cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1.5px solid var(--accent);
  padding-bottom: 2px;
  transition: all var(--transition);
}
.hero__cta:hover {
  color: var(--accent-hover);
  border-color: var(--accent-hover);
}
.hero__cta::after { content: ' →'; }

/* --- Section --- */
.section {
  padding: 64px 0;
}
.section--ruled {
  border-top: 1px solid var(--rule);
}
.section__label {
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  margin-bottom: 32px;
}
.section__heading {
  font-family: var(--serif);
  font-size: 1.8rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  margin-bottom: 12px;
}
.section__more {
  font-size: 0.85rem;
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid transparent;
}
.section__more:hover { border-color: var(--accent); }

/* --- Now section (replaces the generic "what I do" cards) --- */
.now-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  border: 1px solid var(--rule);
}
.now-item {
  padding: 28px 32px;
  border-bottom: 1px solid var(--rule);
}
.now-item:nth-child(odd) {
  border-right: 1px solid var(--rule);
}
.now-item:nth-last-child(-n+2) {
  border-bottom: none;
}
.now-item__title {
  font-family: var(--serif);
  font-size: 1.1rem;
  font-weight: 500;
  margin-bottom: 6px;
}
.now-item__desc {
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* --- Post list --- */
.post-list {
  list-style: none;
  padding: 0;
}
.post-list__item {
  padding: 20px 0;
  border-bottom: 1px solid var(--rule);
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  align-items: baseline;
}
.post-list__item:first-child {
  padding-top: 0;
}
.post-list__title {
  font-family: var(--serif);
  font-size: 1.15rem;
  font-weight: 500;
}
.post-list__title a {
  color: var(--text);
  text-decoration: none;
}
.post-list__title a:hover { color: var(--accent); }
.post-list__summary {
  font-size: 0.88rem;
  color: var(--text-secondary);
  margin-top: 4px;
  line-height: 1.6;
}
.post-list__date {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--text-tertiary);
  white-space: nowrap;
}

/* --- Project list --- */
.project-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 0;
  border-top: 1px solid var(--rule);
  border-left: 1px solid var(--rule);
}
.project-item {
  padding: 28px;
  border-right: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}
.project-item__title {
  font-family: var(--serif);
  font-size: 1.1rem;
  font-weight: 500;
  margin-bottom: 6px;
}
.project-item__title a {
  color: var(--text);
  text-decoration: none;
}
.project-item__title a:hover { color: var(--accent); }
.project-item__desc {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 12px;
}
.project-item__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.tag {
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--text-tertiary);
  background: var(--bg-alt);
  padding: 2px 8px;
  border-radius: 3px;
}

/* --- Colophon (bottom of homepage) --- */
.colophon {
  padding: 64px 0;
  border-top: 1px solid var(--rule);
}
.colophon__inner {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
}
.colophon__heading {
  font-family: var(--serif);
  font-size: 1.5rem;
  font-weight: 500;
  margin-bottom: 12px;
}
.colophon__text {
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.7;
}
.colophon__links {
  display: flex;
  gap: 24px;
  margin-top: 16px;
}
.colophon__link {
  font-size: 0.88rem;
  color: var(--text-secondary);
  text-decoration: none;
  border-bottom: 1px solid var(--rule);
  padding-bottom: 1px;
  transition: all var(--transition);
}
.colophon__link:hover {
  color: var(--text);
  border-color: var(--text);
}

/* --- Single article --- */
.article {
  padding: 80px 0 64px;
}
.article__label {
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  margin-bottom: 12px;
}
.article__title {
  font-family: var(--serif);
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: -0.02em;
  margin-bottom: 12px;
}
.article__meta {
  font-size: 0.85rem;
  color: var(--text-tertiary);
  margin-bottom: 48px;
  display: flex;
  gap: 12px;
}
.article__desc {
  font-family: var(--serif);
  font-size: 1.15rem;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 12px;
  font-style: italic;
}

/* --- Prose --- */
.prose h2 {
  font-family: var(--serif);
  font-size: 1.5rem;
  font-weight: 500;
  margin-top: 48px;
  margin-bottom: 16px;
}
.prose h3 {
  font-family: var(--serif);
  font-size: 1.2rem;
  font-weight: 500;
  margin-top: 36px;
  margin-bottom: 12px;
}
.prose p {
  margin-bottom: 20px;
  line-height: 1.8;
}
.prose ul, .prose ol {
  margin-bottom: 20px;
  padding-left: 20px;
}
.prose li {
  margin-bottom: 6px;
  line-height: 1.7;
}
.prose strong { font-weight: 600; }
.prose blockquote {
  border-left: 2px solid var(--accent);
  padding: 4px 0 4px 24px;
  margin: 28px 0;
  font-family: var(--serif);
  font-style: italic;
  color: var(--text-secondary);
}
.prose blockquote p { margin-bottom: 0; }
.prose code {
  font-family: var(--mono);
  font-size: 0.85em;
  padding: 2px 6px;
  background: var(--bg-alt);
  border-radius: 3px;
}
.prose pre {
  margin: 28px 0;
  padding: 20px 24px;
  background: var(--bg-code) !important;
  border-radius: 4px;
  overflow-x: auto;
  line-height: 1.5;
}
.archive-gist__meta {
  margin-bottom: 10px;
  font-size: 0.85rem;
  color: var(--text-tertiary);
}
.archive-gist__meta a {
  color: var(--link);
}
.prose pre code {
  padding: 0;
  background: none;
  color: #E0E0E0;
  font-size: 0.84rem;
}
.prose img {
  margin: 28px 0;
  border-radius: 4px;
}
.prose a {
  color: var(--link);
}
.prose hr {
  border: none;
  border-top: 1px solid var(--rule);
  margin: 48px 0;
}

/* --- Article tags --- */
.article__tags {
  margin-top: 48px;
  padding-top: 20px;
  border-top: 1px solid var(--rule);
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

/* --- Article nav --- */
.article__nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid var(--rule);
}
.article__nav-link {
  font-size: 0.9rem;
  text-decoration: none;
  color: var(--text-secondary);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.article__nav-link:hover { color: var(--text); }
.article__nav-link small {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.article__nav-link--next { text-align: right; grid-column: 2; }

/* --- Archive / list --- */
.archive {
  padding: 80px 0 64px;
}
.archive__title {
  font-family: var(--serif);
  font-size: 2rem;
  font-weight: 500;
  margin-bottom: 8px;
}
.archive__desc {
  color: var(--text-secondary);
  margin-bottom: 40px;
  font-size: 0.95rem;
}

/* --- Footer --- */
.site-footer {
  border-top: 1px solid var(--rule);
  padding: 32px 0;
}
.site-footer .wrap {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 16px;
}
.site-footer__copy {
  font-size: 0.78rem;
  color: var(--text-tertiary);
}
.site-footer__links {
  display: flex;
  gap: 20px;
}
.site-footer__link {
  font-size: 0.8rem;
  color: var(--text-tertiary);
  text-decoration: none;
}
.site-footer__link:hover { color: var(--text); }

/* --- Pagination --- */
.pagination {
  display: flex;
  justify-content: center;
  gap: 4px;
  margin-top: 48px;
  list-style: none;
  padding: 0;
}
.page-item .page-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  font-size: 0.85rem;
  color: var(--text-secondary);
  text-decoration: none;
  border-radius: 3px;
}
.page-item .page-link:hover { background: var(--bg-alt); color: var(--text); }
.page-item.active .page-link {
  background: var(--text);
  color: var(--bg);
}

/* --- Responsive --- */
@media (max-width: 768px) {
  body { font-size: 16px; }
  .wrap, .wrap--narrow { padding: 0 20px; }

  .site-nav__toggle { display: block; }
  .site-nav__links {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg);
    border-bottom: 1px solid var(--rule);
    flex-direction: column;
    padding: 16px 20px;
    gap: 12px;
    z-index: 100;
  }
  .site-nav__links.open { display: flex; }
  .site-nav .wrap { position: relative; }

  .hero { padding: 60px 0 48px; }
  .hero__title { font-size: 2rem; }

  .now-grid { grid-template-columns: 1fr; }
  .now-item:nth-child(odd) { border-right: none; }
  .now-item:nth-last-child(2) { border-bottom: 1px solid var(--rule); }

  .post-list__item {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .colophon__inner { grid-template-columns: 1fr; gap: 32px; }

  .article__nav { grid-template-columns: 1fr; }
  .article__nav-link--next { text-align: left; grid-column: 1; }

  .project-list { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .hero__blurb { font-size: 1rem; }
  .colophon__links { flex-direction: column; gap: 8px; }
}
