/*
  Feed layout: filters · posts · bio.
  Loaded by site/snippets/feed/layout.php on the home page (feed),
  short notes (post.php) and long thoughts (note.php).
  Project and other pages keep assets/css/index.css + topbar.css.
*/

@font-face {
  font-family: "FixelText";
  src: url("/assets/fonts/FixelText-Medium.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "FixelText";
  src: url("/assets/fonts/FixelText-SemiBold.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

:root {
  --ink: #0f0f0f;
  --text: #2b2b2b;
  --muted: #6b6b6b;
  --faint: #9b9b9b;
  --line: #ececec;
  --soft: #f5f5f3;
  --bg: #fff;
  --accent: #ca4a2b;

  --font: "FixelText", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
  --measure: 40rem;
  --top: 4rem;

  --r-post: 1.25rem;   /* 20px post box */
  --r-image: .5rem;    /*  8px images inside a post */
}

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

html {
  font-family: var(--font);
  font-weight: 500;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  font-size: 1.0625rem;
  line-height: 1.5;
  background: var(--bg);
}

/* height: auto keeps the aspect ratio when width/height attributes are set */
img {
  display: block;
  max-width: 100%;
  height: auto;
}

a {
  color: inherit;
}

a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
  border-radius: 4px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ---------- Page grid: filters · feed · bio ---------- */

.page {
  max-width: 80rem;
  margin: 0 auto;
  padding: var(--top) 2.5rem 6rem;
  display: grid;
  grid-template-columns: 12.5rem minmax(0, var(--measure)) 16rem;
  grid-template-areas: "left feed aside";
  column-gap: 4.5rem;
  justify-content: center;
  align-items: start;
}

.left {
  grid-area: left;
  position: sticky;
  top: var(--top);
}

.feed {
  grid-area: feed;
  min-width: 0;
}

.aside {
  grid-area: aside;
  position: sticky;
  top: var(--top);
}

/* ---------- Brand ---------- */

.brand {
  display: block;
  text-decoration: none;
  margin-bottom: 1rem;
  line-height: 1.35;
}

.brand-name {
  display: block;
  font-weight: 600;
}

.brand-role {
  display: block;
  color: var(--muted);
}

/* ---------- Filters ---------- */

.filters-label {
  font-size: .75rem;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--faint);
  margin-bottom: .75rem;
}

.filters ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: .125rem;
}

.filter {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: .75rem;
  padding: .375rem 0;
  text-decoration: none;
  color: var(--muted);
  transition: color .15s ease;
}

.filter:hover {
  color: var(--ink);
}

.filter-label {
  position: relative;
}

.filter[aria-current="true"] {
  color: var(--ink);
  font-weight: 600;
}

.filter[aria-current="true"] .filter-label::before {
  content: "";
  position: absolute;
  left: -.9rem;
  top: 50%;
  width: .375rem;
  height: .375rem;
  border-radius: 50%;
  background: var(--ink);
  transform: translateY(-50%);
}

.count {
  font-size: .8125rem;
  font-weight: 500;
  color: var(--faint);
  font-variant-numeric: tabular-nums;
}

/* ---------- Posts: one clickable box each ---------- */

.post {
  border: 1px solid var(--line);
  border-radius: var(--r-post);
  padding: 1.5rem 1.75rem 1.75rem;
  margin-bottom: 1rem;
  background: var(--bg);
  transition: background-color .2s ease, border-color .2s ease;
}

/* Boxes that open a page (feed.js handles the click) */
.post[data-href] {
  cursor: pointer;
}

.post[data-href]:hover {
  background: var(--soft);
  border-color: #e2e2e2;
}

.post-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .5rem;
  font-size: .8125rem;
  color: var(--muted);
  margin-bottom: .875rem;
}

.post-type {
  color: var(--ink);
  font-weight: 600;
}

.post-meta .sep {
  color: var(--faint);
}

/* The one real link per post (title, or the date on short notes) */
.post-link {
  text-decoration: none;
}

.post-link:hover {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: .15em;
}

/* Short note */

.note-text {
  font-size: 1.1875rem;
  line-height: 1.55;
  letter-spacing: -.005em;
}

.note-text p + p {
  margin-top: .875rem;
}

.note-text a {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: .2em;
  text-decoration-color: var(--faint);
}

.note-text a:hover {
  text-decoration-color: currentColor;
}

.media {
  margin-top: 1.25rem;
  display: grid;
  gap: .5rem;
}

.media--2,
.media--4 {
  grid-template-columns: 1fr 1fr;
}

.media--3 {
  grid-template-columns: 1fr 1fr 1fr;
}

.media a {
  display: block;
  border-radius: var(--r-image);
  overflow: hidden;
  background: var(--soft);
  cursor: zoom-in;
}

.media img {
  width: 100%;
  height: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  transition: transform .4s ease;
}

.media a:hover img {
  transform: scale(1.02);
}

/* A single image keeps its own shape */
.media--1 img {
  aspect-ratio: auto;
  max-height: 36rem;
}

/* Long thought: title + excerpt, the box opens the full page */

.thought-title {
  font-size: 1.5rem;
  line-height: 1.25;
  font-weight: 600;
  letter-spacing: -.015em;
  margin-bottom: .75rem;
}

.prose {
  font-size: 1.0625rem;
  line-height: 1.65;
  color: var(--text);
}

.prose p + p {
  margin-top: 1rem;
}

.prose a {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: .2em;
  text-decoration-color: var(--faint);
}

.prose a:hover {
  text-decoration-color: currentColor;
}

.prose figure {
  margin: 1.75rem 0;
}

.prose figure a {
  display: block;
  cursor: zoom-in;
}

.prose img {
  width: 100%;
  border-radius: var(--r-image);
}

.prose figcaption {
  margin-top: .625rem;
  font-size: .875rem;
  color: var(--muted);
}

.prose h2 {
  font-size: 1.375rem;
  line-height: 1.3;
  font-weight: 600;
  letter-spacing: -.01em;
  margin: 2.25rem 0 .75rem;
}

.prose h3 {
  font-size: 1.125rem;
  line-height: 1.35;
  font-weight: 600;
  margin: 1.75rem 0 .5rem;
}

.prose ul,
.prose ol {
  margin: 1rem 0;
  padding-left: 1.25rem;
}

.prose li + li {
  margin-top: .375rem;
}

.prose code {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: .875em;
  background: var(--soft);
  border-radius: 4px;
  padding: .1em .35em;
}

.prose pre {
  margin: 1.5rem 0;
  padding: 1rem 1.25rem;
  overflow-x: auto;
  background: var(--ink);
  color: #fff;
  border-radius: var(--r-image);
  line-height: 1.5;
}

.prose pre code {
  background: none;
  padding: 0;
  color: inherit;
}

.prose hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 2.5rem 0;
}

.prose table {
  width: 100%;
  border-collapse: collapse;
  font-size: .9375rem;
}

.prose th,
.prose td {
  text-align: left;
  padding: .5rem .75rem .5rem 0;
  border-bottom: 1px solid var(--line);
}

/* Video block (core) and video embed block (plugin) */
.prose .video {
  display: block;
  position: relative;
  aspect-ratio: 16 / 9;
  border-radius: var(--r-image);
  overflow: hidden;
}

.prose .video iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.prose video {
  display: block;
  width: 100%;
  border-radius: var(--r-image);
}

/* Gallery block */
.prose .gallery ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: .5rem;
  grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
}

.prose .gallery li + li {
  margin-top: 0;
}

.prose blockquote {
  margin: 1.75rem 0;
  padding-left: 1rem;
  border-left: 2px solid var(--ink);
  font-size: 1.1875rem;
  line-height: 1.5;
  color: var(--ink);
}

/* Opened long thought: bigger title, optional cover */

.detail-title {
  font-size: 2rem;
  line-height: 1.2;
  font-weight: 600;
  letter-spacing: -.02em;
  margin-bottom: 1.5rem;
}

.post-cover {
  margin-bottom: 1.75rem;
  border-radius: var(--r-image);
  overflow: hidden;
  background: var(--soft);
}

.post-cover img {
  width: 100%;
}

/* Project: cover, title, one-liner, all inside the post box */

.project-media {
  background: var(--soft);
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: var(--r-image);
}

.project-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .5s ease;
}

.post[data-href]:hover .project-media img {
  transform: scale(1.015);
}

.project-body {
  display: grid;
  gap: .375rem;
  padding-top: 1.25rem;
}

.project-title {
  font-size: 1.125rem;
  line-height: 1.3;
  font-weight: 600;
  letter-spacing: -.01em;
}

.project-sub {
  color: var(--muted);
  font-size: .9375rem;
  line-height: 1.45;
}

.project-foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: .5rem;
  margin-top: 1rem;
  font-size: .875rem;
}

.project-cta {
  font-weight: 600;
}

.project-cta .arrow {
  display: inline-block;
  transition: transform .2s ease;
}

.post[data-href]:hover .project-cta .arrow {
  transform: translateX(3px);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  font-size: .75rem;
  color: var(--muted);
  background: var(--soft);
  border-radius: 999px;
  padding: .2rem .6rem .2rem .5rem;
}

/* Keep the lock badge visible against the hover background */
.post[data-href]:hover .badge {
  background: var(--bg);
}

/* Compact layout for portrait covers (today's "half" card size) */

.project--compact {
  display: grid;
  grid-template-columns: 8.5rem minmax(0, 1fr);
  gap: 1.25rem;
}

.project--compact .project-media {
  aspect-ratio: auto;
  height: 100%;
  min-height: 9.5rem;
}

.project--compact .project-body {
  align-content: center;
  padding: 0;
}

/* Single post page */

.back-link {
  display: inline-block;
  margin-bottom: 1rem;
  color: var(--muted);
  text-decoration: none;
  font-size: .9375rem;
}

.back-link:hover {
  color: var(--ink);
}

/* Pagination */

.pagination {
  display: flex;
  justify-content: space-between;
  padding-top: 1rem;
  font-size: 1.25rem;
}

.pagination a,
.pagination span {
  padding: .25rem .75rem;
  border-radius: 999px;
  text-decoration: none;
}

.pagination a:hover {
  background: var(--soft);
}

.pagination span {
  color: var(--line);
}

/* End of feed */

.feed-end {
  padding-top: 1.5rem;
  color: var(--faint);
  font-size: .875rem;
  text-align: center;
}

/* ---------- Bio column ---------- */

.avatar {
  width: 3.5rem;
  height: 3.5rem;
  border-radius: 50%;
  object-fit: cover;
  margin-bottom: 1rem;
}

.bio {
  font-size: 1rem;
  line-height: 1.55;
  color: var(--text);
}

.bio a {
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
}

.bio a:hover {
  text-decoration: underline;
  text-underline-offset: .15em;
}

/* Icons before words in the bio (classes come from the Home "Bio" field).
   Sized in em so they follow the text; inline so they wrap with their word. */
.bio .apps,
.bio .website,
.bio .alert,
.bio .ethena-link {
  white-space: nowrap;
}

.bio .apps::before,
.bio .website::before,
.bio .alert::before {
  display: inline-block;
  margin-right: .2em;
  font-size: 1.15em;
  line-height: 1;
  vertical-align: -.1em;
}

.bio .apps::before {
  content: "📱";
}

.bio .website::before {
  content: "🌐";
}

.bio .alert::before {
  content: "🚸";
}

.bio .ethena-link::before {
  content: "";
  display: inline-block;
  width: 1.3em;
  height: 1.3em;
  margin-right: .25em;
  vertical-align: -.3em;
  background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="30" height="30" fill="none"><rect width="30" height="30" fill="%23FFDED4" rx="15"/><path fill="%23CA4A2B" d="M24.006 17.139h-13.39c.43 2.75 2.845 3.611 4.911 3.611 2.147 0 4.025-.889 5.286-2.667l3.194 3.25c-2.12 2.695-5.126 4.167-8.534 4.167-5.152 0-10.223-3.389-10.223-10.417C5.25 8.111 10.214 4.5 15.152 4.5c4.722 0 8.989 3.333 8.989 10.056.027.722 0 1.527-.134 2.583ZM14.991 9.11c-2.47 0-4.08 1.639-4.374 3.945h8.586C18.99 10.5 17.298 9.11 14.991 9.11Z"/></svg>') center / cover no-repeat;
}

.aside-links {
  list-style: none;
  margin-top: 1.5rem;
  display: grid;
  gap: .375rem;
  font-size: .9375rem;
}

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

.aside-links a:hover {
  color: var(--ink);
}

.aside-links .ext {
  font-size: .75em;
  color: var(--faint);
}

.aside-foot {
  margin-top: 2rem;
  font-size: .8125rem;
  line-height: 1.6;
  color: var(--faint);
}

/* ---------- Lightbox ---------- */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  background: rgba(15, 15, 15, .88);
  cursor: zoom-out;
  opacity: 0;
  transition: opacity .2s ease;
}

.lightbox.is-open {
  opacity: 1;
}

.lightbox img {
  max-width: 100%;
  max-height: 100%;
  border-radius: .5rem;
}


/* ---------- Medium: bio moves under the filters ---------- */

@media (max-width: 72rem) {
  .page {
    grid-template-columns: 12rem minmax(0, var(--measure));
    grid-template-areas:
      "aside feed"
      "left feed";
    grid-template-rows: auto 1fr;
    column-gap: 3.5rem;
  }

  .left,
  .aside {
    position: static;
  }

  .aside {
    margin-bottom: 3rem;
  }
}

/* ---------- Small: single column, filters become sticky chips ---------- */

@media (max-width: 48rem) {
  .page {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "aside"
      "filters"
      "feed";
    grid-template-rows: none;
    padding: 1.5rem 1.25rem 4rem;
  }

  .left {
    display: contents;
  }

  .aside {
    grid-area: aside;
    margin: 0 0 1.25rem;
  }

  .aside-head {
    display: flex;
    gap: .875rem;
    align-items: center;
    margin-bottom: .875rem;
  }

  .avatar {
    width: 2.75rem;
    height: 2.75rem;
    margin: 0;
    flex: none;
  }

  .brand {
    margin: 0;
  }

  .aside-links {
    display: flex;
    flex-wrap: wrap;
    gap: .25rem 1.25rem;
    margin-top: 1rem;
  }

  .aside-foot {
    display: none;
  }

  .filters {
    grid-area: filters;
    position: sticky;
    top: 0;
    z-index: 10;
    margin: 0 -1.25rem 1.75rem;
    padding: .75rem 1.25rem;
    background: rgba(255, 255, 255, .92);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--line);
  }

  .filters-label {
    display: none;
  }

  .filters ul {
    flex-direction: row;
    gap: .5rem;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .filters ul::-webkit-scrollbar {
    display: none;
  }

  .filter {
    white-space: nowrap;
    gap: .4rem;
    padding: .375rem .8rem;
    border: 1px solid var(--line);
    border-radius: 999px;
  }

  .filter[aria-current="true"] {
    background: var(--ink);
    border-color: var(--ink);
    color: #fff;
  }

  .filter[aria-current="true"] .count {
    color: rgba(255, 255, 255, .7);
  }

  .filter[aria-current="true"] .filter-label::before {
    display: none;
  }

  .post {
    padding: 1.25rem 1.25rem 1.5rem;
    margin-bottom: .75rem;
  }

  .note-text {
    font-size: 1.125rem;
  }

  .thought-title {
    font-size: 1.375rem;
  }

  .detail-title {
    font-size: 1.625rem;
  }

  .project--compact {
    grid-template-columns: 6.5rem minmax(0, 1fr);
    gap: 1rem;
  }

  .project--compact .project-media {
    min-height: 8rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
