@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  color-scheme: light;
  --bg: #faf8f5;
  --surface: #f2efe9;
  --card-bg: #ffffff;
  --text: #181715;
  --text-secondary: #4a4742;
  --muted: #7d786f;
  --accent: #c24e2b;
  --accent-soft: rgba(194, 78, 43, 0.09);
  --link: #181715;
  --border: #e6e1d7;
  --border-subtle: #ede9e0;
  --code-bg: #f0ece3;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
  --mono: "JetBrains Mono", "SF Mono", Menlo, Consolas, monospace;
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  padding: 0;
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

main {
  max-width: 820px;
  margin: 0 auto;
  padding: 4rem 1.5rem 5.5rem;
}

a {
  color: var(--link);
  text-decoration: underline;
  text-decoration-color: rgba(24, 23, 21, 0.28);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: color 0.15s ease, text-decoration-color 0.15s ease;
}

a:hover {
  color: var(--accent);
  text-decoration-color: var(--accent);
}

h1, h2, h3, h4 {
  font-weight: 600;
  line-height: 1.2;
  margin: 2rem 0 0.75rem;
}

h1 {
  font-family: var(--sans);
  font-size: 1.75rem;
  font-weight: 650;
  letter-spacing: -0.025em;
  margin-top: 0;
}

h2 {
  font-size: 1.35rem;
  padding-top: 15px;
}

h3 {
  font-size: 1.02rem;
}

p {
  margin: 0 0 1.1rem;
}

article p:has(> strong:first-child) {
  padding-top: 1.25rem;
}

ul, ol {
  padding-left: 1.5rem;
  margin: 0 0 1.1rem;
}

hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 2.25rem 0;
}

blockquote {
  margin: 1.25rem 0;
  padding: 0.1rem 1.1rem;
  border-left: 2px solid var(--accent);
  color: var(--text-secondary);
}

code, pre {
  font-family: var(--mono);
  font-size: 0.88em;
}

pre {
  background: var(--code-bg);
  padding: 0.9rem 1.05rem;
  overflow-x: auto;
  border-radius: 6px;
  border: 1px solid var(--border);
  line-height: 1.48;
}

code {
  background: var(--code-bg);
  padding: 0.14em 0.36em;
  border-radius: 4px;
}

pre code {
  background: transparent;
  padding: 0;
}

/* ==========================================================================
   Hero & Header
   ========================================================================== */

.site-header {
  margin-bottom: 3rem;
}

.site-intro {
  position: relative;
}

.site-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.35rem;
  padding-bottom: 1.1rem;
  border-bottom: 1px solid var(--border);
}

.site-identity {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.site-title {
  font-family: var(--sans);
  font-size: 1.65rem;
  font-weight: 650;
  line-height: 1.15;
  margin: 0;
  letter-spacing: -0.025em;
  color: var(--text);
}

.site-title a {
  color: var(--text);
  text-decoration: none;
}

.site-meta-badge {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.03em;
  color: var(--muted);
  text-transform: uppercase;
}

.social-icons {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.25rem;
}

.social-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.85rem;
  height: 1.85rem;
  padding: 0.42rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--muted);
  background: var(--card-bg);
  text-decoration: none;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.social-icon svg {
  width: 100%;
  height: 100%;
  fill: currentColor;
}

.social-icon:hover,
.social-icon:focus-visible {
  color: var(--text);
  border-color: var(--text);
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(24, 23, 21, 0.06);
  text-decoration: none;
}

.home-bio {
  max-width: 42rem;
}

.home-bio p {
  margin-bottom: 0.85rem;
  font-size: 0.94rem;
  line-height: 1.62;
  color: var(--text-secondary);
}

.home-bio p:first-child {
  font-size: 1.04rem;
  color: var(--text);
  font-weight: 450;
}

.home-bio p:last-child {
  margin-bottom: 0;
}

/* ==========================================================================
   Horizontal 5-Photo Contact Strip & Lightbox
   ========================================================================== */

.snapshot-stack {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.65rem;
  margin-top: 1.85rem;
}

.snapshot {
  position: relative;
  margin: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.28rem;
  background: var(--card-bg);
  box-shadow: 0 2px 6px rgba(24, 23, 21, 0.04);
  aspect-ratio: 4 / 4.5;
  transition: transform 0.2s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.2s ease, border-color 0.2s ease;
  cursor: pointer;
  overflow: hidden;
}

.snapshot:hover {
  z-index: 5;
  transform: translateY(-4px);
  border-color: #cfc8ba;
  box-shadow: 0 10px 22px rgba(24, 23, 21, 0.1);
}

.snapshot-image {
  width: 100%;
  height: 100%;
  border-radius: 5px;
  overflow: hidden;
  background: var(--surface);
}

.snapshot img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

.snapshot:hover img {
  transform: scale(1.04);
}

.snapshot-1 img { object-position: 50% 42%; }
.snapshot-2 img { object-position: 56% 52%; }
.snapshot-3 img { object-position: 50% 62%; }
.snapshot-4 img { object-position: 50% 42%; }
.snapshot-5 img { object-position: 50% 50%; }

.snapshot-lightbox {
  width: 100vw;
  height: 100vh;
  max-width: none;
  max-height: none;
  margin: 0;
  border: 0;
  padding: 3.5rem;
  background: transparent;
  overflow: hidden;
}

.snapshot-lightbox[open] {
  display: grid;
  place-items: center;
}

.snapshot-lightbox::backdrop {
  background: rgba(20, 19, 17, 0.85);
  backdrop-filter: blur(6px);
}

.snapshot-lightbox img {
  max-width: min(84vw, 64rem);
  max-height: 82vh;
  width: auto;
  height: auto;
  padding: 0.45rem;
  border-radius: 8px;
  background: var(--card-bg);
  box-shadow: 0 1.5rem 4rem rgba(0, 0, 0, 0.45);
}

.snapshot-lightbox-close {
  position: fixed;
  top: 1.35rem;
  right: 1.5rem;
  z-index: 1;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 6px;
  padding: 0.38rem 0.7rem;
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
  font-family: var(--mono);
  font-size: 0.78rem;
  cursor: pointer;
}

.snapshot-lightbox-close:hover,
.snapshot-lightbox-close:focus-visible {
  background: rgba(255, 255, 255, 0.18);
}

/* ==========================================================================
   Split Index Sections
   ========================================================================== */

.recent-section {
  display: flex;
  flex-direction: column;
}

.index-section {
  display: grid;
  grid-template-columns: 155px 1fr;
  gap: 2rem;
  padding: 2rem 0;
  border-top: 1px solid var(--border);
}

.section-sidebar {
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 2rem;
  align-self: start;
}

.section-heading {
  margin: 0;
  padding: 0;
  font-family: var(--sans);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text);
}

.section-body {
  min-width: 0;
}

/* ==========================================================================
   Writing & Case Studies Lists
   ========================================================================== */

.writing-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.writing-list li {
  display: grid;
  grid-template-columns: 6.6rem 1fr;
  gap: 1rem;
  padding: 0.58rem 0;
  border-bottom: 1px solid var(--border-subtle);
  align-items: baseline;
  transition: background-color 0.15s ease;
}

.writing-list.finds-list li {
  grid-template-columns: 8.5rem 1fr;
}

.writing-list li:first-child {
  padding-top: 0.1rem;
}

.writing-list li:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.writing-list .date {
  color: var(--muted);
  font-size: 0.76rem;
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.writing-list .row-content {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: baseline;
  gap: 0.75rem;
  min-width: 0;
}

.writing-list .row-main {
  display: block;
  min-width: 0;
  line-height: 1.48;
}

.writing-list .row-title-link,
.writing-list .row-title {
  display: inline;
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 450;
  line-height: 1.48;
  text-decoration: none;
  transition: color 0.15s ease;
}

.writing-list .row-title-link {
  cursor: pointer;
}

.writing-list .row-topic {
  display: inline-flex;
  vertical-align: baseline;
  margin-left: 0.45rem;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.66rem;
  font-weight: 400;
  letter-spacing: 0.02em;
  line-height: 1.35;
  padding: 0.08rem 0.42rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface);
  transition: color 0.15s ease, border-color 0.15s ease, background-color 0.15s ease;
  white-space: nowrap;
  text-decoration: none;
}

.writing-list .row-cue {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.78rem;
  opacity: 0.45;
  transform: translate(0, 0);
  transition: opacity 0.15s ease, color 0.15s ease, transform 0.15s ease;
  text-decoration: none;
  white-space: nowrap;
}

.writing-list .content-row:hover .row-title-link .row-title,
.writing-list .content-row:focus-within .row-title-link .row-title {
  color: var(--accent);
}

.writing-list .content-row:hover .row-cue,
.writing-list .content-row:focus-within .row-cue {
  opacity: 1;
  color: var(--accent);
  transform: translate(2px, -2px);
}

.writing-list a.row-topic:hover,
.writing-list a.row-topic:focus-visible {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-soft);
}

/* ==========================================================================
   Projects & Agent Tools Grid
   ========================================================================== */

.projects-grid {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.65rem;
}

.project-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding: 0.8rem 0.9rem;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  transition: border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.project-card:hover {
  border-color: #cbbba8;
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(24, 23, 21, 0.05);
}

.project-card-header {
  display: flex;
  align-items: center;
  gap: 0.42rem;
}

.project-emoji {
  font-size: 0.92rem;
  line-height: 1;
}

.project-link {
  font-family: var(--mono);
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text);
  text-decoration: none;
}

.project-link::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 8px;
}

.project-card:hover .project-link {
  color: var(--accent);
  text-decoration: none;
}

.project-arrow {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 0.74rem;
  color: var(--muted);
  opacity: 0.5;
  transition: opacity 0.15s ease, transform 0.15s ease, color 0.15s ease;
}

.project-card:hover .project-arrow {
  opacity: 1;
  color: var(--accent);
  transform: translate(2px, -2px);
}

.project-desc {
  margin: 0;
  font-size: 0.82rem;
  line-height: 1.45;
  color: var(--muted);
}

/* ==========================================================================
   Footer Nav
   ========================================================================== */

.nav {
  margin-top: 2.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 1.25rem;
  font-size: 0.8rem;
  font-family: var(--mono);
}

.nav a {
  color: var(--muted);
  text-decoration: none;
}

.nav a:hover {
  color: var(--accent);
}

/* ==========================================================================
   Breadcrumbs & Topic Page
   ========================================================================== */

.breadcrumbs {
  display: flex;
  gap: 0.45rem;
  margin-bottom: 2rem;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.78rem;
}

.breadcrumbs a {
  color: var(--muted);
  text-decoration: none;
}

.breadcrumbs a:hover {
  color: var(--accent);
}

.topic-page-heading {
  margin: 0 0 1.25rem;
  padding: 0;
  font-family: var(--sans);
  font-size: 1.55rem;
  font-weight: 650;
  letter-spacing: -0.025em;
}

/* ==========================================================================
   Blog Post Layout
   ========================================================================== */

.post-layout {
  max-width: 760px;
  margin: 0 auto;
  padding: 3.5rem 1.25rem 5rem;
  font-family: var(--sans);
}

.post-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 2.25rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.post-header a {
  font-family: var(--mono);
  font-size: 0.82rem;
  color: var(--muted);
  text-decoration: none;
}

.post-header a:hover {
  color: var(--accent);
}

.post-header-nav a {
  margin-left: 1.1rem;
}

.post-layout article {
  font-family: var(--sans);
  font-size: 0.96rem;
  line-height: 1.65;
  color: var(--text-secondary);
}

.post-layout article strong {
  color: var(--text);
}

.post-layout article > h1 {
  font-family: var(--sans);
  font-size: clamp(1.85rem, 3.2vw, 2.4rem);
  font-weight: 650;
  line-height: 1.12;
  letter-spacing: -0.03em;
  color: var(--text);
  margin-bottom: 1.25rem;
}

.post-layout article h2 {
  font-family: var(--sans);
  font-size: 1.4rem;
  font-weight: 600;
  line-height: 1.22;
  letter-spacing: -0.025em;
  color: var(--text);
}

.post-layout article h3 {
  font-family: var(--sans);
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.3;
  color: var(--text);
}

.post-meta-row {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.55rem;
  margin: 0 0 2rem;
  white-space: nowrap;
}

.post-meta {
  color: var(--muted);
  font-size: 0.8rem;
  font-family: var(--mono);
  margin: 0;
}

.post-topics {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.4rem;
  margin: 0;
}

.post-topic {
  display: inline-flex;
  align-items: center;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 400;
  letter-spacing: 0.02em;
  line-height: 1.3;
  padding: 0.16rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface);
  text-decoration: none;
  transition: border-color 0.15s ease, color 0.15s ease;
}

.post-topic:hover,
.post-topic:focus-visible {
  color: var(--accent);
  border-color: var(--accent);
}

.post-standfirst {
  font-family: var(--sans);
  font-size: 1.08rem;
  line-height: 1.58;
  color: var(--text);
  margin: 2.25rem 0 3.25rem;
}

.post-standfirst strong {
  font-weight: 600;
}

.article-body {
  display: grid;
  grid-template-columns: 230px 1fr;
  margin-left: -260px;
  gap: 1.75rem;
}

.article-content {
  min-width: 0;
}

.toc {
  position: sticky;
  top: 3.5rem;
  align-self: start;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding-right: 0;
  padding-top: 0.25rem;
  transition: opacity 0.25s ease, visibility 0.25s ease, transform 0.25s ease;
}

.toc.is-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(0.6rem);
}

.toc a {
  font-family: var(--sans);
  font-size: 0.78rem;
  color: var(--muted);
  text-decoration: none;
  line-height: 1.35;
}

.toc a:hover,
.toc a.active {
  color: var(--accent);
}

article video,
article iframe,
article figure,
article .image-grid,
article p:has(img) {
  margin-top: 5%;
  margin-bottom: 5%;
}

article img {
  max-width: 100%;
  height: auto;
  border-radius: 6px;
}

article .article-figure {
  margin: 1.75rem 0;
}

article .article-figure-wide {
  width: 100%;
  max-width: 100%;
  margin: 1.85rem 0;
}

article .article-figure img {
  display: block;
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card-bg);
  box-shadow: 0 2px 10px rgba(24, 23, 21, 0.04);
}

article .article-figure figcaption {
  margin-top: 0.55rem;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.74rem;
  line-height: 1.4;
}

article .post-cover {
  margin-top: 0;
  margin-bottom: 3rem;
}

article .table-wrap {
  width: 100%;
  max-width: 100%;
  margin: 1.75rem 0;
  overflow-x: auto;
  border-radius: 8px;
}

article table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  line-height: 1.55;
  background: var(--card-bg);
}

article th,
article td {
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

article th {
  font-weight: 600;
  font-family: var(--sans);
  font-size: 0.88rem;
  color: var(--text);
  background: var(--surface);
}

article .borderless-table th,
article .borderless-table td {
  border: 0;
  background: transparent;
}

article .strategy-table-wrap {
  max-width: 100%;
}

article .strategy-table th,
article .strategy-table td {
  padding: 0.75rem 0.9rem;
}

article .strategy-table th:first-child,
article .strategy-table td:first-child {
  width: 28%;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.4;
}

.like-btn {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 50px;
  padding: 0.6rem 0.6rem 0.45rem;
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease;
  z-index: 100;
}

.like-btn:hover {
  border-color: var(--accent);
  transform: scale(1.05);
}

.like-heart {
  color: var(--muted);
  transition: color 0.15s ease, fill 0.15s ease;
}

.like-btn.liked .like-heart {
  color: var(--accent);
  fill: var(--accent);
}

.like-count {
  font-family: var(--mono);
  font-size: 0.68rem;
  color: var(--muted);
  line-height: 1;
  min-height: 0.7rem;
}

/* ==========================================================================
   Responsive Breakpoints
   ========================================================================== */

@media (max-width: 1100px) {
  .article-body {
    display: block;
    margin-left: 0;
  }
  .toc {
    display: none;
  }
}

@media (max-width: 720px) {
  .index-section {
    grid-template-columns: 1fr;
    gap: 0.85rem;
    padding: 1.65rem 0;
  }
  .section-sidebar {
    position: static;
    flex-direction: row;
    align-items: baseline;
    gap: 0.5rem;
  }
  .projects-grid {
    grid-template-columns: 1fr;
  }
  article .table-wrap,
  article .article-figure-wide {
    width: 100%;
    left: auto;
    transform: none;
    overflow: visible;
  }
  article .strategy-table,
  article .strategy-table tbody,
  article .strategy-table tr,
  article .strategy-table td {
    display: block;
    width: 100%;
  }
  article .strategy-table thead {
    display: none;
  }
  article .strategy-table tr {
    padding: 0.9rem 0;
    border-bottom: 1px solid var(--border);
  }
  article .strategy-table tr:last-child {
    border-bottom: 0;
  }
  article .strategy-table td,
  article .strategy-table td:first-child,
  article .strategy-table td:last-child {
    width: 100%;
    padding: 0;
  }
  article .strategy-table td:first-child {
    margin-bottom: 0.35rem;
  }
}

@media (max-width: 560px) {
  main {
    padding: 2.5rem 1.15rem 4rem;
  }
  .snapshot-stack {
    grid-template-columns: repeat(5, minmax(115px, 1fr));
    overflow-x: auto;
    padding-bottom: 0.35rem;
    scrollbar-width: none;
  }
  .snapshot-stack::-webkit-scrollbar {
    display: none;
  }
  .snapshot-lightbox {
    padding: 2.5rem 1rem;
  }
  .snapshot-lightbox img {
    max-width: 92vw;
    max-height: 82vh;
  }
  .writing-list li,
  .writing-list.finds-list li {
    grid-template-columns: 1fr;
    gap: 0.2rem;
    padding: 0.65rem 0;
  }
  .writing-list .row-cue {
    display: none;
  }
}
