/* 
  Context Clean Theme
  Single source of truth
  No overrides, no duplicates
*/

/* === RESET === */
/* =========================
   BASE
   ========================= */

* { box-sizing: border-box; }

html, body{
  height: 100%;
}

body {
  display: flex;
  flex-direction: column;
  margin: 0;
  min-height: 100vh;
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  font-weight: 400;
  background: #fff;
}

/* =========================
   GRID (homepage only)
   ========================= */

.page-grid {
  flex: 1;
  background-color: #fff;
  background-image: url("../images/ctx-dia.png");
  background-repeat: repeat;
  background-size: 80px auto;
  display: grid;
  grid-template-columns: 1fr;
/*  min-height: 100vh;*/
}

/* =========================
   RAILS
   ========================= */

.rail {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
}

.rail-left {
  display: none;
}

.rail-left .ctx-mark {
  height: 110%;
  width: auto;
  padding-right: 40px;
  max-width: none;
  object-fit: none;
  opacity: 0.6;
}

.rail-right { grid-area: right;
  max-width: 420px;   /* match your grid’s right column */
  align-self: start; 
}

.rail-right .poster-stack img{
  width: min(100%, 360px);
  height: auto;
  display: block;
  max-width: 420px;   /* hard stop */
}

.rail-right .poster-stack {
  display: grid;
 /* flex-direction: column;*/
  gap: 16px;
}

/* =========================
   Right rail – sticky interpretive margin
   ========================= */

.rail-sticky{
  position: sticky;
  top: 96px; /* below header; adjust later if needed */
  margin-top: 32px;
}

/* JS sticky margin (fixed only after posters scroll away) */
.rail-sticky.is-fixed{
  display: flex;
  justify-content: flex-start;
  position: fixed;
  top: 96px;
  right: max(64px, calc((100vw - 1280px)/2 + 64px));
  width: 420px; /* match rail width */
  pointer-events: none; /* purely informational */
}


.margin-line{
  margin: 0;
  width: 36ch;
  font-size: 18px;
  line-height: 1.35;
  color: rgba(0, 0, 0, 70);
  
  padding: 12px 14px;
  border-left: 3px solid rgba(0,163,255,0.9);
  background: rgba(255,255,255,0.82);
  backdrop-filter: blur(6px);
  border-radius: 14px;
  white-space: pre-line; /* 👈 allows intentional line breaks */
}

/* Sticky can break if an ancestor has overflow other than visible */
.page-grid, .main, .rail-right{
  overflow: visible;
}


/* =========================
   MAIN COLUMN
   ========================= */

.main {
  background-color: #fff;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 420px;
  grid-template-areas:
    "header right"
    "hero   right"
    "info   right"
    "filters right"
    "feed   right";
  column-gap: 72px;
  align-items: start;
  row-gap: 0;
  justify-items: start;  
  padding: 32px 64px 80px;
  /* max-width: 860px;*/
  width: 100%;
  /* grid-area: main; */
  background-image: url("../images/ctx-vertical.svg");
  background-repeat: no-repeat;
  background-position: left 24px top 120px; /* pushes it below nav */
  background-size: clamp(260px, 22vw, 420px) auto;
  background-attachment: fixed; /* watermark does NOT scroll (desktop) */
}

.site-header{ grid-area: header; }
.hero{ grid-area: hero; }
.info{ grid-area: info; }
.filterbar{ grid-area: filters; }
.feed{ grid-area: feed; }
.rail-right{ grid-area: right; }


/* =========================
   HEADER
   ========================= */

.site-header {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  justify-content: space-between;
  font-weight: 700;
  column-gap: 28px; /* gap between title and nav */
  width: 100%;
}

.header-divider {
  margin: 16px 0 32px;
  border: none;
  border-top: 1px solid #ddd;
}

/* Header: make "CONTEXT – CTX" bold and stop nav links from going blue */
.site-title{
  font-weight: 700;
  white-space: nowrap; 
}


.site-nav{
  justify-self: end; /* align-right */
  text-align: right;
  white-space: nowrap; 
}


.site-nav a,
.site-nav a:visited{
  color: inherit;
  text-decoration: none;
}

.site-nav a:hover{
  text-decoration: underline;
}



/* =========================
   HERO
   ========================= */

.hero-title {
  font-family: Rubik, sans-serif;
  font-size: clamp(72px, 7vw, 120px);
  margin: 0 0 12px;
}

.hero-h2{
  font-family: "Rubik", system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  font-weight: 900; /* ensures Black weight when available */
}

.hero-divider {
  height: 3px;
  width: 70%;
  background: #00a3ff;
  margin-bottom: 24px;
}

.hero-h2 {
  font-size: 56px;
  margin: 0 0 6px;
}

.hero-subtitle {
  font-size: 22px;
  margin: 0 0 20px;
}

/* =========================
   Filter Bar
   ========================= */

.filterbar{
  margin: 32px 0 40px; /* space above + below filter bar */
}

.filterbar-row{
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 14px;
}

.filterbar-row:last-child{
  margin-bottom: 0;
}

.filterbar-label{
  min-width: 170px;   /* makes all pill groups start at the same x */
  line-height: 1;
  padding-top: 7px;   /* optically aligns with pill height */
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  opacity: 0.8;
  white-space: nowrap;
}

.filterbar-pills{
  display: flex;
  flex-wrap: wrap;
  gap: 10px; /* spacing BETWEEN tags */
  padding-top: 2px; /* optical alignment tweak */
}

/* Pill styling */
.filterbar-pill{
  display: inline-block;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 0.9rem;
  line-height: 1;
  text-decoration: none;
  border: 1px solid rgba(0,0,0,0.15);
  color: inherit;
  transition: all 0.15s ease;
  background: rgba(0,0,0,0.08);
}

/* Stance tags */
.filterbar-pill[href="/tag/enables/"]{
  background: var(--tag-enables, rgba(0,163,255,0.15));
}
.filterbar-pill[href="/tag/tensions/"]{
  background: var(--tag-tensions, rgba(255,190,152,0.25));
}
.filterbar-pill[href="/tag/erodes/"]{
  background: var(--tag-erodes, rgba(206,51,117,0.18));
}
.filterbar-pill[href="/tag/synthesis/"]{
  background: var(--tag-synthesis, rgba(18,62,116,0.18));
}


/* Format tags (subtler) */
.filterbar-pill[href="/tag/curation/"],
.filterbar-pill[href="/tag/essay/"],
.filterbar-pill[href="/tag/tutorial/"]{
  background: rgba(0,0,0,0.06);
}

/* Hover state */
.filterbar-pill:hover{
  background: rgba(0,0,0,0.05);
  transform: translateY(-1px);
}

/* Optional: active tag highlighting (Ghost adds .tag-<slug> to body) */
body[class*="tag-"] .filterbar-pill{
  opacity: 0.6;
}

body.tag-enables .filterbar-pill[href="/tag/enables/"],
body.tag-tensions .filterbar-pill[href="/tag/tensions/"],
body.tag-erodes .filterbar-pill[href="/tag/erodes/"],
body.tag-synthesis .filterbar-pill[href="/tag/synthesis/"]{
  opacity: 1;
  border-color: currentColor;
}



/* =========================
   INFO + FEED
   ========================= */

.info p {
  max-width: 62ch;
  margin: 0 0 14px;
}

/* Blue divider between intro and date */
.info-divider{
  height: 3px;
  width: 70%;
  background: #00a3ff;
  margin: 88px 0 12px;
}

/* Date sits close to Latest */
.info-date{
  margin: 0 0 12px;
  font-weight: 700;
}

/* Latest starts close (kill extra gap) */

.feed {
  margin-top: 0px;
  margin-bottom: 48px;
}


/* Tighten the date → Latest spacing (heading defaults are the culprit) */
.feed-title{
  margin: 0 0 12px;
}

/* Remove default margins that can add surprise gaps */
.feed h3,
.feed h4{
  margin-top: 0;
}

/* =========================
   POST CARDS (Feed)
   ========================= */

.post-card{
  border: 2px solid #00a3ff;
  border-radius: 28px;
  overflow: hidden;
  background: #fff;
  padding: 0;
  min-height: 168px; /*tune if needed*/
  margin: 0 0 20px;
}

.post-card-top{
  background: #00a3ff;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 22px;
}

.post-card-tag{
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  font-weight: 900;
  font-size: 20px;
  letter-spacing: 0.02em;
}

.post-card-date{
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  font-weight: 400;
  font-size: 20px;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.post-card-title{
  padding-top: 12px;
  margin: 0px 48px 6px;
  font-family: "Rubik", system-ui, -apple-system, "Segoe UI", Arial, sans-serif;  
  font-weight: 900;
  font-size: 20px;
  line-height: 1.15;
}

.post-card-title a,
.post-card-title a:visited{
  color: inherit;
  text-decoration: none;
}

.post-card-title a:hover{
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}

.post-card-top-left{
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: flex-start;
}

.post-card-body{
  display: grid;
  grid-template-columns: 125px 1fr; /* ~2x your old 54px */
/*  gap: 18px;*/
  padding: 0px 0px 0px;
  align-items: center;
  column-gap: 20px;
}

.post-card-thumb{
  width: 180px;
  height: 124px;
  border-radius: 12px;
  object-fit: cover;
  display: block;
  border: 0px solid #00a3ff;
  background: rgba(0,163,255,0.08);
}

.post-card-thumb.is-placeholder{
  background: rgba(0,163,255,0.10);
}

.post-card-excerpt{
  margin-left: 48px;
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  font-weight: 400;
  font-size: 18px;
  line-height: 1.35;
  max-width: 62ch;
    display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Optional: subtle lift on hover for the whole card */
.post-card:hover{
  transform: translateY(-4px);
}


/* =========================
   GHOST KOENIG REQUIRED CLASSES
   ========================= */

.kg-width-wide {
  max-width: 1100px;
  margin-left: auto;
  margin-right: auto;
}

.kg-width-full {
  width: 100vw;
  margin-left: calc(50% - 50vw);
}






@media (max-width: 980px){
  /* Outer grid becomes single column */
  .page-grid{
    grid-template-columns: 1fr;
    grid-template-areas:
      "main"
      "right";
  }

  /* Make posters horizontal strip */
  .rail-right{
    max-width: none;
    padding: 0 20px 24px;
    align-self: start;
  }


  .poster-stack{
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    position: static; /* important if you used sticky/absolute earlier */
  }

  .poster-stack img{
    width: 100%;
    height: auto;
    display: block;
  }

  /* Adjust main padding + watermark scale */
  .main{
  max-width: 1280px;
  margin: 0 auto;
  align-content: start;
    padding: 24px 20px 40px;
    background-position: left 12px top 80px;
    background-size: 280px auto;
  }
}

@media (max-width: 980px){
  .main{
  max-width: 1280px;
  margin: 0 auto;

    grid-template-columns: 1fr;
    grid-template-areas:
     "header"
     "hero"
     "right"
     "info"
     "filters"
     "feed";
    row-gap: 4px;
    padding: 24px 20px 60px;
    background-position: left 12px top 80px;
    background-size: 280px auto;
    background-attachment: scroll; /* mobile sanity */
      /* Mobile: never show the margin note (prevents overlay + clutter) */
  .rail-sticky,
  .rail-sticky.is-fixed{
    display: none !important;
  }

  /* Mobile: the rail is not essential; keep posters below everything */
  .rail-right{
    max-width: 100%;
  }
  
 }

  .poster-stack{
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
  }
}

/* =========================
   Right rail – sticky interpretive margin
   ========================= */

.rail-right {
  /* IMPORTANT: sticky breaks if overflow is hidden */
  overflow: visible;
}

.rail-sticky {
  position: sticky;
  top: 96px; /* adjust if your header height differs */
  margin-top: 32px;
}

.margin-line {
  max-width: 22ch;
  font-size: 0.95rem;
  line-height: 1.4;
  color: rgba(0, 0, 0, 0.6);
}


/* === Layout clamp: prevent "infinite whitespace" on wide screens === */
.main{
  max-width: 1280px;
  margin-left: auto;
  margin-right: auto;
}

/* =========================
   SINGLE POST
   ========================= */

.content{
  max-width: 760px;
  margin: 0 auto;
  padding: 40px 20px 80px;
}

.post-title{
  font-family: "Rubik", system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  font-weight: 900;
  font-size: clamp(36px, 4vw, 56px);
  line-height: 1.05;
  margin: 0 0 32px;
}

.post-content{
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  font-size: 18px;
  line-height: 1.6;
}

.post-content p{
  margin: 0 0 20px;
  max-width: 62ch;
}

.post-content h2{
  font-family: "Rubik", system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  font-weight: 900;
  font-size: 28px;
  margin: 48px 0 16px;
}

.post-content img{
  display: block;
  max-width: 100%;
  height: auto;
  margin: 32px 0;
  border-radius: 16px;
}
.post-meta{
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 16px;
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  font-size: 14px;
  color: rgba(0,0,0,0.6);
}

.post-footer{
  margin-top: 64px;
  padding-top: 16px;
  border-top: 1px solid rgba(0,0,0,0.1);

  display: flex;
  justify-content: space-between;
  align-items: baseline;

  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  font-size: 14px;
  color: rgba(0,0,0,0.6);
}

.post-back{
  text-decoration: none;
  color: inherit;
}

.post-back:hover{
  text-decoration: underline;
}

.post-author{
  white-space: nowrap;
}

.poster-note{
  margin-top: 12px;
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  font-size: 10px;
  line-height: 1.4;
  color: rgba(0,0,0,0.55);
  max-width: 42ch;
}

/* Poster shuffle button */
.poster-rotate-btn{
  width: min(100%, 360px);      /* matches poster image width rule */
  display: block;              /* makes width apply reliably */
  padding: 12px 16px;

  background: #00a3ff;
  color: #fff;

  border: 2px solid rgba(0,0,0,0.25);
  border-radius: 10px;

  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.02em;

  cursor: pointer;
}

.poster-rotate-btn:hover{
  filter: brightness(0.95);
}

.poster-rotate-btn:active{
  transform: translateY(1px);
}

.poster-rotate-btn:disabled{
  opacity: 0.7;
  cursor: not-allowed;
}


/* =========================
   STATIC PAGE HEADERS
   ========================= */

.page-header{
  margin-bottom: 32px;
}

.page-title{
  font-family: "Rubik", system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  font-weight: 900;
  font-size: clamp(32px, 4vw, 48px);
  line-height: 1.05;
  margin: 0 0 24px;
}

/* =========================
   PAGES + POSTS: layout + CTX watermark
   ========================= */

.page-template .content,
.post-template .content{
  /* layout */
  max-width: 1040px;
  margin: 0 auto;
  padding: 40px 64px 80px;

  /* white panel */
  background-color: #fff;

  /* blue side columns */
  box-shadow:
    -200vw 0 0 #123e74,
     200vw 0 0 #123e74;

  /* CTX vertical watermark */
  background-image: url("../images/ctx-vertical.svg");
  background-repeat: no-repeat;
  background-position: left 24px top 120px;
  background-size: clamp(260px, 22vw, 420px) auto;
  background-attachment: fixed;
}


@media (max-width: 980px){
  .page-template .content,
  .post-template .content{
    padding: 24px 20px 60px;
    background-position: left 12px top 80px;
    background-size: 280px auto;
    background-attachment: scroll;
    box-shadow: none;
  }
}

/* Page/post background = blue, like homepage side columns */
body.page-template,
body.post-template{
  background-color: #fff;
  background-image: url("../images/ctx-dia.png");
  background-repeat: repeat;
  background-size: 80px auto;
}

/* =========================
   FOOTER (homepage)
   ========================= */

.site-footer{
  margin-top: auto;
  padding: 16px 16px;
  color: white;  
  background-color: #00a3ff;
  width: 100%;
    display: flex;
  justify-content: center;
}


.footer-line{
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  font-size: 12px;
  color: #fff;
  max-width: 80%;
  text-align: center;
}

.site-footer a,
.site-footer a:visited{
  color: inherit;
  text-decoration: underline;
}

.site-footer a:hover{
  text-decoration: none;
}
